partially fix jitter with two of the same model

This commit is contained in:
fgsfds 2021-04-05 04:21:14 +03:00
parent 5eba0cb0f6
commit ee71f19e6e
1 changed files with 15 additions and 2 deletions

View File

@ -405,7 +405,8 @@ Gfx* geo_switch_mario_eyes(s32 callContext, struct GraphNode* node, UNUSED Mat4*
Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) { Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
Mat4 * curTransform = mtx; Mat4 * curTransform = mtx;
struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node; struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node;
struct MarioBodyState* bodyState = geo_get_body_state(); u8 plrIdx = geo_get_processing_object_index();
struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
s32 action = bodyState->action; s32 action = bodyState->action;
if (callContext == GEO_CONTEXT_RENDER) { if (callContext == GEO_CONTEXT_RENDER) {
@ -418,6 +419,11 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
rotNode->rotation[0] = bodyState->torsoAngle[1]; rotNode->rotation[0] = bodyState->torsoAngle[1];
rotNode->rotation[1] = bodyState->torsoAngle[2]; rotNode->rotation[1] = bodyState->torsoAngle[2];
rotNode->rotation[2] = bodyState->torsoAngle[0]; rotNode->rotation[2] = bodyState->torsoAngle[0];
if (plrIdx != 0) {
// only interpolate angles for the local player
vec3s_copy(rotNode->prevRotation, rotNode->rotation);
rotNode->prevTimestamp = gGlobalTimer;
}
// update torso position in bodyState // update torso position in bodyState
get_pos_from_transform_mtx(bodyState->torsoPos, *curTransform, *gCurGraphNodeCamera->matrixPtr); get_pos_from_transform_mtx(bodyState->torsoPos, *curTransform, *gCurGraphNodeCamera->matrixPtr);
} }
@ -429,7 +435,8 @@ Gfx* geo_mario_tilt_torso(s32 callContext, struct GraphNode* node, Mat4* mtx) {
*/ */
Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) { Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat4* c) {
struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node; struct GraphNodeGenerated* asGenerated = (struct GraphNodeGenerated*) node;
struct MarioBodyState* bodyState = geo_get_body_state(); u8 plrIdx = geo_get_processing_object_index();
struct MarioBodyState* bodyState = &gBodyStates[plrIdx];
s32 action = bodyState->action; s32 action = bodyState->action;
if (callContext == GEO_CONTEXT_RENDER) { if (callContext == GEO_CONTEXT_RENDER) {
@ -449,6 +456,12 @@ Gfx* geo_mario_head_rotation(s32 callContext, struct GraphNode* node, UNUSED Mat
vec3s_set(bodyState->headAngle, 0, 0, 0); vec3s_set(bodyState->headAngle, 0, 0, 0);
vec3s_set(rotNode->rotation, 0, 0, 0); vec3s_set(rotNode->rotation, 0, 0, 0);
} }
if (plrIdx != 0) {
// only interpolate angles for the local player
vec3s_copy(rotNode->prevRotation, rotNode->rotation);
rotNode->prevTimestamp = gGlobalTimer;
}
} }
return NULL; return NULL;
} }