Nebula
Loading...
Searching...
No Matches
visualdebugger.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13//------------------------------------------------------------------------------
14
15#include "core/refcounted.h"
16#include "core/ptr.h"
17#include "core/singleton.h"
18#include "math/bbox.h"
19
20namespace Physics
21{
22class Scene;
23
25{
27public:
31 virtual ~VisualDebugger();
32
34 virtual void OnStep();
36 virtual void Initialize(Scene* s);
37
39 void SetSimulationFrameTime(float time);
41 float SetSimulationFrameTime() const;
42
43
45 void DrawTimedArrow(const Math::point& p, const Math::vector& dir, uint numSteps, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
47 void DrawTimedLine(const Math::point& p, const Math::vector& dir, uint numSteps, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
49 void DrawTimedPlane(const Math::point& p, const Math::vector& dir, float scale, uint numSteps, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
51 void DrawTimedText(const Math::point& p, const Util::String& text, uint numSteps, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
53 void DrawTimedAABB(const Math::bbox& bbox, uint numSteps, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
54
56 virtual void SetCameraView(const Math::mat4& viewMatrix);
57
58 /* === abstract draw-methods === */
59
61 virtual void DrawArrow(const Math::point& p, const Math::vector& dir, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
63 virtual void DrawLine(const Math::point& p, const Math::vector& dir, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
65 virtual void DrawPlane(const Math::point& p, const Math::vector& dir, float scale, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
67 virtual void DrawText(const Math::point& p, const Util::String& text, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
69 virtual void DrawAABB(const Math::bbox& bbox, const Math::vec4& color = Math::vec4(1, 1, 1, 1));
70
71protected:
72
73 class TimedDrawData;
74
76 void Draw(const TimedDrawData& data);
77
80 {
81 public:
91
96
98 TimedDrawData(uint numSteps, DrawType t, const Math::vec4& c, const Math::point& vec1, const Math::vector& vec2, const Util::String& txt, float _f):
99 stepsLeft(numSteps),
100 type(t),
101 color(c),
102 v1(vec1),
103 v2(vec2),
104 text(txt),
105 f(_f)
106 { }
107
114 float f;
116 };
117
121};
122
123//------------------------------------------------------------------------------
126inline void
128{
129 this->simulationFrameTime = time;
130}
131
132//------------------------------------------------------------------------------
135inline float
140
141}
142// namespace Physics
143//------------------------------------------------------------------------------
Nebula's bounding box class.
Definition bbox.h:24
base class for draw-calls that should be done over a number of steps
Definition visualdebugger.h:80
Math::vector v2
Definition visualdebugger.h:113
float f
Definition visualdebugger.h:114
Math::point v1
these below are not always used
Definition visualdebugger.h:112
DrawType type
Definition visualdebugger.h:109
Util::String text
Definition visualdebugger.h:115
DrawType
Definition visualdebugger.h:83
@ AABB
Definition visualdebugger.h:87
@ Text3D
Definition visualdebugger.h:86
@ Arrow
Definition visualdebugger.h:85
@ Plane
Definition visualdebugger.h:89
@ Line
Definition visualdebugger.h:88
@ Unitialized
Definition visualdebugger.h:84
TimedDrawData()
default constructor
Definition visualdebugger.h:93
Math::vec4 color
Definition visualdebugger.h:110
uint stepsLeft
Definition visualdebugger.h:108
TimedDrawData(uint numSteps, DrawType t, const Math::vec4 &c, const Math::point &vec1, const Math::vector &vec2, const Util::String &txt, float _f)
constructor
Definition visualdebugger.h:98
Class that communicates with the physics visual debugger program.
Definition visualdebugger.h:25
void Draw(const TimedDrawData &data)
perform drawing
Definition visualdebugger.cc:138
void DrawTimedLine(const Math::point &p, const Math::vector &dir, uint numSteps, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw a line during a number of steps
Definition visualdebugger.cc:92
virtual void SetCameraView(const Math::mat4 &viewMatrix)
set the camera view
Definition visualdebugger.cc:166
void DrawTimedPlane(const Math::point &p, const Math::vector &dir, float scale, uint numSteps, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw a plane during a number of steps
Definition visualdebugger.cc:101
virtual void DrawAABB(const Math::bbox &bbox, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw an AABB
Definition visualdebugger.cc:129
Scene * scene
Definition visualdebugger.h:118
virtual void DrawPlane(const Math::point &p, const Math::vector &dir, float scale, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw a plane
Definition visualdebugger.cc:184
Util::Array< TimedDrawData > timedDrawData
Definition visualdebugger.h:120
float SetSimulationFrameTime() const
get how much time that should pass each step
Definition visualdebugger.h:136
__DeclareInterfaceSingleton(VisualDebugger)
float simulationFrameTime
Definition visualdebugger.h:119
void DrawTimedAABB(const Math::bbox &bbox, uint numSteps, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw an AABB during a number of steps
Definition visualdebugger.cc:83
virtual void OnStep()
do one step
Definition visualdebugger.cc:35
void DrawTimedText(const Math::point &p, const Util::String &text, uint numSteps, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw text during a number of steps
Definition visualdebugger.cc:74
virtual ~VisualDebugger()
destructor
Definition visualdebugger.cc:24
virtual void DrawLine(const Math::point &p, const Math::vector &dir, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw a line
Definition visualdebugger.cc:175
virtual void DrawText(const Math::point &p, const Util::String &text, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw text
Definition visualdebugger.cc:120
virtual void DrawArrow(const Math::point &p, const Math::vector &dir, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw an arrow
Definition visualdebugger.cc:111
virtual void Initialize(Scene *s)
initialize debugger connection
Definition visualdebugger.cc:56
VisualDebugger()
constructor
Definition visualdebugger.cc:15
void DrawTimedArrow(const Math::point &p, const Math::vector &dir, uint numSteps, const Math::vec4 &color=Math::vec4(1, 1, 1, 1))
draw an arrow during a number of steps
Definition visualdebugger.cc:65
Nebula's dynamic array class.
Definition array.h:60
Diverse functions for manipulating physics actors.
Definition actorcontext.cc:17
A 4x4 single point precision float matrix.
Definition mat4.h:47
Represents a 3D point in space.
Definition point.h:22
A 4D vector.
Definition vec4.h:24
A vector is a 3D direction in space.
Definition vector.h:22
physx scene classes, foundation and physics are duplicated here for convenience instead of static get...
Definition physicsinterface.h:68
Nebula's universal string class.
Definition string.h:50
unsigned int uint
Definition types.h:31