Removed depth member var. Fixed a problem with normal generation.
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
diff --git a/include/FTExtrdGlyph.h b/include/FTExtrdGlyph.h
index 135b25a..e0e8a56 100644
--- a/include/FTExtrdGlyph.h
+++ b/include/FTExtrdGlyph.h
@@ -22,7 +22,7 @@ class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
{
public:
/**
- * Constructor. Sets the Error to Invalid_Outline if the glyphs isn't an outline.
+ * Constructor. Sets the Error to Invalid_Outline if the glyph isn't an outline.
*
* @param glyph The Freetype glyph to be processed
* @param depth The distance along the z axis to extrude the glyph
@@ -61,11 +61,6 @@ class FTGL_EXPORT FTExtrdGlyph : public FTGlyph
* OpenGL display list
*/
GLuint glList;
-
- /**
- * Distance to extrude the glyph
- */
- float depth;
};
diff --git a/src/FTExtrdGlyph.cpp b/src/FTExtrdGlyph.cpp
index 7696c4c..532dfbc 100644
--- a/src/FTExtrdGlyph.cpp
+++ b/src/FTExtrdGlyph.cpp
@@ -6,10 +6,9 @@
#include "FTVectoriser.h"
-FTExtrdGlyph::FTExtrdGlyph( FT_GlyphSlot glyph, float d, bool useDisplayList)
+FTExtrdGlyph::FTExtrdGlyph( FT_GlyphSlot glyph, float depth, bool useDisplayList)
: FTGlyph( glyph),
- glList(0),
- depth(d)
+ glList(0)
{
bBox.SetDepth( -depth);
@@ -100,8 +99,11 @@ FTExtrdGlyph::FTExtrdGlyph( FT_GlyphSlot glyph, float d, bool useDisplayList)
FTPoint point = contour->Point(pointIndex);
FTPoint normal = GetNormal( point, contour->Point(nextPointIndex));
- glNormal3f( normal.X(), normal.Y(), 0.0f);
-
+ if(normal != FTPoint( 0.0f, 0.0f, 0.0f))
+ {
+ glNormal3dv((FTGL_DOUBLE*)normal);
+ }
+
if( contourFlag & ft_outline_reverse_fill)
{
glTexCoord2f( point.X() / horizontalTextureScale,
@@ -155,7 +157,7 @@ FTPoint FTExtrdGlyph::GetNormal( const FTPoint &a, const FTPoint &b)
float length = sqrt( vectorX * vectorX + vectorY * vectorY );
- if( length > 0.0f)
+ if( length > 0.01f)
{
length = 1 / length;
}