scene geo, foliage;
rigidbody rb_geo;
+ /* TODO Maybe make this less hardcoded */
mdl_submesh sm_geo_std_oob, sm_geo_std, sm_geo_vb,
- sm_foliage_main, sm_foliage_alphatest;
+ sm_foliage_main, sm_foliage_alphatest,
+ sm_graffiti;
glmesh skybox, skydome;
mdl_submesh dome_upper, dome_lower;
vg_tex2d tex_alphatest = { .path = "textures/alphatest.qoi",
.flags = VG_TEXTURE_NEAREST };
+vg_tex2d tex_graffiti = { .path = "textures/graffitibox.qoi",
+ .flags = VG_TEXTURE_NEAREST };
+
static void ray_world_get_tri( ray_hit *hit, v3f tri[3] )
{
for( int i=0; i<3; i++ )
u32 mat_surf = 0,
mat_surf_oob = 0,
mat_vertex_blend = 0,
- mat_alphatest = 0;
+ mat_alphatest = 0,
+ mat_graffiti = 0;
for( int i=1; i<mworld->material_count; i++ )
{
mat_vertex_blend = i;
else if( !strcmp( "alphatest", mat_name ))
mat_alphatest = i;
+ else if( !strcmp( "graffitibox", mat_name ))
+ mat_graffiti = i;
}
m4x3f midentity;
add_all_if_material( midentity, &world.foliage, mworld, mat_alphatest );
scene_copy_slice( &world.foliage, &world.sm_foliage_alphatest );
+ add_all_if_material( midentity, &world.foliage, mworld, mat_graffiti );
+ scene_copy_slice( &world.foliage, &world.sm_graffiti );
+
scene_upload( &world.foliage );
world_routes_loadfrom( mworld );
{
vg_tex2d_init( (vg_tex2d *[]){ &tex_terrain_colours,
&tex_terrain_noise,
- &tex_alphatest }, 3 );
+ &tex_alphatest,
+ &tex_graffiti }, 4 );
mdl_header *mcars = mdl_load( "models/rs_cars.mdl" );
mdl_unpack_glmesh( mcars, &world.cars );
glDisable(GL_CULL_FACE);
scene_bind( &world.foliage );
mdl_draw_submesh( &world.sm_foliage_alphatest );
+
+ vg_tex2d_bind( &tex_graffiti, 1 );
+ mdl_draw_submesh( &world.sm_graffiti );
+
glEnable(GL_CULL_FACE);
}
static void render_world_gates( m4x4f projection, m4x3f camera )
{
- int count = 0;
+ float closest = INFINITY;
+ int id = 0;
+
for( int i=0; i<world.routes.gate_count; i++ )
{
struct route_gate *rg = &world.routes.gates[i];
- count += render_gate( &rg->gate, camera );
+ float dist = v3_dist2( rg->gate.co[0], camera[3] );
- if( count == 2 )
- return;
+ if( dist < closest )
+ {
+ closest = dist;
+ id = i;
+ }
}
+
+ render_gate( &world.routes.gates[id].gate, camera );
}
static void render_world( m4x4f projection, m4x3f camera )