23static const float DU_PI = 3.14159265f;
25enum duDebugDrawPrimitives
38 virtual void depthMask(
bool state) = 0;
40 virtual void texture(
bool state) = 0;
45 virtual void begin(duDebugDrawPrimitives prim,
float size = 1.0f) = 0;
50 virtual void vertex(
const float* pos,
unsigned int color) = 0;
55 virtual void vertex(
const float x,
const float y,
const float z,
unsigned int color) = 0;
60 virtual void vertex(
const float* pos,
unsigned int color,
const float* uv) = 0;
65 virtual void vertex(
const float x,
const float y,
const float z,
unsigned int color,
const float u,
const float v) = 0;
68 virtual void end() = 0;
71 virtual unsigned int areaToCol(
unsigned int area);
74inline unsigned int duRGBA(
int r,
int g,
int b,
int a)
76 return ((
unsigned int)r) | ((
unsigned int)g << 8) | ((
unsigned int)b << 16) | ((
unsigned int)a << 24);
79inline unsigned int duRGBAf(
float fr,
float fg,
float fb,
float fa)
81 unsigned char r = (
unsigned char)(fr*255.0f);
82 unsigned char g = (
unsigned char)(fg*255.0f);
83 unsigned char b = (
unsigned char)(fb*255.0f);
84 unsigned char a = (
unsigned char)(fa*255.0f);
85 return duRGBA(r,g,b,a);
88unsigned int duIntToCol(
int i,
int a);
89void duIntToCol(
int i,
float* col);
91inline unsigned int duMultCol(
const unsigned int col,
const unsigned int d)
93 const unsigned int r = col & 0xff;
94 const unsigned int g = (col >> 8) & 0xff;
95 const unsigned int b = (col >> 16) & 0xff;
96 const unsigned int a = (col >> 24) & 0xff;
97 return duRGBA((r*d) >> 8, (g*d) >> 8, (b*d) >> 8, a);
100inline unsigned int duDarkenCol(
unsigned int col)
102 return ((col >> 1) & 0x007f7f7f) | (col & 0xff000000);
105inline unsigned int duLerpCol(
unsigned int ca,
unsigned int cb,
unsigned int u)
107 const unsigned int ra = ca & 0xff;
108 const unsigned int ga = (ca >> 8) & 0xff;
109 const unsigned int ba = (ca >> 16) & 0xff;
110 const unsigned int aa = (ca >> 24) & 0xff;
111 const unsigned int rb = cb & 0xff;
112 const unsigned int gb = (cb >> 8) & 0xff;
113 const unsigned int bb = (cb >> 16) & 0xff;
114 const unsigned int ab = (cb >> 24) & 0xff;
116 unsigned int r = (ra*(255-u) + rb*u)/255;
117 unsigned int g = (ga*(255-u) + gb*u)/255;
118 unsigned int b = (ba*(255-u) + bb*u)/255;
119 unsigned int a = (aa*(255-u) + ab*u)/255;
120 return duRGBA(r,g,b,a);
123inline unsigned int duTransCol(
unsigned int c,
unsigned int a)
125 return (a<<24) | (c & 0x00ffffff);
129void duCalcBoxColors(
unsigned int* colors,
unsigned int colTop,
unsigned int colSide);
131void duDebugDrawCylinderWire(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
132 float maxx,
float maxy,
float maxz,
unsigned int col,
const float lineWidth);
134void duDebugDrawBoxWire(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
135 float maxx,
float maxy,
float maxz,
unsigned int col,
const float lineWidth);
137void duDebugDrawArc(
struct duDebugDraw* dd,
const float x0,
const float y0,
const float z0,
138 const float x1,
const float y1,
const float z1,
const float h,
139 const float as0,
const float as1,
unsigned int col,
const float lineWidth);
141void duDebugDrawArrow(
struct duDebugDraw* dd,
const float x0,
const float y0,
const float z0,
142 const float x1,
const float y1,
const float z1,
143 const float as0,
const float as1,
unsigned int col,
const float lineWidth);
145void duDebugDrawCircle(
struct duDebugDraw* dd,
const float x,
const float y,
const float z,
146 const float r,
unsigned int col,
const float lineWidth);
148void duDebugDrawCross(
struct duDebugDraw* dd,
const float x,
const float y,
const float z,
149 const float size,
unsigned int col,
const float lineWidth);
151void duDebugDrawBox(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
152 float maxx,
float maxy,
float maxz,
const unsigned int* fcol);
154void duDebugDrawCylinder(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
155 float maxx,
float maxy,
float maxz,
unsigned int col);
157void duDebugDrawGridXZ(
struct duDebugDraw* dd,
const float ox,
const float oy,
const float oz,
158 const int w,
const int h,
const float size,
159 const unsigned int col,
const float lineWidth);
163void duAppendCylinderWire(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
164 float maxx,
float maxy,
float maxz,
unsigned int col);
166void duAppendBoxWire(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
167 float maxx,
float maxy,
float maxz,
unsigned int col);
169void duAppendBoxPoints(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
170 float maxx,
float maxy,
float maxz,
unsigned int col);
172void duAppendArc(
struct duDebugDraw* dd,
const float x0,
const float y0,
const float z0,
173 const float x1,
const float y1,
const float z1,
const float h,
174 const float as0,
const float as1,
unsigned int col);
176void duAppendArrow(
struct duDebugDraw* dd,
const float x0,
const float y0,
const float z0,
177 const float x1,
const float y1,
const float z1,
178 const float as0,
const float as1,
unsigned int col);
180void duAppendCircle(
struct duDebugDraw* dd,
const float x,
const float y,
const float z,
181 const float r,
unsigned int col);
183void duAppendCross(
struct duDebugDraw* dd,
const float x,
const float y,
const float z,
184 const float size,
unsigned int col);
186void duAppendBox(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
187 float maxx,
float maxy,
float maxz,
const unsigned int* fcol);
189void duAppendCylinder(
struct duDebugDraw* dd,
float minx,
float miny,
float minz,
190 float maxx,
float maxy,
float maxz,
unsigned int col);
196 unsigned int* m_color;
201 duDebugDrawPrimitives m_prim;
204 void resize(
int cap);
209 virtual void depthMask(
bool state);
210 virtual void begin(duDebugDrawPrimitives prim,
float size = 1.0f);
211 virtual void vertex(
const float x,
const float y,
const float z,
unsigned int color);
212 virtual void vertex(
const float* pos,
unsigned int color);
Definition DebugDraw.h:194
virtual void begin(duDebugDrawPrimitives prim, float size=1.0f)
Definition DebugDraw.cpp:575
virtual void end()
End drawing primitives.
Definition DebugDraw.cpp:599
virtual void vertex(const float x, const float y, const float z, unsigned int color)
Definition DebugDraw.cpp:582
Abstract debug draw interface.
Definition DebugDraw.h:35
virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v)=0
virtual void vertex(const float x, const float y, const float z, unsigned int color)=0
virtual void begin(duDebugDrawPrimitives prim, float size=1.0f)=0
virtual void vertex(const float *pos, unsigned int color, const float *uv)=0
virtual void vertex(const float *pos, unsigned int color)=0
virtual unsigned int areaToCol(unsigned int area)
Compute a color for given area.
Definition DebugDraw.cpp:31
virtual void end()=0
End drawing primitives.