Added invers aspect ratio

Added inverse aspect ratio for use with face virtual textures.
master
minerjr 2025-03-05 09:04:16 -04:00 committed by Beq
parent 87eb902f7a
commit 27ec21aa7e
2 changed files with 18 additions and 0 deletions

View File

@ -35,6 +35,9 @@ LLCamera::LLCamera() :
LLCoordFrame(),
mView(DEFAULT_FIELD_OF_VIEW),
mAspect(DEFAULT_ASPECT_RATIO),
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
mInverseAspect(1.0f / DEFAULT_ASPECT_RATIO),
// </FS:minerjr> [FIRE-35081]
mViewHeightInPixels( -1 ), // invalid height
mNearPlane(DEFAULT_NEAR_PLANE),
mFarPlane(DEFAULT_FAR_PLANE),
@ -63,6 +66,10 @@ LLCamera::LLCamera(F32 vertical_fov_rads, F32 aspect_ratio, S32 view_height_in_p
}
mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the inverse of the aspect ratio, so we can remove it from texture calculations
mInverseAspect = 1.0f / mAspect;
// </FS:minerjr> [FIRE-35081]
mNearPlane = llclamp(near_plane, MIN_NEAR_PLANE, MAX_NEAR_PLANE);
if(far_plane < 0) far_plane = DEFAULT_FAR_PLANE;
mFarPlane = llclamp(far_plane, MIN_FAR_PLANE, MAX_FAR_PLANE);
@ -129,6 +136,10 @@ void LLCamera::setViewHeightInPixels(S32 height)
void LLCamera::setAspect(F32 aspect_ratio)
{
mAspect = llclamp(aspect_ratio, MIN_ASPECT_RATIO, MAX_ASPECT_RATIO);
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the inverse of the aspect ratio, so we can remove it from texture calculations
mInverseAspect = 1.0f / mAspect;
// </FS:minerjr> [FIRE-35081]
calculateFrustumPlanes();
}

View File

@ -127,6 +127,10 @@ private:
F32 mView; // angle between top and bottom frustum planes in radians.
F32 mAspect; // width/height
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
// Store the inverse of the aspect ratio, for the texture's sizes
F32 mInverseAspect; // height/width
// </FS:minerjr> [FIRE-35081]
S32 mViewHeightInPixels; // for ViewHeightInPixels() only
F32 mNearPlane;
F32 mFarPlane;
@ -161,6 +165,9 @@ public:
F32 getView() const { return mView; } // vertical FOV in radians
S32 getViewHeightInPixels() const { return mViewHeightInPixels; }
F32 getAspect() const { return mAspect; } // width / height
// <FS:minerjr> [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer
F32 getInverseAspect() const { return mInverseAspect; } // width / height
// </FS:minerjr> [FIRE-35081]
F32 getNear() const { return mNearPlane; } // meters
F32 getFar() const { return mFarPlane; } // meters