Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Ogre::EdgeListBuilder Class Reference

General utility class for building edge lists for geometry. More...

#include <OgreEdgeListBuilder.h>

List of all members.

Public Methods

 EdgeListBuilder ()
virtual ~EdgeListBuilder ()
void addVertexData (const VertexData *vertexData)
 Add a set of vertex geometry data to the edge builder.

void addIndexData (const IndexData *indexData, size_t vertexSet=0, RenderOperation::OperationType opType=RenderOperation::OT_TRIANGLE_LIST)
 Add a set of index geometry data to the edge builder.

EdgeDatabuild (void)
 Builds the edge information based on the information built up so far.

void log (Log *l)
 Debugging method.


Protected Types

typedef std::vector< const
VertexData * > 
VertexDataList
typedef std::vector< const
IndexData * > 
IndexDataList
typedef std::vector< CommonVertexCommonVertexList
typedef std::vector< RenderOperation::OperationTypeOperationTypeList
typedef std::set< std::pair<
size_t, size_t > > 
UniqueEdgeSet
 Unique edges, used to detect whether there are too many triangles on an edge.


Protected Methods

void buildTrianglesEdges (size_t indexSet, size_t vertexSet)
void connectEdges (void)
EdgeData::EdgefindEdge (size_t sharedIndex1, size_t sharedIndex2)
size_t findOrCreateCommonVertex (const Vector3 &vec, size_t vertexSet, size_t indexSet, size_t originalIndex)
 Finds an existing common vertex, or inserts a new one.

void createEdge (size_t vertexSet, size_t triangleIndex, size_t vertIndex0, size_t vertIndex1, size_t sharedVertIndex0, size_t sharedVertIndex1)
 Create a new edge - utility method during building.

void attemptBuild (void)
 Internal method to attempt to build the edge list.


Protected Attributes

IndexDataList mIndexDataList
OperationTypeList mOperationTypeList
std::vector< size_t > mIndexDataVertexDataSetList
VertexDataList mVertexDataList
CommonVertexList mVertices
EdgeDatamEdgeData
UniqueEdgeSet mUniqueEdges
bool mWeldVertices
bool mWeldVerticesAcrossVertexSets
bool mWeldVerticesAcrossIndexSets


Detailed Description

General utility class for building edge lists for geometry.

Remarks:
You can add multiple sets of vertex and index data to build and edge list. Edges will be built between the various sets as well as within sets; this allows you to use a model which is built from multiple SubMeshes each using separate index and (optionally) vertex data and still get the same connectivity information. It's important to note that the indexes for the edge will be constrained to a single vertex buffer though (this is required in order to render the edge).

Definition at line 127 of file OgreEdgeListBuilder.h.


Member Typedef Documentation

typedef std::vector<CommonVertex> Ogre::EdgeListBuilder::CommonVertexList [protected]
 

Definition at line 177 of file OgreEdgeListBuilder.h.

typedef std::vector<const IndexData*> Ogre::EdgeListBuilder::IndexDataList [protected]
 

Definition at line 176 of file OgreEdgeListBuilder.h.

typedef std::vector<RenderOperation::OperationType> Ogre::EdgeListBuilder::OperationTypeList [protected]
 

Definition at line 178 of file OgreEdgeListBuilder.h.

typedef std::set< std::pair<size_t, size_t> > Ogre::EdgeListBuilder::UniqueEdgeSet [protected]
 

Unique edges, used to detect whether there are too many triangles on an edge.

Definition at line 187 of file OgreEdgeListBuilder.h.

typedef std::vector<const VertexData*> Ogre::EdgeListBuilder::VertexDataList [protected]
 

Definition at line 175 of file OgreEdgeListBuilder.h.


Constructor & Destructor Documentation

Ogre::EdgeListBuilder::EdgeListBuilder  
 

Definition at line 74 of file OgreEdgeListBuilder.cpp.

Ogre::EdgeListBuilder::~EdgeListBuilder   [virtual]
 

Definition at line 80 of file OgreEdgeListBuilder.cpp.


Member Function Documentation

void Ogre::EdgeListBuilder::addIndexData const IndexData   indexData,
size_t    vertexSet = 0,
RenderOperation::OperationType    opType = RenderOperation::OT_TRIANGLE_LIST
 

Add a set of index geometry data to the edge builder.

