fixe
authorhgn <hgodden00@gmail.com>
Fri, 31 Mar 2023 15:51:21 +0000 (16:51 +0100)
committerhgn <hgodden00@gmail.com>
Fri, 31 Mar 2023 15:51:21 +0000 (16:51 +0100)
30 files changed:
blender_export.py
entity.h
maps_src/mp_gridmap.mdl
player.c
player.h
player_skate.c
player_walk.c
player_walk.h
render.h
shaders/common_world.glsl
shaders/model_character_view.h
shaders/model_sky.h
shaders/scene_depth.h
shaders/scene_position.h
shaders/scene_route.h
shaders/scene_scoretext.h
shaders/scene_standard.h
shaders/scene_standard_alphatest.h
shaders/scene_terrain.h
shaders/scene_vertex_blend.h
shaders/scene_water.fs
shaders/scene_water.h
shaders/scene_water_fast.h
skaterift.c
skeleton.h
world.h
world_gate.h
world_gen.h
world_routes.h
world_water.h

index 8b04a208082673c2c483e4dea8146937b3d700f7..07179e71b7c5bc5b684d1b0d82f95a62869feddd 100644 (file)
@@ -196,6 +196,14 @@ class ent_route(Structure):
                ("latest_pass",c_double)]
 #}
 
+class ent_water(Structure):
+#{
+   _fields_ = [("transform",mdl_transform),
+               ("max_dist",c_float),
+               ("reserved0",c_uint32),
+               ("reserved1",c_uint32)]
+#}
+
 def obj_ent_type( obj ):
 #{
    if obj.type == 'ARMATURE': return 'mdl_armature'
@@ -366,9 +374,6 @@ def material_info(mat):
 
                   _graph_read( from_node_def, from_node, depth+1 )
                #}
-               
-               # No definition! :(
-               #  TODO: Make a warning for this?
             #}
             else:#{
                if "default" in link_def:#{
@@ -430,8 +435,6 @@ def sr_compile_material( mat ):
    if mat.name in sr_compile.material_cache: 
       return sr_compile.material_cache[mat.name]
 
-   print( "\n"+ mat.name+"\n" )
-
    index = (len(sr_compile.material_data)//sizeof(mdl_material))+1
    sr_compile.material_cache[mat.name] = index
 
@@ -1080,7 +1083,7 @@ def sr_compile( collection ):
          elif ent_type == 'ent_route': #{
             obj_data = obj.SR_data.ent_route[0]
             route = ent_route()
-            route.pstr_name = sr_compile_string( obj_data.alias ) #TODO
+            route.pstr_name = sr_compile_string( obj_data.alias )
             route.checkpoints_start = checkpoint_count
             route.checkpoints_count = 0
 
@@ -1144,6 +1147,12 @@ def sr_compile( collection ):
             rn.co[2] = -obj.location[1]
             sr_ent_push( rn )
          #}
+         elif ent_type == 'ent_water':#{
+            water = ent_water()
+            compile_obj_transform( obj, water.transform )
+            water.max_dist = 0.0
+            sr_ent_push( water )
+         #}
       #}
    #}
    
@@ -1518,7 +1527,7 @@ class SR_MATERIAL_PANEL(bpy.types.Panel):
 def sr_get_type_enum( scene, context ):
 #{
    items = [('none','None',"")]
-   mesh_entities=['ent_gate']
+   mesh_entities=['ent_gate','ent_water']
    point_entities=['ent_spawn','ent_route_node','ent_route']
 
    for e in point_entities: items += [(e,e,'')]
@@ -1665,7 +1674,8 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup):
              ('ent_gate','Gate','', 1),
              ('ent_spawn','Spawn','', 2),
              ('ent_route_node', 'Route Node', '', 3 ),
-             ('ent_route', 'Route', '', 4)],
+             ('ent_route', 'Route', '', 4),
+             ('ent_water', 'Water Surface', '', 5)],
       update=sr_on_type_change
    )
 #}
