mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Overlay improvements
* Move render utils to dedicated file. * Implement more render/mesh utils. * Added structure for OverlayTriangle_t, OverlaySweptBox_t and OverlayCapsule_t. OverlayCapsule_t has been modified to accommodate the size in r5 (2 new vectors).
This commit is contained in:
parent
0463647268
commit
d8a45ae563
@ -5,14 +5,16 @@
|
||||
//============================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "common/pseudodefs.h"
|
||||
#include "tier0/tslist.h"
|
||||
#include "tier0/basetypes.h"
|
||||
#include "tier1/cvar.h"
|
||||
#include "common/pseudodefs.h"
|
||||
#include "tier2/renderutils.h"
|
||||
#include "engine/client/clientstate.h"
|
||||
#include "engine/host_cmd.h"
|
||||
#include "engine/debugoverlay.h"
|
||||
#include "materialsystem/cmaterialsystem.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
@ -82,7 +84,8 @@ void DestroyOverlay(OverlayBase_t* pOverlay)
|
||||
LeaveCriticalSection(&*s_OverlayMutex);
|
||||
return;
|
||||
case OverlayType_t::OVERLAY_BOX2:
|
||||
break;
|
||||
pOverlaySize = 88i64;
|
||||
goto LABEL_MALLOC;
|
||||
case OverlayType_t::OVERLAY_CAPSULE:
|
||||
pOverlaySize = 112i64;
|
||||
break;
|
||||
@ -100,71 +103,24 @@ void DestroyOverlay(OverlayBase_t* pOverlay)
|
||||
LeaveCriticalSection(&*s_OverlayMutex);
|
||||
}
|
||||
|
||||
//script_client DrawAngledBox(<0,0,0>, <10,10,10>, <0,0,0>, <1000,1000,1000>, 20, 200, 220, true, 10)
|
||||
|
||||
void DrawBoxTest(OverlayBox_t* pBox) // FIXME: center within box and angles.
|
||||
{
|
||||
|
||||
//Vector3D test = Vector3D(10, 10, 10).ToForward();
|
||||
//printf("<%f, %f, %f>\n", test.x, test.y, test.z);
|
||||
|
||||
//v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z }, { pBox->origin_X, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false); // WIREFRAME
|
||||
|
||||
// Vertical
|
||||
v_RenderLine({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, { pBox->origin_X, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z }, { pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z }, { pBox->origin_X, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z }, { pBox->origin_X + pBox->maxs.x, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
|
||||
// Lower horizontal
|
||||
v_RenderLine({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, { pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, { pBox->origin_X, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z }, { pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z }, { pBox->origin_X, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
|
||||
// Upper horizontal
|
||||
v_RenderLine({ pBox->origin_X, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z + pBox->maxs.z }, { pBox->origin_X, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, { pBox->origin_X, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z + pBox->maxs.z }, { pBox->origin_X + pBox->maxs.x, pBox->origin_Y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
v_RenderLine({ pBox->origin_X + pBox->maxs.x, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z + pBox->maxs.z }, { pBox->origin_X, pBox->origin_Y + pBox->maxs.y, pBox->origin_Z + pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose: draws a generic overlay
|
||||
//------------------------------------------------------------------------------
|
||||
void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
{
|
||||
//void* pRenderContext = nullptr; // ptr to CMatQueuedRenderContext vtable.
|
||||
|
||||
EnterCriticalSection(&*s_OverlayMutex);
|
||||
|
||||
//pRenderContext = (*(void*(__fastcall**)(void*))(**(std::int64_t**)g_pMaterialSystem + MATERIALSYSTEM_VCALL_OFF_0))((void*)g_pMaterialSystem);
|
||||
//(*(void(__fastcall**)(void*, std::int64_t))(*(std::int64_t*)pRenderContext + CMATQUEUEDRENDERCONTEXT_VCALL_OFS_0))((void*)pRenderContext, 0x1);
|
||||
|
||||
switch (pOverlay->m_Type)
|
||||
{
|
||||
case OverlayType_t::OVERLAY_BOX:
|
||||
{
|
||||
//printf("%p\n", pOverlay);
|
||||
|
||||
OverlayBox_t* pBox = static_cast<OverlayBox_t*>(pOverlay); // TODO: debug this since it doesn't work but does compute something..
|
||||
// for testing, since RenderWireframeBox doesn't seem to work properly
|
||||
//v_RenderWireframeBox({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, pBox->maxs, {0,0,0}, Color(pBox->r, pBox->g, pBox->b, 255), false); // <-- currently broken!
|
||||
//v_RenderWireframeSphere({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, pBox->maxs.x, 8, 8, Color(pBox->r, pBox->g, pBox->b, 255), false);
|
||||
//v_RenderLine({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, { pBox->origin_X, pBox->origin_Y, pBox->origin_Z+pBox->maxs.z }, Color(pBox->r, pBox->g, pBox->b, 255), false);
|
||||
|
||||
|
||||
OverlayBox_t* pBox = static_cast<OverlayBox_t*>(pOverlay);
|
||||
if (pBox->a < 1)
|
||||
pBox->a = 255;
|
||||
DrawBoxTest(pBox);
|
||||
|
||||
//if (pBox->a < 255)
|
||||
//{
|
||||
// RenderWireframeBox({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, pBox->angles, pBox->maxs, Color(pBox->r, pBox->g, pBox->b, 255), false);
|
||||
//}
|
||||
//else {
|
||||
// RenderBox({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, pBox->angles, pBox->mins, pBox->maxs, Color(pBox->r, pBox->g, pBox->b, pBox->a), false);
|
||||
//}
|
||||
DrawAngledBox({ pBox->origin_X, pBox->origin_Y, pBox->origin_Z }, { 0,0,0 }, pBox->mins, pBox->maxs, pBox->r, pBox->g, pBox->b, pBox->a, false);
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_SPHERE:
|
||||
@ -181,31 +137,35 @@ void DrawOverlay(OverlayBase_t* pOverlay)
|
||||
}
|
||||
case OverlayType_t::OVERLAY_TRIANGLE:
|
||||
{
|
||||
//printf("TRIANGLE %p\n", pOverlay);
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_SWEPT_BOX:
|
||||
{
|
||||
//printf("SBOX %p\n", pOverlay);
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_BOX2:
|
||||
{
|
||||
//printf("BOX2 %p\n", pOverlay);
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_CAPSULE:
|
||||
{
|
||||
//printf("CAPSULE %p\n", pOverlay);
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_UNK0:
|
||||
{
|
||||
//printf("UNK0 %p\n", pOverlay);
|
||||
break;
|
||||
}
|
||||
case OverlayType_t::OVERLAY_UNK1:
|
||||
{
|
||||
//printf("UNK1 %p\n", pOverlay);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//(*(void(__fastcall**)(void*))(*(_QWORD*)pRenderContext + CMATQUEUEDRENDERCONTEXT_VCALL_OFS_1))(pRenderContext);
|
||||
//(*(void(__fastcall**)(void*))(*(_QWORD*)pRenderContext + CMATQUEUEDRENDERCONTEXT_VCALL_OFS_2))(pRenderContext);
|
||||
|
||||
LeaveCriticalSection(&*s_OverlayMutex);
|
||||
}
|
||||
|
@ -71,11 +71,11 @@ struct OverlayBox_t : public OverlayBase_t
|
||||
{
|
||||
OverlayBox_t(void) { m_Type = OverlayType_t::OVERLAY_BOX; }
|
||||
|
||||
QAngle angles{}; //0x0020 - this isn't angles but idrk where it is
|
||||
RadianEuler angles{}; //0x0020 - this isn't angles but idrk where it is
|
||||
float origin_X{}; //0x002C
|
||||
Vector3D unk30{}; //0x0030
|
||||
RadianEuler unk30{}; //0x0030
|
||||
float origin_Y{}; //0x003C
|
||||
Vector3D unk40{}; //0x0040
|
||||
RadianEuler unk40{}; //0x0040
|
||||
float origin_Z{}; //0x004C
|
||||
Vector3D mins{}; //0x0050
|
||||
Vector3D maxs{}; //0x005C
|
||||
@ -99,6 +99,51 @@ struct OverlaySphere_t : public OverlayBase_t
|
||||
int a{};
|
||||
};
|
||||
|
||||
struct OverlayTriangle_t : public OverlayBase_t
|
||||
{
|
||||
OverlayTriangle_t() { m_Type = OverlayType_t::OVERLAY_TRIANGLE; }
|
||||
|
||||
Vector3D p1;
|
||||
Vector3D p2;
|
||||
Vector3D p3;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int a;
|
||||
bool noDepthTest;
|
||||
};
|
||||
|
||||
struct OverlaySweptBox_t : public OverlayBase_t
|
||||
{
|
||||
OverlaySweptBox_t() { m_Type = OverlayType_t::OVERLAY_SWEPT_BOX; }
|
||||
|
||||
Vector3D start;
|
||||
Vector3D end;
|
||||
Vector3D mins;
|
||||
Vector3D maxs;
|
||||
QAngle angles;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int a;
|
||||
};
|
||||
|
||||
struct OverlayCapsule_t : public OverlayBase_t
|
||||
{
|
||||
OverlayCapsule_t() { m_Type = OverlayType_t::OVERLAY_CAPSULE; }
|
||||
|
||||
Vector3D start;
|
||||
Vector3D end;
|
||||
Vector3D radius;
|
||||
Vector3D top;
|
||||
Vector3D bottom;
|
||||
int r;
|
||||
int g;
|
||||
int b;
|
||||
int a;
|
||||
bool m_bWireframe;
|
||||
};
|
||||
|
||||
void DestroyOverlay(OverlayBase_t* pOverlay);
|
||||
void DrawOverlay(OverlayBase_t* pOverlay);
|
||||
void DebugOverlays_Attach();
|
||||
|
@ -173,6 +173,27 @@
|
||||
#define ALIGN128_POST
|
||||
#endif
|
||||
|
||||
// This can be used to declare an abstract (interface only) class.
|
||||
// Classes marked abstract should not be instantiated. If they are, and access violation will occur.
|
||||
//
|
||||
// Example of use:
|
||||
//
|
||||
// abstract_class CFoo
|
||||
// {
|
||||
// ...
|
||||
// }
|
||||
//
|
||||
// MSDN __declspec(novtable) documentation: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_langref_novtable.asp
|
||||
//
|
||||
// Note: NJS: This is not enabled for regular PC, due to not knowing the implications of exporting a class with no no vtable.
|
||||
// It's probable that this shouldn't be an issue, but an experiment should be done to verify this.
|
||||
//
|
||||
#ifndef COMPILER_MSVCX360
|
||||
#define abstract_class class
|
||||
#else
|
||||
#define abstract_class class NO_VTABLE
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Generally useful platform-independent macros (move to another file?)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
141
r5dev/tier2/meshutils.cpp
Normal file
141
r5dev/tier2/meshutils.cpp
Normal file
@ -0,0 +1,141 @@
|
||||
//===== Copyright <20> 2005-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: A set of utilities to render standard shapes
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "tier2/meshutils.h"
|
||||
|
||||
// NOTE: This has to be the last file included!
|
||||
//#include "tier0/memdbgon.h"
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper methods to create various standard index buffer types
|
||||
//-----------------------------------------------------------------------------
|
||||
void GenerateSequentialIndexBuffer(unsigned short* pIndices, int nIndexCount, int nFirstVertex)
|
||||
{
|
||||
if (!pIndices)
|
||||
return;
|
||||
|
||||
// Format the sequential buffer
|
||||
for (int i = 0; i < nIndexCount; ++i)
|
||||
{
|
||||
pIndices[i] = (unsigned short)(i + nFirstVertex);
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateQuadIndexBuffer(unsigned short* pIndices, int nIndexCount, int nFirstVertex)
|
||||
{
|
||||
if (!pIndices)
|
||||
return;
|
||||
|
||||
// Format the quad buffer
|
||||
int i;
|
||||
int numQuads = nIndexCount / 6;
|
||||
unsigned short baseVertex = (unsigned short)nFirstVertex;
|
||||
|
||||
if (((size_t)pIndices & 0x3) == 0)
|
||||
{
|
||||
// Fast version, requires aligned indices
|
||||
int* pWrite = (int*)pIndices;
|
||||
int nWrite = (baseVertex << 16) | baseVertex;
|
||||
for (i = 0; i < numQuads; ++i)
|
||||
{
|
||||
// Have to deal with endian-ness
|
||||
if (IsX360() || IsPS3())
|
||||
{
|
||||
// this avoids compiler write reodering and prevents the write-combined out-of-order penalty
|
||||
// _WriteBarrier won't compile here, and volatile is ignored
|
||||
// the compiler otherwise scrambles these writes
|
||||
*pWrite++ = nWrite + 1;
|
||||
*pWrite++ = nWrite + (2 << 16);
|
||||
*pWrite++ = nWrite + (2 << 16) + 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
pWrite[0] = nWrite + (1 << 16);
|
||||
pWrite[1] = nWrite + 2;
|
||||
pWrite[2] = nWrite + (3 << 16) + 2;
|
||||
pWrite += 3;
|
||||
}
|
||||
nWrite += (4 << 16) | 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < numQuads; ++i)
|
||||
{
|
||||
pIndices[0] = baseVertex;
|
||||
pIndices[1] = baseVertex + 1;
|
||||
pIndices[2] = baseVertex + 2;
|
||||
|
||||
// Triangle 2
|
||||
pIndices[3] = baseVertex;
|
||||
pIndices[4] = baseVertex + 2;
|
||||
pIndices[5] = baseVertex + 3;
|
||||
|
||||
baseVertex += 4;
|
||||
pIndices += 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GeneratePolygonIndexBuffer(unsigned short* pIndices, int nIndexCount, int nFirstVertex)
|
||||
{
|
||||
if (!pIndices)
|
||||
return;
|
||||
|
||||
int i, baseVertex;
|
||||
int numPolygons = nIndexCount / 3;
|
||||
baseVertex = nFirstVertex;
|
||||
for (i = 0; i < numPolygons; ++i)
|
||||
{
|
||||
// Triangle 1
|
||||
pIndices[0] = (unsigned short)(nFirstVertex);
|
||||
pIndices[1] = (unsigned short)(nFirstVertex + i + 1);
|
||||
pIndices[2] = (unsigned short)(nFirstVertex + i + 2);
|
||||
pIndices += 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GenerateLineStripIndexBuffer(unsigned short* pIndices, int nIndexCount, int nFirstVertex)
|
||||
{
|
||||
if (!pIndices)
|
||||
return;
|
||||
|
||||
int i, baseVertex;
|
||||
int numLines = nIndexCount / 2;
|
||||
baseVertex = nFirstVertex;
|
||||
for (i = 0; i < numLines; ++i)
|
||||
{
|
||||
pIndices[0] = (unsigned short)(nFirstVertex + i);
|
||||
pIndices[1] = (unsigned short)(nFirstVertex + i + 1);
|
||||
pIndices += 2;
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateLineLoopIndexBuffer(unsigned short* pIndices, int nIndexCount, int nFirstVertex)
|
||||
{
|
||||
if (!pIndices)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int i, baseVertex;
|
||||
int numLines = nIndexCount / 2;
|
||||
baseVertex = nFirstVertex;
|
||||
|
||||
pIndices[0] = (unsigned short)(nFirstVertex + numLines - 1);
|
||||
pIndices[1] = (unsigned short)(nFirstVertex);
|
||||
pIndices += 2;
|
||||
|
||||
for (i = 1; i < numLines; ++i)
|
||||
{
|
||||
pIndices[0] = (unsigned short)(nFirstVertex + i - 1);
|
||||
pIndices[1] = (unsigned short)(nFirstVertex + i);
|
||||
pIndices += 2;
|
||||
}
|
||||
}
|
26
r5dev/tier2/meshutils.h
Normal file
26
r5dev/tier2/meshutils.h
Normal file
@ -0,0 +1,26 @@
|
||||
//===== Copyright <20> 2005-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: A set of utilities to help with generating meshes
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#ifndef MESHUTILS_H
|
||||
#define MESHUTILS_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helper methods to create various standard index buffer types
|
||||
//-----------------------------------------------------------------------------
|
||||
void GenerateSequentialIndexBuffer(unsigned short* pIndexMemory, int nIndexCount, int nFirstVertex);
|
||||
void GenerateQuadIndexBuffer(unsigned short* pIndexMemory, int nIndexCount, int nFirstVertex);
|
||||
void GeneratePolygonIndexBuffer(unsigned short* pIndexMemory, int nIndexCount, int nFirstVertex);
|
||||
void GenerateLineStripIndexBuffer(unsigned short* pIndexMemory, int nIndexCount, int nFirstVertex);
|
||||
void GenerateLineLoopIndexBuffer(unsigned short* pIndexMemory, int nIndexCount, int nFirstVertex);
|
||||
|
||||
|
||||
#endif // MESHUTILS_H
|
||||
|
60
r5dev/tier2/renderutils.cpp
Normal file
60
r5dev/tier2/renderutils.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
//===== Copyright <20> 2005-2005, Valve Corporation, All rights reserved. ======//
|
||||
//
|
||||
// Purpose: A set of utilities to render standard shapes
|
||||
//
|
||||
//===========================================================================//
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "mathlib/color.h"
|
||||
#include "mathlib/vector.h"
|
||||
#include "mathlib/vector2d.h"
|
||||
#include "mathlib/vector4d.h"
|
||||
#include "mathlib/mathlib.h"
|
||||
#include "tier2/renderutils.h"
|
||||
#include "engine/debugoverlay.h"
|
||||
|
||||
Vector3D* GetBoxCorners(Vector3D org, QAngle ang, Vector3D mins, Vector3D maxs)
|
||||
{
|
||||
Vector3D forward;
|
||||
Vector3D up;
|
||||
Vector3D right;
|
||||
|
||||
AngleVectors(ang, &forward, &right, &up);
|
||||
|
||||
Vector3D orgs[8];
|
||||
orgs[0] = org + (forward * mins.x) + (right * maxs.y) + (up * maxs.z);
|
||||
orgs[1] = org + (forward * mins.x) + (right * mins.y) + (up * maxs.z);
|
||||
orgs[2] = org + (forward * maxs.x) + (right * mins.y) + (up * maxs.z);
|
||||
orgs[3] = org + (forward * maxs.x) + (right * maxs.y) + (up * maxs.z);
|
||||
orgs[4] = org + (forward * mins.x) + (right * maxs.y) + (up * mins.z);
|
||||
orgs[5] = org + (forward * mins.x) + (right * mins.y) + (up * mins.z);
|
||||
orgs[6] = org + (forward * maxs.x) + (right * mins.y) + (up * mins.z);
|
||||
orgs[7] = org + (forward * maxs.x) + (right * maxs.y) + (up * mins.z);
|
||||
|
||||
return orgs;
|
||||
}
|
||||
|
||||
void DrawAngledBox(Vector3D org, QAngle ang, Vector3D mins, Vector3D maxs, int r, int g, int b, int a, bool throughSolid)
|
||||
{
|
||||
Vector3D* orgs = GetBoxCorners(org, ang, mins, maxs);
|
||||
|
||||
v_RenderLine(orgs[0], orgs[1], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[1], orgs[2], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[2], orgs[3], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[3], orgs[0], Color(r, g, b, a), throughSolid);
|
||||
|
||||
v_RenderLine(orgs[4], orgs[5], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[5], orgs[6], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[6], orgs[7], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[7], orgs[4], Color(r, g, b, a), throughSolid);
|
||||
|
||||
v_RenderLine(orgs[0], orgs[4], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[1], orgs[5], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[2], orgs[6], Color(r, g, b, a), throughSolid);
|
||||
v_RenderLine(orgs[3], orgs[7], Color(r, g, b, a), throughSolid);
|
||||
}
|
||||
|
||||
void RenderCapsule(const Vector3D& vStart, const Vector3D& vEnd, const float& flRadius, Color c)
|
||||
{
|
||||
|
||||
}
|
10
r5dev/tier2/renderutils.h
Normal file
10
r5dev/tier2/renderutils.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef RENDERUTILS_H
|
||||
#define RENDERUTILS_H
|
||||
#include "mathlib/vector.h"
|
||||
|
||||
Vector3D* GetBoxCorners(Vector3D org, QAngle ang, Vector3D mins, Vector3D maxs);
|
||||
void DrawAngledBox(Vector3D org, QAngle ang, Vector3D mins, Vector3D maxs, int r, int g, int b, int a, bool throughSolid);
|
||||
|
||||
void RenderCapsule(const Vector3D& vStart, const Vector3D& vEnd, const float& flRadius, Color c);
|
||||
|
||||
#endif // RENDERUTILS_H
|
@ -109,6 +109,8 @@
|
||||
<ClCompile Include="..\tier1\IConVar.cpp" />
|
||||
<ClCompile Include="..\tier1\NetAdr2.cpp" />
|
||||
<ClCompile Include="..\tier1\strtools.cpp" />
|
||||
<ClCompile Include="..\tier2\meshutils.cpp" />
|
||||
<ClCompile Include="..\tier2\renderutils.cpp" />
|
||||
<ClCompile Include="..\tier2\socketcreator.cpp" />
|
||||
<ClCompile Include="..\vguimatsurface\MatSystemSurface.cpp" />
|
||||
<ClCompile Include="..\vgui\vgui_baseui_interface.cpp" />
|
||||
@ -458,6 +460,8 @@
|
||||
<ClInclude Include="..\tier1\utldict.h" />
|
||||
<ClInclude Include="..\tier1\utlmemory.h" />
|
||||
<ClInclude Include="..\tier1\utlvector.h" />
|
||||
<ClInclude Include="..\tier2\meshutils.h" />
|
||||
<ClInclude Include="..\tier2\renderutils.h" />
|
||||
<ClInclude Include="..\tier2\socketcreator.h" />
|
||||
<ClInclude Include="..\vguimatsurface\MatSystemSurface.h" />
|
||||
<ClInclude Include="..\vgui\vgui_baseui_interface.h" />
|
||||
|
@ -540,6 +540,12 @@
|
||||
<ClCompile Include="..\vstdlib\random.cpp">
|
||||
<Filter>sdk\vstdlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\tier2\renderutils.cpp">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\tier2\meshutils.cpp">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -1586,6 +1592,12 @@
|
||||
<ClInclude Include="..\vstdlib\random.h">
|
||||
<Filter>sdk\vstdlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier2\renderutils.h">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier2\meshutils.h">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
@ -116,6 +116,8 @@
|
||||
<ClCompile Include="..\tier1\IConVar.cpp" />
|
||||
<ClCompile Include="..\tier1\NetAdr2.cpp" />
|
||||
<ClCompile Include="..\tier1\strtools.cpp" />
|
||||
<ClCompile Include="..\tier2\meshutils.cpp" />
|
||||
<ClCompile Include="..\tier2\renderutils.cpp" />
|
||||
<ClCompile Include="..\tier2\socketcreator.cpp" />
|
||||
<ClCompile Include="..\vguimatsurface\MatSystemSurface.cpp" />
|
||||
<ClCompile Include="..\vgui\vgui_baseui_interface.cpp" />
|
||||
@ -478,6 +480,8 @@
|
||||
<ClInclude Include="..\tier1\utldict.h" />
|
||||
<ClInclude Include="..\tier1\utlmemory.h" />
|
||||
<ClInclude Include="..\tier1\utlvector.h" />
|
||||
<ClInclude Include="..\tier2\meshutils.h" />
|
||||
<ClInclude Include="..\tier2\renderutils.h" />
|
||||
<ClInclude Include="..\tier2\socketcreator.h" />
|
||||
<ClInclude Include="..\vguimatsurface\MatSystemSurface.h" />
|
||||
<ClInclude Include="..\vgui\vgui_baseui_interface.h" />
|
||||
|
@ -570,6 +570,12 @@
|
||||
<ClCompile Include="..\mathlib\color_conversion.cpp">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\tier2\renderutils.cpp">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\tier2\meshutils.cpp">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\client\cdll_engine_int.h">
|
||||
@ -1655,6 +1661,12 @@
|
||||
<ClInclude Include="..\mathlib\ssequaternion.h">
|
||||
<Filter>sdk\mathlib</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier2\renderutils.h">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\tier2\meshutils.h">
|
||||
<Filter>sdk\tier2</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="..\shared\resource\lockedserver.png">
|
||||
|
Loading…
x
Reference in New Issue
Block a user