28 #include "../maths/glc_plane.h"
29 #include "../maths/glc_geomtools.h"
38 , m_ExtrusionLenght(lenght)
51 , m_Points(other.m_Points)
52 , m_ExtrusionVector(other.m_ExtrusionVector)
53 , m_ExtrusionLenght(other.m_ExtrusionLenght)
54 , m_GivenFaceNormal(other.m_GivenFaceNormal)
163 const GLuint count=
m_Points.count();
164 for (GLuint i= 0; i < (count + 1); ++i)
166 face1Index.append(i % count);
168 vertices+= face1Vertices;
169 normals+= face1Normals;
170 Q_ASSERT(vertices.size() == normals.size());
180 const int offset= vertices.size() / 3;
181 const GLuint count=
m_Points.count();
182 for (GLuint i= 0; i < (count + 1); ++i)
184 face2Index.append(offset + (i % count));
186 vertices+= face2Vertices;
187 normals+= face2Normals;
188 Q_ASSERT(vertices.size() == normals.size());
196 const GLuint count=
m_Points.count();
197 GLuint offset1= vertices.size() / 3;
199 GLuint indexLenght= (facesNormals.size() / 3);
200 GLuint offset2= offset1 + indexLenght;
203 vertices+= facesVertices;
204 normals+= facesNormals;
206 for (GLuint face= 0; face < count; ++face)
209 GLuint startIndex1= offset1 + (face * 2);
210 GLuint startIndex2= offset2 + (indexLenght -1) - (face * 2);
211 faceIndex << startIndex1 << startIndex2 << (startIndex1 + 1) << (startIndex2 - 1);
225 baseFaceWire << baseFaceWire.at(0) << baseFaceWire.at(1) << baseFaceWire.at(2);
229 createdFaceWire << createdFaceWire.at(0) << createdFaceWire.at(1) << createdFaceWire.at(2);
234 for (
int i= 0; i < count; ++i)
237 edge[0]= baseFaceWire.at(i * 3);
238 edge[1]= baseFaceWire.at(i * 3 + 1);
239 edge[2]= baseFaceWire.at(i * 3 + 2);
241 edge[3]= createdFaceWire.at(((count - i) % count) * 3);
242 edge[4]= createdFaceWire.at(((count - i) % count) * 3 + 1);
243 edge[5]= createdFaceWire.at(((count - i) % count) * 3 + 2);
270 for (
int i= 3; i < count; ++i)
284 for (
int i= 0; i < count; ++i)
290 subject[(6 * i)]= static_cast<GLfloat>(normal.x());
291 subject[(6 * i) + 1]= static_cast<GLfloat>(normal.y());
292 subject[(6 * i) + 2]= static_cast<GLfloat>(normal.z());
295 subject[(6 * i) + 3]= static_cast<GLfloat>(normal.x());
296 subject[(6 * i) + 4]= static_cast<GLfloat>(normal.y());
297 subject[(6 * i) + 5]= static_cast<GLfloat>(normal.z());
308 for (
int i= count; i > 0; --i)
314 subject[(6 * index)]= static_cast<GLfloat>(normal.x());
315 subject[(6 * index) + 1]= static_cast<GLfloat>(normal.y());
316 subject[(6 * index) + 2]= static_cast<GLfloat>(normal.z());
319 subject[(6 * index) + 3]= static_cast<GLfloat>(normal.x());
320 subject[(6 * index) + 4]= static_cast<GLfloat>(normal.y());
321 subject[(6 * index) + 5]= static_cast<GLfloat>(normal.z());
332 for (
int i= 0; i < count; ++i)
335 subject[(3 * i)]= static_cast<GLfloat>(point.
x());
336 subject[(3 * i) + 1]= static_cast<GLfloat>(point.
y());
337 subject[(3 * i) + 2]= static_cast<GLfloat>(point.
z());
351 for (
int i= 0; i < count; ++i)
354 subject[i * 2]=
static_cast<GLfloat
>(texel.
x());
355 subject[i * 2 + 1]=
static_cast<GLfloat
>(texel.
y());
365 for (
int i= 0; i < count; ++i)
368 subject[(6 * i)]= static_cast<GLfloat>(point1.
x());
369 subject[(6 * i) + 1]= static_cast<GLfloat>(point1.
y());
370 subject[(6 * i) + 2]= static_cast<GLfloat>(point1.
z());
373 subject[(6 * i) + 3]= static_cast<GLfloat>(point2.x());
374 subject[(6 * i) + 4]= static_cast<GLfloat>(point2.y());
375 subject[(6 * i) + 5]= static_cast<GLfloat>(point2.z());
389 for (
int i= 0; i < count; ++i)
392 subject[i * 4]=
static_cast<GLfloat
>(texel1.
x());
393 subject[i * 4 + 1]=
static_cast<GLfloat
>(texel1.
y());
395 GLC_Point2d texel2= normalizePolygon.at((i + 1) % count);
396 subject[i * 4 + 2]=
static_cast<GLfloat
>(texel2.
x());
397 subject[i * 4 + 3]=
static_cast<GLfloat
>(texel2.
y());
407 for (
int i= 0; i < count; ++i)
422 QList<GLC_Point3d> subject;
423 for (
int i= 0; i < count; ++i)
425 subject.append(
m_Points.at((count -i) % count) + offset);
437 for (
int i= 0; i < count; ++i)
439 subject[(3 * i)]= static_cast<GLfloat>(normal.
x());
440 subject[(3 * i) + 1]= static_cast<GLfloat>(normal.
y());
441 subject[(3 * i) + 2]= static_cast<GLfloat>(normal.
z());
451 const int count= points.count();
453 for (
int i= 0; i < count; ++i)
456 subject[(3 * i)]= static_cast<GLfloat>(point.
x());
457 subject[(3 * i) + 1]= static_cast<GLfloat>(point.
y());
458 subject[(3 * i) + 2]= static_cast<GLfloat>(point.
z());
472 for (
int i= 0; i < count; ++i)
475 subject[i * 2]=
static_cast<GLfloat
>(texel.
x());
476 subject[i * 2 + 1]=
static_cast<GLfloat
>(texel.
y());
486 const int count= points.count();
488 for (
int i= 0; i < count; ++i)
491 subject[(6 * i)]= static_cast<GLfloat>(point1.
x());
492 subject[(6 * i) + 1]= static_cast<GLfloat>(point1.
y());
493 subject[(6 * i) + 2]= static_cast<GLfloat>(point1.
z());
496 subject[(6 * i) + 3]= static_cast<GLfloat>(point2.x());
497 subject[(6 * i) + 4]= static_cast<GLfloat>(point2.y());
498 subject[(6 * i) + 5]= static_cast<GLfloat>(point2.z());
513 for (
int i= 0; i < count; ++i)
516 subject[i * 4]=
static_cast<GLfloat
>(texel1.
x());
517 subject[i * 4 + 1]=
static_cast<GLfloat
>(texel1.
y());
519 GLC_Point2d texel2= normalizePolygon.at((i + 1) % count);
520 subject[i * 4 + 2]=
static_cast<GLfloat
>(texel2.
x());
521 subject[i * 4 + 3]=
static_cast<GLfloat
>(texel2.
y());