Logo Search packages:      
Sourcecode: octplot version File versions  Download package

void FTVectoriser::MakeMesh ( FTGL_DOUBLE  zNormal = FTGL_FRONT_FACING  ) 

Build an FTMesh from the vector outline data.

zNormal The direction of the z axis of the normal for this mesh

Definition at line 175 of file FTVectoriser.cpp.

References ContourCount(), contourFlag, contourList, FTContour::Point(), and FTContour::PointCount().

Referenced by FTExtrdGlyph::FTExtrdGlyph(), and FTPolyGlyph::FTPolyGlyph().

    if( mesh)
        delete mesh;
    mesh = new FTMesh;
    GLUtesselator* tobj = gluNewTess();

    gluTessCallback( tobj, GLU_TESS_BEGIN_DATA,     (GLUTesselatorFunction)ftglBegin);
    gluTessCallback( tobj, GLU_TESS_VERTEX_DATA,    (GLUTesselatorFunction)ftglVertex);
    gluTessCallback( tobj, GLU_TESS_COMBINE_DATA,   (GLUTesselatorFunction)ftglCombine);
    gluTessCallback( tobj, GLU_TESS_END_DATA,       (GLUTesselatorFunction)ftglEnd);
    gluTessCallback( tobj, GLU_TESS_ERROR_DATA,     (GLUTesselatorFunction)ftglError);
    if( contourFlag & ft_outline_even_odd_fill) // ft_outline_reverse_fill
        gluTessProperty( tobj, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_ODD);
    gluTessProperty( tobj, GLU_TESS_TOLERANCE, 0);
    gluTessNormal( tobj, 0.0f, 0.0f, zNormal);
    gluTessBeginPolygon( tobj, mesh);
        for( size_t c = 0; c < ContourCount(); ++c)
            const FTContour* contour = contourList[c];

            gluTessBeginContour( tobj);
                for( size_t p = 0; p < contour->PointCount(); ++p)
                    const FTGL_DOUBLE* d = contour->Point(p);
                    gluTessVertex( tobj, (GLdouble*)d, (GLdouble*)d);

            gluTessEndContour( tobj);
    gluTessEndPolygon( tobj);

    gluDeleteTess( tobj);

Generated by  Doxygen 1.6.0   Back to index