Nebula
Loading...
Searching...
No Matches
im3dcontext.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
11//------------------------------------------------------------------------------
12
13#include "coregraphics/buffer.h"
15#include "input/inputevent.h"
16#include "math/bbox.h"
17#include "math/line.h"
18
19namespace Im3d
20{
29
31{
33public:
37 virtual ~Im3dContext();
38
39 static void Create();
40 static void Discard();
41
42 static void DrawText(const Math::vec3& position, Util::String const& text, const float size = 10.0f, const Math::vec4 color = { 1.0f, 0.0f, 0.0f, 1.0f }, uint32_t renderFlags = CheckDepth);
43
44 static void DrawPoint(const Math::vec3& position, const float size = 10.0f, const Math::vec4 color = { 1.0f, 0.0f, 0.0f, 1.0f }, uint32_t renderFlags = CheckDepth);
45
46 static void DrawLine(const Math::line& line, const float size = 1.0f, const Math::vec4 color = {1.0f, 0.0f, 0.0f, 1.0f}, uint32_t renderFlags = CheckDepth);
47
48 static void DrawBox(const Math::bbox& box, const Math::vec4& color, uint32_t renderFlags = CheckDepth|Wireframe);
49
50 static void DrawOrientedBox(const Math::mat4& transform, const Math::bbox& box, const Math::vec4& color, uint32_t renderFlags = CheckDepth | Wireframe);
51
52 static void DrawBox(const Math::mat4& modelTransform, const Math::vec4& color, uint32_t renderFlags = CheckDepth | Wireframe);
54 static void DrawSphere(const Math::mat4& modelTransform, const Math::vec4& color, uint32_t renderFlags = CheckDepth | Wireframe);
56 static void DrawSphere(const Math::point& pos, float radius, const Math::vec4& color, uint32_t renderFlags = CheckDepth | Wireframe);
58 static void DrawCylinder(const Math::mat4& modelTransform, const Math::vec4& color, uint32_t renderFlags = CheckDepth | Wireframe);
60 static void DrawCone(const Math::mat4& modelTransform, const Math::vec4& color, uint32_t renderFlags = CheckDepth | Wireframe);
61
63 static void OnPrepareView(const Ptr<Graphics::View>& view, const Graphics::FrameContext& ctx);
65 static void Render(const CoreGraphics::CmdBufferId cmdBuf, const IndexT frameIndex);
66
68 static bool HandleInput(const Input::InputEvent& event);
69
71 static void SetGridStatus(bool enable);
73 static void SetGridSize(float cellSize, int cellCount);
75 static void SetGridColor(Math::vec4 const& color);
77 static void SetGridOffset(Math::vec2 const& offset);
79 static void SetGizmoSize(int size, int width);
80};
81
82
83} // namespace Im3d
Definition graphicscontext.h:165
Definition im3dcontext.h:31
static void Create()
Definition im3dcontext.cc:135
static void Discard()
Definition im3dcontext.cc:204
static void DrawLine(const Math::line &line, const float size=1.0f, const Math::vec4 color={1.0f, 0.0f, 0.0f, 1.0f}, uint32_t renderFlags=CheckDepth)
Definition im3dcontext.cc:240
static void SetGridStatus(bool enable)
Definition im3dcontext.cc:554
static void DrawOrientedBox(const Math::mat4 &transform, const Math::bbox &box, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
Definition im3dcontext.cc:286
static void SetGizmoSize(int size, int width)
configure size and thickness of gizmos
Definition im3dcontext.cc:591
static void DrawCone(const Math::mat4 &modelTransform, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
draw a cone
static void Render(const CoreGraphics::CmdBufferId cmdBuf, const IndexT frameIndex)
called when rendering a frame batch
Definition im3dcontext.cc:482
static void OnPrepareView(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
called before frame
Definition im3dcontext.cc:374
static void DrawPoint(const Math::vec3 &position, const float size=10.0f, const Math::vec4 color={ 1.0f, 0.0f, 0.0f, 1.0f }, uint32_t renderFlags=CheckDepth)
Definition im3dcontext.cc:229
static void SetGridSize(float cellSize, int cellCount)
Definition im3dcontext.cc:563
static void DrawCylinder(const Math::mat4 &modelTransform, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
draw a cylinder
static bool HandleInput(const Input::InputEvent &event)
handle event
Definition im3dcontext.cc:536
static void DrawBox(const Math::bbox &box, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
Definition im3dcontext.cc:251
static void SetGridOffset(Math::vec2 const &offset)
Definition im3dcontext.cc:582
static void SetGridColor(Math::vec4 const &color)
Definition im3dcontext.cc:573
Im3dContext()
constructor
Definition im3dcontext.cc:118
virtual ~Im3dContext()
destructor
Definition im3dcontext.cc:126
static void DrawText(const Math::vec3 &position, Util::String const &text, const float size=10.0f, const Math::vec4 color={ 1.0f, 0.0f, 0.0f, 1.0f }, uint32_t renderFlags=CheckDepth)
Definition im3dcontext.cc:218
static void DrawSphere(const Math::mat4 &modelTransform, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
draw a sphere
Definition im3dcontext.cc:325
The input events of the Input subsystems.
Definition inputevent.h:24
Nebula's bounding box class.
Definition bbox.h:24
A line in 3d space.
Definition line.h:22
Nebula's smart pointer class which manages the life time of RefCounted objects.
Definition ptr.h:38
Definition im3d.h:22
RenderFlag
Definition im3dcontext.h:22
@ CheckDepth
Definition im3dcontext.h:23
@ Wireframe
Definition im3dcontext.h:25
@ AlwaysOnTop
Definition im3dcontext.h:24
@ Solid
Definition im3dcontext.h:26
@ NumDepthFlags
Definition im3dcontext.h:27
Definition commandbuffer.h:155
Definition graphicsserver.h:31
A 4x4 single point precision float matrix.
Definition mat4.h:49
Represents a 3D point in space.
Definition point.h:22
A 2-component float vector class.
Definition vec2.h:21
A 3D vector.
Definition vec3.h:40
A 4D vector.
Definition vec4.h:24
Nebula's universal string class.
Definition string.h:50
int IndexT
Definition types.h:48