Remarks:
You must add at least one set of index data to the builder before invoking the build method.
Parameters:
indexData  The index information which describes the triangles.
vertexSet  The vertex data set this index data refers to; you only need to alter this if you have added multiple sets of vertices
opType  The operation type used to render these indexes. Only triangle types are supported (no point or line types)

Definition at line 89 of file OgreEdgeListBuilder.cpp.

References mIndexDataList, mIndexDataVertexDataSetList, and mOperationTypeList.

Referenced by Ogre::Mesh::buildEdgeList().

void Ogre::EdgeListBuilder::addVertexData const VertexData   vertexData
 

Add a set of vertex geometry data to the edge builder.

Remarks:
You must add at least one set of vertex data to the builder before invoking the build method.

Definition at line 84 of file OgreEdgeListBuilder.cpp.

References mVertexDataList.

Referenced by Ogre::Mesh::buildEdgeList().

void Ogre::EdgeListBuilder::attemptBuild void    [protected]
 

Internal method to attempt to build the edge list.

Definition at line 255 of file OgreEdgeListBuilder.cpp.

References buildTrianglesEdges(), connectEdges(), Ogre::EdgeData::edgeGroups, mEdgeData, mIndexDataList, mIndexDataVertexDataSetList, mUniqueEdges, mVertexDataList, mVertices, and Ogre::EdgeData::triangles.

Referenced by build().

EdgeData * Ogre::EdgeListBuilder::build void   
 

Builds the edge information based on the information built up so far.

Remarks:
The caller takes responsibility for deleting the returned structure.

Definition at line 97 of file OgreEdgeListBuilder.cpp.

References attemptBuild(), mEdgeData, mWeldVertices, mWeldVerticesAcrossIndexSets, mWeldVerticesAcrossVertexSets, and Ogre::ushort.

Referenced by Ogre::Mesh::buildEdgeList().

void Ogre::EdgeListBuilder::buildTrianglesEdges size_t    indexSet,
size_t    vertexSet
[protected]
 

Definition at line 302 of file OgreEdgeListBuilder.cpp.

References Ogre::VertexElement::baseVertexPointerToElement(), createEdge(), Ogre::VertexDeclaration::findElementBySemantic(), findOrCreateCommonVertex(), Ogre::VertexBufferBinding::getBuffer(), Ogre::VertexElement::getSource(), Ogre::IndexData::indexBuffer, Ogre::IndexData::indexCount, Ogre::EdgeData::Triangle::indexSet, mEdgeData, mIndexDataList, mOperationTypeList, mVertexDataList, Ogre::EdgeData::Triangle::normal, Ogre::Real, Ogre::EdgeData::Triangle::sharedVertIndex, Ogre::EdgeData::triangles, Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexDeclaration, Ogre::EdgeData::Triangle::vertexSet, Ogre::EdgeData::Triangle::vertIndex, Ogre::VES_POSITION, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by attemptBuild().

void Ogre::EdgeListBuilder::connectEdges void    [protected]
 

Definition at line 526 of file OgreEdgeListBuilder.cpp.

References Ogre::EdgeData::Edge::degenerate, findEdge(), mEdgeData, Ogre::EdgeData::Triangle::sharedVertIndex, Ogre::EdgeData::triangles, and Ogre::EdgeData::Edge::triIndex.

Referenced by attemptBuild().

void Ogre::EdgeListBuilder::createEdge size_t    vertexSet,
size_t    triangleIndex,
size_t    vertIndex0,
size_t    vertIndex1,
size_t    sharedVertIndex0,
size_t    sharedVertIndex1
[protected]
 

Create a new edge - utility method during building.

Definition at line 462 of file OgreEdgeListBuilder.cpp.

References Ogre::EdgeData::Edge::degenerate, Ogre::EdgeData::edgeGroups, Except, mEdgeData, mUniqueEdges, Ogre::EdgeData::Edge::sharedVertIndex, Ogre::EdgeData::Edge::triIndex, and Ogre::EdgeData::Edge::vertIndex.

Referenced by buildTrianglesEdges().

EdgeData::Edge * Ogre::EdgeListBuilder::findEdge size_t    sharedIndex1,
size_t    sharedIndex2
[protected]
 

Definition at line 570 of file OgreEdgeListBuilder.cpp.

References Ogre::EdgeData::edgeGroups, mEdgeData, and Ogre::EdgeData::Edge::sharedVertIndex.

