small compression
[carveJwlIkooP6JGAAIwe30JlM.git] / font.h
diff --git a/font.h b/font.h
index c49bc6639f396a5fb27d9a55f2b78b06f2d98add..c00aece3c9f2f46a59ae2e3f76062284bd93e113 100644 (file)
--- a/font.h
+++ b/font.h
@@ -7,6 +7,7 @@
 #include "shaders/model_font.h"
 #include "shaders/scene_font.h"
 #include "world_render.h"
+#include "depth_compare.h"
 
 enum efont_SRglyph{
    k_SRglyph_end           = 0x00, /* control characters */
@@ -147,17 +148,10 @@ static void font3d_bind( font3d *font, enum font_shader shader,
 
       shader_model_font_uDepthCompare( depth_compare );
       if( depth_compare ){
-         /* TODO: Compress with code in player_render.c */
-         shader_model_font_uTexSceneDepth( 2 );
-         render_fb_bind_texture( gpipeline.fb_main, 2, 2 );
-         v3f inverse;
-         render_fb_inverse_ratio( gpipeline.fb_main, inverse );
-         inverse[2] = skaterift.cam.farz-skaterift.cam.nearz;
-
-         shader_model_font_uInverseRatioDepth( inverse );
-         render_fb_inverse_ratio( NULL, inverse );
-         inverse[2] = cam->farz-cam->nearz;
-         shader_model_font_uInverseRatioMain( inverse );
+         depth_compare_bind( 
+            shader_model_font_uTexSceneDepth,
+            shader_model_font_uInverseRatioDepth,
+            shader_model_font_uInverseRatioMain, cam );
       }
 
       shader_model_font_uPv( cam->mtx.pv );
@@ -171,14 +165,7 @@ static void font3d_bind( font3d *font, enum font_shader shader,
       shader_scene_font_uPv( skaterift.cam.mtx.pv );
       shader_scene_font_uTime( vg.time );
 
-      /* TODO: Code dupe... */
-      world_link_lighting_ub( world, _shader_scene_font.id );
-      world_bind_position_texture( world, _shader_scene_font.id, 
-                                   _uniform_scene_font_g_world_depth, 2 );
-      world_bind_light_array( world, _shader_scene_font.id,
-                                   _uniform_scene_font_uLightsArray, 3 );
-      world_bind_light_index( world, _shader_scene_font.id,
-                                   _uniform_scene_font_uLightsIndex, 4 );
+      WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_font );
 
       bind_terrain_noise();
       shader_scene_font_uCamera( skaterift.cam.transform[3] );