19 #ifndef GLCOMPLEXPOLYGON_H
20 #define GLCOMPLEXPOLYGON_H
26 #if defined(__APPLE__)
27 #include <OpenGL/gl.h>
28 #include <OpenGL/glu.h>
42 #include <tulip/Color.h>
43 #include <tulip/Coord.h>
44 #include <tulip/tulipconf.h>
45 #include <tulip/GlSimpleEntity.h>
50 GLdouble x, y, z, r, g, b, a;
53 void CALLBACK beginCallback(GLenum which, GLvoid *polygonData);
54 void CALLBACK errorCallback(GLenum errorCode);
55 void CALLBACK endCallback(GLvoid *polygonData);
56 void CALLBACK vertexCallback(GLvoid *vertex, GLvoid *polygonData);
57 void CALLBACK combineCallback(GLdouble coords[3], VERTEX *d[4], GLfloat w[4], VERTEX** dataOut, GLvoid *polygonData);
106 friend void CALLBACK beginCallback(GLenum which, GLvoid *polygonData);
107 friend void CALLBACK errorCallback(GLenum errorCode);
108 friend void CALLBACK endCallback(GLvoid *polygonData);
109 friend void CALLBACK vertexCallback(GLvoid *vertex, GLvoid *polygonData);
110 friend void CALLBACK combineCallback(GLdouble coords[3], VERTEX *d[4], GLfloat w[4], VERTEX** dataOut, GLvoid *polygonData);
121 GlComplexPolygon(
const std::vector<Coord> &coords,Color fcolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
125 GlComplexPolygon(
const std::vector<Coord> &coords,Color fcolor,Color ocolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
129 GlComplexPolygon(
const std::vector<std::vector<Coord> >&coords,Color fcolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
133 GlComplexPolygon(
const std::vector<std::vector<Coord> >&coords,Color fcolor,Color ocolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
140 virtual void draw(
float lod,Camera *camera);
145 void setOutlineMode(
const bool);
150 void setOutlineSize(
double size);
202 std::string getTextureName();
207 void setTextureName(
const std::string &name);
221 void activateQuadBorder(
const float borderWidth,
const Color &color,
const std::string &texture =
"",
const int position = 1,
222 const float texCoordFactor = 1.f,
const int polygonId = 0);
227 void desactivateQuadBorder(
const int polygonId = 0);
232 virtual void translate(
const Coord& mouvement);
237 virtual void getXML(std::string &outString);
242 virtual void getXMLOnlyData(std::string &outString);
247 virtual void setWithXML(
const std::string &inString,
unsigned int ¤tPosition);
249 const std::vector<std::vector<Coord> > &getPolygonSides()
const {
259 virtual void addPoint(
const Coord& point);
263 virtual void beginNewHole();
265 void runTesselation();
266 void createPolygon(
const std::vector<Coord> &coords,
int polygonEdgesType);
267 void startPrimitive(GLenum primitive);
269 void addVertex(
const Coord &vertexCoord,
const Vec2f &vertexTexCoord);
270 VERTEX *allocateNewVertex();
272 std::vector<std::vector<Coord> > points;
273 std::vector<std::vector<GLfloat> > pointsIdx;
274 std::set<GLenum> primitivesSet;
275 std::map<GLenum, std::vector<Coord> > verticesMap;
276 std::map<GLenum, std::vector<Vec2f> > texCoordsMap;
277 std::map<GLenum, std::vector<int> >startIndicesMap;
278 std::map<GLenum, std::vector<int> >verticesCountMap;
279 std::vector<VERTEX *> allocatedVertices;
280 GLenum currentPrimitive;
281 int nbPrimitiveVertices;
287 std::string textureName;
289 std::vector<bool> quadBorderActivated;
290 std::vector<float> quadBorderWidth;
291 std::vector<Color> quadBorderColor;
292 std::vector<std::string> quadBorderTexture;
293 std::vector<int> quadBorderPosition;
294 std::vector<float> quadBorderTexFactor;
Color getOutlineColor() const
Get outline color of GlComplexPolygon.
Base class for all Tulip OpenGL entities.
void setTextureZoom(float zoom)
Set the texture zoom factor.
Class to create a complex polygon (concave polygon or polygon with hole) If you want to create a comp...
Color getFillColor() const
Get fill color of GlComplexPolygon.
float getTextureZoom()
Get the texture zoom factor.
void setFillColor(const Color &color)
Set fill color of GlComplexPolygon.
void setOutlineColor(const Color &color)
Set outline color of GlComplexPolygon.
GlComplexPolygon()
Default constructor.