39 mDefaultEffect =
new Effect;
40 mDefaultEffect->shader()->enable(
EN_BLEND);
46 std::vector<dvec2> ln;
47 ln.push_back(
dvec2(x1,y1));
48 ln.push_back(
dvec2(x2,y2));
61 float u1 = 1.0f / mState.mImage->width() * 0.5f;
62 float u2 = 1.0f - 1.0f / mState.mImage->width() * 0.5f;
63 for(
size_t i=0; i<tex_array->
size(); i+=2)
65 tex_array->
at(i+0) =
fvec2(u1, 0);
66 tex_array->
at(i+1) =
fvec2(u2, 0);
82 generateLinearTexCoords(geom.
get());
94 generateLinearTexCoords(geom.
get());
106 generatePlanarTexCoords(geom.
get(), poly);
118 generatePlanarTexCoords(geom.
get(), triangles);
130 generatePlanarTexCoords(geom.
get(), fan);
142 generatePlanarTexCoords(geom.
get(), strip);
154 generateQuadsTexCoords(geom.
get(), quads);
166 generatePlanarTexCoords(geom.
get(), quad_strip);
175 std::vector<dvec2> pt;
176 pt.push_back(
dvec2(x,y));
184 pos_array->
resize(pt.size());
186 for(
unsigned i=0; i<pt.size(); ++i)
190 if (mState.mPointSize % 2 == 0)
192 pos_array->
at(i).
s() += 0.5;
193 pos_array->
at(i).
t() += 0.5;
206 std::vector<dvec2> points;
207 points.resize(segments);
208 for(
int i=0; i<segments; ++i)
210 double t = (double)i/(segments-1) *
dPi * 2.0 +
dPi * 0.5;
211 points[i] =
dvec2(
cos(t)*xaxis*0.5+origx,
sin(t)*yaxis*0.5+origy);
218 std::vector<dvec2> points;
219 points.resize(segments);
220 for(
int i=0; i<segments; ++i)
222 double t = (double)i/segments *
dPi * 2.0 +
dPi * 0.5;
223 points[i] =
dvec2(
cos(t)*xaxis*0.5+origx,
sin(t)*yaxis*0.5+origy);
230 std::vector<dvec2> quad;
231 quad.push_back(
dvec2(left,bottom));
232 quad.push_back(
dvec2(left,top));
233 quad.push_back(
dvec2(right,top));
234 quad.push_back(
dvec2(right,bottom));
240 std::vector<dvec2> quad;
241 quad.push_back(
dvec2(left,bottom));
242 quad.push_back(
dvec2(left,top));
243 quad.push_back(
dvec2(right,top));
244 quad.push_back(
dvec2(right,bottom));
248 generateQuadsTexCoords(geom.
get(), quad);
266 mMatrixStack.clear();
274 mVGToEffectMap.clear();
275 mImageToTextureMap.clear();
276 mRectToScissorMap.clear();
280 mMatrixStack.clear();
290 mVGToEffectMap.clear();
291 mImageToTextureMap.clear();
292 mRectToScissorMap.clear();
297 mMatrixStack.clear();
317 unsigned char solid_stipple[] = {
318 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
319 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
320 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
321 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
322 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
323 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
324 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
325 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF };
326 unsigned char hline_stipple[] = {
327 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
328 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
329 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
330 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
331 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
332 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
333 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,
334 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00 };
335 unsigned char vline_stipple[] = {
336 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
337 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
338 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
339 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
340 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
341 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
342 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
343 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA };
344 unsigned char chain_stipple[] = {
345 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
346 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55,
347 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
348 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55,
349 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
350 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55,
351 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA, 0xAA,0xAA,0xAA,0xAA,
352 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55, 0x55,0x55,0x55,0x55 };
353 unsigned char dot_stipple[] = {
354 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
355 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
356 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
357 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
358 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
359 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
360 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55,
361 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55, 0xAA,0xAA,0xAA,0xAA, 0x55,0x55,0x55,0x55 };
374 mState.mBlendFactorSrcRGB = src_rgb;
375 mState.mBlendFactorDstRGB = dst_rgb;
376 mState.mBlendFactorSrcAlpha = src_alpha;
377 mState.mBlendFactorDstAlpha = dst_alpha;
382 src_rgb = mState.mBlendFactorSrcRGB;
383 dst_rgb = mState.mBlendFactorDstRGB;
384 src_alpha = mState.mBlendFactorSrcAlpha;
385 dst_alpha = mState.mBlendFactorDstAlpha;
390 mState.mBlendEquationRGB = rgb_eq;
391 mState.mBlendEquationAlpha = alpha_eq;
396 rgb_eq = mState.mBlendEquationRGB;
397 alpha_eq = mState.mBlendEquationAlpha;
402 mState.mStencil_SFail = sfail;
403 mState.mStencil_DpFail = dpfail;
404 mState.mStencil_DpPass = dppass;
409 sfail = mState.mStencil_SFail;
410 dpfail = mState.mStencil_DpFail;
411 dppass = mState.mStencil_DpPass;
416 mState.mStencil_Function = func;
417 mState.mStencil_RefValue = refval;
418 mState.mStencil_FunctionMask = mask;
423 func = mState.mStencil_Function;
424 refval = mState.mStencil_RefValue;
425 mask = mState.mStencil_FunctionMask;
449 text->
setFont(mState.mFont.get());
476 if (!keep_effect || !actor->
effect())
478 if (transform !=
NULL)
480 return addActor(actor);
508 if (mMatrixStack.empty())
510 Log::error(
"VectorGraphics::popMatrix() matrix stack underflow!\n");
514 mMatrixStack.pop_back();
519 mStateStack.push_back(mState);
526 if (mStateStack.empty())
528 Log::error(
"VectorGraphics::popState() matrix stack underflow!\n");
531 mState = mStateStack.back();
532 mStateStack.pop_back();
537 mScissorStack.push_back(mScissor.get());
538 RectI newscissor = mScissor ? mScissor->scissorRect().intersected(
RectI(x,y,w,h)) :
RectI(x,y,w,h);
544 if (mScissorStack.empty())
546 Log::error(
"VectorGraphics::popScissor() scissor stack underflow!\n");
549 mScissor = mScissorStack.back();
550 mScissorStack.pop_back();
553 void VectorGraphics::generateQuadsTexCoords(
Geometry* geom,
const std::vector<dvec2>& points)
563 float du = 1.0f / mState.mImage->width() / 2.0f;
564 float dv = mState.mImage->height() ? (1.0f / mState.mImage->height() / 2.0f) : 0.5f;
570 for(
unsigned i=0; i<points.size(); ++i)
572 float s = texc[i%4].
s();
573 float t = texc[i%4].
t();
574 tex_array->
at(i).
s() = s;
575 tex_array->
at(i).
t() = t;
581 for(
unsigned i=0; i<points.size(); ++i)
583 for(
unsigned i=0; i<points.size(); ++i)
586 double s = (v.
s()-aabb.
minCorner().
s()) / (mState.mImage->width() );
587 double t = (v.
t()-aabb.
minCorner().
t()) / (mState.mImage->height());
588 tex_array->
at(i).
s() = (float)s;
589 tex_array->
at(i).
t() = (float)t;
595 void VectorGraphics::generatePlanarTexCoords(
Geometry* geom,
const std::vector<dvec2>& points)
608 for(
unsigned i=0; i<points.size(); ++i)
610 for(
unsigned i=0; i<points.size(); ++i)
612 float s = float((points[i].x() - aabb.
minCorner().
x()) / aabb.
width() );
614 tex_array->
at(i).
s() = s;
615 tex_array->
at(i).
t() = t;
621 for(
unsigned i=0; i<points.size(); ++i)
623 for(
unsigned i=0; i<points.size(); ++i)
626 double s = (v.
s()-aabb.
minCorner().
s()) / mState.mImage->width();
627 double t = (v.
t()-aabb.
minCorner().
t()) / mState.mImage->height();
628 tex_array->
at(i).
s() = (float)s;
629 tex_array->
at(i).
t() = (float)t;
635 void VectorGraphics::generateLinearTexCoords(
Geometry* geom)
641 float u1 = 1.0f / mState.mImage->width() * 0.5f;
642 float u2 = 1.0f - 1.0f / mState.mImage->width() * 0.5f;
643 for(
size_t i=0; i<tex_array->
size(); ++i)
645 float t = (float)i/(tex_array->
size()-1);
646 tex_array->
at(i).
s() = u1 * (1.0f-t) + u2 * t;
647 tex_array->
at(i).
t() = 0;
654 ref<Geometry> VectorGraphics::prepareGeometryPolyToTriangles(
const std::vector<dvec2>& ln)
658 pos_array->
resize( (ln.size()-2) * 3 );
660 for(
unsigned i=0, itri=0; i<ln.size()-2; ++i, itri+=3)
672 ref<Geometry> VectorGraphics::prepareGeometry(
const std::vector<dvec2>& ln)
676 pos_array->
resize(ln.size());
678 for(
unsigned i=0; i<ln.size(); ++i)
686 Scissor* VectorGraphics::resolveScissor(
int x,
int y,
int width,
int height)
691 scissor =
new Scissor(x,y,width,height);
694 return scissor.
get();
699 Texture* texture = mImageToTextureMap[ImageState(image,mState.mTextureMode)].get();
720 mImageToTextureMap[ImageState(image,mState.mTextureMode)] = texture;
727 Effect* effect = mVGToEffectMap[vgs].get();
732 mVGToEffectMap[vgs] = effect;
748 if ( vgs.mLineStipple != 0xFFFF )
750 #if defined(VL_OPENGL) 754 Log::error(
"vl::VectorGraphics: line stipple not supported under OpenGL ES. Try using a stipple texture instead.\n");
758 if (vgs.mLineWidth != 1.0f)
761 if (vgs.mPointSmoothing)
767 if (vgs.mLineSmoothing)
773 if (vgs.mPolygonSmoothing)
779 unsigned char solid_stipple[] = {
780 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
781 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
782 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
783 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
784 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
785 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
786 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,
787 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF
789 if ( memcmp(vgs.mPolyStipple, solid_stipple, 32*32/8) != 0 )
791 #if defined(VL_OPENGL) 795 Log::error(
"vl::VectorGraphics: polygon stipple not supported under OpenGL ES. Try using a stipple texture instead.\n");
800 shader->
gocBlendFunc()->
set(vgs.mBlendFactorSrcRGB, vgs.mBlendFactorDstRGB, vgs.mBlendFactorSrcAlpha, vgs.mBlendFactorDstAlpha);
807 if (vgs.mColorMask !=
ivec4(1,1,1,1) )
808 shader->
gocColorMask()->
set(vgs.mColorMask.r()?
true:
false,vgs.mColorMask.g()?
true:
false,vgs.mColorMask.b()?
true:
false,vgs.mColorMask.a()?
true:
false);
810 if (vgs.mStencilTestEnabled)
829 Log::error(
"GL_ARB_point_sprite not supported.\n");
Actor * drawEllipse(double origx, double origy, double xaxis, double yaxis, int segments=64)
Renders the outline of an ellipse.
Associates a Renderable object to an Effect and Transform.
void setPointSpriteCoordReplace(bool replace)
void setEffect(Effect *effect)
Binds an Effect to an Actor.
TexParameter * getTexParameter()
The TexParameter object associated to a Texture.
void setTexture(Texture *texture)
The texture sampler by a texture unit.
Actor * drawLine(double x1, double y1, double x2, double y2)
Renders a line starting a point <x1,y1> and ending at point <x2,y2>
const T_Scalar & t() const
Actor * fillQuads(const std::vector< dvec2 > &quads)
Renders a set of rectangles as defined by the OpenGL primitive GL_QUADS.
void set(EPolygonFace face, unsigned int mask)
const double dPi
Greek Pi constant using double precision.
const fvec4 & color() const
The current color. Note that the current color also modulates the currently active image...
void setPointSmoothHint(EHintMode mode)
Vector3< float > fvec3
A 3 components vector with float precision.
Vector2< double > dvec2
A 2 components vector with double precision.
LineWidth * gocLineWidth()
void setAutomaticDelete(bool autodel_on)
If set to true the Object is deleted when its reference count reaches 0.
void setLineSmoothHint(EHintMode mode)
void pushState()
Pushes the current VectorGraphics state (including the matrix state) in the state stack in order to r...
The texture is repeated over the primitive.
Actor * drawActor(Actor *actor, Transform *transform=NULL, bool keep_effect=false)
Draws the specified Actor with the specified Transform.
Vector4< float > fvec4
A 4 components vector with float precision.
StencilFunc * gocStencilFunc()
The RectI class represents a 2D rectangular area using int precision.
const T_Scalar & s() const
void pushMatrix()
Pushes the current matrix in the matrix stack in order to restore it later with popMatrix().
Matrix4< double > dmat4
A 4x4 matrix using double precision.
A Renderable that renders text with a given Font.
TextureSampler * gocTextureSampler(int unit_index)
void set(int factor, GLushort pattern)
const T_Scalar & s() const
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
void getStencilOp(EStencilOp &sfail, EStencilOp &dpfail, EStencilOp &dppass)
Current stencil operation.
If enabled, use the current polygon stipple pattern when rendering polygons, see also PolygonStipple...
void set(const unsigned char *mask)
If enabled, use the current lighting parameters to compute the vertex color; Otherwise, simply associate the current color with each vertex, see also Material, LightModel, and Light.
const ArrayAbstract * vertexArray() const
Conventional vertex array.
StencilOp * gocStencilOp()
void setText(const String &text)
If enabled, blend the incoming RGBA color values with the values in the color buffers, see also BlendFunc for more information.
void set(EBlendEquation mode_rgba)
The poligon is completely filled (default)
void endDrawing(bool release_cache=true)
Ends the rendering on a VectorGraphics and releases the resources used during the Actor generation pr...
void getBlendFunc(EBlendFactor &src_rgb, EBlendFactor &dst_rgb, EBlendFactor &src_alpha, EBlendFactor &dst_alpha) const
The current blending factor.
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
void setWrapT(ETexParamWrap texturewrap)
LineStipple * gocLineStipple()
void setPolygonSmoohtHint(EHintMode mode)
void set(EFunction alphafunc, float ref_value)
void setVertexArray(ArrayAbstract *data)
Conventional vertex array.
void setBlendFunc(EBlendFactor src_rgb, EBlendFactor dst_rgb, EBlendFactor src_alpha, EBlendFactor dst_alpha)
The current blending factor, see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendFunc.xml for more information.
Wraps an OpenGL texture object representing and managing all the supported texture types...
void setWrapS(ETexParamWrap texturewrap)
void setStencilOp(EStencilOp sfail, EStencilOp dpfail, EStencilOp dppass)
Current stencil operation, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilOp.xml for more information.
AlphaFunc * gocAlphaFunc()
PointSize * gocPointSize()
If enabled, draw points with proper filtering; Otherwise, draw aliased points, see also PointSize...
ELineStipple
Line stipple patterns.
virtual vec3 getAsVec3(size_t vector_index) const =0
Returns a vector from the buffer as a vec3 value.
void setStencilFunc(EFunction func, int refval, unsigned int mask)
The current stencil function, see also http://www.opengl.org/sdk/docs/man/xhtml/glStencilFunc.xml for more information.
If enabled, performs alpha testing, see also AlphaFunc for more information.
void popState()
Pops the top most state in the state stack and sets it as the current state.
The texture is stretched over the primitive.
size_t size() const
Returns the number of elements of an array.
Effect * currentEffect()
Returns the Effect representing the current VectorGraphic's state.
The Geometry class is a Renderable that implements a polygonal mesh made of polygons, lines and points.
void setScissor(int x, int y, int width, int height)
Defines the scissor box and enables the scissor test.
Visualization Library main namespace.
BlendEquation * gocBlendEquation()
Actor * fillTriangleStrip(const std::vector< dvec2 > &strip)
Renders a strip of triangles as defined by the OpenGL primitive GL_TRIANGLE_STRIP.
void set(EPolygonFace face, EFunction function, int refvalue, unsigned int mask)
Actor * drawLineStrip(const std::vector< dvec2 > &ln)
Renders a line passing through the points defined by 'ln'.
Actor * clearColor(const fvec4 &color, int x=0, int y=0, int w=-1, int h=-1)
Clears the specific area of the viewport.
Vector2< float > fvec2
A 2 components vector with float precision.
void set(float linewidth)
void setPolygonStipple(EPolygonStipple stipple)
The current polygon stipple, see also http://www.opengl.org/sdk/docs/man/xhtml/glPolygonStipple.xml for more information.
void setMinFilter(ETexParamFilter minfilter)
Actor * drawQuad(double left, double bottom, double right, double top)
Utility function that renders the outline of a quad.
Actor * drawPoints(const std::vector< dvec2 > &pt)
Renders a set of points using the currently set pointSize(), color() and image(). ...
void continueDrawing()
Continues the rendering on a VectorGraphics object.
Actor * fillTriangles(const std::vector< dvec2 > &triangles)
Renders a set of triangles. The 'triangles' parameters must contain N triplets of dvec2...
void popScissor()
Pops the top most scissor in the scissor stack and sets it as the current scissor.
void getBlendEquation(EBlendEquation &rgb_eq, EBlendEquation &alpha_eq) const
The current blend equation.
The AABB class implements an axis-aligned bounding box using vl::real precision.
Actor * fillTriangleFan(const std::vector< dvec2 > &fan)
Renders a triangle fan.
void translate(double x, double y, double z=0.0)
Translates the current transform matrix.
The line is completely filled (default)
void setClearColorValue(const fvec4 &clear_val)
real width() const
Returns the width of the AABB computed as max.x - min.x.
void setBorderColor(fvec4 bordercolor)
Actor * fillEllipse(double origx, double origy, double xaxis, double yaxis, int segments=64)
Renders an ellipse.
If enabled, draw lines with correct filtering; Otherwise, draw aliased lines, see also LineWidth...
Vector3< double > dvec3
A 3 components vector with double precision.
void addPoint(const vec3 &p, real radius)
Updates the AABB to contain the given point.
const T_Scalar & y() const
The Clear class is a Renderable used to clear the whole or a portion of the color, stencil or depth buffer.
void set(ELogicOp logicop)
void setTransform(Transform *transform)
Binds a Transform to an Actor.
void setLineStipple(ELineStipple stipple)
The current line stipple, see also http://www.opengl.org/sdk/docs/man/xhtml/glLineStipple.xml for more information.
void setMatrix(const dmat4 &matrix)
Sets the current transform matrix.
void clear()
Resets the VectorGraphics removing all the graphics objects and resetting its internal state...
void setTexCoordArray(int tex_unit, ArrayAbstract *data)
Conventional texture coords arrays.
If enabled, calculate texture coordinates for points based on texture environment and point parameter...
const T_Scalar & s() const
void scale(double x, double y, double z=1.0)
Scales the current transform matrix.
If enabled, apply the currently selected logical operation to the incoming RGBA color and color buffe...
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
void getStencilFunc(EFunction &func, int &refval, unsigned int &mask)
The current stencil function.
Actor * drawPoint(double x, double y)
Renders a single point. This is only an utility function. If you want to draw many points use drawPoi...
Actor * fillQuadStrip(const std::vector< dvec2 > &quad_strip)
Renders a set of rectangles as defined by the OpenGL primitive GL_QUAD_STRIP.
Actor * fillPolygon(const std::vector< dvec2 > &poly)
Renders a convex polygon whose corners are defined by 'poly'.
void set(float pointsize)
Shader * shader(int lodi=0, int pass=0)
Utility function, same as 'lod(lodi)->at(pass);'.
Actor * clearStencil(int clear_val, int x=0, int y=0, int w=-1, int h=-1)
Clears the specific area of the viewport.
Defines the sequence of Shader objects used to render an Actor.
const vec3 & minCorner() const
Returns the corner of the AABB with the minimum x y z coordinates.
static Matrix4 & getRotation(Matrix4 &out, double degrees, double x, double y, double z)
void setColor(const fvec4 &color)
T_VectorType & at(size_t i)
Effect * effect()
Returns the Effect bound to an Actor.
const dmat4 & matrix() const
Returns the current transform matrix.
void set(bool red, bool green, bool blue, bool alpha)
fvec3 vec3
Defined as: 'typedef fvec3 vec3'. See also VL_PIPELINE_PRECISION.
ColorMask * gocColorMask()
const T_Scalar & t() const
virtual size_t size() const =0
Returns the number of elements of an array.
void setClearColorBuffer(bool clear)
void popMatrix()
Pops the top most matrix in the matrix stack and sets it as the current matrix.
Actor * fillQuad(double left, double bottom, double right, double top)
Utility function that renders a single quad.
EPolygonStipple
Poligon stipple patterns.
static Matrix4 & getTranslation(Matrix4 &out, const Vector3< double > &v)
const T_Scalar & t() const
If enabled, do stencil testing and update the stencil buffer, see also StencilFunc and StencilOp...
BlendFunc * gocBlendFunc()
static Matrix4 & getScaling(Matrix4 &out, const Vector3< double > &v)
const T_Scalar & x() const
void setViewportAlignment(int align)
void setScissor(Scissor *scissor)
Sets the Scissor to be used when rendering an Actor.
const Scissor * scissor() const
Returns the currently active Scissor.
Implements a generic 1d, 2d, 3d and cubemap image that can have mipmaps.
virtual vec4 getAsVec4(size_t vector_index) const =0
Returns a vector from the buffer as a vec4 value.
The ref<> class is used to reference-count an Object.
const Font * font() const
void setFlatColor(const fvec4 &color)
The Scissor class wraps the OpenGL function glScissor(), see http://www.opengl.org/sdk/docs/man/xhtml...
Actor * drawLines(const std::vector< dvec2 > &ln)
Renders a set of lines. The 'ln' parameter shoud contain N pairs of dvec2. Each pair defines a line s...
Actor * drawLineLoop(const std::vector< dvec2 > &ln)
Renders a closed line passing through the points defined by 'ln'.
If enabled, draw polygons with proper filtering; Otherwise, draw aliased polygons; For correct antial...
const Image * image() const
The current image used to texture the rendered objects. Note that the current color also modulates th...
Wraps the OpenGL function glDrawArrays().
Actor * drawActorCopy(Actor *actor, Transform *transform=NULL)
Like drawActor() but instead of drawing the given actor creates a copy of it and draws that...
void setMagFilter(ETexParamFilter magfilter)
void setAlignment(int align)
Actor * drawText(Text *text)
Draw the specified Text object.
void setClearStencilBuffer(bool clear)
TexEnv * gocTexEnv(int unit_index)
void set(EPolygonFace face, EStencilOp sfail, EStencilOp dpfail, EStencilOp dppass)
void pushScissor(int x, int y, int w, int h)
Pushes the current scissor in the scissor stack in order to restore it later with popScissor() and ac...
void enable(EEnable capability)
void setMatrix(const fmat4 &matrix)
void rotate(double deg)
Performs a rotation of 'deg' degrees around the z axis.
void setClearStencilValue(int clear_val)
void set(EBlendFactor src_rgb, EBlendFactor dst_rgb, EBlendFactor src_alpha, EBlendFactor dst_alpha)
void setScissorBox(int x, int y, int w, int h)
Defines which portion of the rendering buffers should be cleared.
PolygonStipple * gocPolygonStipple()
If enabled, use the current line stipple pattern when drawing lines, see also LineStipple.
Collection< DrawCall > & drawCalls()
Returns the list of DrawCall objects bound to a Geometry.
void setBlendEquation(EBlendEquation rgb_eq, EBlendEquation alpha_eq)
The current blend equation, see also http://www.opengl.org/sdk/docs/man/xhtml/glBlendEquation.xml for more information.
StencilMask * gocStencilMask()
real height() const
Returns the height of the AABB computed as max.y - min.y.