('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
class volume_trigger(Structure):
#{
_fields_ = [("event",c_uint32),
- ("blank",c_uint32)]
+ ("event_leave",c_uint32)]
#}
class volume_particles(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 ):
# 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
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)
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 )
+ #}
#}
#}
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):
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'] )
#}
#}
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 ){
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];
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,
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{
};
struct volume_trigger{
- u32 event, blank;
+ u32 event, event_leave;
};
enum ent_volume_flag {
u32 pstr_world;
i32 purpose;
+ u32 proxy;
+};
+
+struct ent_prop {
+ mdl_transform transform;
+ u32 submesh_start, submesh_count, flags;
};
#include "world.h"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
"\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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
" 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"
ent_challenge,
ent_relay,
ent_cubemap,
- ent_miniworld;
+ ent_miniworld,
+ ent_prop;
enum skybox {
k_skybox_default,
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 ){
}
}
+ /* unpack prop models */
+ for( u32 i=0; i<mdl_arrcount( &world->ent_prop ); i++ ){
+ ent_prop *prop = mdl_arritm( &world->ent_prop, i );
+
+ for( u32 j=0; j<prop->submesh_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 );
}
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 );
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; j<mdl_arrcount( &world->ent_prop ); j++ ){
+ ent_prop *prop = mdl_arritm( &world->ent_prop, j );
+ if( prop->flags & 0x1 ) continue;
+
+ for( u32 k=0; k<prop->submesh_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 ){
}
else{
world_render_traffic( world, i, pass );
+ world_render_props( world, i, pass );
sm = &mat->sm_no_collide;
}
}
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;