Fixing formatting, calls to glLineWidth with invalid line width and chuck in some improvements

master
Ansariel 2025-10-13 23:43:19 +02:00
parent 137cd754e9
commit 259c453f6d
3 changed files with 221 additions and 221 deletions

View File

@ -603,7 +603,7 @@ void FSManipRotateJoint::renderCenterCircle(const F32 radius, const LLColor4& no
LLGLDepthTest gls_depth(GL_FALSE); LLGLDepthTest gls_depth(GL_FALSE);
constexpr int segments = 64; constexpr int segments = 64;
glLineWidth(6.0f); // Set the desired line thickness gGL.setLineWidth(6.0f); // Set the desired line thickness
// Compute a scale factor that already factors in the radius. // Compute a scale factor that already factors in the radius.
float scale = radius; float scale = radius;
@ -637,7 +637,7 @@ void FSManipRotateJoint::renderCenterCircle(const F32 radius, const LLColor4& no
} }
gGL.end(); gGL.end();
glLineWidth(1.0f); // Reset the line width. gGL.setLineWidth(1.0f); // Reset the line width.
} }
gGL.popMatrix(); gGL.popMatrix();
} }

View File

@ -825,7 +825,7 @@ void LLViewerParcelOverlay::renderPropertyLinesOnMinimap(F32 scale_pixels_per_me
const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge; const S32 GRIDS_PER_EDGE = mParcelGridsPerEdge;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glLineWidth(1.0f); gGL.setLineWidth(1.0f);
gGL.color4fv(parcel_outline_color); gGL.color4fv(parcel_outline_color);
for (S32 i = 0; i <= GRIDS_PER_EDGE; i++) for (S32 i = 0; i <= GRIDS_PER_EDGE; i++)
{ {

View File

@ -4614,7 +4614,7 @@ void LLPipeline::renderSnapshotGuidesOverlay()
gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.pushMatrix(); gGL.pushMatrix();
gGL.loadIdentity(); gGL.loadIdentity();
gGLLastMatrix = NULL; gGLLastMatrix = nullptr;
const LLColor4 line_color(mSnapshotGuideState.color, alpha); const LLColor4 line_color(mSnapshotGuideState.color, alpha);
gGL.color4fv(line_color.mV); gGL.color4fv(line_color.mV);
@ -4646,7 +4646,7 @@ void LLPipeline::renderSnapshotGuidesOverlay()
{ {
case SnapshotGuideState::Style::RuleOfThirds: case SnapshotGuideState::Style::RuleOfThirds:
{ {
const F32 offsets[] = { 1.f / 3.f, 2.f / 3.f }; constexpr std::array<F32, 2> offsets = { 1.f / 3.f, 2.f / 3.f };
for (F32 offset : offsets) for (F32 offset : offsets)
{ {
draw_vertical_norm(offset); draw_vertical_norm(offset);
@ -4738,25 +4738,24 @@ void LLPipeline::renderSnapshotGuidesOverlay()
break; break;
} }
if (step % 4 == 0) switch (step % 4)
{ {
case 0:
x0 += height; x0 += height;
add_line(x0, y0, x0, y1); add_line(x0, y0, x0, y1);
} break;
else if (step % 4 == 1) case 1:
{
y0 += width; y0 += width;
add_line(x0, y0, x1, y0); add_line(x0, y0, x1, y0);
} break;
else if (step % 4 == 2) case 2:
{
x1 -= height; x1 -= height;
add_line(x1, y0, x1, y1); add_line(x1, y0, x1, y1);
} break;
else default:
{
y1 -= width; y1 -= width;
add_line(x0, y1, x1, y1); add_line(x0, y1, x1, y1);
break;
} }
} }
@ -4842,22 +4841,22 @@ void LLPipeline::renderSnapshotGuidesOverlay()
gGL.flush(); gGL.flush();
const F32 line_width = llmax(thickness, 1.f); const F32 line_width = llmax(thickness, 1.f);
glLineWidth(line_width); gGL.setLineWidth(line_width);
draw_golden_spiral(12); draw_golden_spiral(12);
glLineWidth(1.f); gGL.setLineWidth(1.f);
if (!line_segments.empty()) if (!line_segments.empty())
{ {
gGL.flush(); gGL.flush();
glLineWidth(line_width); gGL.setLineWidth(line_width);
gGL.begin(LLRender::LINES); gGL.begin(LLRender::LINES);
for (const auto& segment : line_segments) for (const auto& segment : line_segments)
{ {
gGL.vertex2f(segment.first.mV[0], segment.first.mV[1]); gGL.vertex2f(segment.first.mV[VX], segment.first.mV[VY]);
gGL.vertex2f(segment.second.mV[0], segment.second.mV[1]); gGL.vertex2f(segment.second.mV[VX], segment.second.mV[VY]);
} }
gGL.end(); gGL.end();
glLineWidth(1.f); gGL.setLineWidth(1.f);
} }
break; break;
} }
@ -4865,14 +4864,14 @@ void LLPipeline::renderSnapshotGuidesOverlay()
{ {
const F32 line_width = llmax(thickness, 1.f); const F32 line_width = llmax(thickness, 1.f);
gGL.flush(); gGL.flush();
glLineWidth(line_width); gGL.setLineWidth(line_width);
gGL.begin(LLRender::LINES); gGL.begin(LLRender::LINES);
gGL.vertex2f(left_px, bottom_px); gGL.vertex2f(left_px, bottom_px);
gGL.vertex2f(right_px, top_px); gGL.vertex2f(right_px, top_px);
gGL.vertex2f(left_px, top_px); gGL.vertex2f(left_px, top_px);
gGL.vertex2f(right_px, bottom_px); gGL.vertex2f(right_px, bottom_px);
gGL.end(); gGL.end();
glLineWidth(1.f); gGL.setLineWidth(1.f);
break; break;
} }
} }
@ -4881,17 +4880,17 @@ void LLPipeline::renderSnapshotGuidesOverlay()
gGL.popMatrix(); gGL.popMatrix();
gGL.matrixMode(LLRender::MM_PROJECTION); gGL.matrixMode(LLRender::MM_PROJECTION);
gGL.popMatrix(); gGL.popMatrix();
gGLLastMatrix = NULL; gGLLastMatrix = nullptr;
ui_shader->unbind(); ui_shader->unbind();
mSnapshotGuideState.active = false; mSnapshotGuideState.active = false;
} }
// </FS:Beq> // </FS:Beq>
// <FS:Beq> FIRE-32023 Focus Point Rendering // <FS:Beq> FIRE-32023 Focus Point Rendering
void LLPipeline::renderFocusPoint() void LLPipeline::renderFocusPoint()
{ {
static LLCachedControl<bool> render_focus_point_crosshair(gSavedSettings, "FSFocusPointRender", false); static LLCachedControl<bool> render_focus_point_crosshair(gSavedSettings, "FSFocusPointRender", false);
if (sDoFEnabled && render_focus_point_crosshair && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) if (sDoFEnabled && render_focus_point_crosshair && gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI))
{ {
@ -4930,6 +4929,7 @@ void LLPipeline::renderFocusPoint()
} }
} }
// </FS:Beq> // </FS:Beq>
void LLPipeline::renderPhysicsDisplay() void LLPipeline::renderPhysicsDisplay()
{ {
if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) if (!hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
@ -4942,7 +4942,7 @@ void LLPipeline::renderPhysicsDisplay()
LLGLEnable(GL_POLYGON_OFFSET_LINE); LLGLEnable(GL_POLYGON_OFFSET_LINE);
glPolygonOffset(3.f, 3.f); glPolygonOffset(3.f, 3.f);
glLineWidth(3.f); gGL.setLineWidth(3.f);
LLGLEnable blend(GL_BLEND); LLGLEnable blend(GL_BLEND);
gGL.setSceneBlendType(LLRender::BT_ALPHA); gGL.setSceneBlendType(LLRender::BT_ALPHA);
@ -4984,7 +4984,7 @@ void LLPipeline::renderPhysicsDisplay()
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
} }
} }
glLineWidth(1.f); gGL.setLineWidth(1.f);
gDebugProgram.unbind(); gDebugProgram.unbind();
} }