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 bool GetGridStatus();
75 static void SetGridSize(float cellSize, int cellCount);
77 static void GetGridSize(float& cellSize, int& cellCount);
79 static void SetGridColor(Math::vec4 const& color);
81 static const Math::vec4& GetGridColor();
83 static void SetGridOffset(Math::vec2 const& offset);
85 static Math::vec2 const& GetGridOffset();
87 static void SetGizmoSize(int size, int width);
88
90 static void GetGizmoSize(int& size, int& width);
92 static void SetViewportRect(Math::vec2 const& viewPortPosition, Math::vec2 const& viewPortSize);
93};
94
95
96} // namespace Im3d
Definition graphicscontext.h:165
static void SetGridOffset(Math::vec2 const &offset)
Definition im3dcontext.cc:612
static void SetGizmoSize(int size, int width)
configure size and thickness of gizmos
Definition im3dcontext.cc:630
Im3dContext()
constructor
Definition im3dcontext.cc:120
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:242
static void DrawCone(const Math::mat4 &modelTransform, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
draw a cone
static void OnPrepareView(const Ptr< Graphics::View > &view, const Graphics::FrameContext &ctx)
called before frame
Definition im3dcontext.cc:376
static void SetGridStatus(bool enable)
Definition im3dcontext.cc:556
static bool HandleInput(const Input::InputEvent &event)
handle event
Definition im3dcontext.cc:538
static void DrawCylinder(const Math::mat4 &modelTransform, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
draw a cylinder
static void GetGridSize(float &cellSize, int &cellCount)
Definition im3dcontext.cc:584
static Math::vec2 const & GetGridOffset()
Definition im3dcontext.cc:621
static bool GetGridStatus()
Definition im3dcontext.cc:565
static void Discard()
Definition im3dcontext.cc:206
static void SetViewportRect(Math::vec2 const &viewPortPosition, Math::vec2 const &viewPortSize)
Definition im3dcontext.cc:654
static void Create()
Definition im3dcontext.cc:137
static void Render(const CoreGraphics::CmdBufferId cmdBuf, const IndexT frameIndex)
called when rendering a frame batch
Definition im3dcontext.cc:484
static void SetGridColor(Math::vec4 const &color)
Definition im3dcontext.cc:594
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:231
static void DrawOrientedBox(const Math::mat4 &transform, const Math::bbox &box, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
Definition im3dcontext.cc:288
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:220
static void DrawSphere(const Math::mat4 &modelTransform, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
draw a sphere
Definition im3dcontext.cc:327
static void SetGridSize(float cellSize, int cellCount)
Definition im3dcontext.cc:574
static void DrawBox(const Math::bbox &box, const Math::vec4 &color, uint32_t renderFlags=CheckDepth|Wireframe)
Definition im3dcontext.cc:253
static const Math::vec4 & GetGridColor()
Definition im3dcontext.cc:603
static void GetGizmoSize(int &size, int &width)
configure size and thickness of gizmos
Definition im3dcontext.cc:642
virtual ~Im3dContext()
destructor
Definition im3dcontext.cc:128
The input events of the Input subsystems.
Definition inputevent.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:167
Definition graphicsserver.h:31
A 4x4 single point precision float matrix.
Definition mat4.h:49
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.cs:8
int IndexT
Definition types.h:48