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);
229 QStringList propertiesNames()
const;
231 QVariantList propertiesQVariant()
const;
233 void setProperty(
const QString &name,
const QVariant &value);
238 virtual void translate(
const Coord& mouvement);
243 virtual void getXML(std::string &outString);
248 virtual void getXMLOnlyData(std::string &outString);
253 virtual void setWithXML(
const std::string &inString,
unsigned int ¤tPosition);
255 const std::vector<std::vector<Coord> > &getPolygonSides()
const {
265 virtual void addPoint(
const Coord& point);
269 virtual void beginNewHole();
271 void runTesselation();
272 void createPolygon(
const std::vector<Coord> &coords,
int polygonEdgesType);
273 void startPrimitive(GLenum primitive);
275 void addVertex(
const Coord &vertexCoord,
const Vec2f &vertexTexCoord);
276 VERTEX *allocateNewVertex();
278 std::vector<std::vector<Coord> > points;
279 std::vector<std::vector<GLfloat> > pointsIdx;
280 std::set<GLenum> primitivesSet;
281 std::map<GLenum, std::vector<Coord> > verticesMap;
282 std::map<GLenum, std::vector<Vec2f> > texCoordsMap;
283 std::map<GLenum, std::vector<int> >startIndicesMap;
284 std::map<GLenum, std::vector<int> >verticesCountMap;
285 std::vector<VERTEX *> allocatedVertices;
286 GLenum currentPrimitive;
287 int nbPrimitiveVertices;
293 std::string textureName;
295 std::vector<bool> quadBorderActivated;
296 std::vector<float> quadBorderWidth;
297 std::vector<Color> quadBorderColor;
298 std::vector<std::string> quadBorderTexture;
299 std::vector<int> quadBorderPosition;
300 std::vector<float> quadBorderTexFactor;