From: hgn Date: Thu, 13 Jul 2023 15:16:52 +0000 (+0100) Subject: challange entitites X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;h=a1b878e2cdbf145b59d611b5060d3c1a1a80d017;p=carveJwlIkooP6JGAAIwe30JlM.git challange entitites --- diff --git a/blender_export.py b/blender_export.py index 2b059d9..ae8b641 100644 --- a/blender_export.py +++ b/blender_export.py @@ -35,7 +35,8 @@ sr_entity_list = [ ('ent_swspreview', 'Workshop Preview', '', 14 ), ('ent_menuitem', 'Menu Item', '', 15 ), ('ent_worldinfo', 'World Info', '', 16 ), - ('ent_ccmd', 'CCmd', '', 17 ) + ('ent_ccmd', 'CCmd', '', 17 ), + ('ent_challenge', 'Challenge', '', 18 ) ] def get_entity_enum_id( alias ): @@ -445,6 +446,13 @@ class ent_ccmd(Structure): _fields_ = [("pstr_command",c_uint32)] #} +class ent_challenge(Structure):#{ + _fields_ = [("transform",mdl_transform), + ("submesh_start",c_uint32), ("submesh_count",c_uint32), + ("id_next",c_uint32), + ("filter",c_uint32)] +#} + def obj_ent_type( obj ): #{ if obj.type == 'ARMATURE': return 'mdl_armature' @@ -793,8 +801,9 @@ def sr_armature_bones( armature ): yield from _recurse_bone( b ) #} -def sr_entity_id( obj ): -#{ +def sr_entity_id( obj ):#{ + if not obj: return 0 + tipo = get_entity_enum_id( obj_ent_type(obj) ) index = sr_compile.entity_ids[ obj.name ] @@ -1531,6 +1540,7 @@ def sr_compile( collection ): if ent_type == 'ent_font': continue if ent_type == 'ent_font_variant': continue if ent_type == 'ent_menuitem': continue + if ent_type == 'ent_challenge': continue #-------------------------- print( F'[SR] {i: 3}/{mesh_count} {obj.name:<40}', end='\r' ) @@ -1743,6 +1753,17 @@ def sr_compile( collection ): ccmd.pstr_command = sr_compile_string( obj_data.command ) sr_ent_push( ccmd ) #} + elif ent_type == 'ent_challenge':#{ + challenge = ent_challenge() + obj_data = obj.SR_data.ent_challenge[0] + challenge.id_next = sr_entity_id( obj_data.proxima ) + + compile_obj_transform( obj, challenge.transform ) + challenge.submesh_start, challenge.submesh_count, _ = \ + sr_compile_mesh_internal( obj ) + + sr_ent_push( challenge ) + #} #} #} @@ -2982,6 +3003,16 @@ class SR_OBJECT_ENT_CCMD(bpy.types.PropertyGroup): command: bpy.props.StringProperty(name="Command Line") #} +class SR_OBJECT_ENT_CHALLENGE(bpy.types.PropertyGroup):#{ + proxima: bpy.props.PointerProperty( \ + type=bpy.types.Object, name="Next", \ + poll=lambda self,obj: sr_filter_ent_type(obj,['ent_challenge'])) + target: bpy.props.PointerProperty( \ + type=bpy.types.Object, name="Target", \ + poll=lambda self,obj: sr_filter_ent_type(obj,\ + ['ent_audio','ent_ccmd'])) +#} + class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): #{ ent_gate: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_GATE) @@ -2999,6 +3030,7 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): ent_menuitem: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MENU_ITEM) ent_worldinfo: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_WORLD_INFO) ent_ccmd: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_CCMD) + ent_challenge: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_CHALLENGE) ent_type: bpy.props.EnumProperty( name="Type", @@ -4121,6 +4153,7 @@ classes = [ SR_INTERFACE, SR_MATERIAL_PANEL,\ SR_OBJECT_ENT_FONT,SR_OBJECT_ENT_TRAFFIC,SR_OBJECT_ENT_SKATESHOP,\ SR_OBJECT_ENT_WORKSHOP_PREVIEW,SR_OBJECT_ENT_MENU_ITEM,\ SR_OBJECT_ENT_WORLD_INFO,SR_OBJECT_ENT_CCMD,\ + SR_OBJECT_ENT_CHALLENGE,\ \ SR_OBJECT_PROPERTIES, SR_LIGHT_PROPERTIES, SR_BONE_PROPERTIES, SR_MESH_PROPERTIES, SR_MATERIAL_PROPERTIES \ diff --git a/entity.h b/entity.h index 7143a41..487c4d3 100644 --- a/entity.h +++ b/entity.h @@ -26,6 +26,7 @@ typedef struct ent_camera ent_camera; typedef struct ent_swspreview ent_swspreview; typedef struct ent_worldinfo ent_worldinfo; typedef struct ent_ccmd ent_ccmd; +typedef struct ent_challenge ent_challenge; enum entity_alias{ k_ent_none = 0, @@ -45,7 +46,8 @@ enum entity_alias{ k_ent_swspreview = 14, k_ent_menuitem = 15, k_ent_worldinfo = 16, - k_ent_ccmd = 17 + k_ent_ccmd = 17, + k_ent_challenge = 18 }; static u32 mdl_entity_id_type( u32 entity_id ){ @@ -378,6 +380,14 @@ struct ent_ccmd{ u32 pstr_command; }; +struct ent_challenge{ + mdl_transform transform; + u32 submesh_start, + submesh_count, + id_next, + filter; +}; + typedef struct ent_call ent_call; struct ent_call{ u32 id, function; diff --git a/maps_src/mp_spawn/main.mdl b/maps_src/mp_spawn/main.mdl index bbb3004..f54719a 100644 Binary files a/maps_src/mp_spawn/main.mdl and b/maps_src/mp_spawn/main.mdl differ diff --git a/shaders/scene_fxglow.fs b/shaders/scene_fxglow.fs index 6d7df91..5d1a5bb 100644 --- a/shaders/scene_fxglow.fs +++ b/shaders/scene_fxglow.fs @@ -4,9 +4,8 @@ uniform vec3 uCamera; #include "common_scene.glsl" #include "motion_vectors_fs.glsl" -void main() -{ - compute_motion_vectors(); +void main(){ + oMotionVec = vec2(0.0); vec4 vsamplemain = texture( uTexMain, aUv ); diff --git a/shaders/scene_fxglow.h b/shaders/scene_fxglow.h index e67c665..3f5e0c6 100644 --- a/shaders/scene_fxglow.h +++ b/shaders/scene_fxglow.h @@ -424,9 +424,8 @@ static struct vg_shader _shader_scene_fxglow = { "\n" "#line 6 0 \n" "\n" -"void main()\n" -"{\n" -" compute_motion_vectors();\n" +"void main(){\n" +" oMotionVec = vec2(0.0);\n" "\n" " vec4 vsamplemain = texture( uTexMain, aUv );\n" "\n" diff --git a/skaterift.c b/skaterift.c index fa9459c..a575fc5 100644 --- a/skaterift.c +++ b/skaterift.c @@ -411,16 +411,10 @@ VG_STATIC void render_player_transparent(void){ camera_finalize( &small_cam ); /* Draw player to window buffer and blend background ontop */ - glBindFramebuffer( GL_FRAMEBUFFER, 0 ); - glViewport( 0,0, vg.window_x, vg.window_y ); player__render( &small_cam, &localplayer ); } VG_STATIC void render_scene(void){ - render_fb_bind( gpipeline.fb_main, 1 ); - glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); - glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT ); - /* Draw world */ glEnable( GL_DEPTH_TEST ); @@ -493,15 +487,34 @@ VG_STATIC void render_main_game(void){ skaterift_composite_maincamera(); - render_scene(); + /* --------------------------------------------------------------------- */ + + /* variable res target */ + render_fb_bind( gpipeline.fb_main, 1 ); + glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ); + glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT ); + render_scene(); glEnable( GL_DEPTH_TEST ); - render_player_transparent(); + /* full res target */ + glBindFramebuffer( GL_FRAMEBUFFER, 0 ); + glViewport( 0,0, vg.window_x, vg.window_y ); + + render_player_transparent(); /* needs to read the depth buffer before we fuck + it up with the oblique rendering inside the + portals */ + + world_render_challenges( localplayer.viewable_world ); + + /* continue with variable rate */ render_scene_gate_subview(); + /* composite */ present_view_with_post_processing(); + /* --------------------------------------------------------------------- */ + /* capture the current resume frame at the very last point */ if( button_down( k_srbind_reset ) ){ if( skaterift.activity == k_skaterift_default ){ diff --git a/world.h b/world.h index ddb82e1..7d513f9 100644 --- a/world.h +++ b/world.h @@ -155,7 +155,8 @@ struct world_instance { ent_marker, ent_camera, ent_swspreview, - ent_ccmd; + ent_ccmd, + ent_challenge; ent_gate *rendering_gate; diff --git a/world_load.c b/world_load.c index bbf5c91..9ca847c 100644 --- a/world_load.c +++ b/world_load.c @@ -59,6 +59,7 @@ VG_STATIC void world_load_mdl( const char *path ) mdl_load_array( meta, &world->ent_skateshop, "ent_skateshop", heap ); mdl_load_array( meta, &world->ent_swspreview,"ent_swspreview", heap ); mdl_load_array( meta, &world->ent_ccmd, "ent_ccmd", heap ); + mdl_load_array( meta, &world->ent_challenge, "ent_challenge", 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 c332ace..950e35f 100644 --- a/world_render.c +++ b/world_render.c @@ -154,7 +154,10 @@ struct world_pass{ void (*fn_set_uPvmPrev)( m4x4f pvm ); }; -VG_STATIC void world_render_if( world_instance *world, struct world_pass *pass ) +/* TODO: high level control pass renders. */ + +VG_STATIC +void world_render_if( world_instance *world, struct world_pass *pass ) { for( int i=0; isurface_count; i++ ){ struct world_surface *mat = &world->surfaces[i]; @@ -202,6 +205,20 @@ VG_STATIC void world_render_if( world_instance *world, struct world_pass *pass ) } } +VG_STATIC +void world_render_challenges( world_instance *world ){ + if( !world ) return; + + shader_scene_fxglow_use(); + for( u32 i=0; ient_challenge); i++ ){ + ent_challenge *challenge = mdl_arritm(&world->ent_challenge,i); + + m4x3f mmdl; + mdl_transform_m4x3( &challenge->transform, mmdl ); + shader_scene_fxglow_uMdl( mmdl ); + } +} + VG_STATIC void world_render_both_stages( world_instance *world, struct world_pass *pass ) { @@ -320,7 +337,7 @@ VG_STATIC void render_world_alphatest( world_instance *world, camera *cam ) } VG_STATIC void render_world_fxglow( world_instance *world, camera *cam ){ - glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } ); + //glDrawBuffers( 1, (GLenum[]){ GL_COLOR_ATTACHMENT0 } ); shader_scene_fxglow_use(); shader_scene_fxglow_uTexMain(1); @@ -348,7 +365,7 @@ VG_STATIC void render_world_fxglow( world_instance *world, camera *cam ){ world_render_both_stages( world, &pass ); glEnable(GL_CULL_FACE); - glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 } ); + //glDrawBuffers( 2, (GLenum[]){ GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 } ); } VG_STATIC void bindpoint_terrain( world_instance *world,