return NULL;
}
+void _cutscene_play(void)
+{
+ _cutscene.state = k_cutscene_state_playing;
+}
+
+void _cutscene_unload(void)
+{
+ vg_info( "Unloading cutscene\n" );
+
+ for( u32 i=0; i<_cutscene.unique_refs; i ++ )
+ mdl_sync_std_unload( &_cutscene.refs[i].mdl );
+
+ vg_allocator_free( _cutscene.arena );
+ _cutscene.arena = NULL;
+ _cutscene.active_camera = NULL;
+ _cutscene.strip = 0;
+ _cutscene.time = 0.0f;
+ _cutscene.active_samplers = 0;
+ _cutscene.state = k_cutscene_state_none;
+ _cutscene.player_binding = NULL;
+}
+
/*
* Find associated entity data. We should also probably do this on the world
* thingy
* Currently draws everything as skinned meshes.
*/
void cutscene_render_instance( struct cs_instance *ins,
- world_instance *world, vg_camera *cam )
+ world_instance *world, vg_camera *cam )
{
struct model_ref *ref = &_cutscene.refs[ ins->ref_id ];
mdl_context *mdl = &ref->mdl;
WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, model_character_view );
- glActiveTexture( GL_TEXTURE0 );
+ glActiveTexture( GL_TEXTURE0 );
shader_model_character_view_uTexMain( 0 );
u32 armature_id = 0x00;
m4x3f *skinning_data = ins->skinning_data + skele->skinning_offset;
glUniformMatrix4x3fv( _uniform_model_character_view_uTransforms,
- skele->sk.bone_count,
- 0,
- (const GLfloat *)skinning_data );
+ skele->sk.bone_count,
+ 0,
+ (const GLfloat *)skinning_data );
}
for( u32 j=0; j<mesh->submesh_count; j ++ )
{
mdl_submesh *sm = &mdl->submeshes[ mesh->submesh_start+j ];
VG_ASSERT( sm->material_id );
-
+
if( sm->material_id != material_id )
{
mdl_material *m = &mdl->materials[ sm->material_id-1 ];
};
static bool link_internal_datapath( struct cs_asoc *asoc, const char *datapath,
- struct cs_link_info *out_link )
+ struct cs_link_info *out_link )
{
VG_ASSERT( asoc->entity_type == k_ent_camera );
for( u32 i=0; i<_cutscene.active_samplers; i ++ )
{
struct cs_sampler *si = &_cutscene.samplers[i];
-
+
if( frame > (si->strip->offset + si->strip->length) )
{
move = 1;
struct cs_sampler *sj = &_cutscene.samplers[j];
*sj = *si;
}
-
+
j ++;
}
}
ent_camera *cam = af_arritm( &_cutscene.meta.cameras, i );
vg_line_cross( cam->co, VG__RED, 0.2f );
}
+
+ if( (_cutscene.strip == af_arrcount(&_cutscene.meta.strips)) &&
+ (_cutscene.active_samplers == 0 ) )
+ {
+ _cutscene.state = k_cutscene_state_done;
+ }
}
void cutscene_render( world_instance *world, vg_camera *cam )
static void cb_cutscene_view( ui_context *ctx, ui_rect rect,
struct vg_magi_panel *magi )
{
+ if( _cutscene.state == k_cutscene_state_none )
+ {
+ ui_text( ctx, rect, "No cutscene loaded.", 1,
+ k_ui_align_middle_center, 0 );
+ return;
+ }
+
+ if( _cutscene.state == k_cutscene_state_loading )
+ {
+ ui_text( ctx, rect, "Cutscene loading..", 1,
+ k_ui_align_middle_center, 0 );
+ return;
+ }
+
ms_strip *usage[8];
for( u32 i=0; i<VG_ARRAY_LEN(usage); i ++ ) usage[i] = NULL;
static void render_main_game(void)
{
- if( skaterift.activity == k_skaterift_replay )
+ if( (_cutscene.state >= k_cutscene_state_ready) && _cutscene.player_binding )
+ {
+ struct cs_instance *inst = _cutscene.player_binding;
+ struct skeleton *sk = &localplayer.skeleton;
+ for( u32 i=0; i<sk->bone_count; i ++ )
+ {
+ m4x3_copy( inst->skinning_data[i], localplayer.final_mtx[i] );
+ }
+ }
+ else if( skaterift.activity == k_skaterift_replay )
{
player__animate_from_replay( &player_replay.local );
}
localplayer.deferred_frame_record = 0;
}
- //temp_not_done_1();
-
animate_remote_players();
player__pre_render();
#include "control_overlay.c"
#include "ent_camera.c"
#include "skaterift_script.c"
-
-#if 0
-static void temp_not_done_1(void)
-{
- if( _cutscene.ready )
- {
- struct cs_instance *inst = _cutscene_get_first_model_instance(
- "playermodels/skaterift_john/ch_john" );
-
- if( inst )
- {
- struct skeleton *sk = &localplayer.skeleton;
- for( u32 i=0; i<sk->bone_count; i ++ )
- {
- m4x3_copy( inst->skinning_data[i], localplayer.final_mtx[i] );
- }
- }
- }
-}
-#endif