From 27ec21aa7eb198b1fdeb5e3e01711da3fdf41e15 Mon Sep 17 00:00:00 2001 From: minerjr Date: Wed, 5 Mar 2025 09:04:16 -0400 Subject: [PATCH] Added invers aspect ratio Added inverse aspect ratio for use with face virtual textures. --- indra/llmath/llcamera.cpp | 11 +++++++++++ indra/llmath/llcamera.h | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/indra/llmath/llcamera.cpp b/indra/llmath/llcamera.cpp index 3daed2ac31..988d600486 100644 --- a/indra/llmath/llcamera.cpp +++ b/indra/llmath/llcamera.cpp @@ -35,6 +35,9 @@ LLCamera::LLCamera() : LLCoordFrame(), mView(DEFAULT_FIELD_OF_VIEW), mAspect(DEFAULT_ASPECT_RATIO), + // [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer + mInverseAspect(1.0f / DEFAULT_ASPECT_RATIO), + // [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); + // [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; + // [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); + // [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; + // [FIRE-35081] calculateFrustumPlanes(); } diff --git a/indra/llmath/llcamera.h b/indra/llmath/llcamera.h index b6e0e4a2be..8155573263 100644 --- a/indra/llmath/llcamera.h +++ b/indra/llmath/llcamera.h @@ -127,6 +127,10 @@ private: F32 mView; // angle between top and bottom frustum planes in radians. F32 mAspect; // width/height + // [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 + // [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 + // [FIRE-35081] Blurry prims not changing with graphics settings, not happening with SL Viewer + F32 getInverseAspect() const { return mInverseAspect; } // width / height + // [FIRE-35081] F32 getNear() const { return mNearPlane; } // meters F32 getFar() const { return mFarPlane; } // meters