mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-28 06:57:02 -04:00
Frame interp: Revised camera system
FOV is now smooth, and the individual hacks for stars and Epona's reins are removed
This commit is contained in:
@@ -4110,54 +4110,20 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
color_reg0.b = 0xFF;
|
||||
color_reg0.a = 0xFF;
|
||||
|
||||
#if TARGET_PC
|
||||
Mtx star_gx_view;
|
||||
cXyz anchor_eye;
|
||||
f32 star_fovy = 45.0f;
|
||||
MtxP gx_load_view = drawMtx;
|
||||
bool star_use_present_view = false;
|
||||
|
||||
if (dusk::getSettings().game.enableFrameInterpolation) {
|
||||
star_use_present_view = dusk::frame_interp::build_star_view(star_gx_view, camMtx, &anchor_eye, &star_fovy);
|
||||
}
|
||||
|
||||
if (star_use_present_view) {
|
||||
gx_load_view = star_gx_view;
|
||||
} else {
|
||||
if (dComIfGd_getView() != NULL) {
|
||||
MTXInverse(dComIfGd_getView()->viewMtxNoTrans, camMtx);
|
||||
anchor_eye = camera->view.lookat.eye;
|
||||
star_fovy = dComIfGd_getView()->fovy;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (dComIfGd_getView() != NULL) {
|
||||
MTXInverse(dComIfGd_getView()->viewMtxNoTrans, camMtx);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (strcmp(dComIfGp_getStartStageName(), "F_SP200") == 0 && dComIfG_play_c::getLayerNo(0) == 0) {
|
||||
moon_pos = envlight->moon_pos;
|
||||
} else {
|
||||
#if TARGET_PC
|
||||
moon_pos = anchor_eye + envlight->moon_pos;
|
||||
#else
|
||||
moon_pos = camera->view.lookat.eye + envlight->moon_pos;
|
||||
#endif
|
||||
if (sp38) {
|
||||
#if TARGET_PC
|
||||
moon_pos.x = 3900.0f + anchor_eye.x;
|
||||
moon_pos.y = 8052.0f + anchor_eye.y;
|
||||
moon_pos.z = -9072.0f + anchor_eye.z;
|
||||
#else
|
||||
moon_pos.x = 3900.0f + camera->view.lookat.eye.x;
|
||||
moon_pos.y = 8052.0f + camera->view.lookat.eye.y;
|
||||
moon_pos.z = -9072.0f + camera->view.lookat.eye.z;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4193,11 +4159,7 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
MTXRotRad(rotMtx, 'Z', DEG_TO_RAD(rot));
|
||||
MTXConcat(camMtx, rotMtx, camMtx);
|
||||
|
||||
#if TARGET_PC
|
||||
GXLoadPosMtxImm(gx_load_view, GX_PNMTX0);
|
||||
#else
|
||||
GXLoadPosMtxImm(drawMtx, GX_PNMTX0);
|
||||
#endif
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
|
||||
rot += 0.65f;
|
||||
@@ -4205,23 +4167,12 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
rot = 0.0f;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
spBC = anchor_eye;
|
||||
#else
|
||||
spBC.x = camera->view.lookat.eye.x;
|
||||
spBC.y = camera->view.lookat.eye.y;
|
||||
spBC.z = camera->view.lookat.eye.z;
|
||||
#endif
|
||||
|
||||
f32 sp34 = -1.0f;
|
||||
int sp30 = 0;
|
||||
#if TARGET_PC
|
||||
f32 var_f30 = star_fovy / 45.0f;
|
||||
if (var_f30 >= 1.0f) {
|
||||
var_f30 = 1.0f;
|
||||
}
|
||||
var_f30 = 1.0f - var_f30;
|
||||
#else
|
||||
f32 var_f30 = 0.0f;
|
||||
|
||||
if (dComIfGd_getView() != NULL) {
|
||||
@@ -4231,7 +4182,6 @@ void dKyr_drawStar(Mtx drawMtx, u8** tex) {
|
||||
}
|
||||
var_f30 = 1.0f - var_f30;
|
||||
}
|
||||
#endif
|
||||
f32 temp_f27 = 0.28f * (1.0f - var_f30);
|
||||
|
||||
sp98.x = 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user