Referenced by connectEdges().

size_t Ogre::EdgeListBuilder::findOrCreateCommonVertex const Vector3   vec,
size_t    vertexSet,
size_t    indexSet,
size_t    originalIndex
[protected]
 

Finds an existing common vertex, or inserts a new one.

Definition at line 492 of file OgreEdgeListBuilder.cpp.

References Ogre::EdgeListBuilder::CommonVertex::index, Ogre::EdgeListBuilder::CommonVertex::indexSet, mVertices, mWeldVertices, mWeldVerticesAcrossIndexSets, mWeldVerticesAcrossVertexSets, Ogre::EdgeListBuilder::CommonVertex::originalIndex, Ogre::EdgeListBuilder::CommonVertex::position, Ogre::EdgeListBuilder::CommonVertex::vertexSet, Ogre::Vector3::x, Ogre::Vector3::y, and Ogre::Vector3::z.

Referenced by buildTrianglesEdges().

void Ogre::EdgeListBuilder::log Log   l
 

Debugging method.

Definition at line 651 of file OgreEdgeListBuilder.cpp.

References Ogre::VertexElement::baseVertexPointerToElement(), Ogre::VertexDeclaration::findElementBySemantic(), Ogre::VertexBufferBinding::getBuffer(), Ogre::VertexElement::getSource(), Ogre::IndexData::indexBuffer, Ogre::IndexData::indexCount, Ogre::Log::logMessage(), mIndexDataList, mIndexDataVertexDataSetList, mOperationTypeList, mVertexDataList, mVertices, Ogre::EdgeListBuilder::CommonVertex::originalIndex, Ogre::EdgeListBuilder::CommonVertex::position, Ogre::Real, Ogre::VertexData::vertexBufferBinding, Ogre::VertexData::vertexCount, Ogre::VertexData::vertexDeclaration, Ogre::EdgeListBuilder::CommonVertex::vertexSet, and Ogre::VES_POSITION.


Member Data Documentation

EdgeData* Ogre::EdgeListBuilder::mEdgeData [protected]
 

Definition at line 185 of file OgreEdgeListBuilder.h.

Referenced by attemptBuild(), build(), buildTrianglesEdges(), connectEdges(), createEdge(), and findEdge().

IndexDataList Ogre::EdgeListBuilder::mIndexDataList [protected]
 

Definition at line 180 of file OgreEdgeListBuilder.h.

Referenced by addIndexData(), attemptBuild(), buildTrianglesEdges(), and log().

std::vector<size_t> Ogre::EdgeListBuilder::mIndexDataVertexDataSetList [protected]
 

Definition at line 182 of file OgreEdgeListBuilder.h.

Referenced by addIndexData(), attemptBuild(), and log().

OperationTypeList Ogre::EdgeListBuilder::mOperationTypeList [protected]
 

Definition at line 181 of file OgreEdgeListBuilder.h.

Referenced by addIndexData(), buildTrianglesEdges(), and log().

UniqueEdgeSet Ogre::EdgeListBuilder::mUniqueEdges [protected]
 

Definition at line 188 of file OgreEdgeListBuilder.h.

Referenced by attemptBuild(), and createEdge().

VertexDataList Ogre::EdgeListBuilder::mVertexDataList [protected]
 

Definition at line 183 of file OgreEdgeListBuilder.h.

Referenced by addVertexData(), attemptBuild(), buildTrianglesEdges(), and log().

CommonVertexList Ogre::EdgeListBuilder::mVertices [protected]
 

Definition at line 184 of file OgreEdgeListBuilder.h.

Referenced by attemptBuild(), findOrCreateCommonVertex(), and log().

bool Ogre::EdgeListBuilder::mWeldVertices [protected]
 

Definition at line 190 of file OgreEdgeListBuilder.h.

Referenced by build(), and findOrCreateCommonVertex().

bool Ogre::EdgeListBuilder::mWeldVerticesAcrossIndexSets [protected]
 

Definition at line 194 of file OgreEdgeListBuilder.h.

Referenced by build(), and findOrCreateCommonVertex().

bool Ogre::EdgeListBuilder::mWeldVerticesAcrossVertexSets [protected]
 

Definition at line 192 of file OgreEdgeListBuilder.h.

Referenced by build(), and findOrCreateCommonVertex().


The documentation for this class was generated from the following files:

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:50:53 2004