Back to index

extremetuxracer  0.5beta
FTVectoriser.h
Go to the documentation of this file.
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 
00020 class FTGL_EXPORT FTTesselation
00021 {
00022     public:
00026         FTTesselation( GLenum m)
00027         :     meshType(m)
00028         {
00029             pointList.reserve( 128);
00030         }
00031 
00035         ~FTTesselation()
00036         {
00037             pointList.clear();
00038         }
00039 
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 
00051         size_t PointCount() const { return pointList.size();}
00052         
00056         const FTPoint& Point( unsigned int index) const { return pointList[index];}
00057         
00061         GLenum PolygonType() const { return meshType;}
00062         
00063     private:
00067         typedef FTVector<FTPoint> PointVector;
00068         PointVector pointList;
00069 
00073         GLenum meshType;
00074 };
00075 
00076 
00080 class FTGL_EXPORT FTMesh
00081 {
00082        typedef FTVector<FTTesselation*> TesselationVector;
00083        typedef FTList<FTPoint> PointList;
00084 
00085     public:
00089         FTMesh();
00090 
00094         ~FTMesh();
00095         
00099         void AddPoint( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
00100         
00104         const FTGL_DOUBLE* Combine( const FTGL_DOUBLE x, const FTGL_DOUBLE y, const FTGL_DOUBLE z);
00105         
00109         void Begin( GLenum meshType);
00110         
00114         void End();
00115         
00119         void Error( GLenum e) { err = e;}
00120         
00124         unsigned int TesselationCount() const { return tesselationList.size();}
00125 
00129         const FTTesselation* const Tesselation( unsigned int index) const;
00130         
00134         const PointList& TempPointList() const { return tempPointList;}
00135 
00139         GLenum Error() const { return err;}
00140 
00141     private:
00145         FTTesselation* currentTesselation;
00146         
00150         TesselationVector tesselationList;
00151         
00155         PointList tempPointList;
00156         
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 
00178 class FTGL_EXPORT FTVectoriser
00179 {
00180     public:
00186         FTVectoriser( const FT_GlyphSlot glyph);
00187 
00191         virtual ~FTVectoriser();
00192 
00199         void MakeMesh( FTGL_DOUBLE zNormal = FTGL_FRONT_FACING);
00200         
00204         const FTMesh* const GetMesh() const { return mesh;}
00205         
00211         size_t PointCount();
00212 
00218         size_t ContourCount() const { return ftContourCount;}
00219 
00225          const FTContour* const Contour( unsigned int index) const;
00226 
00233         size_t ContourSize( int c) const { return contourList[c]->PointCount();}
00234 
00240         int ContourFlag() const { return contourFlag;}
00241         
00242     private:
00246         void ProcessContours();
00247 
00251         FTContour** contourList;
00252 
00256         FTMesh* mesh;
00257         
00261         short ftContourCount;
00262 
00266         int contourFlag;
00267 
00271         FT_Outline outline;
00272 };
00273 
00274 
00275 #endif  //  __FTVectoriser__