29 #ifndef __ProgressiveMeshGenerator_H_
30 #define __ProgressiveMeshGenerator_H_
50 virtual void generateLodLevels(
LodConfig& lodConfig) = 0;
57 virtual void generateAutoconfiguredLodLevels(
MeshPtr& mesh);
82 void generateLodLevels(
LodConfig& lodConfig);
90 template<
typename T,
unsigned S>
95 void addNotExists(
const T& item);
98 void removeExists(
const T& item);
99 bool remove(
const T& item);
100 void replaceExists(
const T& oldItem,
const T& newItem);
101 bool has(
const T& item);
111 struct PMCollapseCostLess;
133 size_t operator() (
const PMVertex* v)
const;
169 unsigned int vertexID[3];
171 void computeNormal();
172 bool hasVertex(
const PMVertex* v)
const;
173 unsigned int getVertexID(
const PMVertex* v)
const;
215 size_t calcLodVertexCount(
const LodLevel& lodConfig);
216 void tuneContainerSize();
217 void addVertexData(
VertexData* vertexData,
bool useSharedVertexLookup);
218 void addIndexData(
IndexData* indexData,
bool useSharedVertexLookup,
unsigned short submeshID);
219 template<
typename IndexType>
222 unsigned short submeshID)
226 for (; iPos < iEnd; iPos += 3) {
228 OgreAssert(mTriangleList.capacity() > mTriangleList.size(),
"");
233 for (
int i = 0; i < 3; i++) {
237 tri->
vertex[i] = lookup[iPos[i]];
242 str <<
"In " << mMeshName <<
" malformed triangle found with ID: " << getTriangleID(tri) <<
". " <<
244 printTriangle(tri, str);
245 str <<
"It will be excluded from LOD level calculations.";
249 mIndexBufferInfoList[tri->
submeshID].indexCount -= 3;
253 addTriangleToEdges(tri);
258 bool isBorderVertex(
const PMVertex* vertex)
const;
259 PMEdge* getPointer(VEdges::iterator it);
260 void computeVertexCollapseCost(PMVertex* vertex);
261 Real computeEdgeCollapseCost(PMVertex* src, PMEdge* dstEdge);
262 virtual void bakeLods();
263 void collapse(PMVertex* vertex);
266 void updateVertexCollapseCost(PMVertex* src);
268 bool hasSrcID(
unsigned int srcID,
unsigned short submeshID);
269 size_t findDstID(
unsigned int srcID,
unsigned short submeshID);
270 void replaceVertexID(PMTriangle* triangle,
unsigned int oldID,
unsigned int newID, PMVertex* dst);
273 void assertValidVertex(PMVertex* v);
274 void assertValidMesh();
275 void assertOutdatedCollapseCost(PMVertex* vertex);
276 #endif // ifndef NDEBUG
278 void addTriangleToEdges(PMTriangle* triangle);
279 void removeTriangleFromEdges(PMTriangle* triangle, PMVertex* skip = NULL);
280 void addEdge(PMVertex* v,
const PMEdge& edge);
281 void removeEdge(PMVertex* v,
const PMEdge& edge);
282 void printTriangle(PMTriangle* triangle,
stringstream& str);
283 PMTriangle* findSideTriangle(
const PMVertex* v1,
const PMVertex* v2);
284 bool isDuplicateTriangle(PMTriangle* triangle, PMTriangle* triangle2);
285 PMTriangle* isDuplicateTriangle(PMTriangle* triangle);
286 int getTriangleID(PMTriangle* triangle);
287 void cleanupMemory();
UniqueVertexSet mUniqueVertexSet
float Real
Software floating point type.
vector< PMCollapsedEdge >::type CollapsedEdges
TriangleList mTriangleList
void computeNormal()
Vertex ID in the buffer associated with the submeshID.
bool operator<(SharedPtr< T > const &a, SharedPtr< U > const &b)
IndexBufferInfoList mIndexBufferInfoList
PMVertex * collapseTo
Triangle ID set, which are using this vertex.
Structure for automatic LOD configuration.
VectorSet< PMTriangle *, 7 > VTriangles
vector< PMVertex * >::type VertexLookupList
SmallVector< T, S >::iterator iterator
multimap< Real, PMVertex * >::type CollapseCostHeap
Improved version of ProgressiveMesh.
SmallVector - This is a 'vector' (really, a variable-sized array), optimized for the case when the ar...
HashSet< PMVertex *, PMVertexHash, PMVertexEqual > UniqueVertexSet
Log::Stream stream(LogMessageLevel lml=LML_NORMAL, bool maskDebug=false)
Get a stream on the default log.
Real mMeshBoundingSphereRadius
String mMeshName
The name of the mesh being processed.
void addIndexDataImpl(IndexType *iPos, const IndexType *iEnd, VertexLookupList &lookup, unsigned short submeshID)
Summary class collecting together index data source information.
CollapseCostHeap mCollapseCostHeap
StringStream stringstream
unsigned int vertexID[3]
ID of the submesh. Usable with mMesh.getSubMesh() function.
VertexLookupList mSharedVertexLookup
Standard 3-dimensional vector.
CollapseCostHeap::iterator costHeapPosition
VertexLookupList mVertexLookup
Summary class collecting together vertex source information.
ProgressiveMeshGenerator * mGen
vector< PMIndexBufferInfo >::type IndexBufferInfoList
CollapsedEdges tmpCollapsedEdges
PMVertexHash(ProgressiveMeshGenerator *gen)
vector< PMTriangle >::type TriangleList
VectorSet< PMEdge, 8 > VEdges
vector< PMVertex >::type VertexList
virtual ~ProgressiveMeshGeneratorBase()
static LogManager & getSingleton(void)
Override standard Singleton retrieval.
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)