You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
remap scale with fov and avoid copy when world scale is 1
This commit is contained in:
@@ -576,8 +576,11 @@ void geo_process_perspective(struct GraphNodePerspective *node) {
|
|||||||
#ifdef VERTICAL_CULLING
|
#ifdef VERTICAL_CULLING
|
||||||
node->halfFovVertical = tans(vHalfFov);
|
node->halfFovVertical = tans(vHalfFov);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
guPerspective(mtx, &perspNorm, node->fov, sAspectRatio, node->near / WORLD_SCALE, node->far / WORLD_SCALE, 1.0f);
|
// With low fovs, coordinate overflow can occur more easily. This slightly reduces precision only while zoomed in.
|
||||||
|
f32 scale = node->fov < 28.0f ? remap(MAX(node->fov, 15), 15, 28, 0.5f, 1.0f): 1.0f;
|
||||||
|
guPerspective(mtx, &perspNorm, node->fov, sAspectRatio, node->near / WORLD_SCALE, node->far / WORLD_SCALE, scale);
|
||||||
|
|
||||||
gSPPerspNormalize(gDisplayListHead++, perspNorm);
|
gSPPerspNormalize(gDisplayListHead++, perspNorm);
|
||||||
|
|
||||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(mtx), G_MTX_PROJECTION | G_MTX_LOAD | G_MTX_NOPUSH);
|
||||||
@@ -697,6 +700,7 @@ void geo_process_camera(struct GraphNodeCamera *node) {
|
|||||||
gCurLookAt->l[1].l.dir[2] = (s8)(127.0f * -(*cameraMatrix)[2][1]);
|
gCurLookAt->l[1].l.dir[2] = (s8)(127.0f * -(*cameraMatrix)[2][1]);
|
||||||
#endif // F3DEX_GBI_2
|
#endif // F3DEX_GBI_2
|
||||||
|
|
||||||
|
#if WORLD_SCALE > 1
|
||||||
// Make a copy of the view matrix and scale its translation based on WORLD_SCALE
|
// Make a copy of the view matrix and scale its translation based on WORLD_SCALE
|
||||||
Mat4 scaledCamera;
|
Mat4 scaledCamera;
|
||||||
mtxf_copy(scaledCamera, gCameraTransform);
|
mtxf_copy(scaledCamera, gCameraTransform);
|
||||||
@@ -706,6 +710,9 @@ void geo_process_camera(struct GraphNodeCamera *node) {
|
|||||||
|
|
||||||
// Convert the scaled matrix to fixed-point and integrate it into the projection matrix stack
|
// Convert the scaled matrix to fixed-point and integrate it into the projection matrix stack
|
||||||
guMtxF2L(scaledCamera, viewMtx);
|
guMtxF2L(scaledCamera, viewMtx);
|
||||||
|
#else
|
||||||
|
guMtxF2L(gCameraTransform, viewMtx);
|
||||||
|
#endif
|
||||||
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(viewMtx), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
|
gSPMatrix(gDisplayListHead++, VIRTUAL_TO_PHYSICAL(viewMtx), G_MTX_PROJECTION | G_MTX_MUL | G_MTX_NOPUSH);
|
||||||
setup_global_light();
|
setup_global_light();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user