21 #ifndef GLCOMPLEXPOLYGON_H
22 #define GLCOMPLEXPOLYGON_H
24 #include <tulip/OpenGlConfigManager.h>
38 #include <tulip/Color.h>
39 #include <tulip/Coord.h>
40 #include <tulip/tulipconf.h>
42 #include <tulip/GlSimpleEntity.h>
47 GLdouble x, y, z, r, g, b, a;
50 void CALLBACK beginCallback(GLenum which, GLvoid *polygonData);
51 void CALLBACK errorCallback(GLenum errorCode);
52 void CALLBACK endCallback(GLvoid *polygonData);
53 void CALLBACK vertexCallback(GLvoid *vertex, GLvoid *polygonData);
54 void CALLBACK combineCallback(GLdouble coords[3], VERTEX *d[4], GLfloat w[4], VERTEX** dataOut, GLvoid *polygonData);
103 friend void CALLBACK beginCallback(GLenum which, GLvoid *polygonData);
104 friend void CALLBACK errorCallback(GLenum errorCode);
105 friend void CALLBACK endCallback(GLvoid *polygonData);
106 friend void CALLBACK vertexCallback(GLvoid *vertex, GLvoid *polygonData);
107 friend void CALLBACK combineCallback(GLdouble coords[3], VERTEX *d[4], GLfloat w[4], VERTEX** dataOut, GLvoid *polygonData);
118 GlComplexPolygon(
const std::vector<Coord> &coords,Color fcolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
122 GlComplexPolygon(
const std::vector<Coord> &coords,Color fcolor,Color ocolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
126 GlComplexPolygon(
const std::vector<std::vector<Coord> >&coords,Color fcolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
130 GlComplexPolygon(
const std::vector<std::vector<Coord> >&coords,Color fcolor,Color ocolor,
int polygonEdgesType=0,
const std::string &textureName =
"");
137 virtual void draw(
float lod,Camera *camera);
142 void setOutlineMode(
const bool);
147 void setOutlineSize(
double size);
199 std::string getTextureName();
204 void setTextureName(
const std::string &name);
218 void activateQuadBorder(
const float borderWidth,
const Color &color,
const std::string &texture =
"",
const int position = 1,
219 const float texCoordFactor = 1.f,
const int polygonId = 0);
224 void desactivateQuadBorder(
const int polygonId = 0);
226 QStringList propertiesNames()
const;
228 QVariantList propertiesQVariant()
const;
230 void setProperty(
const QString &name,
const QVariant &value);
235 virtual void translate(
const Coord& mouvement);
240 virtual void getXML(std::string &outString);
245 virtual void getXMLOnlyData(std::string &outString);
250 virtual void setWithXML(
const std::string &inString,
unsigned int ¤tPosition);
252 const std::vector<std::vector<Coord> > &getPolygonSides()
const {
262 virtual void addPoint(
const Coord& point);
266 virtual void beginNewHole();
268 void runTesselation();
269 void createPolygon(
const std::vector<Coord> &coords,
int polygonEdgesType);
270 void startPrimitive(GLenum primitive);
272 void addVertex(
const Coord &vertexCoord,
const Vec2f &vertexTexCoord);
273 VERTEX *allocateNewVertex();
275 std::vector<std::vector<Coord> > points;
276 std::vector<std::vector<GLfloat> > pointsIdx;
277 std::set<GLenum> primitivesSet;
278 std::map<GLenum, std::vector<Coord> > verticesMap;
279 std::map<GLenum, std::vector<Vec2f> > texCoordsMap;
280 std::map<GLenum, std::vector<int> >startIndicesMap;
281 std::map<GLenum, std::vector<int> >verticesCountMap;
282 std::vector<VERTEX *> allocatedVertices;
283 GLenum currentPrimitive;
284 int nbPrimitiveVertices;
290 std::string textureName;
292 std::vector<bool> quadBorderActivated;
293 std::vector<float> quadBorderWidth;
294 std::vector<Color> quadBorderColor;
295 std::vector<std::string> quadBorderTexture;
296 std::vector<int> quadBorderPosition;
297 std::vector<float> quadBorderTexFactor;