From 27ff727949b2398658b7fb825291c4c43b2bb50f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 11 Jul 2022 20:45:14 +0200 Subject: [PATCH] Use Vector3D for capsule and hemisphere radius. --- r5dev/engine/debugoverlay.cpp | 2 +- r5dev/tier2/renderutils.cpp | 18 +++++++++--------- r5dev/tier2/renderutils.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/r5dev/engine/debugoverlay.cpp b/r5dev/engine/debugoverlay.cpp index 719a280c..84fc611f 100644 --- a/r5dev/engine/debugoverlay.cpp +++ b/r5dev/engine/debugoverlay.cpp @@ -219,7 +219,7 @@ void DrawOverlay(OverlayBase_t* pOverlay) VectorAngles(pCapsule->end, pCapsule->start, angles); AngleInverse(angles, angles); - DebugDrawCapsule(pCapsule->start, angles, 100, pCapsule->start.DistTo(pCapsule->end), Color(pCapsule->r, pCapsule->g, pCapsule->b, pCapsule->a), true); + DebugDrawCapsule(pCapsule->start, angles, pCapsule->radius, pCapsule->start.DistTo(pCapsule->end), Color(pCapsule->r, pCapsule->g, pCapsule->b, pCapsule->a), true); break; } case OverlayType_t::OVERLAY_UNK0: diff --git a/r5dev/tier2/renderutils.cpp b/r5dev/tier2/renderutils.cpp index 65709f04..67d25c39 100644 --- a/r5dev/tier2/renderutils.cpp +++ b/r5dev/tier2/renderutils.cpp @@ -109,7 +109,7 @@ void DebugDrawCylinder(const Vector3D& vOrigin, const QAngle& vAngles, float flR // |----|----| // "-..|..-" --> +x //----------------------------------------------------------------------------- -void DebugDrawCapsule(const Vector3D& vStart, const QAngle& vAngles, float flRadius, float flHeight, Color color, bool bZBuffer) +void DebugDrawCapsule(const Vector3D& vStart, const QAngle& vAngles, const Vector3D& vRadius, float flHeight, Color color, bool bZBuffer) { int nSides = 4; float flDegrees = 360.0 / float(nSides); @@ -124,7 +124,7 @@ void DebugDrawCapsule(const Vector3D& vStart, const QAngle& vAngles, float flRad { AngleCompose(vAngles, { 0, flDegrees * i, 0 }, vComposed); AngleVectors(vComposed, &vForward); - vvPoints.push_back(vStart + (vForward * flRadius)); + vvPoints.push_back(vStart + (vForward * vRadius)); } for (int i = 0; i < nSides; i++) @@ -135,8 +135,8 @@ void DebugDrawCapsule(const Vector3D& vStart, const QAngle& vAngles, float flRad AngleCompose(vAngles, { 180, 180, 0 }, vHemi); - DebugDrawHemiSphere(vStart + (vUp * flHeight), vAngles, flRadius, color, 16, bZBuffer); - DebugDrawHemiSphere(vStart, vHemi, flRadius, color, 16, bZBuffer); + DebugDrawHemiSphere(vStart + (vUp * flHeight), vAngles, vRadius, color, 16, bZBuffer); + DebugDrawHemiSphere(vStart, vHemi, vRadius, color, 16, bZBuffer); } //----------------------------------------------------------------------------- @@ -171,7 +171,7 @@ void DebugDrawSphere(const Vector3D& vOrigin, float flRadius, Color color, int n // / | \ /--> +r // | <----( )---->-|/ --> +x //----------------------------------------------------------------------------- -void DebugDrawHemiSphere(const Vector3D& vOrigin, const QAngle& vAngles, float flRadius, Color color, int nSegments, bool bZBuffer) +void DebugDrawHemiSphere(const Vector3D& vOrigin, const QAngle& vAngles, const Vector3D& vRadius, Color color, int nSegments, bool bZBuffer) { bool bFirstLoop = true; @@ -194,10 +194,10 @@ void DebugDrawHemiSphere(const Vector3D& vOrigin, const QAngle& vAngles, float f AngleVectors(vComposed[2], &vForward[2]); AngleVectors(vComposed[3], &vForward[3]); - vEnd[0] = vOrigin + (vForward[0] * flRadius); - vEnd[1] = vOrigin + (vForward[1] * flRadius); - vEnd[2] = vOrigin + (vForward[2] * flRadius); - vEnd[3] = vOrigin + (vForward[3] * flRadius); + vEnd[0] = vOrigin + (vForward[0] * vRadius); + vEnd[1] = vOrigin + (vForward[1] * vRadius); + vEnd[2] = vOrigin + (vForward[2] * vRadius); + vEnd[3] = vOrigin + (vForward[3] * vRadius); if (!bFirstLoop) { diff --git a/r5dev/tier2/renderutils.h b/r5dev/tier2/renderutils.h index 43dc6b18..d80841b5 100644 --- a/r5dev/tier2/renderutils.h +++ b/r5dev/tier2/renderutils.h @@ -4,9 +4,9 @@ void DebugDrawBox(const Vector3D& vOrigin, const QAngle& vAngles, const Vector3D& vMins, const Vector3D& vMaxs, Color color, bool bZBuffer); void DebugDrawCylinder(const Vector3D& vOrigin, const QAngle& vAngles, float flRadius, float flHeight, Color color, int nSides = 16, bool bZBuffer = false); -void DebugDrawCapsule(const Vector3D& vStart, const QAngle& vAngles, float flRadius, float flHeight, Color color, bool bZBuffer = false); +void DebugDrawCapsule(const Vector3D& vStart, const QAngle& vAngles, const Vector3D& vRadius, float flHeight, Color color, bool bZBuffer = false); void DebugDrawSphere(const Vector3D& vOrigin, float flRadius, Color color, int nSegments = 16, bool bZBuffer = false); -void DebugDrawHemiSphere(const Vector3D& vOrigin, const QAngle& vAngles, float flRadius, Color color, int nSegments = 16, bool bZBuffer = false); +void DebugDrawHemiSphere(const Vector3D& vOrigin, const QAngle& vAngles, const Vector3D& vRadius, Color color, int nSegments = 16, bool bZBuffer = false); void DebugDrawCircle(const Vector3D& vOrigin, const QAngle& vAngles, float flRadius, Color color, int nSegments = 16, bool bZBuffer = false); void DebugDrawSquare(const Vector3D& vOrigin, const QAngle& vAngles, float flSquareSize, Color color, bool bZBuffer = false); void DebugDrawTriangle(const Vector3D& vOrigin, const QAngle& vAngles, float flTriangleSize, Color color, bool bZBuffer = false);