OctahedronPolygon.cpp   OctahedronPolygon.cpp 
skipping to change at line 269 skipping to change at line 269
{ {
qWarning() << "Tesselator error:" << QString::fromAscii((char*)glues ErrorString(errno)); qWarning() << "Tesselator error:" << QString::fromAscii((char*)glues ErrorString(errno));
Q_ASSERT(0); Q_ASSERT(0);
} }
void vertexTrianglesCallback(Vec3d* vertexData, OctTessTrianglesCallbackDat a* userData) void vertexTrianglesCallback(Vec3d* vertexData, OctTessTrianglesCallbackDat a* userData)
{ {
userData->result.append(*vertexData); userData->result.append(*vertexData);
} }
void noOpCallback(GLboolean flag) {;} void noOpCallback(GLboolean) {;}
void combineTrianglesCallback(double coords[3], Vec3d* vertex_data[4], GLfl oat weight[4], Vec3d** outData, OctTessTrianglesCallbackData* userData) void combineTrianglesCallback(double coords[3], Vec3d*[4], GLfloat[4], Vec3 d** outData, OctTessTrianglesCallbackData* userData)
{ {
// Check that the new coordinate lay on the octahedron plane // Check that the new coordinate lay on the octahedron plane
Q_ASSERT(coords[2]<0.000001); Q_ASSERT(coords[2]<0.000001);
userData->tempVertices.append(Vec3d(coords[0], coords[1], coords[2]) ); userData->tempVertices.append(Vec3d(coords[0], coords[1], coords[2]) );
*outData = &(userData->tempVertices.last()); *outData = &(userData->tempVertices.last());
} }
#ifndef NDEBUG
void checkBeginTrianglesCallback(GLenum type) void checkBeginTrianglesCallback(GLenum type)
{ {
Q_ASSERT(type==GL_TRIANGLES); Q_ASSERT(type==GL_TRIANGLES);
} }
#endif
QVector<Vec3d> OctahedronPolygon::tesselateOneSideTriangles(GLUEStesselator * tess, int sidenb) const QVector<Vec3d> OctahedronPolygon::tesselateOneSideTriangles(GLUEStesselator * tess, int sidenb) const
{ {
const QVector<SubContour>& contours = sides[sidenb]; const QVector<SubContour>& contours = sides[sidenb];
Q_ASSERT(!contours.isEmpty()); Q_ASSERT(!contours.isEmpty());
OctTessTrianglesCallbackData data; OctTessTrianglesCallbackData data;
gluesTessNormal(tess, 0.,0., (sidenb%2==0 ? -1. : 1.)); gluesTessNormal(tess, 0.,0., (sidenb%2==0 ? -1. : 1.));
gluesTessBeginPolygon(tess, &data); gluesTessBeginPolygon(tess, &data);
for (int c=0;c<contours.size();++c) for (int c=0;c<contours.size();++c)
{ {
skipping to change at line 460 skipping to change at line 462
void vertexLineLoopCallback(EdgeVertex* vertexData, OctTessLineLoopCallback Data* userData) void vertexLineLoopCallback(EdgeVertex* vertexData, OctTessLineLoopCallback Data* userData)
{ {
Q_ASSERT(vertexData->vertex[2]<0.0000001); Q_ASSERT(vertexData->vertex[2]<0.0000001);
if (userData->result.isEmpty() || !tooClose(userData->result.last(). vertex, vertexData->vertex)) if (userData->result.isEmpty() || !tooClose(userData->result.last(). vertex, vertexData->vertex))
userData->result.append(*vertexData); userData->result.append(*vertexData);
else else
userData->result.last().edgeFlag = userData->result.last().e dgeFlag && vertexData->edgeFlag; userData->result.last().edgeFlag = userData->result.last().e dgeFlag && vertexData->edgeFlag;
} }
void combineLineLoopCallback(double coords[3], EdgeVertex* vertex_data[4], GLfloat weight[4], EdgeVertex** outData, OctTessLineLoopCallbackData* userD ata) void combineLineLoopCallback(double coords[3], EdgeVertex* vertex_data[4], GLfloat[4], EdgeVertex** outData, OctTessLineLoopCallbackData* userData)
{ {
bool newFlag=false; bool newFlag=false;
//qDebug() << "Combine data" << coords[0] << coords[1] << coords[2]; //qDebug() << "Combine data" << coords[0] << coords[1] << coords[2];
for (int i=0;i<4;++i) for (int i=0;i<4;++i)
{ {
if (vertex_data[i]==NULL) if (vertex_data[i]==NULL)
break; break;
//qDebug() << "Vertex " << i << dd->vertex.toString() << wei ght[i]; //qDebug() << "Vertex " << i << dd->vertex.toString() << wei ght[i];
newFlag = newFlag || vertex_data[i]->edgeFlag; newFlag = newFlag || vertex_data[i]->edgeFlag;
} }
// Check that the new coordinate lay on the octahedron plane // Check that the new coordinate lay on the octahedron plane
// Q_ASSERT(fabs(fabs(coords[0])+fabs(coords[1])+fabs(coords[2])-1.)<0. 000001); // Q_ASSERT(fabs(fabs(coords[0])+fabs(coords[1])+fabs(coords[2])-1.)<0. 000001);
Q_ASSERT(coords[2]<0.000001); Q_ASSERT(coords[2]<0.000001);
userData->tempVertices.append(EdgeVertex(Vec3d(coords[0], coords[1], coords[2]),newFlag)); userData->tempVertices.append(EdgeVertex(Vec3d(coords[0], coords[1], coords[2]),newFlag));
*outData = &(userData->tempVertices.last()); *outData = &(userData->tempVertices.last());
} }
#ifndef NDEBUG
void checkBeginLineLoopCallback(GLenum type) void checkBeginLineLoopCallback(GLenum type)
{ {
Q_ASSERT(type==GL_LINE_LOOP); Q_ASSERT(type==GL_LINE_LOOP);
} }
#endif
void endLineLoopCallback(OctTessLineLoopCallbackData* data) void endLineLoopCallback(OctTessLineLoopCallbackData* data)
{ {
// Store the finished contour and prepare for the next one // Store the finished contour and prepare for the next one
if (data->result.size()>2) if (data->result.size()>2)
data->resultList.append(data->result); data->resultList.append(data->result);
data->result.clear(); data->result.clear();
} }
void OctahedronPolygon::tesselate(TessWindingRule windingRule) void OctahedronPolygon::tesselate(TessWindingRule windingRule)
skipping to change at line 803 skipping to change at line 807
static const OctahedronPolygon poly = createAllSkyOctahedronPolygon( ); static const OctahedronPolygon poly = createAllSkyOctahedronPolygon( );
return poly; return poly;
} }
QDataStream& operator<<(QDataStream& out, const OctahedronPolygon& p) QDataStream& operator<<(QDataStream& out, const OctahedronPolygon& p)
{ {
for (int i=0;i<8;++i) for (int i=0;i<8;++i)
{ {
out << p.sides[i]; out << p.sides[i];
} }
out << p.fillCachedVertexArray;
out << p.outlineCachedVertexArray;
out << p.capN;
out << p.capD;
return out; return out;
} }
QDataStream& operator>>(QDataStream& in, OctahedronPolygon& p) QDataStream& operator>>(QDataStream& in, OctahedronPolygon& p)
{ {
for (int i=0;i<8;++i) for (int i=0;i<8;++i)
{ {
in >> p.sides[i]; in >> p.sides[i];
} }
//p.tesselate(OctahedronPolygon::WindingPositive); in >> p.fillCachedVertexArray;
p.updateVertexArray(); in >> p.outlineCachedVertexArray;
//Q_ASSERT(p.checkAllTrianglesPositive()); in >> p.capN;
in >> p.capD;
return in; return in;
} }
 End of changes. 9 change blocks. 
6 lines changed or deleted 16 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/