Refactored variable names Removed Point() Added docs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
diff --git a/include/FTVectoriser.h b/include/FTVectoriser.h
index 0db74a6..8f127ed 100644
--- a/include/FTVectoriser.h
+++ b/include/FTVectoriser.h
@@ -149,7 +149,6 @@ class FTGL_EXPORT FTMesh
void End();
void Error( GLenum e) { err = e;}
- FTGL_DOUBLE* Point();
int size() const;
/**
@@ -157,19 +156,25 @@ class FTGL_EXPORT FTMesh
*/
GLenum Error() const { return err;}
+ /**
+ * Holds extra points created by gluTesselator. See ftglCombine.
+ */
typedef FTVector<FTPoint> PointVector;
- PointVector tempPool;
+ PointVector tempPointList;
+ /**
+ * Holds each sub mesh that comprises this glyph.
+ */
typedef FTVector<FTTesselation*> TesselationVector;
- TesselationVector tess;
+ TesselationVector tesselationList;
protected:
private:
/**
- * The list of points in this mesh
+ * The current sub mesh that we are constructing.
*/
- FTTesselation* tempTess;
+ FTTesselation* currentTesselation;
/**
* GL ERROR returned by the glu tesselator
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index 2c746bc..b11d89c 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -42,62 +42,57 @@ void CALLBACK ftglEnd( FTMesh* mesh)
void CALLBACK ftglCombine( FTGL_DOUBLE coords[3], void* vertex_data[4], GLfloat weight[4], void** outData, FTMesh* mesh)
{
FTGL_DOUBLE* vertex = (FTGL_DOUBLE*)coords;
- mesh->tempPool.push_back( FTPoint( vertex[0], vertex[1], vertex[2]));
+ mesh->tempPointList.push_back( FTPoint( vertex[0], vertex[1], vertex[2]));
- *outData = &mesh->tempPool[ mesh->tempPool.size() - 1].x;
+ *outData = &mesh->tempPointList[ mesh->tempPointList.size() - 1].x;
}
FTMesh::FTMesh()
: err(0)
{
- tess.reserve( 16);
- tempPool.reserve( 128);
+ tesselationList.reserve( 16);
+ tempPointList.reserve( 128);
}
FTMesh::~FTMesh()
{
- for( size_t t = 0; t < tess.size(); ++t)
+ for( size_t t = 0; t < tesselationList.size(); ++t)
{
- delete tess[t];
+ delete tesselationList[t];
}
- tess.clear();
+ tesselationList.clear();
- tempPool.clear();
+ tempPointList.clear();
}
void FTMesh::AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
{
- tempTess->AddPoint( x, y, z);
+ currentTesselation->AddPoint( x, y, z);
}
void FTMesh::Begin( GLenum m)
{
- tempTess = new FTTesselation;
- tempTess->meshType = m;
+ currentTesselation = new FTTesselation;
+ currentTesselation->meshType = m;
}
void FTMesh::End()
{
- tess.push_back( tempTess);
-}
-
-
-FTGL_DOUBLE* FTMesh::Point()
-{
- return &tempTess->pointList[ tempTess->size() - 1].x;
+ tesselationList.push_back( currentTesselation);
}
int FTMesh::size() const
{
int s = 0;
- for( size_t t = 0; t < tess.size(); ++t)
+ for( size_t t = 0; t < tesselationList.size(); ++t)
{
- s += tess[t]->size();
+ s += tesselationList[t]->size();
+// FIXME What the hell is this for?
++s;
}
return s;
@@ -378,22 +373,22 @@ void FTVectoriser::GetMesh( FTGL_DOUBLE* data)
int i = 0;
// fill out the header
- size_t msize = mesh->tess.size();
+ size_t msize = mesh->tesselationList.size();
data[0] = msize;
for( int p = 0; p < data[0]; ++p)
{
- FTTesselation* tess = mesh->tess[p];
- size_t tSize = tess->pointList.size();
- int tType = tess->meshType;
+ FTTesselation* tesselation = mesh->tesselationList[p];
+ size_t tSize = tesselation->pointList.size();
+ int tType = tesselation->meshType;
data[i+1] = tType;
data[i+2] = tSize;
i += 3;
- for( size_t q = 0; q < ( tess->pointList.size()); ++q)
+ for( size_t q = 0; q < ( tesselation->pointList.size()); ++q)
{
- data[i] = tess->pointList[q].x / 64.0f; // is 64 correct?
- data[i + 1] = tess->pointList[q].y / 64.0f;
+ data[i] = tesselation->pointList[q].x / 64.0f; // is 64 correct?
+ data[i + 1] = tesselation->pointList[q].y / 64.0f;
data[i + 2] = 0.0f; // static_cast<FTGL_DOUBLE>(mesh->pointList[p].z / 64.0f);
i += 3;
}