chaos pt 2
[carveJwlIkooP6JGAAIwe30JlM.git] / world_gate.c
index 96317c1b4da3b458a8fbb449c0caddf3f1823c0e..bc21e95bc13dea6cd4a1645201ba7ffd0b859167 100644 (file)
@@ -86,8 +86,7 @@ static void ent_gate_get_mdl_mtx( ent_gate *gate, m4x3f mmdl ){
  * Render the view through a gate
  */
 static int render_gate( world_instance *world, world_instance *world_inside,
-                           ent_gate *gate, camera *cam, int layer_depth )
-{
+                           ent_gate *gate, camera *cam ){
    v3f viewdir, gatedir;
    m3x3_mulv( cam->transform, (v3f){0.0f,0.0f,-1.0f}, viewdir );
    q_mulv( gate->q[0], (v3f){0.0f,0.0f,-1.0f}, gatedir );
@@ -145,63 +144,42 @@ static int render_gate( world_instance *world, world_instance *world_inside,
    camera_finalize( &world_gates.cam );
 
    vg_line_point( world_gates.cam.transform[3], 0.3f, 0xff00ff00 );
-   {
-      shader_model_gate_use();
-      shader_model_gate_uPv( cam->mtx.pv );
-      shader_model_gate_uCam( cam->pos );
-      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){
-            1.0f / (float)vg.window_x,
-            1.0f / (float)vg.window_y });
-
-      glEnable( GL_STENCIL_TEST );
-      glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );  
-      glStencilFunc( GL_ALWAYS, 1, 0xFF ); 
-      glStencilMask( 0xFF );
-      glDisable( GL_CULL_FACE );
-
-      m4x3f mmdl;
-      ent_gate_get_mdl_mtx( gate, mmdl );
-      shader_model_gate_uMdl( mmdl );
-      
-      if( gate->flags & k_ent_gate_custom_mesh ){
-         mesh_bind( &world->mesh_no_collide );
-         for( u32 i=0; i<gate->submesh_count; i++ ){
-            mdl_submesh *sm = mdl_arritm( &world->meta.submeshs, 
-                                          gate->submesh_start+i );
-            mdl_draw_submesh( sm );
-         }
-      }
-      else {
-         mesh_bind( &world_gates.mesh );
-         mdl_draw_submesh( &world_gates.sm_surface );
-      }
 
-      glClear( GL_DEPTH_BUFFER_BIT );
-      glStencilFunc( GL_EQUAL, 1, 0xFF );
-      glStencilMask( 0x00 ); 
-      glEnable( GL_CULL_FACE );
+   shader_model_gate_use();
+   shader_model_gate_uPv( cam->mtx.pv );
+   shader_model_gate_uCam( cam->pos );
+   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){
+         1.0f / (float)vg.window_x,
+         1.0f / (float)vg.window_y });
+
+   glEnable( GL_STENCIL_TEST );
+   glStencilOp( GL_KEEP, GL_KEEP, GL_REPLACE );  
+   glStencilFunc( GL_ALWAYS, 1, 0xFF ); 
+   glStencilMask( 0xFF );
+   glDisable( GL_CULL_FACE );
+
+   m4x3f mmdl;
+   ent_gate_get_mdl_mtx( gate, mmdl );
+   shader_model_gate_uMdl( mmdl );
+   
+   if( gate->flags & k_ent_gate_custom_mesh ){
+      mesh_bind( &world->mesh_no_collide );
+      for( u32 i=0; i<gate->submesh_count; i++ ){
+         mdl_submesh *sm = mdl_arritm( &world->meta.submeshs, 
+                                       gate->submesh_start+i );
+         mdl_draw_submesh( sm );
+      }
    }
-
-   render_world( world_inside, &world_gates.cam, layer_depth );
-   render_remote_players( world_inside, &world_gates.cam );
-
-   {
-      glDisable( GL_STENCIL_TEST );
-
-      render_water_texture( world_inside, &world_gates.cam, layer_depth );
-      render_fb_bind( gpipeline.fb_main, 1 );
-
-      glEnable( GL_STENCIL_TEST );
-
-      render_water_surface( world_inside, &world_gates.cam );
-
-      glStencilMask( 0xFF );
-      glStencilFunc( GL_ALWAYS, 1, 0xFF );
-      glDisable( GL_STENCIL_TEST );
+   else {
+      mesh_bind( &world_gates.mesh );
+      mdl_draw_submesh( &world_gates.sm_surface );
    }
 
+   render_world( world_inside, &world_gates.cam, 
+                 1, !localplayer.gate_waiting, 1, 1 );
+
    return 1;
 }