X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_gate.h;h=469f73695e7da46489e08a2f3b6dc8a93e67b306;hb=e8a65239f85784e2e596d2622c2baddda9fb5fae;hp=f2a383c1f2856aea16a060f686d9e2f638bb52fa;hpb=a1056ed8198f0f5be0e0f341da8bd49aa6c47198;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_gate.h b/world_gate.h index f2a383c..469f736 100644 --- a/world_gate.h +++ b/world_gate.h @@ -27,8 +27,8 @@ VG_STATIC void gate_transform_update( ent_gate *gate ) v3_copy( gate->co[1], recv_to_world[3] ); m4x3_mul( recv_to_world, to_local, gate->transport ); - m4x3_scalev( gate->to_world, (v3f){ gate->dimensions[0], - gate->dimensions[1], 1.0f } ); + m3x3_scale( gate->to_world, (v3f){ gate->dimensions[0], + gate->dimensions[1], 1.0f } ); } VG_STATIC void world_gates_init(void) @@ -42,7 +42,6 @@ VG_STATIC void world_gates_init(void) mdl_context mgate; mdl_open( &mgate, "models/rs_gate.mdl", vg_mem.scratch ); mdl_load_metadata_block( &mgate, vg_mem.scratch ); - mdl_load_mesh_block( &mgate, vg_mem.scratch ); mdl_mesh *surface = mdl_find_mesh( &mgate, "rs_gate" ); mdl_submesh *sm = mdl_arritm(&mgate.submeshs,surface->submesh_start); @@ -57,17 +56,12 @@ VG_STATIC void world_gates_init(void) world_global.sm_gate_marker[i] = *sm; } + mdl_async_load_glmesh( &mgate, &world_global.mesh_gate ); mdl_close( &mgate ); - - vg_acquire_thread_sync(); - { - mdl_unpack_glmesh( &mgate, &world_global.mesh_gate ); - } - vg_release_thread_sync(); } VG_STATIC int render_gate( world_instance *world_inside, - ent_gate *gate, camera *cam ) + ent_gate *gate, camera *cam, int layer_depth ) { v3f viewdir, gatedir; m3x3_mulv( cam->transform, (v3f){0.0f,0.0f,-1.0f}, viewdir ); @@ -130,8 +124,6 @@ VG_STATIC int render_gate( world_instance *world_inside, shader_model_gate_uPv( cam->mtx.pv ); shader_model_gate_uMdl( gate->to_world ); shader_model_gate_uCam( cam->pos ); - - /* TODO(ART IMPROVEMENT): animate alpha of this? */ shader_model_gate_uColour( (v4f){0.0f,1.0f,0.0f,0.0f} ); shader_model_gate_uTime( vg.time*0.25f ); shader_model_gate_uInvRes( (v2f){ @@ -151,13 +143,13 @@ VG_STATIC int render_gate( world_instance *world_inside, glStencilMask( 0x00 ); } - render_world( world_inside, &gate_camera ); + render_world( world_inside, &gate_camera, layer_depth ); { glDisable( GL_STENCIL_TEST ); - render_water_texture( world_inside, &gate_camera ); - render_fb_bind( gpipeline.fb_main ); + render_water_texture( world_inside, &gate_camera, layer_depth ); + render_fb_bind( gpipeline.fb_main, 1 ); glEnable( GL_STENCIL_TEST ); @@ -233,7 +225,8 @@ VG_STATIC ent_gate *world_intersect_gates( world_instance *world, { for( u32 i=0; ient_gate); i++ ){ ent_gate *gate = mdl_arritm( &world->ent_gate, i ); - if( gate->type == k_gate_type_unlinked ) + if( gate->type == k_gate_type_unlinked || + gate->type == k_gate_type_nonlocal_unlinked ) continue; if( gate_intersect( gate, pos, last ) ){