Replace camera far Z with fake infinite one

This commit is contained in:
JackCarterSmith 2024-12-29 20:36:01 +01:00
parent 5b5c04e368
commit 4521ce27d5
Signed by: JackCarterSmith
GPG Key ID: 832E52F4E23F8F24
3 changed files with 2 additions and 5 deletions

View File

@ -283,8 +283,8 @@ float Graphic3DRenderer::ComputeSGRatio() {
// The triangle made by the ground plane intersection with the frustum. This intersection
// cross the far plane at some point. Instead of computing the coordinate of the point, we
// directly use the far plane length to get the corresponding ratio for the screen.
sgRatio = -(altitude * fovCos - mMainCamera->GetFarZ() * fovThetaSin)
/ (2.f * mMainCamera->GetFarZ() * fovSin * thetaCos);
sgRatio = -(altitude * fovCos - 1000.f * fovThetaSin)
/ (2.f * 1000.f * fovSin * thetaCos);
}
// Clamp

View File

@ -8,7 +8,6 @@ Camera::Camera() {
void Camera::SetFrustrum(float fov, float r, float zn, float zf) {
//if (!frameDirty)
this->fov = fov;
this->zf = zf;
M3D_MATRIX pMat = M3D_TransformMatrixFrustrumFovLH(M3D_Deg2Rad(fov), r, zn, zf);
M3D_V4StoreF4x4(&mProjMat, pMat);
frustrumUpdated = true;

View File

@ -14,7 +14,6 @@ public:
Camera& operator= (Camera const&) = delete;
float GetFoV() const { return fov; }
float GetFarZ() const { return zf; }
const bool IsFrustrumUpdated() const { return frustrumUpdated; }
const bool IsCameraMoved() const { return camMoved; }
M3D_VECTOR GetPos() const { return M3D_V4LoadF3(&mPos); }
@ -45,7 +44,6 @@ public:
private:
float fov; // It's the Y-FoV!
float zf;
bool frustrumUpdated = true;
bool camMoved = true;