00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGTEXTVECTORGLYPH_H_
00040 #define _OSGTEXTVECTORGLYPH_H_
00041
00042 #ifdef _MSC_VER
00043 # pragma once
00044 #endif
00045
00046 #include <OSGConfig.h>
00047 #include <OSGSystemDef.h>
00048 #include <OSGBaseTypes.h>
00049 #include <OSGVector.h>
00050
00051 #include "OSGTextGlyph.h"
00052
00053 #include <vector>
00054 #include <map>
00055
00056
00057 OSG_BEGIN_NAMESPACE
00058
00059
00064 class OSG_SYSTEMLIB_DLLMAPPING TextVectorGlyph: public TextGlyph
00065 {
00066
00068 friend class TextVectorFace;
00069
00070
00071 public:
00072
00077 struct OSG_SYSTEMLIB_DLLMAPPING Point
00078 {
00080 enum PointType
00081 {
00082 PT_ON,
00083 PT_QUAD,
00084 PT_CUBIC
00085 };
00086
00088 Vec2f pos;
00089
00091 PointType type;
00092
00098 inline Point(const Vec2f &_pos, PointType _type);
00099 };
00100
00102 typedef std::vector<Point> Contour;
00103
00105 typedef std::vector<Contour> Outline;
00106
00108 struct OSG_SYSTEMLIB_DLLMAPPING PolygonOutline
00109 {
00111 std::vector<Vec2f> coords;
00112
00114 std::vector<UInt32> contours;
00115
00117 std::vector<UInt32> indices;
00118
00120 typedef std::pair<GLenum, UInt32> TypeIndex;
00121
00127 std::vector<TypeIndex> types;
00128 };
00129
00134 struct OSG_SYSTEMLIB_DLLMAPPING VertexNormal
00135 {
00137 Vec2f nextEdgeNormal;
00138
00140 Vec2f meanEdgeNormal;
00141
00143 Real32 edgeAngle;
00144
00146 inline VertexNormal(const Vec2f &nextEdgeNormal_, const Vec2f &meanEdgeNormal_, Real32 edgeAngle_);
00147 };
00148
00150 typedef std::vector<VertexNormal> Normals;
00151
00153 virtual ~TextVectorGlyph();
00154
00159 virtual Real32 getWidth() const;
00160
00165 virtual Real32 getHeight() const;
00166
00173 virtual Real32 getHoriBearingX() const;
00174
00181 virtual Real32 getHoriBearingY() const;
00182
00189 virtual Real32 getVertBearingX() const;
00190
00197 virtual Real32 getVertBearingY() const;
00198
00204 inline const Outline &getOutline() const;
00205
00212 const PolygonOutline &getLines(UInt32 level = 2) const;
00213
00219 const Normals &getNormals(UInt32 level = 2) const;
00220
00222 enum Orientation
00223 {
00224 CW, CCW
00225 };
00226
00231 const std::vector<Orientation> &getContourOrientations() const;
00232
00233
00234 protected:
00235
00237 inline TextVectorGlyph();
00238
00240 Real32 _width;
00241
00243 Real32 _height;
00244
00246 Real32 _horiBearingX;
00247
00249 Real32 _horiBearingY;
00250
00252 Real32 _vertBearingX;
00253
00255 Real32 _vertBearingY;
00256
00258 Outline _outline;
00259
00261 mutable std::vector<Orientation> _contourOrientations;
00262
00264 typedef std::map<UInt32, PolygonOutline> PolygonOutlineMap;
00265
00267 mutable PolygonOutlineMap _polygonOutlineMap;
00268
00270 typedef std::map<UInt32, Normals> NormalMap;
00271
00273 mutable NormalMap _normalMap;
00274
00275
00276 private:
00277
00279 TextVectorGlyph(const TextVectorGlyph &);
00280
00282 const TextVectorGlyph &operator=(const TextVectorGlyph &);
00283
00285 void computeContourOrientations() const;
00286 };
00287
00288
00289 OSG_END_NAMESPACE
00290
00291
00292 #include <OSGTextVectorGlyph.inl>
00293
00294 #define OSGTEXTVECTORGLYPH_HEADER_CVSID "@(#)$Id: OSGTextVectorGlyph.h,v 1.1 2005/03/03 13:43:07 a-m-z Exp $"
00295
00296 #endif