Add wind speed world parameter
authorhgn <hgodden00@gmail.com>
Wed, 5 Feb 2025 16:25:26 +0000 (16:25 +0000)
committerhgn <hgodden00@gmail.com>
Wed, 5 Feb 2025 16:25:26 +0000 (16:25 +0000)
content_skaterift/maps/dev_heaven/main.mdl
shaders/model_sky_space.fs
shaders/scene_foliage.vs
skaterift_blender/sr_main.py
skaterift_blender/sr_mdl.py
src/entity.h
src/model.h
src/world_load.c
src/world_render.c

index c83c2225634fca8395a7696829d19e3fd6eea8e3..c96de6007c2d9e1290aced98fc9b90f668aa07d1 100644 (file)
Binary files a/content_skaterift/maps/dev_heaven/main.mdl and b/content_skaterift/maps/dev_heaven/main.mdl differ
index 057c23c0339ec4a2818f237abd1e446a98c0baa3..e8d2c5f3b942c6070d89678bd83121fedc174455 100644 (file)
@@ -48,5 +48,5 @@ void main(){
       star += stars( rd, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));
    }
 
-   oColour = vec4( vec3(star*20.0), 1.0);
+   oColour = vec4( vec3(0.1,0.1,0.2) + vec3(max(0.0,star*20.0)), 1.0);
 }
index 79209e6273f9afafb32a0fb358bccf986370e17c..997f2523904971e633391d4fb44c121cc3508def 100644 (file)
@@ -8,15 +8,17 @@ uniform mat4x3 uMdl;
 uniform mat4   uPv;
 uniform mat4   uPvmPrev;
 uniform float uTime;
+uniform float uAmt;
 
 out vec2 aUv;
 out vec4 aNorm;
 out vec3 aCo;
 out vec3 aWorldCo;
 
-void main(){
+void main()
+{
    vec4 vsine = sin(vec4(uTime + a_co.x, uTime*0.7 + a_co.z,uTime,uTime*1.3));
-   vec3 co = a_co + vsine.xyz * a_norm.w * 0.5;
+   vec3 co = a_co + vsine.xyz * a_norm.w * uAmt;
    
    vec3 world_pos0 = uMdl     * vec4( co, 1.0 );
    vec4 vproj0     = uPv      * vec4( world_pos0, 1.0 );
index b2663b2a25c580706efcd039090cf224c90f9693..87fee3f8091913364bc0383a823a8d6422f07238 100644 (file)
@@ -41,7 +41,7 @@ sr_entity_list = [
    # reserved 28.. armature
 ]
 
-MDL_VERSION_NR = 108
+MDL_VERSION_NR = 109
 SR_TRIGGERABLE = [ 'ent_audio', 'ent_ccmd', 'ent_gate', 'ent_challenge', \
                    'ent_relay', 'ent_skateshop', 'ent_objective', 'ent_route',\
                    'ent_miniworld', 'ent_region', 'ent_glider', 'ent_list',\
@@ -461,7 +461,8 @@ class ent_worldinfo(Structure):
                ("pstr_desc",c_uint32),      # unused
                ("timezone",c_float),
                ("pstr_skybox",c_uint32),
-               ("flags",c_uint32)]
+               ("flags",c_uint32),
+               ("wind_scale",c_float)]
 #}
 
 class ent_ccmd(Structure):
@@ -1862,6 +1863,7 @@ class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup):
    fix_time: bpy.props.BoolProperty(name="Fix Time")
    timezone: bpy.props.FloatProperty(name="Timezone(hrs) (UTC0 +hrs)")
    fixed_time: bpy.props.FloatProperty(name="Fixed Time (0-1)")
+   wind_scale: bpy.props.FloatProperty(name="Wind Scale",default=0.5)
 
    water_safe: bpy.props.BoolProperty(name="Water is Safe")
 
@@ -1879,6 +1881,8 @@ class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup):
          layout.prop( data[0], 'timezone' )
 
       layout.prop( data[0], 'water_safe' )
+      layout.prop( data[0], 'wind_scale' )
+      layout.prop( data[0], 'skybox' )
    #}
 #}
 
index f348893b1a0e955e4267730b4344aeafe8cbb04f..9ef074003c1fdbb166b823b998b69e31491eb284 100644 (file)
@@ -810,6 +810,7 @@ def _mdl_compiler_compile_entities():
 
             worldinfo.flags = flags
             worldinfo.pstr_skybox = _af_pack_string( obj_data.skybox )
+            worldinfo.wind_scale = obj_data.wind_scale
             sr_ent_push( worldinfo )
          #}
          elif ent_type == 'ent_ccmd':#{
index 3339019b76afd423b73f79a781026349637b9102..e8243a13d21499686e14a42c82c1729f01d77f3c 100644 (file)
@@ -481,6 +481,7 @@ struct ent_worldinfo{
    f32 timezone;
    u32 pstr_skybox;
    u32 flags;
+   f32 wind_scale;
 };
 
 ent_marker *ent_find_marker( mdl_context *mdl, array_file_ptr *arr, 
index fdf1608235df7967070041a251953361ca329dc2..e80423da84cfc1d0512b1c43d6ecb2e6b0056b55 100644 (file)
@@ -5,7 +5,7 @@
 #pragma once
 
 #define MDL_VERSION_MIN 101
-#define MDL_VERSION_NR 108
+#define MDL_VERSION_NR 109
 
 #include "array_file.h"
 
index 23f1f1be2d965ed307003a6bdf3ab4a5c2501779..438f2cfbb35fd219fafc0bef7293a833cb605dce 100644 (file)
@@ -103,6 +103,9 @@ static void world_instance_load_mdl( u32 instance_id, const char *path ){
             world->skybox = k_skybox_space;
          }
       }
+
+      if( world->meta.version < 108 )
+         world->info.wind_scale = 0.5f;
    }
    else
    {
index c7b11607e72d1eda60d5ebd6e2f18d2d7f9e9541..68952c7fe863350102531a52bb8c8f23b0ac8e94 100644 (file)
@@ -472,6 +472,7 @@ static void render_world_foliage( world_instance *world, vg_camera *cam )
    shader_scene_foliage_uTexMain(1);
    shader_scene_foliage_uPv( cam->mtx.pv );
    shader_scene_foliage_uTime( vg.time );
+   shader_scene_foliage_uAmt( world->info.wind_scale );
 
    WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_foliage );
    bind_terrain_noise();