#include "shaders/model_character_view.h"
#include "shaders/model_board_view.h"
#include "shaders/model_entity.h"
+#include "shaders/model_board_view.h"
+#include "depth_compare.h"
static void player_avatar_load( struct player_avatar *av, const char *path ){
mdl_open( &av->meta, path, vg_mem.rtmemory );
skeleton_setup( sk, vg_mem.rtmemory, &av->meta );
av->id_hip = skeleton_bone_id( sk, "hips" );
+ av->id_chest = skeleton_bone_id( sk, "chest" );
av->id_ik_hand_l = skeleton_bone_id( sk, "hand.IK.L" );
av->id_ik_hand_r = skeleton_bone_id( sk, "hand.IK.R" );
av->id_ik_elbow_l = skeleton_bone_id( sk, "elbow.L" );
assert( sys->animator_data );
sys->animate();
- sys->pose( sys->animator_data, &localplayer.pose );
+
+ player_pose *pose = &localplayer.pose;
+ sys->pose( sys->animator_data, pose );
struct skeleton *sk = &localplayer.playeravatar->sk;
if( localplayer.holdout_time > 0.0f ){
- player_pose *pose = &localplayer.pose;
skeleton_lerp_pose( sk,
pose->keyframes,localplayer.holdout_pose.keyframes,
localplayer.holdout_time, pose->keyframes );
+
+ v3_muladds( pose->root_co, localplayer.holdout_pose.root_co,
+ localplayer.holdout_time, pose->root_co );
q_nlerp( pose->root_q, localplayer.holdout_pose.root_q,
localplayer.holdout_time, pose->root_q );
+
localplayer.holdout_time -= vg.time_frame_delta * 2.0f;
}
{
if( !board ) return;
+ /* TODO:
+ * adding depth compare to this shader
+ */
+
v3f inverse;
glActiveTexture( GL_TEXTURE0 );
shader_model_board_view_uTexMain( 0 );
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 );
+ shader_model_board_view_uDepthCompare(1);
+ depth_compare_bind(
+ shader_model_board_view_uTexSceneDepth,
+ shader_model_board_view_uInverseRatioDepth,
+ shader_model_board_view_uInverseRatioMain,
+ cam );
- inverse[2] = skaterift.cam.farz-skaterift.cam.nearz;
-
- shader_model_board_view_uInverseRatioDepth( inverse );
- render_fb_inverse_ratio( NULL, inverse );
- inverse[2] = cam->farz-cam->nearz;
- shader_model_board_view_uInverseRatioMain( inverse );
-
- world_link_lighting_ub( world, _shader_model_board_view.id );
- world_bind_position_texture( world, _shader_model_board_view.id,
- _uniform_model_board_view_g_world_depth, 2 );
- world_bind_light_array( world, _shader_model_board_view.id,
- _uniform_model_board_view_uLightsArray, 3 );
- world_bind_light_index( world, _shader_model_board_view.id,
- _uniform_model_board_view_uLightsIndex, 4 );
+ WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, model_board_view );
}
else if( shader == k_board_shader_entity ){
shader_model_entity_use();
shader_model_entity_uCamera( cam->transform[3] );
shader_model_entity_uPv( cam->mtx.pv );
- world_link_lighting_ub( world, _shader_model_entity.id );
- world_bind_position_texture( world, _shader_model_entity.id,
- _uniform_model_entity_g_world_depth, 2 );
- world_bind_light_array( world, _shader_model_entity.id,
- _uniform_model_entity_uLightsArray, 3 );
- world_bind_light_index( world, _shader_model_entity.id,
- _uniform_model_entity_uLightsIndex, 4 );
+ WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, model_entity );
}
mesh_bind( &board->mdl.mesh );
shader_model_character_view_uCamera( cam->transform[3] );
shader_model_character_view_uPv( cam->mtx.pv );
+ shader_model_character_view_uDepthCompare( depth_compare );
if( depth_compare ){
- shader_model_character_view_uTexSceneDepth( 1 );
- render_fb_bind_texture( gpipeline.fb_main, 2, 1 );
- v3f inverse;
- render_fb_inverse_ratio( gpipeline.fb_main, inverse );
- inverse[2] = skaterift.cam.farz-skaterift.cam.nearz;
-
- shader_model_character_view_uInverseRatioDepth( inverse );
- render_fb_inverse_ratio( NULL, inverse );
- inverse[2] = cam->farz-cam->nearz;
- shader_model_character_view_uInverseRatioMain( inverse );
+ depth_compare_bind(
+ shader_model_character_view_uTexSceneDepth,
+ shader_model_character_view_uInverseRatioDepth,
+ shader_model_character_view_uInverseRatioMain,
+ cam );
}
- shader_model_character_view_uDepthCompare( depth_compare );
- 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 );
- world_bind_light_array( world, _shader_model_character_view.id,
- _uniform_model_character_view_uLightsArray, 3 );
- world_bind_light_index( world, _shader_model_character_view.id,
- _uniform_model_character_view_uLightsIndex, 4 );
+ WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, model_character_view );
glUniformMatrix4x3fv( _uniform_model_character_view_uTransforms,
skeleton->bone_count,
0,
- (f32 *)final_mtx );
+ (const GLfloat *)final_mtx );
mesh_bind( &model->mdl.mesh );
mesh_draw( &model->mdl.mesh );