From: hgn Date: Wed, 5 Feb 2025 16:25:26 +0000 (+0000) Subject: Add wind speed world parameter X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=5d9689fb4b1fc23de2c159bede8794fcb3b8cb01;p=carveJwlIkooP6JGAAIwe30JlM.git Add wind speed world parameter --- diff --git a/content_skaterift/maps/dev_heaven/main.mdl b/content_skaterift/maps/dev_heaven/main.mdl index c83c222..c96de60 100644 Binary files a/content_skaterift/maps/dev_heaven/main.mdl and b/content_skaterift/maps/dev_heaven/main.mdl differ diff --git a/shaders/model_sky_space.fs b/shaders/model_sky_space.fs index 057c23c..e8d2c5f 100644 --- a/shaders/model_sky_space.fs +++ b/shaders/model_sky_space.fs @@ -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); } diff --git a/shaders/scene_foliage.vs b/shaders/scene_foliage.vs index 79209e6..997f252 100644 --- a/shaders/scene_foliage.vs +++ b/shaders/scene_foliage.vs @@ -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 ); diff --git a/skaterift_blender/sr_main.py b/skaterift_blender/sr_main.py index b2663b2..87fee3f 100644 --- a/skaterift_blender/sr_main.py +++ b/skaterift_blender/sr_main.py @@ -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' ) #} #} diff --git a/skaterift_blender/sr_mdl.py b/skaterift_blender/sr_mdl.py index f348893..9ef0740 100644 --- a/skaterift_blender/sr_mdl.py +++ b/skaterift_blender/sr_mdl.py @@ -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':#{ diff --git a/src/entity.h b/src/entity.h index 3339019..e8243a1 100644 --- a/src/entity.h +++ b/src/entity.h @@ -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, diff --git a/src/model.h b/src/model.h index fdf1608..e80423d 100644 --- a/src/model.h +++ b/src/model.h @@ -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" diff --git a/src/world_load.c b/src/world_load.c index 23f1f1b..438f2cf 100644 --- a/src/world_load.c +++ b/src/world_load.c @@ -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 { diff --git a/src/world_render.c b/src/world_render.c index c7b1160..68952c7 100644 --- a/src/world_render.c +++ b/src/world_render.c @@ -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();