You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
Important Culling Fixes (#666)
* Culling fix Precison of half fov horizontal being equal to or above 2 leads to many issues. using 1.5 would break rt64 and other emulators with ultra widescreen. Vertical culling will be disabled by default until 3.0 * Improved emu checks and naming * Comment changes * Small typo fix
This commit is contained in:
@@ -567,27 +567,15 @@ void geo_process_perspective(struct GraphNodePerspective *node) {
|
||||
sAspectRatio = 4.0f / 3.0f; // 1.33333f
|
||||
#endif
|
||||
|
||||
// The reason this is not divided as an integer is to prevent an integer division.
|
||||
f32 vHalfFov = ( (f32) ((node->fov * 4096) + 8192) ) / 45.f;
|
||||
f32 vHalfFov = ( ((node->fov * 4096.f) + 8192.f) ) / 45.f;
|
||||
|
||||
// We need to account for aspect ratio changes by multiplying by the widescreen horizontal stretch
|
||||
// (normally 1.775).
|
||||
f32 hHalfFov = vHalfFov * sAspectRatio;
|
||||
|
||||
node->halfFovHorizontal = tans(hHalfFov);
|
||||
node->halfFovHorizontal = tans(vHalfFov * sAspectRatio);
|
||||
|
||||
#ifdef VERTICAL_CULLING
|
||||
node->halfFovVertical = tans(vHalfFov);
|
||||
#endif
|
||||
|
||||
#ifndef HORIZONTAL_CULLING_ON_EMULATOR
|
||||
// If an emulator is detected, use a large value for the half fov
|
||||
// horizontal value to account for viewport widescreen hacks.
|
||||
|
||||
if(!(gEmulator & EMU_CONSOLE)){
|
||||
node->halfFovHorizontal = 9999.0f;
|
||||
}
|
||||
#endif
|
||||
|
||||
guPerspective(mtx, &perspNorm, node->fov, sAspectRatio, node->near / WORLD_SCALE, node->far / WORLD_SCALE, 1.0f);
|
||||
gSPPerspNormalize(gDisplayListHead++, perspNorm);
|
||||
@@ -1065,6 +1053,9 @@ void geo_process_shadow(struct GraphNodeShadow *node) {
|
||||
*
|
||||
* Since (0,0,0) is unaffected by rotation, columns 0, 1 and 2 are ignored.
|
||||
*/
|
||||
|
||||
#define NO_CULLING_EMULATOR_BLACKLIST (EMU_CONSOLE | EMU_WIIVC | EMU_ARES | EMU_SIMPLE64 | EMU_CEN64)
|
||||
|
||||
s32 obj_is_in_view(struct GraphNodeObject *node) {
|
||||
struct GraphNode *geo = node->sharedChild;
|
||||
|
||||
@@ -1089,6 +1080,13 @@ s32 obj_is_in_view(struct GraphNodeObject *node) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef CULLING_ON_EMULATOR
|
||||
// If an emulator is detected, skip any other culling.
|
||||
if(!(gEmulator & NO_CULLING_EMULATOR_BLACKLIST)){
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef VERTICAL_CULLING
|
||||
f32 vScreenEdge = -cameraToObjectDepth * gCurGraphNodeCamFrustum->halfFovVertical;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user