ogre/ogre-a24ac4afbbb9dc5ff49a61634af50da11ba8fb97.diff
zhangyinuo d875d024d0 test
Signed-off-by: 张一诺 <zhangyinuo4@h-partners.com>
2024-07-31 14:05:23 +08:00

122 lines
4.7 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# HG changeset patch
# User David Rogers <masterfalcon@ogre3d.org>
# Date 1387963977 21600
# Branch v1-9
# Node ID a24ac4afbbb9dc5ff49a61634af50da11ba8fb97
# Parent de9ed8c143d87fc54ee9979db142d3410245fcf0
[OGRE-357] Resolve link errors due to incorrect template creation that is a allowed by some compilers but isnt actually correct c++ usage.
diff --git a/OgreMain/include/OgreProgressiveMeshGenerator.h b/OgreMain/include/OgreProgressiveMeshGenerator.h
--- a/OgreMain/include/OgreProgressiveMeshGenerator.h
+++ b/OgreMain/include/OgreProgressiveMeshGenerator.h
@@ -34,6 +34,7 @@
#include "OgreSmallVector.h"
#include "OgreMesh.h"
#include "OgreLodConfig.h"
+#include "OgreLogManager.h"
namespace Ogre
{
@@ -214,9 +215,44 @@
size_t calcLodVertexCount(const LodLevel& lodConfig);
void tuneContainerSize();
void addVertexData(VertexData* vertexData, bool useSharedVertexLookup);
- template<typename IndexType>
- void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, VertexLookupList& lookup, unsigned short submeshID);
void addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID);
+ template<typename IndexType>
+ void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd,
+ VertexLookupList& lookup,
+ unsigned short submeshID)
+ {
+
+ // Loop through all triangles and connect them to the vertices.
+ for (; iPos < iEnd; iPos += 3) {
+ // It should never reallocate or every pointer will be invalid.
+ OgreAssert(mTriangleList.capacity() > mTriangleList.size(), "");
+ mTriangleList.push_back(PMTriangle());
+ PMTriangle* tri = &mTriangleList.back();
+ tri->isRemoved = false;
+ tri->submeshID = submeshID;
+ for (int i = 0; i < 3; i++) {
+ // Invalid index: Index is bigger then vertex buffer size.
+ OgreAssert(iPos[i] < lookup.size(), "");
+ tri->vertexID[i] = iPos[i];
+ tri->vertex[i] = lookup[iPos[i]];
+ }
+ if (tri->isMalformed()) {
+#if OGRE_DEBUG_MODE
+ stringstream str;
+ str << "In " << mMeshName << " malformed triangle found with ID: " << getTriangleID(tri) << ". " <<
+ std::endl;
+ printTriangle(tri, str);
+ str << "It will be excluded from LOD level calculations.";
+ LogManager::getSingleton().stream() << str.str();
+#endif
+ tri->isRemoved = true;
+ mIndexBufferInfoList[tri->submeshID].indexCount -= 3;
+ continue;
+ }
+ tri->computeNormal();
+ addTriangleToEdges(tri);
+ }
+ }
void computeCosts();
bool isBorderVertex(const PMVertex* vertex) const;
diff --git a/OgreMain/src/OgreProgressiveMeshGenerator.cpp b/OgreMain/src/OgreProgressiveMeshGenerator.cpp
--- a/OgreMain/src/OgreProgressiveMeshGenerator.cpp
+++ b/OgreMain/src/OgreProgressiveMeshGenerator.cpp
@@ -45,7 +45,6 @@
#include "OgreSubMesh.h"
#include "OgreMesh.h"
#include "OgreLodStrategy.h"
-#include "OgreLogManager.h"
#include "OgrePixelCountLodStrategy.h"
namespace Ogre
@@ -219,43 +218,6 @@
}
vbuf->unlock();
}
-template<typename IndexType>
-void ProgressiveMeshGenerator::addIndexDataImpl(IndexType* iPos, const IndexType* iEnd,
- VertexLookupList& lookup,
- unsigned short submeshID)
-{
-
- // Loop through all triangles and connect them to the vertices.
- for (; iPos < iEnd; iPos += 3) {
- // It should never reallocate or every pointer will be invalid.
- OgreAssert(mTriangleList.capacity() > mTriangleList.size(), "");
- mTriangleList.push_back(PMTriangle());
- PMTriangle* tri = &mTriangleList.back();
- tri->isRemoved = false;
- tri->submeshID = submeshID;
- for (int i = 0; i < 3; i++) {
- // Invalid index: Index is bigger then vertex buffer size.
- OgreAssert(iPos[i] < lookup.size(), "");
- tri->vertexID[i] = iPos[i];
- tri->vertex[i] = lookup[iPos[i]];
- }
- if (tri->isMalformed()) {
-#if OGRE_DEBUG_MODE
- stringstream str;
- str << "In " << mMeshName << " malformed triangle found with ID: " << getTriangleID(tri) << ". " <<
- std::endl;
- printTriangle(tri, str);
- str << "It will be excluded from LOD level calculations.";
- LogManager::getSingleton().stream() << str.str();
-#endif
- tri->isRemoved = true;
- mIndexBufferInfoList[tri->submeshID].indexCount -= 3;
- continue;
- }
- tri->computeNormal();
- addTriangleToEdges(tri);
- }
-}
void ProgressiveMeshGenerator::addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID)
{