SleakEngine
0.1.0
C++23 multi-backend game engine
Toggle main menu visibility
Loading...
Searching...
No Matches
DebugLineRenderer.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <
Core/OSDef.hpp
>
4
#include <
Math/Vector.hpp
>
5
#include <
Memory/RefPtr.hpp
>
6
#include <
Physics/Colliders.hpp
>
7
#include <vector>
8
9
namespace
Sleak
{
10
11
struct
Vertex
;
12
namespace
RenderEngine
{
class
BufferBase
;
class
Shader
; }
13
14
class
Camera
;
15
16
/// Immediate-mode wireframe line drawing for debug visualization; lines queue up and are flushed once per frame.
17
/// @ingroup debug
18
class
ENGINE_API
DebugLineRenderer
{
19
public
:
20
/// Allocates the shared vertex buffer, shader, and constant buffer.
21
static
void
Initialize
();
22
static
void
Shutdown
();
23
24
static
void
SetEnabled
(
bool
enabled) { s_enabled = enabled; }
25
static
bool
IsEnabled
() {
return
s_enabled; }
26
27
/// Queues a single line segment for the next Flush.
28
static
void
DrawLine(
const
Math::Vector3D
& start,
const
Math::Vector3D
& end,
29
float
r,
float
g,
float
b,
float
a = 1.0f);
30
31
/// Queues a wireframe box outline.
32
static
void
DrawAABB(
const
Physics::AABB
& aabb,
33
float
r,
float
g,
float
b,
float
a = 1.0f);
34
35
/// Queues a wireframe sphere approximated with segments latitude/longitude rings.
36
static
void
DrawSphere(
const
Math::Vector3D
& center,
float
radius,
37
float
r,
float
g,
float
b,
float
a = 1.0f,
38
int
segments = 16);
39
40
/// Queues a wireframe capsule outline.
41
static
void
DrawCapsule(
const
Physics::BoundingCapsule
& capsule,
42
float
r,
float
g,
float
b,
float
a = 1.0f,
43
int
segments = 16);
44
45
/// Uploads all queued lines and draws them in one pass, then clears the queue.
46
static
void
Flush(
Camera
* camera);
47
48
private
:
49
static
std::vector<Vertex>* s_vertices;
50
static
RefPtr<RenderEngine::BufferBase>
s_vertexBuffer;
51
static
RefPtr<RenderEngine::Shader>
s_shader;
52
static
RefPtr<RenderEngine::BufferBase>
s_constantBuffer;
53
static
bool
s_enabled;
54
static
bool
s_initialized;
55
56
static
constexpr
uint32_t MAX_VERTICES = 65536;
57
};
58
59
}
// namespace Sleak
Colliders.hpp
OSDef.hpp
RefPtr.hpp
Vector.hpp
Sleak::Camera
Definition
Camera.hpp:59
Sleak::DebugLineRenderer
Definition
DebugLineRenderer.hpp:18
Sleak::DebugLineRenderer::IsEnabled
static bool IsEnabled()
Definition
DebugLineRenderer.hpp:25
Sleak::DebugLineRenderer::SetEnabled
static void SetEnabled(bool enabled)
Definition
DebugLineRenderer.hpp:24
Sleak::DebugLineRenderer::Shutdown
static void Shutdown()
Definition
DebugLineRenderer.cpp:56
Sleak::DebugLineRenderer::Initialize
static void Initialize()
Allocates the shared vertex buffer, shader, and constant buffer.
Definition
DebugLineRenderer.cpp:24
Sleak::Math::Vector3D
Definition
Vector.hpp:354
Sleak::RefPtr
Definition
RefPtr.hpp:62
Sleak::RenderEngine::BufferBase
Backend-agnostic GPU buffer: vertex, index, constant, or resource view target.
Definition
BufferBase.hpp:16
Sleak::RenderEngine::Shader
Backend-agnostic compiled shader program.
Definition
Shader.hpp:11
Sleak::RenderEngine
Backend-facing rendering layer shared by the four graphics backends.
Definition
Application.hpp:60
Sleak
Root namespace for everything the engine exposes.
Definition
Camera.hpp:10
Sleak::Physics::AABB
Definition
Colliders.hpp:20
Sleak::Physics::BoundingCapsule
Definition
Colliders.hpp:133
Sleak::Vertex
Definition
MeshData.hpp:16
include
public
Debug
DebugLineRenderer.hpp
Generated on
for SleakEngine by
1.18.0