00001 #ifndef __FTVectoriser__
00002 #define __FTVectoriser__
00003
00004
00005 #include "FTContour.h"
00006 #include "FTList.h"
00007 #include "FTPoint.h"
00008 #include "FTVector.h"
00009 #include "FTGL.h"
00010
00011
00012 #ifndef CALLBACK
00013 #define CALLBACK
00014 #endif
00015
00016
00017
00018
00019
00020 class FTGL_EXPORT FTTesselation
00021 {
00022 public:
00023
00024
00025
00026 FTTesselation( GLenum m)
00027 : meshType(m)
00028 {
00029 pointList.reserve( 128);
00030 }
00031
00032
00033
00034
00035 ~FTTesselation()
00036 {
00037 pointList.clear();
00038 }
00039
00040
00041
00042
00043 void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z)
00044 {
00045 pointList.push_back( FTPoint( x, y, z));
00046 }
00047
00048
00049
00050
00051 size_t PointCount() const { return pointList.size();}
00052
00053
00054
00055
00056 const FTPoint& Point( unsigned int index) const { return pointList[index];}
00057
00058
00059
00060
00061 GLenum PolygonType() const { return meshType;}
00062
00063 private:
00064
00065
00066
00067 typedef FTVector<FTPoint> PointVector;
00068 PointVector pointList;
00069
00070
00071
00072
00073 GLenum meshType;
00074 };
00075
00076
00077
00078
00079
00080 class FTGL_EXPORT FTMesh
00081 {
00082 typedef FTVector<FTTesselation*> TesselationVector;
00083 typedef FTList<FTPoint> PointList;
00084
00085 public:
00086
00087
00088
00089 FTMesh();
00090
00091
00092
00093
00094 ~FTMesh();
00095
00096
00097
00098
00099 void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
00100
00101
00102
00103
00104 const FTGL_DOUBLE* Combine( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
00105
00106
00107
00108
00109 void Begin( GLenum meshType);
00110
00111
00112
00113
00114 void End();
00115
00116
00117
00118
00119 void Error( GLenum e) { err = e;}
00120
00121
00122
00123
00124 unsigned int TesselationCount() const { return tesselationList.size();}
00125
00126
00127
00128
00129 const FTTesselation* Tesselation( unsigned int index) const;
00130
00131
00132
00133
00134 const PointList& TempPointList() const { return tempPointList;}
00135
00136
00137
00138
00139 GLenum Error() const { return err;}
00140
00141 private:
00142
00143
00144
00145 FTTesselation* currentTesselation;
00146
00147
00148
00149
00150 TesselationVector tesselationList;
00151
00152
00153
00154
00155 PointList tempPointList;
00156
00157
00158
00159
00160 GLenum err;
00161
00162 };
00163
00164 const FTGL_DOUBLE FTGL_FRONT_FACING = 1.0;
00165 const FTGL_DOUBLE FTGL_BACK_FACING = -1.0;
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178 class FTGL_EXPORT FTVectoriser
00179 {
00180 public:
00181
00182
00183
00184
00185
00186 FTVectoriser( const FT_GlyphSlot glyph);
00187
00188
00189
00190
00191 virtual ~FTVectoriser();
00192
00193
00194
00195
00196
00197
00198
00199 void MakeMesh( FTGL_DOUBLE zNormal = FTGL_FRONT_FACING);
00200
00201
00202
00203
00204 const FTMesh* GetMesh() const { return mesh;}
00205
00206
00207
00208
00209
00210
00211 size_t PointCount();
00212
00213
00214
00215
00216
00217
00218 size_t ContourCount() const { return ftContourCount;}
00219
00220
00221
00222
00223
00224
00225 const FTContour* Contour( unsigned int index) const;
00226
00227
00228
00229
00230
00231
00232
00233 size_t ContourSize( int c) const { return contourList[c]->PointCount();}
00234
00235
00236
00237
00238
00239
00240 int ContourFlag() const { return contourFlag;}
00241
00242 private:
00243
00244
00245
00246 void ProcessContours();
00247
00248
00249
00250
00251 FTContour** contourList;
00252
00253
00254
00255
00256 FTMesh* mesh;
00257
00258
00259
00260
00261 short ftContourCount;
00262
00263
00264
00265
00266 int contourFlag;
00267
00268
00269
00270
00271 FT_Outline outline;
00272 };
00273
00274
00275 #endif // __FTVectoriser__