}
/* TODO: allow error handling */
-VG_STATIC void player_board_load( struct player_board *mdl, const char *path )
-{
+VG_STATIC void player_board_load( struct player_board *mdl, const char *path ){
vg_linear_clear( vg_mem.scratch );
mdl_context ctx;
mdl_async_load_glmesh( &ctx, &mdl->mesh );
mdl_close( &ctx );
+ /* TODO: you get put into a new section, the above is standard mdl loads. */
for( int i=0; i<4; i++ )
mdl->wheels[i].indice_count = 0;
for( int i=0; i<2; i++ )
shader_model_board_view_uCamera( cam->transform[3] );
shader_model_board_view_uPv( cam->mtx.pv );
shader_model_board_view_uTexSceneDepth( 1 );
+ render_fb_bind_texture( gpipeline.fb_main, 2, 1 );
render_fb_inverse_ratio( gpipeline.fb_main, inverse );
}
}
-PLAYER_API void player__render( camera *cam, player_instance *player )
-{
+VG_STATIC void render_playermodel( camera *cam, world_instance *world,
+ struct player_model *model,
+ struct skeleton *skeleton ){
+ if( !model ) return;
+
shader_model_character_view_use();
glActiveTexture( GL_TEXTURE0 );
- glBindTexture( GL_TEXTURE_2D, player->playermodel->texture );
+ glBindTexture( GL_TEXTURE_2D, model->texture );
shader_model_character_view_uTexMain( 0 );
shader_model_character_view_uCamera( cam->transform[3] );
shader_model_character_view_uPv( cam->mtx.pv );
inverse[2] = cam->farz-cam->nearz;
shader_model_character_view_uInverseRatioMain( inverse );
- world_instance *world = world_current_instance();
world_link_lighting_ub( world, _shader_model_character_view.id );
world_bind_position_texture( world, _shader_model_character_view.id,
_uniform_model_character_view_g_world_depth, 2 );
_uniform_model_character_view_uLightsIndex, 4 );
glUniformMatrix4x3fv( _uniform_model_character_view_uTransforms,
- player->playeravatar->sk.bone_count,
+ skeleton->bone_count,
0,
- (float *)player->playeravatar->sk.final_mtx );
+ (float *)skeleton->final_mtx );
- mesh_bind( &player->playermodel->mesh );
- mesh_draw( &player->playermodel->mesh );
+ mesh_bind( &model->mesh );
+ mesh_draw( &model->mesh );
+}
- struct player_board *board = player_get_player_board( player );
+PLAYER_API void player__render( camera *cam, player_instance *player )
+{
+ world_instance *world = world_current_instance();
+
+ struct player_model *model = player_get_player_model( player );
+ render_playermodel( cam, world, model, &player->playeravatar->sk );
+ struct player_board *board = player_get_player_board( player );
render_board( cam, world, board, player->playeravatar->sk.final_mtx[
player->playeravatar->id_board],
k_board_shader_player );