Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
VectorGraphics.hpp
Go to the documentation of this file.
1 /**************************************************************************************/
2 /* */
3 /* Visualization Library */
4 /* http://visualizationlibrary.org */
5 /* */
6 /* Copyright (c) 2005-2020, Michele Bosi */
7 /* All rights reserved. */
8 /* */
9 /* Redistribution and use in source and binary forms, with or without modification, */
10 /* are permitted provided that the following conditions are met: */
11 /* */
12 /* - Redistributions of source code must retain the above copyright notice, this */
13 /* list of conditions and the following disclaimer. */
14 /* */
15 /* - Redistributions in binary form must reproduce the above copyright notice, this */
16 /* list of conditions and the following disclaimer in the documentation and/or */
17 /* other materials provided with the distribution. */
18 /* */
19 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
20 /* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
21 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
22 /* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
23 /* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
24 /* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
25 /* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
26 /* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
27 /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
28 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
29 /* */
30 /**************************************************************************************/
31 
32 #ifndef VectorGraphics_INCLUDE_ONCE
33 #define VectorGraphics_INCLUDE_ONCE
34 
35 #include <vlVG/link_config.hpp>
36 #include <vlCore/Image.hpp>
38 #include <vlGraphics/Actor.hpp>
39 #include <vlGraphics/Text.hpp>
41 #include <vlGraphics/Effect.hpp>
43 #include <vlGraphics/Clear.hpp>
44 #include <vlGraphics/Scissor.hpp>
45 #include <vlGraphics/Geometry.hpp>
47 
48 namespace vl
49 {
51  typedef enum
52  {
57  } ETextureMode;
58 
60  typedef enum
61  {
69 
71  typedef enum
72  {
81  } ELineStipple;
82 
83 //-------------------------------------------------------------------------------------------------------------------------------------------
84 // VectorGraphics
85 //-------------------------------------------------------------------------------------------------------------------------------------------
107  {
109 
110  private:
111  //------------------------------------------------------------------------- start internal
113  class ImageState
114  {
115  public:
116  ImageState(const Image* img, ETextureMode mode): mImage(img), mTextureMode(mode) {}
117 
118  bool operator<(const ImageState& other) const
119  {
120  if (mImage != other.mImage)
121  return mImage < other.mImage;
122  else
123  if (mTextureMode != other.mTextureMode)
124  return mTextureMode < other.mTextureMode;
125  else
126  return false;
127  }
128  protected:
129  const Image* mImage;
130  ETextureMode mTextureMode;
131  };
132  //------------------------------------------------------------------------- start internal
134  class State
135  {
136  public:
137  State()
138  {
139  mColor = white;
140  mPointSize = 5;
141  mImage = NULL;
142  mTextureMode = TextureMode_Clamp;
143  mLogicOp = LO_COPY;
144  mPointSmoothing= true;
145  mLineSmoothing = true;
146  mPolygonSmoothing = false;
147  mLineWidth = 1.0;
148  mLineStipple = 0xFFFF;
149  memset(mPolyStipple, 0xFF, 32*32/8);
150 
151  // blend equation
152  mBlendEquationRGB = BE_FUNC_ADD;
153  mBlendEquationAlpha = BE_FUNC_ADD;
154  // blend factor
155  mBlendFactorSrcRGB = BF_SRC_ALPHA;
156  mBlendFactorDstRGB = BF_ONE_MINUS_SRC_ALPHA;
157  mBlendFactorSrcAlpha = BF_SRC_ALPHA;
158  mBlendFactorDstAlpha = BF_ONE_MINUS_SRC_ALPHA;
159  // alpha func
160  mAlphaFuncRefValue = 0.0f;
161  mAlphaFunc = FU_ALWAYS;
162  // font
163  mFont = defFontManager()->acquireFont("/font/bitstream-vera/VeraMono.ttf", 10, false);
164  // masks
165  /*mDepthMask = true;*/
166  mColorMask = ivec4(1,1,1,1);
167  // stencil
168  mStencilMask = 0xFFFFFFFF;
169  mStencilTestEnabled = false;
170  mStencil_SFail = SO_KEEP;
171  mStencil_SFail = SO_KEEP;
172  mStencil_DpFail = SO_KEEP;
173  mStencil_Function = FU_ALWAYS;
174  mStencil_RefValue = 0;
175  mStencil_FunctionMask = ~(unsigned int)0;
176  }
177 
178  fvec4 mColor;
179  int mPointSize;
180  ref<Image> mImage;
181  ETextureMode mTextureMode;
182  ELogicOp mLogicOp;
183  float mLineWidth;
184  bool mPointSmoothing;
185  bool mLineSmoothing;
186  bool mPolygonSmoothing;
187  unsigned short mLineStipple;
188  unsigned char mPolyStipple[32*32/8];
189  EBlendEquation mBlendEquationRGB;
190  EBlendEquation mBlendEquationAlpha;
191  EBlendFactor mBlendFactorSrcRGB;
192  EBlendFactor mBlendFactorDstRGB;
193  EBlendFactor mBlendFactorSrcAlpha;
194  EBlendFactor mBlendFactorDstAlpha;
195  float mAlphaFuncRefValue;
196  EFunction mAlphaFunc;
197  ref<Font> mFont;
198  /*bool mDepthMask;*/
199  ivec4 mColorMask;
200  // stencil
201  bool mStencilTestEnabled;
202  unsigned int mStencilMask;
203  EStencilOp mStencil_SFail;
204  EStencilOp mStencil_DpFail;
205  EStencilOp mStencil_DpPass;
206  EFunction mStencil_Function;
207  int mStencil_RefValue;
208  unsigned int mStencil_FunctionMask;
209 
210  bool operator<(const State& other) const
211  {
212  // lexicographic sorting
213  if (mColor.r() != other.mColor.r())
214  return mColor.r() < other.mColor.r();
215  else
216  if (mColor.g() != other.mColor.g())
217  return mColor.g() < other.mColor.g();
218  else
219  if (mColor.b() != other.mColor.b())
220  return mColor.b() < other.mColor.b();
221  else
222  if (mColor.a() != other.mColor.a())
223  return mColor.a() < other.mColor.a();
224  else
225  if(mPointSize != other.mPointSize)
226  return mPointSize < other.mPointSize;
227  else
228  if(mImage != other.mImage)
229  return mImage < other.mImage;
230  else
231  if (mTextureMode != other.mTextureMode)
232  return mTextureMode < other.mTextureMode;
233  else
234  if (mPolygonSmoothing != other.mPolygonSmoothing)
235  return mPolygonSmoothing < other.mPolygonSmoothing;
236  else
237  if (mPointSmoothing!= other.mPointSmoothing)
238  return mPointSmoothing < other.mPointSmoothing;
239  else
240  if (mLineSmoothing!= other.mLineSmoothing)
241  return mLineSmoothing < other.mLineSmoothing;
242  else
243  if (mLineWidth != other.mLineWidth)
244  return mLineWidth < other.mLineWidth;
245  else
246  if (mLineStipple != other.mLineStipple)
247  return mLineStipple < other.mLineStipple;
248  else
249  if (mLogicOp != other.mLogicOp)
250  return mLogicOp < other.mLogicOp;
251  else
252  if ( memcmp(mPolyStipple, other.mPolyStipple, 32*32/8) != 0 )
253  return memcmp(mPolyStipple, other.mPolyStipple, 32*32/8) < 0;
254  else
255  if ( mBlendEquationRGB != other.mBlendEquationRGB)
256  return mBlendEquationRGB < other.mBlendEquationRGB;
257  else
258  if ( mBlendEquationAlpha != other.mBlendEquationAlpha)
259  return mBlendEquationAlpha < other.mBlendEquationAlpha;
260  else
261  if ( mBlendFactorSrcRGB != other.mBlendFactorSrcRGB)
262  return mBlendFactorSrcRGB < other.mBlendFactorSrcRGB;
263  else
264  if ( mBlendFactorDstRGB != other.mBlendFactorDstRGB)
265  return mBlendFactorDstRGB < other.mBlendFactorDstRGB;
266  else
267  if ( mBlendFactorSrcAlpha != other.mBlendFactorSrcAlpha)
268  return mBlendFactorSrcAlpha < other.mBlendFactorSrcAlpha;
269  else
270  if ( mBlendFactorDstAlpha != other.mBlendFactorDstAlpha)
271  return mBlendFactorDstAlpha < other.mBlendFactorDstAlpha;
272  else
273  if ( mAlphaFuncRefValue != other.mAlphaFuncRefValue)
274  return mAlphaFuncRefValue < other.mAlphaFuncRefValue;
275  else
276  if ( mAlphaFunc != other.mAlphaFunc)
277  return mAlphaFunc < other.mAlphaFunc;
278  else
279  if ( mFont != other.mFont)
280  return mFont < other.mFont;
281  else
282  /*if ( mDepthMask != other.mDepthMask)
283  return mDepthMask < other.mDepthMask;
284  else*/
285  if ( mColorMask.r() != other.mColorMask.r())
286  return mColorMask.r() < other.mColorMask.r();
287  else
288  if ( mColorMask.g() != other.mColorMask.g())
289  return mColorMask.g() < other.mColorMask.g();
290  else
291  if ( mColorMask.b() != other.mColorMask.b())
292  return mColorMask.b() < other.mColorMask.b();
293  else
294  if ( mColorMask.a() != other.mColorMask.a())
295  return mColorMask.a() < other.mColorMask.a();
296  else
297  if ( mStencilMask != other.mStencilMask)
298  return mStencilMask < other.mStencilMask;
299  else
300  if ( mStencilTestEnabled != other.mStencilTestEnabled)
301  return mStencilTestEnabled < other.mStencilTestEnabled;
302  else
303  if ( mStencil_SFail != other.mStencil_SFail )
304  return mStencil_SFail < other.mStencil_SFail;
305  else
306  if ( mStencil_DpFail != other.mStencil_DpFail )
307  return mStencil_DpFail < other.mStencil_DpFail;
308  else
309  if ( mStencil_DpPass != other.mStencil_DpPass )
310  return mStencil_DpPass < other.mStencil_DpPass;
311  else
312  if ( mStencil_Function != other.mStencil_Function )
313  return mStencil_Function < other.mStencil_Function;
314  else
315  if ( mStencil_RefValue != other.mStencil_RefValue )
316  return mStencil_RefValue < other.mStencil_RefValue;
317  else
318  if ( mStencil_FunctionMask != other.mStencil_FunctionMask )
319  return mStencil_FunctionMask < other.mStencil_FunctionMask;
320  else
321  return false;
322  }
323  };
324  //------------------------------------------------------------------------- end internal
325 
326  public:
327  VectorGraphics();
328 
330  const ActorCollection* actors() const { return &mActors; }
331 
333  ActorCollection* actors() { return &mActors; }
334 
336  Actor* drawLine(double x1, double y1, double x2, double y2);
337 
339  Actor* drawLines(const std::vector<dvec2>& ln);
340 
342  Actor* drawLineStrip(const std::vector<dvec2>& ln);
343 
345  Actor* drawLineLoop(const std::vector<dvec2>& ln);
346 
348  Actor* fillPolygon(const std::vector<dvec2>& poly);
349 
351  Actor* fillTriangles(const std::vector<dvec2>& triangles);
352 
354  Actor* fillTriangleFan(const std::vector<dvec2>& fan);
355 
357  Actor* fillTriangleStrip(const std::vector<dvec2>& strip);
358 
360  Actor* fillQuads(const std::vector<dvec2>& quads);
361 
363  Actor* fillQuadStrip(const std::vector<dvec2>& quad_strip);
364 
366  Actor* drawPoint(double x, double y);
367 
369  Actor* drawPoints(const std::vector<dvec2>& pt);
370 
372  Actor* drawEllipse(double origx, double origy, double xaxis, double yaxis, int segments = 64);
373 
375  Actor* fillEllipse(double origx, double origy, double xaxis, double yaxis, int segments = 64);
376 
378  Actor* drawQuad(double left, double bottom, double right, double top);
379 
381  Actor* fillQuad(double left, double bottom, double right, double top);
382 
385  void startDrawing() { clear(); }
386 
389  void continueDrawing();
390 
393  void endDrawing(bool release_cache=true);
394 
396  void clear();
397 
399  void setColor(const fvec4& color) { mState.mColor = color; }
400 
402  const fvec4& color() const { return mState.mColor; }
403 
405  void setPointSize(int size) { mState.mPointSize = size; }
406 
408  int pointSize() const { return mState.mPointSize; }
409 
411  void setImage(Image* image) { mState.mImage = image; }
412 
414  const Image* image() const { return mState.mImage.get(); }
415 
417  Image* image() { return mState.mImage.get(); }
418 
420  void setPoint(Image* image) { setImage(image); setPointSize(image->width()); }
421 
423  void setTextureMode(ETextureMode mode) { mState.mTextureMode = mode; }
424 
426  ETextureMode textureMode() const { return mState.mTextureMode; }
427 
429  void setLogicOp(ELogicOp op) { mState.mLogicOp = op; }
430 
432  ELogicOp logicOp() const { return mState.mLogicOp; }
433 
435  void setLineWidth(float width) { mState.mLineWidth = width; }
436 
438  float lineWidth() const { return mState.mLineWidth; }
439 
441  void setPointSmoothing(bool smooth) { mState.mPointSmoothing = smooth; }
442 
444  bool pointSmoothing() const { return mState.mPointSmoothing; }
445 
447  void setLineSmoothing(bool smooth) { mState.mLineSmoothing = smooth; }
448 
450  bool lineSmoothing() const { return mState.mLineSmoothing; }
451 
453  void setPolygonSmoothing(bool smooth) { mState.mPolygonSmoothing = smooth; }
454 
456  bool polygonSmoothing() const { return mState.mPolygonSmoothing; }
457 
459  void setLineStipple(ELineStipple stipple) ;
460 
462  void setLineStipple(unsigned short stipple) { mState.mLineStipple = stipple; }
463 
465  unsigned short lineStipple() const { return mState.mLineStipple; }
466 
468  void setPolygonStipple(EPolygonStipple stipple);
469 
471  void setPolygonStipple(unsigned char* stipple) { memcpy(mState.mPolyStipple, stipple, 32*32/8); }
472 
474  const unsigned char* polygonStipple() const { return mState.mPolyStipple; }
475 
477  unsigned char* polygonStipple() { return mState.mPolyStipple; }
478 
480  void setAlphaFunc(EFunction func, float ref_value) { mState.mAlphaFuncRefValue=ref_value; mState.mAlphaFunc=func; }
481 
483  void getAlphaFunc(EFunction& func, float& ref_value) const { ref_value=mState.mAlphaFuncRefValue; func=mState.mAlphaFunc; }
484 
486  void setBlendFunc(EBlendFactor src_rgb, EBlendFactor dst_rgb, EBlendFactor src_alpha, EBlendFactor dst_alpha);
487 
489  void getBlendFunc(EBlendFactor& src_rgb, EBlendFactor& dst_rgb, EBlendFactor& src_alpha, EBlendFactor& dst_alpha) const;
490 
492  void setBlendEquation( EBlendEquation rgb_eq, EBlendEquation alpha_eq );
493 
495  void getBlendEquation( EBlendEquation& rgb_eq, EBlendEquation& alpha_eq ) const;
496 
498  void setColorMask(bool r, bool g, bool b, bool a) { mState.mColorMask = ivec4(r?1:0,g?1:0,b?1:0,a?1:0); }
499 
501  const ivec4& colorMask() const { return mState.mColorMask; }
502 
503  /*void setDetphMask(bool mask) { mState.mDepthMask = mask; }
504  bool depthMask() const { return mState.mDepthMask; }*/
505 
507  void setStencilTestEnabled(bool enabled) { mState.mStencilTestEnabled = enabled; }
508 
510  bool stencilTestEnabled() const { return mState.mStencilTestEnabled; }
511 
513  void setStencilMask(unsigned int mask) { mState.mStencilMask = mask; }
514 
516  unsigned int stencilMask() const { return mState.mStencilMask; }
517 
519  void setStencilOp(EStencilOp sfail, EStencilOp dpfail, EStencilOp dppass);
520 
522  void getStencilOp(EStencilOp& sfail, EStencilOp& dpfail, EStencilOp& dppass);
523 
525  void setStencilFunc(EFunction func, int refval, unsigned int mask);
526 
528  void getStencilFunc(EFunction& func, int& refval, unsigned int& mask);
529 
531  void setFont(const String& name, int size, bool smooth=false) { mState.mFont = defFontManager()->acquireFont(name,size,smooth); }
532 
534  void setFont(const Font* font) { setFont(font->filePath(),font->size(),font->smooth()); }
535 
537  void setDefaultFont() { setFont(defFontManager()->acquireFont("/font/bitstream-vera/VeraMono.ttf", 10, false)); }
538 
540  const Font* font() const { return mState.mFont.get(); }
541 
546  void setScissor(int x, int y, int width, int height)
547  {
548  mScissor = resolveScissor(x,y,width,height);
549  }
550 
552  const Scissor* scissor() const { return mScissor.get(); }
553 
556  {
557  mScissor = NULL;
558  }
559 
564  Actor* clearColor(const fvec4& color, int x=0, int y=0, int w=-1, int h=-1);
565 
570  Actor* clearStencil(int clear_val, int x=0, int y=0, int w=-1, int h=-1);
571 
573  Actor* drawText(Text* text);
574 
577  Actor* drawText(int x, int y, const String& text, int alignment = AlignBottom|AlignLeft);
578 
580  Actor* drawText(const String& text, int alignment = AlignBottom|AlignLeft);
581 
585  Actor* drawActor(Actor* actor, Transform* transform=NULL, bool keep_effect=false);
586 
589  Actor* drawActorCopy(Actor* actor, Transform* transform=NULL);
590 
592  const dmat4& matrix() const { return mMatrix; }
593 
595  void setMatrix(const dmat4& matrix) { mMatrix = matrix; }
596 
598  void resetMatrix() { mMatrix.setIdentity(); }
599 
601  void rotate(double deg);
602 
604  void translate(double x, double y, double z=0.0);
605 
607  void scale(double x, double y, double z=1.0);
608 
610  void pushMatrix() { mMatrixStack.push_back(matrix()); }
611 
613  void popMatrix();
614 
616  const std::vector<dmat4>& matrixStack() const { return mMatrixStack; }
617 
619  void pushState();
620 
622  void popState();
623 
624  /*const std::vector<State>& stateStack() const { return mStateStack; }*/
625 
629  void pushScissor(int x, int y, int w, int h);
630 
632  void popScissor();
633 
635  const std::vector< ref<Scissor> >& scissorStack() const { return mScissorStack; }
636 
638  void setTransform(Transform* transform) { for(size_t i=0; i<actors()->size(); ++i) actors()->at(i)->setTransform(transform); }
639 
641  Effect* currentEffect() { return currentEffect(mState); }
642 
643  private:
644  void generateQuadsTexCoords(Geometry* geom, const std::vector<dvec2>& points);
645 
646  void generatePlanarTexCoords(Geometry* geom, const std::vector<dvec2>& points);
647 
648  void generateLinearTexCoords(Geometry* geom);
649 
650  ref<Geometry> prepareGeometry(const std::vector<dvec2>& ln);
651 
652  ref<Geometry> prepareGeometryPolyToTriangles(const std::vector<dvec2>& ln);
653 
654  Scissor* resolveScissor(int x, int y, int width, int height);
655 
656  Texture* resolveTexture(const Image* image);
657 
658  Effect* currentEffect(const State& vgs);
659 
660  Actor* addActor(Actor* actor) ;
661 
662  private:
663  // state-machine state variables
664  State mState;
665  dmat4 mMatrix;
666  ref<Scissor> mScissor;
667  std::vector<State> mStateStack;
668  std::vector<dmat4> mMatrixStack;
669  std::vector< ref<Scissor> > mScissorStack;
670  // state-machine state map
671  std::map<State, ref<Effect> > mVGToEffectMap;
672  std::map<ImageState, ref<Texture> > mImageToTextureMap;
673  std::map<RectI, ref<Scissor> > mRectToScissorMap;
674  ref<Effect> mDefaultEffect;
675  ActorCollection mActors;
676  };
677 //-------------------------------------------------------------------------------------------------------------------------------------------
678 }
679 
680 #endif
void setLineSmoothing(bool smooth)
The current line smoothing mode.
Associates a Renderable object to an Effect and Transform.
Definition: Actor.hpp:130
int pointSize() const
The current point size.
unsigned short lineStipple() const
The current line stipple.
const fvec4 & color() const
The current color. Note that the current color also modulates the currently active image...
Implements a 4x4 matrix transform used to define the position and orientation of an Actor...
Definition: Transform.hpp:72
bool pointSmoothing() const
The current point smoothing mode.
bool lineSmoothing() const
The current line smoothing mode.
The texture is repeated over the primitive.
ActorCollection * actors()
Returns the list of Actor[s] generated by a VectorGraphics object.
void pushMatrix()
Pushes the current matrix in the matrix stack in order to restore it later with popMatrix().
void setColor(const fvec4 &color)
The current color. Note that the current color also modulates the currently active image...
A Renderable that renders text with a given Font.
Definition: Text.hpp:50
void setLineWidth(float width)
The current line width, see also http://www.opengl.org/sdk/docs/man/xhtml/glLineWidth.xml for more information.
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
Definition: String.hpp:62
void startDrawing()
Starts the drawing process.
A font to be used with a Text renderable.
Definition: Font.hpp:127
void setPointSmoothing(bool smooth)
The current point smoothing mode.
const T_Scalar & r() const
Definition: Vector4.hpp:112
void setFont(const Font *font)
Sets the current Font.
Font * acquireFont(const String &font, int size, bool smooth=false)
Creates or returns an already created Font.
Definition: FontManager.cpp:68
bool polygonSmoothing() const
The current polygon smoothing mode.
void setPolygonStipple(unsigned char *stipple)
The current polygon stipple.
The poligon is completely filled (default)
const unsigned char * polygonStipple() const
The current polygon stipple.
void removeScissor()
Disables the Scissor test and clipping.
Wraps an OpenGL texture object representing and managing all the supported texture types...
Definition: Texture.hpp:178
void setStencilMask(unsigned int mask)
Current stencil mask, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilMask.xml for more information.
void resetMatrix()
Resets the current transform matrix.
ETextureMode textureMode() const
The current texture mode.
ELineStipple
Line stipple patterns.
void setPointSize(int size)
The current point size.
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
Definition: TypeInfo.hpp:122
EStencilOp
The texture is stretched over the primitive.
unsigned int stencilMask() const
Current stencil mask.
void setPolygonSmoothing(bool smooth)
The current polygon smoothing mode.
const Font * font() const
Returns the current Font.
void setPoint(Image *image)
Utility function equivalent to &#39;setImage(image); setPointSize(image->width());&#39;.
Effect * currentEffect()
Returns the Effect representing the current VectorGraphic&#39;s state.
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
Definition: Geometry.hpp:66
void setScissor(int x, int y, int width, int height)
Defines the scissor box and enables the scissor test.
void getAlphaFunc(EFunction &func, float &ref_value) const
The current alpha function.
Visualization Library main namespace.
int size() const
The size of the font.
Definition: Font.hpp:167
float lineWidth() const
The current line width.
void setImage(Image *image)
The current image used to texture the rendered objects. Note that the current color also modulates th...
const T_Scalar & g() const
Definition: Vector4.hpp:113
Vector4< int > ivec4
A 4 components vector with int precision.
Definition: Vector4.hpp:276
The line is completely filled (default)
const std::vector< ref< Scissor > > & scissorStack() const
Returns the scissor stack.
The base class for all the reference counted objects.
Definition: Object.hpp:158
void setStencilTestEnabled(bool enabled)
If set to &#39;true&#39; the stencil test and operations will be enabled.
int width() const
Definition: Image.hpp:207
EBlendFactor
const std::vector< dmat4 > & matrixStack() const
Returns the matrix stack.
void setLineStipple(unsigned short stipple)
The current line stipple.
const String & filePath() const
The font&#39;s file path.
Definition: Font.hpp:161
void setMatrix(const dmat4 &matrix)
Sets the current transform matrix.
EBlendEquation
const ivec4 & colorMask() const
The current color mask.
void setAlphaFunc(EFunction func, float ref_value)
The current alpha function, see also http://www.opengl.org/sdk/docs/man/xhtml/glAlphaFunc.xml for more information.
const T_Scalar & b() const
Definition: Vector4.hpp:114
void setTransform(Transform *transform)
Binds the given Transform to all the Actor[s] that have been generated so far.
#define NULL
Definition: OpenGLDefs.hpp:81
const ActorCollection * actors() const
Returns the list of Actor[s] generated by a VectorGraphics object.
unsigned char * polygonStipple()
The current polygon stipple.
Defines the sequence of Shader objects used to render an Actor.
Definition: Effect.hpp:91
void setColorMask(bool r, bool g, bool b, bool a)
The current color mask, see also http://www.opengl.org/sdk/docs/man/xhtml/glColorMask.xml for more information.
Defined as a simple subclass of Collection<Actor>, see Collection for more information.
Definition: Actor.hpp:479
const dmat4 & matrix() const
Returns the current transform matrix.
bool smooth() const
Whether the font rendering should use linear filtering or not.
Definition: Font.hpp:179
EPolygonStipple
Poligon stipple patterns.
void setLogicOp(ELogicOp op)
The current logic operation, see also http://www.opengl.org/sdk/docs/man/xhtml/glLogicOp.xml for more information.
void setDefaultFont()
Sets the default Font.
ELogicOp logicOp() const
The current logic operation.
const Scissor * scissor() const
Returns the currently active Scissor.
Implements a generic 1d, 2d, 3d and cubemap image that can have mipmaps.
Definition: Image.hpp:54
The ref<> class is used to reference-count an Object.
Definition: Object.hpp:55
The VectorGraphics class is used in conjuction with SceneManagerVectorGraphics to generate and render...
The Scissor class wraps the OpenGL function glScissor(), see http://www.opengl.org/sdk/docs/man/xhtml...
Definition: Scissor.hpp:47
void setFont(const String &name, int size, bool smooth=false)
Sets the current Font.
void setTextureMode(ETextureMode mode)
The current texture mode.
bool stencilTestEnabled() const
If set to &#39;true&#39; the stencil test and operations will be enabled.
const Image * image() const
The current image used to texture the rendered objects. Note that the current color also modulates th...
Image * image()
The current image used to texture the rendered objects. Note that the current color also modulates th...
ETextureMode
Defines how the texture is applied to the rendering primitive.
VLGRAPHICS_EXPORT FontManager * defFontManager()
Returns the default FontManager used by Visualization Library.
Definition: pimpl.cpp:43
const T_Scalar & a() const
Definition: Vector4.hpp:115