index 3215a6933b4aaae70280bed038b12f44dac00d5a..2c70b82988375ed3e6814869c1e6b8481ea5d97d 100644 (file)
--- a/entity.h
+++ b/entity.h
@@ -10,6 +10,7 @@ typedef struct ent_route_node ent_route_node;
 typedef struct ent_path_index ent_path_index;
 typedef struct ent_checkpoint ent_checkpoint;
 typedef struct ent_route ent_route;
+typedef struct ent_water ent_water;
 
 struct ent_spawn{
    mdl_transform transform;
@@ -102,4 +103,10 @@ struct ent_route{
    double latest_pass;
 };
 
+struct ent_water{
+   mdl_transform transform;
+   float max_dist;
+   u32 reserved0, reserved1;
+};
+
 #endif /* ENTITY_H */
index f20740e41ecf73329e5bb8a195f135ca7e82a996..726aaa877c4142926691c5b4701ff79d4f644f02 100644 (file)
Binary files a/maps_src/mp_gridmap.mdl and b/maps_src/mp_gridmap.mdl differ
index ef23ef43639eed3e367a80c432a0eaf2e3f94df1..d2e8d6f4a671b10926d0770b06896c3736cf06db 100644 (file)
--- a/player.c
+++ b/player.c
@@ -231,8 +231,6 @@ VG_STATIC void player__pre_render( player_instance *player )
       player_animation res;
       _player_animate[ player->subsystem ]( player, &res );
 
-      /* TODO: eventually, blending code goes here */
-
       m4x3f transform;
       q_m3x3( res.root_q, transform );
       v3_copy( res.root_co, transform[3] );
index 1c02a4e55f1742d1fd0894c2ef22e17657bdd6c5..65f8241768d5df6998c7697ef1f015406dc7fed1 100644 (file)
--- a/player.h
+++ b/player.h
@@ -121,7 +121,7 @@ void (*_player_bind[])( player_instance *player ) =
 VG_STATIC
 void (*_player_reset[])( player_instance *player, ent_spawn *rp ) =
 {
-   NULL,
+   player__walk_reset,
    player__skate_reset,
    NULL
 };
index b372aa2b487d449d23706d7f30b7ac86c29203aa..bfccb61a2930b5c146544182eb5d3327b379858f 100644 (file)
@@ -345,42 +345,6 @@ VG_STATIC int create_jumps_to_hit_target( player_instance *player,
    return valid_count;
 }
 
-#if 0
-VG_STATIC 
-int create_jump_for_target( world_instance *world, player_instance *player,
-                            v3f target, float max_angle, jump_info *jump )
-{
-
-      if( fabsf(a0-a) > fabsf(a1-a) )
-         a0 = a1;
-
-      if( fabsf(a0-a) > max_angle )
-         return 0;
-
-      /* TODO: sweep the path before chosing the smallest dist */
-
-
-#if 0
-      /* add a trace */
-      for( int i=0; i<=20; i++ )
-      {
-         float t = (float)i * (1.0f/20.0f) * p->land_dist;
-
-         v3f p0;
-         v3_muls( p->v, t, p0 );
-         v3_muladds( p0, player->basis[1], -0.5f * p->gravity * t*t, p0 );
-
-         v3_add( player->rb.co, p0, p->log[ p->log_length ++ ] );
-      }
-#endif
-
-      return 1;
-   }
-   else
-      return 0;
-}
-#endif
-
 VG_STATIC 
 void player__approximate_best_trajectory( player_instance *player )
 {
@@ -464,7 +428,7 @@ void player__approximate_best_trajectory( player_instance *player )
          if( grind_located ) search_for_grind = 0;
          if( launch_vy - gravity*t > 0.0f ) search_for_grind = 0;
 
-         /* TODO Cleanup */
+         /* REFACTOR */
 
          v3f closest;
          if( search_for_grind ){
@@ -589,8 +553,7 @@ void player__approximate_best_trajectory( player_instance *player )
          create_jumps_to_hit_target( player, grind_jumps, grind.co, 
                                      0.175f*VG_PIf, grind_located_gravity );
 
-      /* knock out original landing points in the 1m area 
-       * TODO: Make this a konstant */
+      /* knock out original landing points in the 1m area */
       for( u32 j=0; j<s->possible_jump_count; j++ ){
          jump_info *jump = &s->possible_jumps[ j ];
          float dist = v3_dist2( jump->log[jump->log_length-1], grind.co );
@@ -615,8 +578,9 @@ void player__approximate_best_trajectory( player_instance *player )
          v3_muladds( co0, basis[1], -0.5f * jump->gravity * t*t, co0 );
          v3_add( launch_co, co0, co0 );
 
-#if 0
          /* rough scan to make sure we dont collide with anything */
+         /* NOTE this was rarely needed and ends up with false negatives. */
+#if 0
          for( int j=1; j<=16; j++ ){
             t  = (float)j*(1.0f/16.0f);
             t *= 0.9f;
@@ -1031,8 +995,6 @@ VG_STATIC void skate_apply_pump_model( player_instance *player )
    }
 
    /* Throw / collect routine 
-    *
-    * TODO: Max speed boost
     */
    if( player->input_grab->axis.value > 0.5f ){
       if( s->state.activity == k_skate_activity_ground ){
@@ -1293,7 +1255,7 @@ VG_STATIC void player__skate_post_update( player_instance *player )
 
       audio_clip *relevant_samples[] = {
          &audio_board[0],
-         &audio_board[0], /* TODO? */
+         &audio_board[0],
          &audio_board[7],
          &audio_board[6],
          &audio_board[5]
@@ -1498,8 +1460,6 @@ VG_STATIC void skate_weight_distribute( player_instance *player )
                                           (float)s->state.manual_direction;
    }
 
-   /* TODO: Fall back on land normal */
-   /* TODO: Lerp weight distribution */
    if( s->state.manual_direction ){
       v3f plane_z;
 
@@ -1569,7 +1529,6 @@ VG_STATIC int skate_point_visible( v3f origin, v3f target )
 
 VG_STATIC void skate_grind_orient( struct grind_info *inf, m3x3f mtx )
 {
-   /* TODO: Is N and Dir really orthogonal? */
    v3_copy( inf->dir, mtx[0] );
    v3_copy( inf->n, mtx[1] );
    v3_cross( mtx[0], mtx[1], mtx[2] );
@@ -1610,7 +1569,7 @@ VG_STATIC void skate_grind_truck_apply( player_instance *player,
 {
    struct player_skate *s = &player->_skate;
 
-   /* TODO: Trash compactor this */
+   /* REFACTOR */
    v3f ra = { 0.0f, -k_board_radius, sign * k_board_length };
    v3f raw, wsp;
    m3x3_mulv( player->rb.to_world, ra, raw );
@@ -1797,7 +1756,7 @@ VG_STATIC int skate_grind_truck_entry( player_instance *player, float sign,
 {
    struct player_skate *s = &player->_skate;
 
-   /* TODO: Trash compactor this */
+   /* REFACTOR */
    v3f ra = { 0.0f, -k_board_radius, sign * k_board_length };
 
    v3f raw, wsp;
@@ -1943,8 +1902,7 @@ VG_STATIC int skate_boardslide_renew( player_instance *player,
    if( !skate_point_visible( vis, inf->co ) )
       return 0;
 
-   /* Exit condition: minimum velocity not reached, but allow a bit of error 
-    * TODO: trash compactor */
+   /* Exit condition: minimum velocity not reached, but allow a bit of error */
    float dv   = fabsf(v3_dot( player->rb.v, inf->dir )),
          minv = k_grind_axel_min_vel*0.8f;
 
@@ -1978,6 +1936,10 @@ VG_STATIC enum skate_activity skate_availible_grind( player_instance *player )
 {
    struct player_skate *s = &player->_skate;
 
+   if( s->grind_cooldown > 100 ){
+      vg_fatal_exit_loop( "wth!\n" );
+   }
+
    /* debounces this state manager a little bit */
    if( s->grind_cooldown ){
       s->grind_cooldown --;
@@ -2837,7 +2799,6 @@ VG_STATIC void player__skate_animate( player_instance *player,
 
    mdl_keyframe grind_pose[32];
    {
-      /* TODO: factor balance into this sampler */
       float grind_frame = 0.5f;
 
       if( s->state.activity == k_skate_activity_grind_front50 ){
index 75e3a379261e5ac7b1a8b0e44d9f94aa51e6ca14..e39c8196b1159e24ffb59dc7814fa6ca8ecfedb1 100644 (file)
@@ -855,8 +855,7 @@ VG_STATIC void player__walk_im_gui( player_instance *player )
                                              "metal" }
                                              [w->surface] );
 
-   if( w->state.outro_anim )
-   {
+   if( w->state.outro_anim ){
       float outro_length = (float)w->state.outro_anim->length /
                                   w->state.outro_anim->rate,
             outro_time   = vg.time - w->state.outro_start_time;
@@ -895,4 +894,13 @@ VG_STATIC void player__walk_transition( player_instance *player, v3f angles )
    rb_update_transform( &player->rb );
 }
 
+VG_STATIC void player__walk_reset( player_instance *player, ent_spawn *rp )
+{
+   struct player_walk *w = &player->_walk;
+   w->state.activity = k_walk_activity_air;
+   w->state.outro_type = k_walk_outro_none;
+   w->state.outro_anim = NULL;
+   w->state.outro_start_time = 0.0;
+}
+
 #endif /* PLAYER_DEVICE_WALK_H */
index fc26280fd3a187cdf42d7423fceb3b85f44c88b3..465a58161d4c177b8b87b59f5aeb7e047ad8db6d 100644 (file)
@@ -66,5 +66,7 @@ VG_STATIC void player__walk_post_animate( player_instance *player );
 VG_STATIC void player__walk_im_gui      ( player_instance *player );
 VG_STATIC void player__walk_bind        ( player_instance *player );
 VG_STATIC void player__walk_transition  ( player_instance *player, v3f angles );
+VG_STATIC void player__walk_reset       ( player_instance *player, 
+                                          ent_spawn *rp );
 
 #endif /* PLAYER_WALK_H */
index f17018bb2e767006dbd6701c355a7f5e9dd5b33b..e7220b0935a92f3a105eb8382bb8cd9345bfc1ba 100644 (file)
--- a/render.h
+++ b/render.h
@@ -158,7 +158,7 @@ framebuffers[] =
        */
       "water_reflection",
       .link = &gpipeline.fb_water_reflection,
-      .resolution_div = 3,
+      .resolution_div = 2,
       .attachments = 
       {
          {
@@ -183,7 +183,7 @@ framebuffers[] =
        */
       "water_beneath",
       .link = &gpipeline.fb_water_beneath,
-      .resolution_div = 4,
+      .resolution_div = 2,
       .attachments = 
       {
          {
index 5c06d73db33caf07636035c02042dd0a7a7388da..2b708858895c4afc8685bec62825c5529a1787d2 100644 (file)
@@ -48,9 +48,8 @@ float world_depth_sample( vec3 pos )
 
 float world_water_depth( vec3 pos )
 {
-   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; 
    float ref_depth = g_water_plane.y*g_water_plane.w;
-   return texture( g_world_depth, depth_coord ).g - ref_depth;
+   return world_depth_sample( pos ) - ref_depth;
 }
 
 float shadow_sample( vec3 vdir )
index 23cba2514f184805f593d432f4e1dbaadcad6589..d7e69019a6c96a57def725c40cfa99eb26243dcc 100644 (file)
@@ -214,7 +214,7 @@ static struct vg_shader _shader_model_character_view = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 2ddc5bd5dfe96aa4961947ffc00fe4d31699158a..d5498311ce6d72782567ca594e8462d978b82620 100644 (file)
@@ -208,7 +208,7 @@ static struct vg_shader _shader_model_sky = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 0a88b46f09c8e2239c5f8e4b561a19a51558e92f..8e836e40a6aa617da6ed143d14507a81e19ed4a9 100644 (file)
@@ -207,7 +207,7 @@ static struct vg_shader _shader_scene_depth = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index b3bf28f49de9750f97dcecb8cbd9c209bd4d1488..8f902a15395cb62481fa970c7ca9a709b0716213 100644 (file)
@@ -207,7 +207,7 @@ static struct vg_shader _shader_scene_position = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 3f41ecab6ebd8deb0b6805c4f07bcb65bc9115a6..4fe92e0c369ffe43980147c75a7104cf7b374e10 100644 (file)
@@ -208,7 +208,7 @@ static struct vg_shader _shader_scene_route = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 417cc2a008b0deb5fbf527d7df964513fb4cd2a1..8b04293ba1cfd7a397a5092b5ad2355918697636 100644 (file)
@@ -228,7 +228,7 @@ static struct vg_shader _shader_scene_scoretext = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 656498d402009bed3a5e4f8c2bda2392dda3a0b1..994f7f30d3dd8c959cd0b30afd861fa7b828252b 100644 (file)
@@ -208,7 +208,7 @@ static struct vg_shader _shader_scene_standard = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 74b36f64f264ce425bac5d733c46589987c3d141..d2d6e084fd8d13eb8328f65af9869273b963dae7 100644 (file)
@@ -208,7 +208,7 @@ static struct vg_shader _shader_scene_standard_alphatest = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 2027fd2a3dc102c082cbb8a2cb250a18036f3e16..6befad3a3b6426ccc517dfcbae74e30fe79145e0 100644 (file)
@@ -209,7 +209,7 @@ static struct vg_shader _shader_scene_terrain = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index b350fda1d88011153a0affcdaa21d0259b4a44c2..6bfb88217c6a944a5d3a2d1bb91e33463aecfacb 100644 (file)
@@ -207,7 +207,7 @@ static struct vg_shader _shader_scene_vertex_blend = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index c40e246f917819b0b871ecf669dffa72966cd106..22aa665e3f5e00885e99976b9d0931f2efe243de 100644 (file)
@@ -44,7 +44,7 @@ void main()
    vec2 ssuv = gl_FragCoord.xy*uInvRes;
    
    // Surface colour composite
-   float depthvalue = clamp( -world_water_depth( aCo )*(1.0/25.0), 0.0, 1.0 );
+   float depthvalue = clamp( -world_water_depth(aCo)*(1.0/25.0), 0.0,1.0 );
 
    vec2 world_coord = aCo.xz * 0.008;
    vec4 time_offsets = vec4( uTime ) * vec4( 0.008, 0.006, 0.003, 0.03 );
index 5d4a5d2eca2126bacf148802028b9f08bb3e61fb..f36b34ef1246b4394f59aa0b4f3e5e0eb67d388b 100644 (file)
@@ -215,7 +215,7 @@ static struct vg_shader _shader_scene_water = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
@@ -462,7 +462,7 @@ static struct vg_shader _shader_scene_water = {
 "   vec2 ssuv = gl_FragCoord.xy*uInvRes;\n"
 "   \n"
 "   // Surface colour composite\n"
-"   float depthvalue = clamp( -world_water_depth( aCo )*(1.0/25.0), 0.0, 1.0 );\n"
+"   float depthvalue = clamp( -world_water_depth(aWorldCo)*(1.0/25.0), 0.0,1.0 );\n"
 "\n"
 "   vec2 world_coord = aCo.xz * 0.008;\n"
 "   vec4 time_offsets = vec4( uTime ) * vec4( 0.008, 0.006, 0.003, 0.03 );\n"
index b02f8ca5b33cbd6551a05148c20ac4bc5a004bfc..5d3b534a25ddeb1c79cf313826e5cd34cf96d100 100644 (file)
@@ -212,7 +212,7 @@ static struct vg_shader _shader_scene_water_fast = {
 "{\n"
 "   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g - ref_depth;\n"
+"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 8e7b738776f7dfccd4104ca9ad69701c76e20983..67e87cc5fa3015d418f57650b8ae55ce88356714 100644 (file)
@@ -512,7 +512,6 @@ VG_STATIC void render_scene(void)
    if( !player_transparent && player_draw )
       player__render( &main_camera, &localplayer );
 
-
    render_water_texture( view_world, &main_camera, 0 );
    render_fb_bind( gpipeline.fb_main );
    render_water_surface( view_world, &main_camera );
@@ -611,7 +610,7 @@ VG_STATIC void vg_render(void)
    
    /* Other shite */
    glDisable(GL_BLEND);
-   glDisable( GL_DEPTH_TEST );
+   glDisable(GL_DEPTH_TEST);
    vg_lines_drawall();
    glViewport( 0,0, vg.window_x, vg.window_y );
 }
index 0332a6051e02faaf0ce79ad6fb8ebeb4f8282a70..2595cda8c6476254700f6da43eac496dd4ffbd24 100644 (file)
@@ -475,8 +475,6 @@ VG_STATIC void skeleton_setup( struct skeleton *skele,
       sb->collider = bone->collider;
       sb->orig_bone = bone;
 
-      vg_info( "orig: %u\n", bone->collider );
-
       if( sb->flags & k_bone_flag_ik ){
          skele->bones[ sb->parent ].flags |= k_bone_flag_ik;
          
diff --git a/world.h b/world.h
index 9883b295d6916bb06b3466f057301b29cf2fe08e..80bf3b6bafad33620b4738fb314440cfd581a6d3 100644 (file)
--- a/world.h
+++ b/world.h
@@ -154,7 +154,8 @@ struct world_instance
                  ent_route_node,
                  ent_path_index,
                  ent_checkpoint,
-                 ent_route;
+                 ent_route,
+                 ent_water;
 
    ent_gate *rendering_gate;
 
index 93322aaa0af11392955e34af7f6d604b671f7e3b..2febafaaa0434f46a249ec2036cb686532e569ca 100644 (file)
@@ -130,8 +130,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){
index b35c6c25f036a3a4380b1d7a0b24afa47ee2f401..5120bd758fe6e2ff09c7ec6ce5051fdba5b756fc 100644 (file)
@@ -126,92 +126,6 @@ VG_STATIC void world_apply_procedural_foliage( world_instance *world,
    vg_info( "%d foliage models added\n", count );
 }
 
-#if 0
-VG_STATIC void world_ents_allocate( world_instance *world )
-{
-   vg_info( "Allocating entities\n" );
-
-   /* --count entites to allocate buffers for them.--
-    * --maybe in the future we just store these numbers in the model file...--
-    *
-    *        ... 16.03.23: I HOPE YOUR FUCKING HAPPY
-    *        ... 22.03.23: incomprehensible pain
-    *        
-    * -- use this in world_routes too  --
-    *
-    */
-
-   struct countable
-   {
-      enum   classtype ct, ct1;
-      void **to_allocate;
-      u32    item_size;
-      int    count;
-   }
-   entity_counts[] =
-   {
-      { 
-         k_classtype_spawn, 
-         k_classtype_none,
-         (void*)&world->spawns,       
-         sizeof(struct respawn_point) 
-      },
-      { 
-         k_classtype_audio, 
-         k_classtype_none,
-         (void*)&world->audio_things, 
-         sizeof(struct world_audio_thing) 
-      },
-      {
-         k_classtype_world_light,
-         k_classtype_none,
-         (void*)&world->lights,
-         sizeof(struct world_light)
-      },
-      {
-         k_classtype_nonlocal_gate,
-         k_classtype_none,
-         (void*)&world->nonlocal_gates,
-         sizeof(struct nonlocal_gate)
-      },
-   };
-
-   for( int i=0; i<vg_list_size(entity_counts); i++ )
-      entity_counts[i].count = 0;
-
-   for( int i=0; i<world->meta->info.node_count; i++ )
-   {
-      mdl_node *pnode = mdl_node_from_id( world->meta, i );
-      
-      for( int j=0; j<vg_list_size(entity_counts); j ++ )
-      {
-         if( (pnode->classtype == entity_counts[j].ct) ||
-             (pnode->classtype == entity_counts[j].ct1) )
-         {
-            pnode->sub_uid = entity_counts[j].count;
-            entity_counts[j].count ++;
-            break;
-         }
-      }
-   }
-
-   for( int i=0; i<vg_list_size(entity_counts); i++ )
-   {
-      struct countable *counter = &entity_counts[i];
-      
-      u32 bufsize = counter->item_size*counter->count;
-      *counter->to_allocate = vg_linear_alloc( world_global.generic_heap, 
-                                               bufsize );
-      memset( *counter->to_allocate, 0, bufsize );
-   }
-
-   world->volume_bh = bh_create( world_global.generic_heap,
-                                  &bh_system_volumes,
-                                  world,
-                                  world->volume_count,
-                                  1 );
-}
-#endif
 
 #if 0
 VG_STATIC void world_pct_spawn( world_instance *world, mdl_node *pnode )
@@ -223,19 +137,6 @@ VG_STATIC void world_pct_spawn( world_instance *world, mdl_node *pnode )
    rp->name = mdl_pstr( world->meta, pnode->pstr_name );
 }
 
-VG_STATIC void world_pct_water( world_instance *world, mdl_node *pnode )
-{
-   if( world->water.enabled )
-   {
-      vg_warn( "Multiple water surfaces in level! ('%s')\n", 
-               mdl_pstr( world->meta, pnode->pstr_name ));
-      return;
-   }
-
-   world->water.enabled = 1;
-   water_set_surface( world, pnode->co[1] );
-}
-
 VG_STATIC void world_pct_audio( world_instance *world, mdl_node *pnode )
 {
    struct world_audio_thing *thing = &world->audio_things[
@@ -974,6 +875,18 @@ VG_STATIC void world_entities_init( world_instance *world )
       ent_gate *gate = mdl_arritm( &world->ent_gate, j );
       gate_transform_update( gate );
    }
+
+   /* water */
+   for( u32 j=0; j<mdl_arrcount(&world->ent_water); j++ ){
+      ent_water *water = mdl_arritm( &world->ent_water, j );
+      if( world->water.enabled ){
+         vg_warn( "Multiple water surfaces in level!\n" );
+         break;
+      }
+
+      world->water.enabled = 1;
+      water_set_surface( world, water->transform.co[1] );
+   }
 }
 
 VG_STATIC void world_load( world_instance *world, const char *path )
@@ -1004,6 +917,8 @@ VG_STATIC void world_load( world_instance *world, const char *path )
                    "ent_checkpoint", world_global.generic_heap );
    mdl_load_array( &world->meta, &world->ent_route,
                    "ent_route", world_global.generic_heap );
+   mdl_load_array( &world->meta, &world->ent_water,
+                   "ent_water", world_global.generic_heap );
 
    mdl_close( &world->meta );
 
index 5862657bdb808a544aabd37bf7b9f3a885f18064..f8a566c825878b534d2cef5aceef0fde9b5c27bc 100644 (file)
@@ -612,8 +612,6 @@ VG_STATIC void render_world_routes( world_instance *world, camera *cam,
    mesh_bind( &world_global.mesh_gate );
 
    /* skip writing into the motion vectors for this */
-   /* TODO: draw future gate if the one we're looking through is to be passed,
-    *       instead of current gate */
    glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } );
 
    for( u32 i=0; i<mdl_arrcount(&world->ent_route); i++ ){
index f44d265aa5a6e0271ae625af3f473ae741b8b351..5dd1b919c3ebd958262d9f4219441e841a9c00fb 100644 (file)
@@ -91,6 +91,8 @@ VG_STATIC void render_water_texture( world_instance *world, camera *cam,
    /*
     * Draw world
     */
+   glEnable( GL_DEPTH_TEST );
+   glDisable( GL_BLEND );
    glCullFace( GL_FRONT );
    render_world( world, &water_cam, layer_depth );
    glCullFace( GL_BACK );
@@ -116,6 +118,8 @@ VG_STATIC void render_water_texture( world_instance *world, camera *cam,
    m4x4_clip_projection( beneath_cam.mtx.p, clippb );
    camera_finalize( &beneath_cam );
 
+   glEnable( GL_DEPTH_TEST );
+   glDisable( GL_BLEND );
    render_world_depth( world, &beneath_cam );
    glViewport( 0, 0, vg.window_x, vg.window_y );
 }