bh_system *system;
void *user;
+ u32 max_per_leaf;
struct bh_node
{
{
bh_node *node = &bh->nodes[ inode ];
+ if( node->count <= bh->max_per_leaf )
+ return;
+
v3f extent;
v3_sub( node->bbx[1], node->bbx[0], extent );
}
VG_STATIC bh_tree *bh_create( void *lin_alloc, bh_system *system,
- void *user, u32 item_count )
+ void *user, u32 item_count, u32 max_per_leaf )
{
+ assert( max_per_leaf > 0 );
+
if( item_count == 0 )
{
bh_tree *bh = vg_linear_alloc( lin_alloc, sizeof(bh_tree) );
bh_tree *bh = vg_linear_alloc( lin_alloc, totsize );
bh->system = system;
bh->user = user;
+ bh->max_per_leaf = max_per_leaf;
bh_node *root = &bh->nodes[0];
bh->node_count = 1;
cd bin/skaterift-clang/
-./skaterift
+./skaterift $@
cd ../../
float g_water_fog;
int g_light_count;
int g_light_preview;
+ int g_shadow_samples;
}
ub_world_lighting;
winf->g_light_directions[0][3] = gpipeline.shadow_length;
winf->g_light_colours[0][3] = gpipeline.shadow_spread;
+ if( vg.quality_profile == k_quality_profile_low )
+ winf->g_shadow_samples = 0;
+ else
+ winf->g_shadow_samples = 8;
+
glBindBuffer( GL_UNIFORM_BUFFER, gpipeline.ubo_world_lighting );
glBufferSubData( GL_UNIFORM_BUFFER, 0, sizeof(struct ub_world_lighting),
&gpipeline.ub_world_lighting );
VG_STATIC bh_tree *scene_bh_create( void *lin_alloc, scene *s )
{
u32 triangle_count = s->indice_count / 3;
- return bh_create( lin_alloc, &bh_system_scene, s, triangle_count );
+ return bh_create( lin_alloc, &bh_system_scene, s, triangle_count, 2 );
}
#endif
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
float g_water_fog;
int g_light_count;
int g_light_preview;
+ int g_shadow_samples;
};
uniform sampler2D g_world_depth;
vec3 do_light_shadowing( vec3 vfrag )
{
+ if( g_shadow_samples == 0 )
+ {
+ return vfrag;
+ }
+
float fspread = g_light_colours[0].w;
vec3 vdir = g_light_directions[0].xyz;
float flength = g_light_directions[0].w;
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
" float g_water_fog;\n"
" int g_light_count;\n"
" int g_light_preview;\n"
+" int g_shadow_samples;\n"
"};\n"
"\n"
"uniform sampler2D g_world_depth;\n"
"\n"
"vec3 do_light_shadowing( vec3 vfrag )\n"
"{\n"
+" if( g_shadow_samples == 0 )\n"
+" {\n"
+" return vfrag;\n"
+" }\n"
+"\n"
" float fspread = g_light_colours[0].w;\n"
" vec3 vdir = g_light_directions[0].xyz;\n"
" float flength = g_light_directions[0].w;\n"
*/
int draw_solid = player.is_dead | freecam;
-
render_world( vg.pv, camera_mtx );
+
if( draw_solid )
draw_player( camera_mtx );
/* Sprinkle foliage models over the map on terrain material */
VG_STATIC void world_apply_procedural_foliage( struct world_material *mat )
{
+ if( vg.quality_profile == k_quality_profile_low )
+ return;
+
vg_linear_clear( vg_mem.scratch );
mdl_context *mfoliage =