reduced shader bind code dupe & adjust skate uprighter strenght
[carveJwlIkooP6JGAAIwe30JlM.git] / world_sfd.c
index d960b0d54ad5a4221c8d69c0e0f1a39e3be16542..a92a4b090719c2fd457e33f4a9a4eef00fb55f66 100644 (file)
@@ -4,9 +4,10 @@
 #include "world_sfd.h"
 #include "shaders/scene_scoretext.h"
 #include "shaders/scene_vertex_blend.h"
+#include "network.h"
+#include "entity.h"
 
-static f32 sfd_encode_glyph( char c )
-{
+static f32 sfd_encode_glyph( char c ){
    int value = 0;
    if( c >= 'a' && c <= 'z' )
       value = c-'a'+11;
@@ -74,13 +75,12 @@ static void world_sfd_update( world_instance *world, v3f pos ){
          }
       }
 
-      if( (world_sfd.active_route_board != closest) || network_scores_updated )
-      {
+      if( (world_sfd.active_route_board != closest) || network_scores_updated ){
          network_scores_updated = 0;
          world_sfd.active_route_board = closest;
 
          ent_route *route = mdl_arritm( &world->ent_route, closest );
-         u32 id = route->official_track_id;
+         u32 id = route->anon.official_track_id;
 
          if( id != 0xffffffff ){
             struct netmsg_board *local_board = 
@@ -114,19 +114,11 @@ static void world_sfd_update( world_instance *world, v3f pos ){
 }
 
 static void bind_terrain_noise(void);
-static void sfd_render( world_instance *world, camera *cam, m4x3f transform )
-{
+static void sfd_render( world_instance *world, camera *cam, m4x3f transform ){
    mesh_bind( &world_sfd.mesh_display );
    shader_scene_scoretext_use();
    shader_scene_scoretext_uTexMain(1);
-
-   world_link_lighting_ub( world, _shader_scene_scoretext.id );
-   world_bind_position_texture( world, _shader_scene_scoretext.id, 
-                        _uniform_scene_scoretext_g_world_depth, 2 );
-   world_bind_light_array( world, _shader_scene_scoretext.id,
-                        _uniform_scene_scoretext_uLightsArray, 3 );
-   world_bind_light_index( world, _shader_scene_scoretext.id,
-                           _uniform_scene_scoretext_uLightsIndex, 4 );
+   WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_scoretext );
 
    bind_terrain_noise();
 
@@ -153,13 +145,8 @@ static void sfd_render( world_instance *world, camera *cam, m4x3f transform )
    shader_scene_vertex_blend_use();
    shader_scene_vertex_blend_uTexGarbage(0);
    shader_scene_vertex_blend_uTexGradients(1);
-   world_link_lighting_ub( world, _shader_scene_vertex_blend.id );
-   world_bind_position_texture( world, _shader_scene_vertex_blend.id, 
-                                _uniform_scene_vertex_blend_g_world_depth, 2 );
-   world_bind_light_array( world, _shader_scene_vertex_blend.id,
-                                _uniform_scene_vertex_blend_uLightsArray, 3 );
-   world_bind_light_index( world, _shader_scene_vertex_blend.id,
-                                _uniform_scene_vertex_blend_uLightsIndex, 4 );
+   WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_vertex_blend );
+
    bind_terrain_noise();
    glActiveTexture( GL_TEXTURE1 );
    glBindTexture( GL_TEXTURE_2D, world_sfd.tex_scoretex );
@@ -173,8 +160,7 @@ static void sfd_render( world_instance *world, camera *cam, m4x3f transform )
    mdl_draw_submesh( &world_sfd.sm_base );
 }
 
-static int world_sfd_test( int argc, const char *argv[] )
-{
+static int world_sfd_test( int argc, const char *argv[] ){
    if( argc == 2 ){
       int row = vg_min( vg_max(atoi(argv[0]),0), world_sfd.h);
       sfd_encode( row, argv[1] );
@@ -183,8 +169,7 @@ static int world_sfd_test( int argc, const char *argv[] )
    return 0;
 }
 
-static void world_sfd_init(void)
-{
+static void world_sfd_init(void){
    vg_info( "world_sfd_init\n" );
    shader_scene_scoretext_register();
    vg_console_reg_cmd( "sfd", world_sfd_test, NULL );