From 1a7f4a35e88698bdb45c90f646f1645589d5511c Mon Sep 17 00:00:00 2001 From: hgn Date: Sun, 19 Nov 2023 04:40:33 +0000 Subject: [PATCH] proxy models --- blender_export.py | 79 +++++++++++++++++++---------- ent_miniworld.c | 26 ++++++++++ entity.h | 12 ++++- maps_src/dev_hub/main.mdl | Bin 194664 -> 227944 bytes shaders/model_board_view.h | 14 +++-- shaders/model_character_view.h | 14 +++-- shaders/model_entity.h | 14 +++-- shaders/model_sky.h | 14 +++-- shaders/model_sky_space.h | 14 +++-- shaders/scene_cubemapped.h | 14 +++-- shaders/scene_depth.h | 14 +++-- shaders/scene_font.h | 14 +++-- shaders/scene_fxglow.h | 14 +++-- shaders/scene_override.h | 16 +++--- shaders/scene_position.h | 14 +++-- shaders/scene_route.h | 14 +++-- shaders/scene_scoretext.h | 14 +++-- shaders/scene_standard.h | 14 +++-- shaders/scene_standard_alphatest.h | 14 +++-- shaders/scene_terrain.h | 14 +++-- shaders/scene_vertex_blend.h | 14 +++-- shaders/scene_water.h | 14 +++-- shaders/scene_water_fast.h | 14 +++-- world.h | 3 +- world_entity.c | 11 ++++ world_gen.c | 11 ++++ world_load.c | 1 + world_render.c | 40 +++++++++++++++ world_volumes.c | 6 +++ 29 files changed, 332 insertions(+), 125 deletions(-) diff --git a/blender_export.py b/blender_export.py index b4a501d..36ca368 100644 --- a/blender_export.py +++ b/blender_export.py @@ -40,7 +40,8 @@ sr_entity_list = [ ('ent_objective', 'Objective', '', 18 ), ('ent_challenge', 'Challenge', '', 19 ), ('ent_relay', 'Relay', '', 20 ), - ('ent_miniworld', 'Mini World', '', 22 ) + ('ent_miniworld', 'Mini World', '', 22 ), + ('ent_prop', 'Prop', '', 23 ) ] MDL_VERSION_NR = 104 @@ -283,7 +284,7 @@ class ent_water(Structure): class volume_trigger(Structure): #{ _fields_ = [("event",c_uint32), - ("blank",c_uint32)] + ("event_leave",c_uint32)] #} class volume_particles(Structure): @@ -527,9 +528,17 @@ class ent_cubemap(Structure):#{ class ent_miniworld(Structure):#{ _fields_ = [("transform",mdl_transform), ("pstr_world",c_uint32), - ("purpose",c_int32)] + ("purpose",c_int32), + ("proxy",c_uint32)] - sr_functions = { 0: 'zone' } + sr_functions = { 0: 'zone', 1: 'leave' } +#} + +class ent_prop(Structure):#{ + _fields_ = [("transform",mdl_transform), + ("submesh_start",c_uint32), + ("submesh_count",c_uint32), + ("flags",c_uint32)] #} def obj_ent_type( obj ): @@ -1665,6 +1674,7 @@ def sr_compile( collection ): # entity ignore mesh list # if ent_type == 'ent_traffic': continue + if ent_type == 'ent_prop': continue if ent_type == 'ent_font': continue if ent_type == 'ent_font_variant': continue if ent_type == 'ent_menuitem': continue @@ -1841,6 +1851,7 @@ def sr_compile( collection ): if obj_data.target:#{ volume.target = sr_entity_id( obj_data.target ) volume._anon.trigger.event = obj_data.target_event + volume._anon.trigger.event_leave = obj_data.target_event_leave #} sr_ent_push(volume) @@ -1960,8 +1971,17 @@ def sr_compile( collection ): compile_obj_transform( obj, miniworld.transform ) miniworld.pstr_world = sr_compile_string( obj_data.world ) + miniworld.proxy = sr_entity_id( obj_data.proxy ) sr_ent_push( miniworld ) #} + elif ent_type == 'ent_prop':#{ + prop = ent_prop() + compile_obj_transform( obj, prop.transform ) + prop.submesh_start, prop.submesh_count, _ = \ + sr_compile_mesh_internal( obj ) + prop.flags = 0 + sr_ent_push( prop ) + #} #} #} @@ -2601,6 +2621,9 @@ class SR_OBJECT_ENT_ROUTE_ENTRY(bpy.types.PropertyGroup): class SR_OBJECT_ENT_MINIWORLD(bpy.types.PropertyGroup): #{ world: bpy.props.StringProperty( name='world UID' ) + proxy: bpy.props.PointerProperty( \ + type=bpy.types.Object, name='proxy', \ + poll=lambda self,obj: sr_filter_ent_type(obj,['ent_prop'])) #} class SR_UL_ROUTE_NODE_LIST(bpy.types.UIList): @@ -2950,40 +2973,44 @@ class SR_OBJECT_ENT_VOLUME(bpy.types.PropertyGroup):#{ target: bpy.props.PointerProperty( \ type=bpy.types.Object, name="Target", \ poll=lambda self,obj: sr_filter_ent_type(obj,SR_TRIGGERABLE)) - target_event: bpy.props.IntProperty( name="Event/Method" ) + target_event: bpy.props.IntProperty( name="Enter Ev" ) + target_event_leave: bpy.props.IntProperty( name="Leave Ev" ) @staticmethod - def inspect_target( layout, data, propname ):#{ + def inspect_target( layout, data, propname, evs = ['_event'] ):#{ box = layout.box() box.prop( data[0], propname ) - row = box.row() - row.prop( data[0], propname + '_event') - - target = getattr( data[0], propname ) - if target:#{ - tipo = target.SR_data.ent_type - cls = globals()[ tipo ] - - table = getattr( cls, 'sr_functions', None ) - if table:#{ - index = getattr( data[0], propname+'_event') - if index in table: - row.label( text=table[index] ) - else: - row.label( text="undefined function" ) + for evname in evs:#{ + row = box.row() + row.prop( data[0], propname + evname ) + + target = getattr( data[0], propname ) + if target:#{ + tipo = target.SR_data.ent_type + cls = globals()[ tipo ] + + table = getattr( cls, 'sr_functions', None ) + if table:#{ + index = getattr( data[0], propname + evname ) + if index in table: + row.label( text=table[index] ) + else: + row.label( text="undefined function" ) + #} + #} + else:#{ + row.label( text="..." ) + row.enabled=False #} - #} - else:#{ - row.label( text="..." ) - row.enabled=False #} #} @staticmethod def sr_inspector( layout, data ):#{ layout.prop( data[0], 'subtype' ) - SR_OBJECT_ENT_VOLUME.inspect_target( layout, data, 'target' ) + SR_OBJECT_ENT_VOLUME.inspect_target( layout, data, 'target', \ + ['_event','_event_leave'] ) #} #} diff --git a/ent_miniworld.c b/ent_miniworld.c index bc59d47..54ce8ae 100644 --- a/ent_miniworld.c +++ b/ent_miniworld.c @@ -14,6 +14,19 @@ static void ent_miniworld_call( world_instance *world, ent_call *call ){ global_miniworld.active_id = call->id; } + else if( call->function == 1 ){ + + if( global_miniworld.active_id == call->id ) + global_miniworld.active_id = 0; + else + vg_warn( "bad call\n" ); + + if( miniworld->proxy ){ + ent_prop *prop = mdl_arritm( &world->ent_prop, + mdl_entity_id_id(miniworld->proxy) ); + prop->flags &= ~0x1; + } + } } static void ent_miniworld_render( world_instance *host_world ){ @@ -25,7 +38,20 @@ static void ent_miniworld_render( world_instance *host_world ){ ent_miniworld *miniworld = mdl_arritm( &host_world->ent_miniworld, mdl_entity_id_id(entity_id) ); + int rendering = 1; if( miniworld->purpose == k_world_purpose_invalid ) + rendering = 0; + + if( miniworld->proxy ){ + ent_prop *prop = mdl_arritm( &host_world->ent_prop, + mdl_entity_id_id(miniworld->proxy) ); + if( !rendering ) + prop->flags &= ~0x1; + else + prop->flags |= 0x1; + } + + if( !rendering ) return; world_instance *dest_world = &world_static.instances[miniworld->purpose]; diff --git a/entity.h b/entity.h index cab16c8..bdb69f8 100644 --- a/entity.h +++ b/entity.h @@ -31,6 +31,7 @@ typedef struct ent_challenge ent_challenge; typedef struct ent_relay ent_relay; typedef struct ent_cubemap ent_cubemap; typedef struct ent_miniworld ent_miniworld; +typedef struct ent_prop ent_prop; enum entity_alias{ k_ent_none = 0, @@ -72,7 +73,8 @@ static u32 mdl_entity_id( u32 type, u32 index ){ enum entity_function{ k_ent_function_trigger, - k_ent_function_particle_spawn + k_ent_function_particle_spawn, + k_ent_function_trigger_leave }; struct ent_spawn{ @@ -207,7 +209,7 @@ struct volume_particles{ }; struct volume_trigger{ - u32 event, blank; + u32 event, event_leave; }; enum ent_volume_flag { @@ -504,6 +506,12 @@ struct ent_miniworld { u32 pstr_world; i32 purpose; + u32 proxy; +}; + +struct ent_prop { + mdl_transform transform; + u32 submesh_start, submesh_count, flags; }; #include "world.h" diff --git a/maps_src/dev_hub/main.mdl b/maps_src/dev_hub/main.mdl index 106e213105632022dc9de5da022840c63e07cf74..deae0e2fd6a1888498422b2e5643d600e58ae432 100644 GIT binary patch delta 25896 zcmcIt30zdw_kY78f*=8-fDX8!sJP@7sLZ=F;J%`%sHwT(5{ertrTAPb$lRYbSZ11v z`xcg%%$pf7MN`sW`qN6&$_2I5`kPDs(*L<{-W$#vc<}svKEL^Nyq9yn=bm$yci+8t z&Yeo{*C>4uV4lP5H!@z$`JkZqfQ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+= stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/model_character_view.h b/shaders/model_character_view.h index 03df443..51e06db 100644 --- a/shaders/model_character_view.h +++ b/shaders/model_character_view.h @@ -213,14 +213,18 @@ static struct vg_shader _shader_model_character_view = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/model_entity.h b/shaders/model_entity.h index 585c897..e7044ed 100644 --- a/shaders/model_entity.h +++ b/shaders/model_entity.h @@ -205,14 +205,18 @@ static struct vg_shader _shader_model_entity = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/model_sky.h b/shaders/model_sky.h index 882e174..0bf6751 100644 --- a/shaders/model_sky.h +++ b/shaders/model_sky.h @@ -207,14 +207,18 @@ static struct vg_shader _shader_model_sky = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/model_sky_space.h b/shaders/model_sky_space.h index 7251196..589175f 100644 --- a/shaders/model_sky_space.h +++ b/shaders/model_sky_space.h @@ -207,14 +207,18 @@ static struct vg_shader _shader_model_sky_space = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_cubemapped.h b/shaders/scene_cubemapped.h index 4c90269..5f8b80a 100644 --- a/shaders/scene_cubemapped.h +++ b/shaders/scene_cubemapped.h @@ -207,14 +207,18 @@ static struct vg_shader _shader_scene_cubemapped = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_depth.h b/shaders/scene_depth.h index 160fd02..ea2fbeb 100644 --- a/shaders/scene_depth.h +++ b/shaders/scene_depth.h @@ -206,14 +206,18 @@ static struct vg_shader _shader_scene_depth = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_font.h b/shaders/scene_font.h index 7eba1b0..2cae292 100644 --- a/shaders/scene_font.h +++ b/shaders/scene_font.h @@ -209,14 +209,18 @@ static struct vg_shader _shader_scene_font = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_fxglow.h b/shaders/scene_fxglow.h index 98bb0e3..f5c14c3 100644 --- a/shaders/scene_fxglow.h +++ b/shaders/scene_fxglow.h @@ -204,14 +204,18 @@ static struct vg_shader _shader_scene_fxglow = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_override.h b/shaders/scene_override.h index fb53671..d0c7ab9 100644 --- a/shaders/scene_override.h +++ b/shaders/scene_override.h @@ -210,14 +210,18 @@ static struct vg_shader _shader_scene_override = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" @@ -478,7 +482,7 @@ static struct vg_shader _shader_scene_override = { "\n" " compute_motion_vectors();\n" "\n" -" vec3 vfrag = vec3(0.5);\n" +" vec3 vfrag = vec3(0.7);\n" " vec3 qnorm = aNorm.xyz;\n" "\n" " qnorm = normalize(floor(aNorm.xyz*4.0)*0.25);\n" diff --git a/shaders/scene_position.h b/shaders/scene_position.h index 99fe303..4b0a226 100644 --- a/shaders/scene_position.h +++ b/shaders/scene_position.h @@ -206,14 +206,18 @@ static struct vg_shader _shader_scene_position = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_route.h b/shaders/scene_route.h index ecaf5fe..8e3cc10 100644 --- a/shaders/scene_route.h +++ b/shaders/scene_route.h @@ -205,14 +205,18 @@ static struct vg_shader _shader_scene_route = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_scoretext.h b/shaders/scene_scoretext.h index a2241c8..17d0eba 100644 --- a/shaders/scene_scoretext.h +++ b/shaders/scene_scoretext.h @@ -225,14 +225,18 @@ static struct vg_shader _shader_scene_scoretext = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_standard.h b/shaders/scene_standard.h index 3904980..b5b3298 100644 --- a/shaders/scene_standard.h +++ b/shaders/scene_standard.h @@ -205,14 +205,18 @@ static struct vg_shader _shader_scene_standard = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_standard_alphatest.h b/shaders/scene_standard_alphatest.h index 2240b4b..f548899 100644 --- a/shaders/scene_standard_alphatest.h +++ b/shaders/scene_standard_alphatest.h @@ -205,14 +205,18 @@ static struct vg_shader _shader_scene_standard_alphatest = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_terrain.h b/shaders/scene_terrain.h index faeb11e..5bf992c 100644 --- a/shaders/scene_terrain.h +++ b/shaders/scene_terrain.h @@ -206,14 +206,18 @@ static struct vg_shader _shader_scene_terrain = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_vertex_blend.h b/shaders/scene_vertex_blend.h index 672d154..2cc345b 100644 --- a/shaders/scene_vertex_blend.h +++ b/shaders/scene_vertex_blend.h @@ -204,14 +204,18 @@ static struct vg_shader _shader_scene_vertex_blend = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_water.h b/shaders/scene_water.h index 2ce696c..3a733b3 100644 --- a/shaders/scene_water.h +++ b/shaders/scene_water.h @@ -214,14 +214,18 @@ static struct vg_shader _shader_scene_water = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/shaders/scene_water_fast.h b/shaders/scene_water_fast.h index 3e88f1d..8a1ba5e 100644 --- a/shaders/scene_water_fast.h +++ b/shaders/scene_water_fast.h @@ -211,14 +211,18 @@ static struct vg_shader _shader_scene_water_fast = { " vec3 sun_colour = mix( vec3(1.0), g_sunset_colour.rgb, g_sunset_phase*0.5 );\n" " sun_colour *= sun_shape;\n" "\n" -"\n" +" \n" " float star = 0.0;\n" -" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" -" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" -" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0 / pow(4.0, j));\n" +" float star_blend = 10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +"\n" +" if( star_blend > 0.001 ){\n" +" for( float j = 1.0; j <= 4.1; j += 1.0 ){\n" +" float m = mix(0.6, 0.9, smoothstep(1.0, 2.0, j));\n" +" star += stars( ray_dir, 1.94 * pow( 1.64, j ), m ) * (1.0/pow(4.0, j));\n" +" }\n" " }\n" " \n" -" vec3 composite = sky_colour + sun_colour + star*10.0*max(0.0,(1.0-g_day_phase*2.0));\n" +" vec3 composite = sky_colour + sun_colour + star*star_blend;\n" " return composite;\n" "}\n" "\n" diff --git a/world.h b/world.h index 02bb02e..dde9aea 100644 --- a/world.h +++ b/world.h @@ -180,7 +180,8 @@ struct world_instance { ent_challenge, ent_relay, ent_cubemap, - ent_miniworld; + ent_miniworld, + ent_prop; enum skybox { k_skybox_default, diff --git a/world_entity.c b/world_entity.c index 73caa0b..975c008 100644 --- a/world_entity.c +++ b/world_entity.c @@ -286,6 +286,17 @@ static void ent_volume_call( world_instance *world, ent_call *call ) entity_call( world, call ); } } + else if( call->function == k_ent_function_trigger_leave ){ + call->id = volume->target; + + if( volume->flags & k_ent_volume_flag_particles ){ + assert(0); + } + else{ + call->function = volume->trigger.event_leave; + entity_call( world, call ); + } + } } static void ent_audio_call( world_instance *world, ent_call *call ){ diff --git a/world_gen.c b/world_gen.c index 7d3cc81..51d0302 100644 --- a/world_gen.c +++ b/world_gen.c @@ -300,6 +300,17 @@ static void world_gen_generate_meshes( world_instance *world ){ } } + /* unpack prop models */ + for( u32 i=0; ient_prop ); i++ ){ + ent_prop *prop = mdl_arritm( &world->ent_prop, i ); + + for( u32 j=0; jsubmesh_count; j ++ ){ + mdl_submesh *sm = mdl_arritm( &world->meta.submeshs, + prop->submesh_start+j ); + world_unpack_submesh_dynamic( world, &world->scene_no_collide, sm ); + } + } + vg_async_dispatch( call, async_scene_upload ); } diff --git a/world_load.c b/world_load.c index 1605325..6378e9b 100644 --- a/world_load.c +++ b/world_load.c @@ -68,6 +68,7 @@ static void world_instance_load_mdl( u32 instance_id, const char *path ){ mdl_load_array( meta, &world->ent_relay, "ent_relay", heap ); mdl_load_array( meta, &world->ent_cubemap, "ent_cubemap", heap ); mdl_load_array( meta, &world->ent_miniworld, "ent_miniworld", heap ); + mdl_load_array( meta, &world->ent_prop, "ent_prop", heap ); mdl_array_ptr infos; mdl_load_array( meta, &infos, "ent_worldinfo", vg_mem.scratch ); diff --git a/world_render.c b/world_render.c index 1463142..1d2256b 100644 --- a/world_render.c +++ b/world_render.c @@ -154,6 +154,45 @@ struct world_pass{ void (*fn_set_uNormalMtx)( m3x3f mnorm ); }; +/* FIXME: we gotta do something about this crap, maybe batch lists. something.. + * anything but this. */ +static +void world_render_props( world_instance *world, u32 material_id, + struct world_pass *pass ){ + if( !mdl_arrcount( &world->ent_prop ) ) return; + + /* HACK: use the first material for every prop entity */ + ent_prop *first = mdl_arritm( &world->ent_prop, 0 ); + if( !first->submesh_count ) return; + + mdl_submesh *sm = mdl_arritm( &world->meta.submeshs, first->submesh_start ); + if( sm->material_id != material_id ) return; + + struct world_surface *mat = &world->surfaces[ material_id ]; + pass->fn_bind_textures( world, mat ); + + for( u32 j=0; jent_prop ); j++ ){ + ent_prop *prop = mdl_arritm( &world->ent_prop, j ); + if( prop->flags & 0x1 ) continue; + + for( u32 k=0; ksubmesh_count; k++ ){ + sm = mdl_arritm( &world->meta.submeshs, prop->submesh_start+k ); + + m4x3f mmdl; + mdl_transform_m4x3( &prop->transform, mmdl ); + + m4x4f m4mdl; + m4x3_expand( mmdl, m4mdl ); + m4x4_mul( pass->cam->mtx_prev.pv, m4mdl, m4mdl ); + + pass->fn_set_mdl( mmdl ); + pass->fn_set_uPvmPrev( m4mdl ); + + mdl_draw_submesh( sm ); + } + } +} + static void world_render_traffic( world_instance *world, u32 material_id, struct world_pass *pass ){ @@ -205,6 +244,7 @@ void world_render_pass( world_instance *world, struct world_pass *pass ){ } else{ world_render_traffic( world, i, pass ); + world_render_props( world, i, pass ); sm = &mat->sm_no_collide; } diff --git a/world_volumes.c b/world_volumes.c index dac790e..23b8299 100644 --- a/world_volumes.c +++ b/world_volumes.c @@ -23,6 +23,12 @@ static void world_volumes_update( world_instance *world, v3f pos ){ } else{ /* trigger on exit...... */ + ent_call basecall; + basecall.function = k_ent_function_trigger_leave; + basecall.id = mdl_entity_id( k_ent_volume, idx ); + basecall.data = NULL; + + entity_call( world, &basecall ); } } world_static.active_trigger_volume_count = j; -- 2.25.1