osgEarth 2.1.1
Public Types | Public Member Functions | Public Attributes

anonymous_namespace{MeshSubdivider.cpp}::TriangleData Struct Reference

List of all members.

Public Types

typedef std::map< osg::Vec3,
GLuint > 
VertMap

Public Member Functions

 TriangleData ()
void setSourceVerts (osg::Vec3Array *sourceVerts)
void setSourceTexCoords (osg::Vec2Array *sourceTexCoords)
GLuint record (const osg::Vec3 &v, const osg::Vec2f &t)
void operator() (unsigned int p1, unsigned int p2, unsigned int p3)

Public Attributes

VertMap _vertMap
osg::Vec3Array * _sourceVerts
osg::Vec2Array * _sourceTexCoords
osg::ref_ptr< osg::Vec3Array > _verts
osg::ref_ptr< osg::Vec2Array > _texcoords
TriangleQueue _tris

Detailed Description

Definition at line 131 of file MeshSubdivider.cpp.


Member Typedef Documentation

typedef std::map<osg::Vec3,GLuint> anonymous_namespace{MeshSubdivider.cpp}::TriangleData::VertMap

Definition at line 133 of file MeshSubdivider.cpp.


Constructor & Destructor Documentation

anonymous_namespace{MeshSubdivider.cpp}::TriangleData::TriangleData ( ) [inline]

Definition at line 141 of file MeshSubdivider.cpp.

        {            
            _verts = new osg::Vec3Array();             
            _sourceVerts = 0;
            _sourceTexCoords = 0;
        }       

Member Function Documentation

void anonymous_namespace{MeshSubdivider.cpp}::TriangleData::operator() ( unsigned int  p1,
unsigned int  p2,
unsigned int  p3 
) [inline]

Definition at line 181 of file MeshSubdivider.cpp.

        {
            const osg::Vec3 v0 = (*_sourceVerts)[p1];
            const osg::Vec3 v1 = (*_sourceVerts)[p2];
            const osg::Vec3 v2 = (*_sourceVerts)[p3];            
            osg::Vec2 t0, t1, t2;
            if (_sourceTexCoords)
            {
                t0 = (*_sourceTexCoords)[p1];
                t1 = (*_sourceTexCoords)[p2];
                t2 = (*_sourceTexCoords)[p3];
            }
            _tris.push( Triangle(record(v0, t0), record(v1, t1), record(v2, t2)) );            
            //OE_NOTICE << "Incoming verts " << p1 << ", " << p2 << ", " << p3 << std::endl;
        }
GLuint anonymous_namespace{MeshSubdivider.cpp}::TriangleData::record ( const osg::Vec3 &  v,
const osg::Vec2f &  t 
) [inline]

Definition at line 159 of file MeshSubdivider.cpp.

        {
            VertMap::iterator i = _vertMap.find(v);
            if ( i == _vertMap.end() )
            {
                GLuint index = _verts->size();
                _verts->push_back(v);                
                _vertMap[v] = index;
                //Only push back the texture coordinate if it's valid
                if (_texcoords)
                {
                  _texcoords->push_back( t );
                }
                return index;
            }
            else
            {
                return i->second;
            }
        }
void anonymous_namespace{MeshSubdivider.cpp}::TriangleData::setSourceTexCoords ( osg::Vec2Array *  sourceTexCoords) [inline]

Definition at line 153 of file MeshSubdivider.cpp.

        {
            _sourceTexCoords = sourceTexCoords;
            _texcoords = new osg::Vec2Array();
        }
void anonymous_namespace{MeshSubdivider.cpp}::TriangleData::setSourceVerts ( osg::Vec3Array *  sourceVerts) [inline]

Definition at line 148 of file MeshSubdivider.cpp.

        {
            _sourceVerts = sourceVerts;
        }

Member Data Documentation

osg::Vec2Array* anonymous_namespace{MeshSubdivider.cpp}::TriangleData::_sourceTexCoords

Definition at line 136 of file MeshSubdivider.cpp.

osg::Vec3Array* anonymous_namespace{MeshSubdivider.cpp}::TriangleData::_sourceVerts

Definition at line 135 of file MeshSubdivider.cpp.

osg::ref_ptr<osg::Vec2Array> anonymous_namespace{MeshSubdivider.cpp}::TriangleData::_texcoords

Definition at line 138 of file MeshSubdivider.cpp.

TriangleQueue anonymous_namespace{MeshSubdivider.cpp}::TriangleData::_tris

Definition at line 139 of file MeshSubdivider.cpp.

VertMap anonymous_namespace{MeshSubdivider.cpp}::TriangleData::_vertMap

Definition at line 134 of file MeshSubdivider.cpp.

osg::ref_ptr<osg::Vec3Array> anonymous_namespace{MeshSubdivider.cpp}::TriangleData::_verts

Definition at line 137 of file MeshSubdivider.cpp.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines