23static const float DU_PI = 3.14159265f;
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;
61 virtual void vertex(
const float* pos,
unsigned int color,
const float* uv) = 0;
67 virtual void vertex(
const float x,
const float y,
const float z,
unsigned int color,
const float u,
const float v) = 0;
70 virtual void end() = 0;
73 virtual unsigned int areaToCol(
unsigned int area);
76inline unsigned int duRGBA(
int r,
int g,
int b,
int a)
78 return ((
unsigned int)r) | ((
unsigned int)g << 8) | ((
unsigned int)b << 16) | ((
unsigned int)a << 24);
81inline unsigned int duRGBAf(
float fr,
float fg,
float fb,
float fa)
83 unsigned char r = (
unsigned char)(fr*255.0f);
84 unsigned char g = (
unsigned char)(fg*255.0f);
85 unsigned char b = (
unsigned char)(fb*255.0f);
86 unsigned char a = (
unsigned char)(fa*255.0f);
93inline unsigned int duMultCol(
const unsigned int col,
const unsigned int d)
95 const unsigned int r = col & 0xff;
96 const unsigned int g = (col >> 8) & 0xff;
97 const unsigned int b = (col >> 16) & 0xff;
98 const unsigned int a = (col >> 24) & 0xff;
99 return duRGBA((r*d) >> 8, (g*d) >> 8, (b*d) >> 8, a);
104 return ((col >> 1) & 0x007f7f7f) | (col & 0xff000000);
107inline unsigned int duLerpCol(
unsigned int ca,
unsigned int cb,
unsigned int u)
109 const unsigned int ra = ca & 0xff;
110 const unsigned int ga = (ca >> 8) & 0xff;
111 const unsigned int ba = (ca >> 16) & 0xff;
112 const unsigned int aa = (ca >> 24) & 0xff;
113 const unsigned int rb = cb & 0xff;
114 const unsigned int gb = (cb >> 8) & 0xff;
115 const unsigned int bb = (cb >> 16) & 0xff;
116 const unsigned int ab = (cb >> 24) & 0xff;
118 unsigned int r = (ra*(255-u) + rb*u)/255;
119 unsigned int g = (ga*(255-u) + gb*u)/255;
120 unsigned int b = (ba*(255-u) + bb*u)/255;
121 unsigned int a = (aa*(255-u) + ab*u)/255;
125inline unsigned int duTransCol(
unsigned int c,
unsigned int a)
127 return (a<<24) | (c & 0x00ffffff);
131void duCalcBoxColors(
unsigned int* colors,
unsigned int colTop,
unsigned int colSide);
134 float maxx,
float maxy,
float maxz,
unsigned int col,
const float lineWidth);
137 float maxx,
float maxy,
float maxz,
unsigned int col,
const float lineWidth);
140 const float x1,
const float y1,
const float z1,
const float h,
141 const float as0,
const float as1,
unsigned int col,
const float lineWidth);
144 const float x1,
const float y1,
const float z1,
145 const float as0,
const float as1,
unsigned int col,
const float lineWidth);
148 const float r,
unsigned int col,
const float lineWidth);
151 const float size,
unsigned int col,
const float lineWidth);
154 float maxx,
float maxy,
float maxz,
const unsigned int* fcol);
157 float maxx,
float maxy,
float maxz,
unsigned int col);
160 const int w,
const int h,
const float size,
161 const unsigned int col,
const float lineWidth);
166 float maxx,
float maxy,
float maxz,
unsigned int col);
169 float maxx,
float maxy,
float maxz,
unsigned int col);
172 float maxx,
float maxy,
float maxz,
unsigned int col);
175 const float x1,
const float y1,
const float z1,
const float h,
176 const float as0,
const float as1,
unsigned int col);
179 const float x1,
const float y1,
const float z1,
180 const float as0,
const float as1,
unsigned int col);
183 const float r,
unsigned int col);
186 const float size,
unsigned int col);
189 float maxx,
float maxy,
float maxz,
const unsigned int* fcol);
192 float maxx,
float maxy,
float maxz,
unsigned int col);
198 unsigned int* m_color;
206 void resize(
int cap);
213 virtual void vertex(
const float x,
const float y,
const float z,
unsigned int color);
214 virtual void vertex(
const float* pos,
unsigned int color);
void duDebugDrawCylinder(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col)
Definition DebugDraw.cpp:150
void duAppendCircle(struct duDebugDraw *dd, const float x, const float y, const float z, const float r, unsigned int col)
Definition DebugDraw.cpp:490
static const float DU_PI
Definition DebugDraw.h:23
void duAppendBox(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, const unsigned int *fcol)
Definition DebugDraw.cpp:279
void duDebugDrawBox(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, const unsigned int *fcol)
Definition DebugDraw.cpp:140
void duAppendArc(struct duDebugDraw *dd, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const float h, const float as0, const float as1, unsigned int col)
Definition DebugDraw.cpp:431
void duDebugDrawArc(struct duDebugDraw *dd, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const float h, const float as0, const float as1, unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:98
unsigned int duIntToCol(int i, int a)
Definition DebugDraw.cpp:48
void duDebugDrawCylinderWire(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:78
void duDebugDrawCircle(struct duDebugDraw *dd, const float x, const float y, const float z, const float r, unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:120
void duAppendCross(struct duDebugDraw *dd, const float x, const float y, const float z, const float size, unsigned int col)
Definition DebugDraw.cpp:515
void duDebugDrawBoxWire(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:88
unsigned int duRGBAf(float fr, float fg, float fb, float fa)
Definition DebugDraw.h:81
unsigned int duDarkenCol(unsigned int col)
Definition DebugDraw.h:102
unsigned int duTransCol(unsigned int c, unsigned int a)
Definition DebugDraw.h:125
void duAppendCylinderWire(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col)
Definition DebugDraw.cpp:181
void duDebugDrawGridXZ(struct duDebugDraw *dd, const float ox, const float oy, const float oz, const int w, const int h, const float size, const unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:160
void duDebugDrawArrow(struct duDebugDraw *dd, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const float as0, const float as1, unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:109
void duAppendCylinder(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col)
Definition DebugDraw.cpp:314
void duAppendBoxWire(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col)
Definition DebugDraw.cpp:219
void duCalcBoxColors(unsigned int *colors, unsigned int colTop, unsigned int colSide)
Definition DebugDraw.cpp:66
unsigned int duRGBA(int r, int g, int b, int a)
Definition DebugDraw.h:76
duDebugDrawPrimitives
Definition DebugDraw.h:26
@ DU_DRAW_QUADS
Definition DebugDraw.h:30
@ DU_DRAW_LINES
Definition DebugDraw.h:28
@ DU_DRAW_TRIS
Definition DebugDraw.h:29
@ DU_DRAW_POINTS
Definition DebugDraw.h:27
void duAppendBoxPoints(struct duDebugDraw *dd, float minx, float miny, float minz, float maxx, float maxy, float maxz, unsigned int col)
Definition DebugDraw.cpp:254
unsigned int duLerpCol(unsigned int ca, unsigned int cb, unsigned int u)
Definition DebugDraw.h:107
void duAppendArrow(struct duDebugDraw *dd, const float x0, const float y0, const float z0, const float x1, const float y1, const float z1, const float as0, const float as1, unsigned int col)
Definition DebugDraw.cpp:473
void duDebugDrawCross(struct duDebugDraw *dd, const float x, const float y, const float z, const float size, unsigned int col, const float lineWidth)
Definition DebugDraw.cpp:130
unsigned int duMultCol(const unsigned int col, const unsigned int d)
Definition DebugDraw.h:93
Definition DebugDraw.h:196
virtual void depthMask(bool state)
Definition DebugDraw.cpp:569
void draw(struct duDebugDraw *dd)
Definition DebugDraw.cpp:602
void clear()
Definition DebugDraw.cpp:564
virtual ~duDisplayList()
Definition DebugDraw.cpp:541
virtual void begin(duDebugDrawPrimitives prim, float size=1.0f)
Begin drawing primitives.
Definition DebugDraw.cpp:574
virtual void end()
End drawing primitives.
Definition DebugDraw.cpp:598
virtual void vertex(const float x, const float y, const float z, unsigned int color)
Submit a vertex.
Definition DebugDraw.cpp:581
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
Submit a vertex.
virtual void vertex(const float x, const float y, const float z, unsigned int color)=0
Submit a vertex.
virtual void begin(duDebugDrawPrimitives prim, float size=1.0f)=0
Begin drawing primitives.
virtual void vertex(const float *pos, unsigned int color, const float *uv)=0
Submit a vertex.
virtual void vertex(const float *pos, unsigned int color)=0
Submit a vertex.
virtual unsigned int areaToCol(unsigned int area)
Compute a color for given area.
Definition DebugDraw.cpp:30
virtual void depthMask(bool state)=0
virtual void end()=0
End drawing primitives.
virtual ~duDebugDraw()=0
Definition DebugDraw.cpp:25
virtual void texture(bool state)=0