Oxygen Engine
Modern C++ 3D Engine using OpenGL
Loading...
Searching...
No Matches
debug.h
1#ifndef OE_RENDER_DEBUG_H
2#define OE_RENDER_DEBUG_H
3
4#include "../common.h"
5
6#ifndef OXYGEN_ENGINE_DEBUG_TOOLS
7 #error Debug tools are not included in this build, please enable then with OE_DEBUG_TOOLS CMake option
8#endif
9
10#include <glm/vec3.hpp>
11#include <glm/matrix.hpp>
12
13namespace oe::core
14{
15 class Device;
16}
17
18namespace oe::scene
19{
20 class Camera;
21 class AABB;
22}
23
24namespace oe::detail::dd
25{
26 class OxygenEngineRenderInterface;
27}
28
29namespace oe::render
30{
35 class Debug
36 {
37 public:
44 static void axis(const float& length = 1.0f, const float& arrow_size = 0.1f);
45
53 static void transform(const glm::mat4& model, const float& length = 1.0f, const float& arrow_size = 0.1f);
54
59 static void tbn(const glm::vec3& origin, const glm::vec3& tangent, const glm::vec3& bitangent, const glm::vec3& normal, const float& length = 1.0);
60
67 static void aabb(const oe::scene::AABB& bbox, const glm::vec3& color = glm::vec3(1.0));
68
76 static void point(const glm::vec3& position, const float& size = 10.0f, const glm::vec3& color = glm::vec3(1.0));
77
85 static void sphere(const glm::vec3& center, const float& radius, const glm::vec3& color = glm::vec3(1.0));
86
94 static void box(const glm::vec3& min, const glm::vec3& max, const glm::vec3& color = glm::vec3(1.0));
95
103 static void line(const glm::vec3& start, const glm::vec3& end, const glm::vec3& color = glm::vec3(1.0));
104
105 static void arrow(const glm::vec3& start, const glm::vec3& end, const float& size = 1.0f, const glm::vec3& color = glm::vec3(1.0));
106 static void cone(const glm::vec3& start, const glm::vec3& end, const float& baseAngle = 1.0f, const float& apexAngle = 0.0f, const glm::vec3& color = glm::vec3(1.0));
107
114 static void frustum(const oe::scene::Camera& camera, const glm::vec3& color = glm::vec3(1.0));
115
120 void render(oe::scene::Camera& camera, const bool flush = true);
121
125 void flush();
126
127 static Debug* getInstance()
128 {
129 return _instance;
130 }
131
132 private:
133 Debug();
134 ~Debug();
135
136 detail::dd::OxygenEngineRenderInterface* _render_interface = nullptr;
137 void* _ctx = nullptr;
138
139 static Debug* _instance;
140
141 // Available for device to build / clean the instance
142 static oe::render::Debug* init();
143 static void clean();
144 friend class core::Device;
145 };
146}
147
148#endif
The OxygenEngine device that will manage events, windows, scene, etc...
Definition device.h:18
Render simple shapes for debugging purposes.
Definition debug.h:36
void render(oe::scene::Camera &camera, const bool flush=true)
Render all debug objects and clean buffer.
static void box(const glm::vec3 &min, const glm::vec3 &max, const glm::vec3 &color=glm::vec3(1.0))
Draw a box between two corners.
static void axis(const float &length=1.0f, const float &arrow_size=0.1f)
Draw origin axis.
static void point(const glm::vec3 &position, const float &size=10.0f, const glm::vec3 &color=glm::vec3(1.0))
Draw a point.
static void frustum(const oe::scene::Camera &camera, const glm::vec3 &color=glm::vec3(1.0))
Draw the frustum pyramid of a camera.
static void sphere(const glm::vec3 &center, const float &radius, const glm::vec3 &color=glm::vec3(1.0))
Draw a sphere.
static void line(const glm::vec3 &start, const glm::vec3 &end, const glm::vec3 &color=glm::vec3(1.0))
Draw a line between two points.
static void transform(const glm::mat4 &model, const float &length=1.0f, const float &arrow_size=0.1f)
Draw a transform.
static void tbn(const glm::vec3 &origin, const glm::vec3 &tangent, const glm::vec3 &bitangent, const glm::vec3 &normal, const float &length=1.0)
Render vertex TBN (Tangent, bi-tangent, normal)
static void aabb(const oe::scene::AABB &bbox, const glm::vec3 &color=glm::vec3(1.0))
Draw a bounding box.
void flush()
Flush buffer without rendering.
Axis-aligned bounding box.
Definition aabb.h:13
The "eye of the scene".
Definition camera.h:33
Core functionality (windows, event handler, logger, ...)
Definition cursor.h:8
Render related abstractions (Shader, Framebuffer, Cubemaps, Textures)
Definition opengl.h:10
Scene related management (Render-agnostic Geometry, Manger, etc...)
Definition debug.h:19