FIRE-32023 Show DoF focal point

Draw a small crosshair at the focal point. Red when focus is locked.
master
Beq 2025-02-20 00:07:38 +00:00
parent cfa3e4b07c
commit b8ee9be3fc
5 changed files with 100 additions and 16 deletions

View File

@ -11572,6 +11572,17 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSFocusPointRender</key>
<map>
<key>Comment</key>
<string>Draw a small crosshair where the DoF focus is</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>CameraDoFResScale</key>
<map>

View File

@ -354,6 +354,9 @@ bool LLPipeline::sReflectionProbesEnabled = false;
S32 LLPipeline::sVisibleLightCount = 0;
bool LLPipeline::sRenderingHUDs;
F32 LLPipeline::sDistortionWaterClipPlaneMargin = 1.0125f;
LLVector3 LLPipeline::sLastFocusPoint={};// <FS:Beq/> FIRE-16728 focus point lock & free focus DoF
bool LLPipeline::sDoFEnabled = false;
F32 LLPipeline::sVolumeSAFrame = 0.f; // ZK LBG
bool LLPipeline::sRenderParticles; // <FS:LO> flag to hold correct, user selected, status of particles
@ -4445,6 +4448,48 @@ void LLPipeline::recordTrianglesDrawn()
add(LLStatViewer::TRIANGLES_DRAWN, LLUnits::Triangles::fromValue(count));
}
// <FS:Beq> FIRE-32023 Focus Point Rendering
void LLPipeline::renderFocusPoint()
{
static LLCachedControl<bool> render_focus_point_crosshair(gSavedSettings, "FSFocusPointRender", false);
if ( sDoFEnabled && render_focus_point_crosshair && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{
gDebugProgram.bind();
LLVector3 focus_point = sLastFocusPoint;
F32 size = 0.02f;
LLGLDepthTest gls_depth(GL_FALSE);
gGL.pushMatrix();
gGL.translatef(focus_point.mV[VX], focus_point.mV[VY], focus_point.mV[VZ]);
gGL.begin(LLRender::LINES);
if (LLPipeline::FSFocusPointLocked)
{
gGL.color4f(1.0f, 0.0f, 0.0f, 0.5f);
}
else
{
gGL.color4f(1.0f, 1.0f, 0.0f, 0.5f);
}
gGL.vertex3f(-size, 0.0f, 0.0f);
gGL.vertex3f(size, 0.0f, 0.0f);
// Y-axis (Green)
gGL.vertex3f(0.0f, -size, 0.0f);
gGL.vertex3f(0.0f, size, 0.0f);
// Z-axis (Blue)
gGL.vertex3f(0.0f, 0.0f, -size);
gGL.vertex3f(0.0f, 0.0f, size);
gGL.end();
gGL.popMatrix();
gGL.flush();
gDebugProgram.unbind();
}
}
// </FS:Beq>
void LLPipeline::renderPhysicsDisplay()
{
if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
@ -8070,14 +8115,14 @@ bool LLPipeline::renderSnapshotFrame(LLRenderTarget* src, LLRenderTarget* dst)
void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
{
{
bool dof_enabled =
sDoFEnabled = // <FS:Beq/> // FIRE-32023 Render focus point
(RenderDepthOfFieldInEditMode || !LLToolMgr::getInstance()->inBuildMode()) &&
RenderDepthOfField &&
!gCubeSnapshot;
gViewerWindow->setup3DViewport();
if (dof_enabled)
if (sDoFEnabled) // <FS:Beq/> // FIRE-32023 Render focus point
{
LL_PROFILE_GPU_ZONE("dof");
LLGLDisable blend(GL_BLEND);
@ -8090,10 +8135,10 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
LLVector3 focus_point;
// <FS:Beq> FIRE-16728 focus point lock & free focus DoF - based on a feature developed by NiranV Dean
static LLVector3 last_focus_point{};
if (LLPipeline::FSFocusPointLocked && !last_focus_point.isExactlyZero())
if (LLPipeline::FSFocusPointLocked && !sLastFocusPoint.isExactlyZero())
{
focus_point = last_focus_point;
focus_point = sLastFocusPoint;
}
else
{
@ -8140,7 +8185,7 @@ void LLPipeline::renderDoF(LLRenderTarget* src, LLRenderTarget* dst)
}
// <FS:Beq> FIRE-16728 Add free aim mouse and focus lock
last_focus_point = focus_point;
sLastFocusPoint = focus_point;
// </FS:Beq>
LLVector3 eye = LLViewerCamera::getInstance()->getOrigin();
F32 target_distance = 16.f;
@ -8438,6 +8483,8 @@ void LLPipeline::renderFinalize()
gDeferredPostNoDoFNoiseProgram.unbind();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
renderFocusPoint(); // <FS:Beq/> FIRE-32023 render focus point
if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
{

View File

@ -291,6 +291,7 @@ public:
void renderGLTFObjects(U32 type, bool texture = true, bool rigged = false);
void renderAlphaObjects(bool rigged = false);
void renderFocusPoint(); // <FS:Beq/> FIRE-32023 Add focus point rendering
void renderMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
void renderFullbrightMaskedObjects(U32 type, bool texture = true, bool batch_texture = false, bool rigged = false);
@ -694,7 +695,8 @@ public:
// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0)
static bool sRenderTextures;
// [/SL:KB]
static LLVector3 sLastFocusPoint;// <FS:Beq/> FIRE-16728 focus point lock & free focus DoF
static bool sDoFEnabled;// <FS:Beq/> FIRE-32023 focus point render
static LLTrace::EventStatHandle<S64> sStatBatchSize;
class RenderTargetPack

View File

@ -1860,15 +1860,28 @@
top_pad="5"
width="280"/>
<check_box
control_name="FSFocusPointFollowsPointer"
enabled_control="RenderDepthOfField"
height="16"
label="Depth of Field focus follows pointer"
layout="topleft"
name="FSFocusPointFollowsPointer"
tool_tip="Allows the DoF focus point to follow your mouse cursor, similar to flycam behavior. Useful when combined with DoF focus lock for dynamic focus adjustments."
top_pad="0"
width="256"/>
control_name="FSFocusPointFollowsPointer"
enabled_control="RenderDepthOfField"
height="16"
label="Depth of Field focus follows pointer"
layout="topleft"
name="FSFocusPointFollowsPointer"
tool_tip="Allows the DoF focus point to follow your mouse cursor, similar to flycam behavior. Useful when combined with DoF focus lock for dynamic focus adjustments."
top_pad="0"
width="256"/>
<button
follows="left|top"
height="19"
is_toggle="true"
control_name="FSFocusPointRender"
image_overlay="Profile_Group_Visibility_On"
image_unselected="Profile_Group_Visibility_Off"
layout="topleft"
top_pad="-19"
right="-5"
name="FocusPointRenderToggle"
tool_tip="Toggle the focus point crosshair display. The crosshair is yellow when free and red when locked."
width="19"/>
<check_box
follows="top|left"
layout="topleft"

View File

@ -1574,6 +1574,17 @@
<menu_item_check.on_click
function="ToggleControl"
parameter="FSFocusPointLocked" />
</menu_item_check>
<menu_item_check
label="Draw DoF Focus crosshair"
layout="topleft"
name="render_focus_point">
<menu_item_check.on_check
function="CheckControl"
parameter="FSFocusPointRender" />
<menu_item_check.on_click
function="ToggleControl"
parameter="FSFocusPointRender" />
</menu_item_check>
</menu>
<menu_item_call