7 #ifndef __draw_DrawCommon_h__ 8 #define __draw_DrawCommon_h__ 15 #define FE_DC_CIRCLE_SIDES 64 //* tweak 16 #define FE_DC_CYLINDER_MAXSLICES 16 //* tweak 18 #define FE_DC_BUFFER_VERTICES 100 //* reusable space vs new() 19 #define FE_DC_ICOSAHEDRON_VERTICES 26 //* don't tweak, includes repeats 37 void initialize(
void);
43 return m_spDrawMode; }
49 virtual void pushMatrix(MatrixMode a_mode,Real a_values[16]) {}
55 { m_brightness=a_brightness; }
59 { m_contrast=a_contrast; }
60 virtual Real
contrast(
void) {
return m_contrast; }
64 m_spViewI=spViewI.isValid()?
65 spViewI: m_spDefaultView; }
69 if(!m_spViewI.isValid())
71 if(!m_spDefaultView.isValid())
74 ->createDefaultView();
77 ->m_spViewI=m_spDefaultView;
84 const Real *radius,U32 vertices,
85 BWORD multicolor,
const Color *color);
96 virtual void drawBox(
const Box2& box,
const Color& color);
97 virtual void drawBox(
const Box2i& box,
const Color& color);
98 virtual void drawBox(
const Box3& box,
const Color& color);
108 const Color& color,U32 slices);
112 Real radius1,Real radius2,
113 const Color& color,U32 slices);
117 const Real *baseScale,
118 const U32* slices,U32 cylinders,
119 BWORD multicolor,
const Color* color);
121 virtual void drawTransformedCylinders(
125 const Real *baseScale,
126 const U32* slices,U32 cylinders,
127 BWORD multicolor,
const Color* color);
131 Real startangle,Real endangle,
134 virtual void drawTransformedPoints(
139 BWORD multicolor,
const Color *color);
140 virtual void drawTransformedPoints(
145 BWORD multicolor,
const Color *color,
148 virtual void drawTransformedLines(
153 U32 vertices,
StripMode strip,BWORD multicolor,
155 virtual void drawTransformedLines(
161 BWORD multicolor,
const Color *color,
162 BWORD multiradius,
const Real *radius,
163 const Vector3i *element,U32 elementCount,
166 virtual void drawTransformedCurve(
172 U32 vertices,BWORD multicolor,
175 virtual void drawTransformedTriangles(
180 const Vector2 *texture,U32 vertices,
183 virtual void drawTransformedTriangles(
188 const Vector2 *texture,U32 vertices,
199 virtual void drawTransformedBoxes(
206 virtual void drawAxes(Real scale);
210 virtual void drawMarker(Real radius,
const Color& color);
211 virtual void drawTransformedMarker(
213 Real radius,
const Color& color);
215 virtual BWORD
isDirect(
void)
const {
return TRUE; }
223 virtual BWORD
empty(
void)
const {
return TRUE; }
234 BWORD multicolor,
const Color *color);
237 BWORD multicolor,
const Color *color,
246 BWORD multicolor,
const Color *color,
247 BWORD multiradius,
const Real *radius,
248 const Vector3i *element,U32 elementCount,
252 const Vector2 *texture,U32 vertices,
257 const Vector2 *texture,U32 vertices,
266 BWORD multicolor,
const Color *color) {}
279 return style==DrawMode::e_defaultStyle?
280 (isDirect()? DrawMode::e_edgedSolid:
281 DrawMode::e_outline): style; }
284 {
return m_spDrawMode->textureImage(); }
285 I32 textureImageID(
void)
const 286 {
return m_spDrawMode->textureImageID(); }
287 Real pointSize(
void)
const 288 {
return m_spDrawMode->pointSize(); }
289 Real lineWidth(
void)
const 290 {
return m_spDrawMode->lineWidth(); }
291 BWORD antialias(
void)
const 292 {
return m_spDrawMode->antialias(); }
293 BWORD frontfaceCulling(
void)
const 294 {
return m_spDrawMode->frontfaceCulling(); }
295 BWORD backfaceCulling(
void)
const 296 {
return m_spDrawMode->backfaceCulling(); }
297 BWORD twoSidedLighting(
void)
const 298 {
return m_spDrawMode->twoSidedLighting(); }
299 BWORD zBuffering(
void)
const 300 {
return m_spDrawMode->zBuffering(); }
301 BWORD isLit(
void)
const 302 {
return m_spDrawMode.isValid() &&
303 m_spDrawMode->lit() &&
304 (drawStyle()==DrawMode::e_solid ||
305 drawStyle()==DrawMode::e_edgedSolid ||
306 drawStyle()==DrawMode::e_ghost); }
307 BWORD isUvSpace(
void)
const 308 {
return m_spDrawMode.isValid() &&
309 m_spDrawMode->uvSpace(); }
311 virtual void createDefaultView(
void);
320 void drawOrthogonalCircles(
326 void createCircle(
void);
327 void createIcosahedron(
void);
328 void createCylinders(
void);
329 void destroyCylinders(
void);
337 SpatialVector m_icosahedronVertex[FE_DC_ICOSAHEDRON_VERTICES];
338 SpatialVector m_icosahedronNormal[FE_DC_ICOSAHEDRON_VERTICES];
339 Vector2 m_icosahedronTexture[FE_DC_ICOSAHEDRON_VERTICES];
341 SpatialVector* m_pCylinderVertex[FE_DC_CYLINDER_MAXSLICES-2];
342 SpatialVector* m_pCylinderNormal[FE_DC_CYLINDER_MAXSLICES-2];
343 Vector2* m_pCylinderTexture[FE_DC_CYLINDER_MAXSLICES-2];
349 std::vector< sp<DrawMode> > m_drawStack;
virtual void setView(sp< ViewI > spViewI)
Set current view.
Definition: DrawCommon.h:62
Object level locking for thread safety.
Definition: Safe.h:216
virtual BWORD isDirect(void) const
Returns TRUE is display is local and rendered directly.
Definition: DrawCommon.h:215
Drawing functions not specific to the graphics language.
Definition: DrawCommon.h:32
Generalized drawing of points, lines, text, and basic triangles.
Definition: DrawI.h:20
virtual void flush(void)
Called once after each frame.
Definition: DrawCommon.h:220
kernel
Definition: namespace.dox:3
virtual void unbindVertexArray(void)
currently, sets vertex array to zero in OpenGL
Definition: DrawCommon.h:52
StripMode
Format of vertices for tri-stripping.
Definition: DrawI.h:26
virtual Real brightness(void)
get lightening
Definition: DrawCommon.h:56
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
virtual void pushMatrixState(void)
Push transform matrices.
Definition: DrawCommon.h:46
virtual void setDrawChain(sp< DrawI > a_spDrawI)
Set next DrawI in a chain.
Definition: DrawCommon.h:216
Special vector for color (RGBA)
Definition: Color.h:21
virtual Real contrast(void)
get light scaling
Definition: DrawCommon.h:60
N-dimensional axis-aligned bounding-box.
Definition: Box.h:18
virtual void pushMatrix(MatrixMode a_mode, Real a_values[16])
push a new 4x4 matrix on a particular stack
Definition: DrawCommon.h:49
Dense vector - size fixed by template.
Definition: Vector.h:19
virtual void setContrast(Real a_contrast)
set multiplicitive light scaling
Definition: DrawCommon.h:58
virtual void flushLive(void)
Pass on current input data as is.
Definition: DrawCommon.h:221
Automatically reference-counted string container.
Definition: String.h:128
virtual void popMatrixState(void)
Pop transform matrices.
Definition: DrawCommon.h:47
virtual BWORD empty(void) const
Returns TRUE if the current input queue is empty.
Definition: DrawCommon.h:223
virtual void popMatrix(MatrixMode a_mode)
pop the top 4x4 matrix from a particular stack
Definition: DrawCommon.h:50
virtual void setBrightness(Real a_brightness)
set additive lightening
Definition: DrawCommon.h:54
virtual void drawRectangles(const SpatialVector *vertex, U32 vertices, BWORD multicolor, const Color *color)
Draw rectangles.
Definition: DrawCommon.h:264
DrawStyle
Rendering schemes that an an implementation may recognize.
Definition: DrawMode.h:42
virtual sp< ViewI > view(void) const
Get current view.
Definition: DrawCommon.h:66
Copy-On-Write shared pointer.
Definition: Protectable.h:93
virtual void setTransform(const SpatialTransform &a_rTransform)
Impose a spatial translation.
Definition: DrawCommon.h:219
virtual sp< FontI > font(void)
Get current font.
Definition: DrawCommon.h:225
virtual void clearInput(void)
Reset the current input queue.
Definition: DrawCommon.h:222
virtual sp< DrawMode > drawMode(void) const
Get rendering mode.
Definition: DrawCommon.h:41
virtual void drawAlignedText(const SpatialVector &location, const String text, const Color &color)
Draw screen-aligned single color text.
Definition: DrawCommon.h:267
virtual Real multiplication(void)
Select the GL-specific index/handle.
Definition: DrawCommon.h:230