tlp::GlComplexPolygon Class Reference
[GlEntities]
#include <GlComplexPolygon.h>
List of all members.
Public Member Functions
- GlComplexPolygon ()
- GlComplexPolygon (const std::vector< Coord > &coords, Color fcolor, int polygonEdgesType=0, const std::string &textureName="")
- GlComplexPolygon (const std::vector< Coord > &coords, Color fcolor, Color ocolor, int polygonEdgesType=0, const std::string &textureName="")
- GlComplexPolygon (const std::vector< std::vector< Coord > > &coords, Color fcolor, int polygonEdgesType=0, const std::string &textureName="")
- GlComplexPolygon (const std::vector< std::vector< Coord > > &coords, Color fcolor, Color ocolor, int polygonEdgesType=0, const std::string &textureName="")
- virtual ~GlComplexPolygon ()
- virtual void draw (float lod, Camera *camera)
- void setOutlineMode (const bool)
- void setOutlineSize (double size)
- Color getFillColor ()
- void setFillColor (const Color &color)
- Color getOutlineColor ()
- void setOutlineColor (const Color &color)
- float getTextureZoom ()
- std::string getTextureName ()
- void setTextureName (const std::string &name)
- void setTextureZoom (float zoom)
- void activateQuadBorder (const float borderWidth, const Color &color, const std::string &texture="", const int position=1, const float texCoordFactor=1.f, const int polygonId=0)
- void desactivateQuadBorder (const int polygonId=0)
- virtual void translate (const Coord &mouvement)
- virtual void getXML (xmlNodePtr rootNode)
- virtual void getXMLOnlyData (xmlNodePtr rootNode)
- virtual void setWithXML (xmlNodePtr rootNode)
Protected Member Functions
Protected Attributes
Friends
Detailed Description
Class to create a complex polygon (concave polygon or polygon with hole) If you want to create a complex polygon you have 4 constructors : Constructors with vector of coords : to create a complex polygon without hole
- In this case you have two constructor : with and without outline color
- You can create a polygon like this :
vector <Coord> coords;
coords.push_back(Coord(0,0,0));
coords.push_back(Coord(10,0,0));
coords.push_back(Coord(10,10,0));
coords.push_back(Coord(0,10,0));
GlComplexPolygon *complexPolygon=new GlComplexPolygon(coords,Color(255,0,0,255));
layer->addGlEntity(complexPolygon,"complexPolygon");
Constructors with vector of vector of Coords : to create a complex polygon with hole
- In this case you have two constructor : with and without outline color
- The first vector of coords is the polygon and others vector are holes
- You can create a polygon with hole like this :
vector <vector <Coord> > coords;
vector <Coord> polygon;
vector <Coord> hole;
polygon.push_back(Coord(0,0,0));
polygon.push_back(Coord(10,0,0));
polygon.push_back(Coord(10,10,0));
polygon.push_back(Coord(0,10,0));
hole.push_back(Coord(4,4,0));
hole.push_back(Coord(6,4,0));
hole.push_back(Coord(6,6,0));
hole.push_back(Coord(4,6,0));
coords.push_back(polygon);
coords.push_back(hole);
GlComplexPolygon *complexPolygon=new GlComplexPolygon(coords,Color(255,0,0,255));
layer->addGlEntity(complexPolygon,"complexPolygon");
In constructors you can specify the polygon border style : polygonEdgesType parameter (0 -> straight lines, 1 -> catmull rom curves, 2 -> bezier curves) You can also specify the texture name if you want to create a textured complex polygon
In complex polygon you can add a smooth border : see activateQuadBorder(..) function And you can specify the texture zoom : see setTextureZoom(...) function
Constructor & Destructor Documentation
tlp::GlComplexPolygon::GlComplexPolygon |
( |
|
) |
[inline] |
Default constructor
- Warning:
- don't use this constructor if you want to create a complex polygon, see others constructors
tlp::GlComplexPolygon::GlComplexPolygon |
( |
const std::vector< Coord > & |
coords, |
|
|
Color |
fcolor, |
|
|
int |
polygonEdgesType = 0 , |
|
|
const std::string & |
textureName = "" | |
|
) |
| | |
Constructor with a vector of coords, a fill color, a polygon edges type(0 -> straight lines, 1 -> catmull rom curves, 2 -> bezier curves) and a textureName if you want
tlp::GlComplexPolygon::GlComplexPolygon |
( |
const std::vector< Coord > & |
coords, |
|
|
Color |
fcolor, |
|
|
Color |
ocolor, |
|
|
int |
polygonEdgesType = 0 , |
|
|
const std::string & |
textureName = "" | |
|
) |
| | |
Constructor with a vector of coords, a fill color, an outline color, a polygon edges type(0 -> straight lines, 1 -> catmull rom curves, 2 -> bezier curves) and a textureName if you want
tlp::GlComplexPolygon::GlComplexPolygon |
( |
const std::vector< std::vector< Coord > > & |
coords, |
|
|
Color |
fcolor, |
|
|
int |
polygonEdgesType = 0 , |
|
|
const std::string & |
textureName = "" | |
|
) |
| | |
Constructor with a vector of vector of coords (the first vector of coord is the polygon and others vectors are holes in polygon), a fill color, a polygon edges type(0 -> straight lines, 1 -> catmull rom curves, 2 -> bezier curves) and a textureName if you want
tlp::GlComplexPolygon::GlComplexPolygon |
( |
const std::vector< std::vector< Coord > > & |
coords, |
|
|
Color |
fcolor, |
|
|
Color |
ocolor, |
|
|
int |
polygonEdgesType = 0 , |
|
|
const std::string & |
textureName = "" | |
|
) |
| | |
Constructor with a vector of vector of coords (the first vector of coord is the polygon and others vectors are holes in polygon), a fill color, an outline color a polygon edges type(0 -> straight lines, 1 -> catmull rom curves, 2 -> bezier curves) and a textureName if you want
virtual tlp::GlComplexPolygon::~GlComplexPolygon |
( |
|
) |
[inline, virtual] |
Member Function Documentation
void tlp::GlComplexPolygon::activateQuadBorder |
( |
const float |
borderWidth, |
|
|
const Color & |
color, |
|
|
const std::string & |
texture = "" , |
|
|
const int |
position = 1 , |
|
|
const float |
texCoordFactor = 1.f , |
|
|
const int |
polygonId = 0 | |
|
) |
| | |
Draw a thick (textured) border around the polygon. The graphic card must support geometry shader to make this feature to work. The position parameter determines the way the border is drawn (depending on the polygon points ordering):
- 0 : the border is drawn outside (or inside) the polygon
- 1 : the border is centered on the polygon outline
- 2 : the border is drawn inside (or outside) the polygon
The texCoordFactor parameter determines the way the texture is applied : if < 1, the texture will be expanded and > 1, the texture will be compressed The polygonId parameter determines on which contour of the polygon, the border will be applied
virtual void tlp::GlComplexPolygon::addPoint |
( |
const Coord & |
point |
) |
[protected, virtual] |
Add a new point in polygon
void tlp::GlComplexPolygon::addVertex |
( |
const Coord & |
vertexCoord, |
|
|
const Vec2f & |
vertexTexCoord | |
|
) |
| | [protected] |
VERTEX* tlp::GlComplexPolygon::allocateNewVertex |
( |
|
) |
[protected] |
virtual void tlp::GlComplexPolygon::beginNewHole |
( |
|
) |
[protected, virtual] |
Begin a new hole in the polygon
void tlp::GlComplexPolygon::createPolygon |
( |
const std::vector< Coord > & |
coords, |
|
|
int |
polygonEdgesType | |
|
) |
| | [protected] |
void tlp::GlComplexPolygon::desactivateQuadBorder |
( |
const int |
polygonId = 0 |
) |
|
Desactivate the textured quad border
virtual void tlp::GlComplexPolygon::draw |
( |
float |
lod, |
|
|
Camera * |
camera | |
|
) |
| | [virtual] |
void tlp::GlComplexPolygon::endPrimitive |
( |
|
) |
[protected] |
Color tlp::GlComplexPolygon::getFillColor |
( |
|
) |
[inline] |
Color tlp::GlComplexPolygon::getOutlineColor |
( |
|
) |
[inline] |
std::string tlp::GlComplexPolygon::getTextureName |
( |
|
) |
|
float tlp::GlComplexPolygon::getTextureZoom |
( |
|
) |
[inline] |
Get the texture zoom factor
virtual void tlp::GlComplexPolygon::getXML |
( |
xmlNodePtr |
rootNode |
) |
[virtual] |
virtual void tlp::GlComplexPolygon::getXMLOnlyData |
( |
xmlNodePtr |
rootNode |
) |
[virtual] |
Function to export data in XML
void tlp::GlComplexPolygon::runTesselation |
( |
|
) |
[protected] |
void tlp::GlComplexPolygon::setFillColor |
( |
const Color & |
color |
) |
[inline] |
void tlp::GlComplexPolygon::setOutlineColor |
( |
const Color & |
color |
) |
[inline] |
void tlp::GlComplexPolygon::setOutlineMode |
( |
const |
bool |
) |
|
Set if the polygon is outlined or not
void tlp::GlComplexPolygon::setOutlineSize |
( |
double |
size |
) |
|
void tlp::GlComplexPolygon::setTextureName |
( |
const std::string & |
name |
) |
|
void tlp::GlComplexPolygon::setTextureZoom |
( |
float |
zoom |
) |
[inline] |
Set the texture zoom factor By default if you have a polygon with a size bigger than (1,1,0) the texture will be repeated If you want to don't have this texture repeat you have to modify texture zoom For example if you have a polygon with coords ((0,0,0),(5,0,0),(5,5,0),(0,5,0)) you can set texture zoom to 5. to don't have texture repeat
virtual void tlp::GlComplexPolygon::setWithXML |
( |
xmlNodePtr |
rootNode |
) |
[virtual] |
void tlp::GlComplexPolygon::startPrimitive |
( |
GLenum |
primitive |
) |
[protected] |
virtual void tlp::GlComplexPolygon::translate |
( |
const Coord & |
mouvement |
) |
[virtual] |
Friends And Related Function Documentation
void CALLBACK beginCallback |
( |
GLenum |
which, |
|
|
GLvoid * |
polygonData | |
|
) |
| | [friend] |
void CALLBACK combineCallback |
( |
GLdouble |
coords[3], |
|
|
VERTEX * |
d[4], |
|
|
GLfloat |
w[4], |
|
|
VERTEX ** |
dataOut, |
|
|
GLvoid * |
polygonData | |
|
) |
| | [friend] |
void CALLBACK endCallback |
( |
GLvoid * |
polygonData |
) |
[friend] |
void CALLBACK errorCallback |
( |
GLenum |
errorCode |
) |
[friend] |
void CALLBACK vertexCallback |
( |
GLvoid * |
vertex, |
|
|
GLvoid * |
polygonData | |
|
) |
| | [friend] |
Member Data Documentation
|