parent
824db16a68
commit
3ce8af18e2
|
@ -3,7 +3,9 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2023, assimp team
|
Copyright (c) 2006-2022, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
@ -57,31 +59,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
namespace Assimp {
|
using namespace Assimp;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Constructor to be privately used by Importer
|
// Constructor to be privately used by Importer
|
||||||
ImproveCacheLocalityProcess::ImproveCacheLocalityProcess() :
|
ImproveCacheLocalityProcess::ImproveCacheLocalityProcess()
|
||||||
mConfigCacheDepth(PP_ICL_PTCACHE_SIZE) {
|
: mConfigCacheDepth(PP_ICL_PTCACHE_SIZE) {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Returns whether the processing step is present in the given flag field.
|
// Returns whether the processing step is present in the given flag field.
|
||||||
bool ImproveCacheLocalityProcess::IsActive(unsigned int pFlags) const {
|
bool ImproveCacheLocalityProcess::IsActive( unsigned int pFlags) const {
|
||||||
return (pFlags & aiProcess_ImproveCacheLocality) != 0;
|
return (pFlags & aiProcess_ImproveCacheLocality) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Setup configuration
|
// Setup configuration
|
||||||
void ImproveCacheLocalityProcess::SetupProperties(const Importer *pImp) {
|
void ImproveCacheLocalityProcess::SetupProperties(const Importer* pImp) {
|
||||||
// AI_CONFIG_PP_ICL_PTCACHE_SIZE controls the target cache size for the optimizer
|
// AI_CONFIG_PP_ICL_PTCACHE_SIZE controls the target cache size for the optimizer
|
||||||
mConfigCacheDepth = pImp->GetPropertyInteger(AI_CONFIG_PP_ICL_PTCACHE_SIZE, PP_ICL_PTCACHE_SIZE);
|
mConfigCacheDepth = pImp->GetPropertyInteger(AI_CONFIG_PP_ICL_PTCACHE_SIZE,PP_ICL_PTCACHE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Executes the post processing step on the given imported data.
|
// Executes the post processing step on the given imported data.
|
||||||
void ImproveCacheLocalityProcess::Execute(aiScene *pScene) {
|
void ImproveCacheLocalityProcess::Execute( aiScene* pScene) {
|
||||||
if (!pScene->mNumMeshes) {
|
if (!pScene->mNumMeshes) {
|
||||||
ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess skipped; there are no meshes");
|
ASSIMP_LOG_DEBUG("ImproveCacheLocalityProcess skipped; there are no meshes");
|
||||||
return;
|
return;
|
||||||
|
@ -91,11 +93,11 @@ void ImproveCacheLocalityProcess::Execute(aiScene *pScene) {
|
||||||
|
|
||||||
float out = 0.f;
|
float out = 0.f;
|
||||||
unsigned int numf = 0, numm = 0;
|
unsigned int numf = 0, numm = 0;
|
||||||
for (unsigned int a = 0; a < pScene->mNumMeshes; ++a) {
|
for( unsigned int a = 0; a < pScene->mNumMeshes; ++a ){
|
||||||
const float res = ProcessMesh(pScene->mMeshes[a], a);
|
const float res = ProcessMesh( pScene->mMeshes[a],a);
|
||||||
if (res) {
|
if (res) {
|
||||||
numf += pScene->mMeshes[a]->mNumFaces;
|
numf += pScene->mMeshes[a]->mNumFaces;
|
||||||
out += res;
|
out += res;
|
||||||
++numm;
|
++numm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,54 +109,9 @@ void ImproveCacheLocalityProcess::Execute(aiScene *pScene) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
static ai_real calculateInputACMR(aiMesh *pMesh, const aiFace *const pcEnd,
|
|
||||||
unsigned int configCacheDepth, unsigned int meshNum) {
|
|
||||||
ai_real fACMR = 0.0f;
|
|
||||||
unsigned int *piFIFOStack = new unsigned int[configCacheDepth];
|
|
||||||
memset(piFIFOStack, 0xff, configCacheDepth * sizeof(unsigned int));
|
|
||||||
unsigned int *piCur = piFIFOStack;
|
|
||||||
const unsigned int *const piCurEnd = piFIFOStack + configCacheDepth;
|
|
||||||
|
|
||||||
// count the number of cache misses
|
|
||||||
unsigned int iCacheMisses = 0;
|
|
||||||
for (const aiFace *pcFace = pMesh->mFaces; pcFace != pcEnd; ++pcFace) {
|
|
||||||
for (unsigned int qq = 0; qq < 3; ++qq) {
|
|
||||||
bool bInCache = false;
|
|
||||||
for (unsigned int *pp = piFIFOStack; pp < piCurEnd; ++pp) {
|
|
||||||
if (*pp == pcFace->mIndices[qq]) {
|
|
||||||
// the vertex is in cache
|
|
||||||
bInCache = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!bInCache) {
|
|
||||||
++iCacheMisses;
|
|
||||||
if (piCurEnd == piCur) {
|
|
||||||
piCur = piFIFOStack;
|
|
||||||
}
|
|
||||||
*piCur++ = pcFace->mIndices[qq];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
delete[] piFIFOStack;
|
|
||||||
fACMR = (ai_real)iCacheMisses / pMesh->mNumFaces;
|
|
||||||
if (3.0 == fACMR) {
|
|
||||||
char szBuff[128]; // should be sufficiently large in every case
|
|
||||||
|
|
||||||
// the JoinIdenticalVertices process has not been executed on this
|
|
||||||
// mesh, otherwise this value would normally be at least minimally
|
|
||||||
// smaller than 3.0 ...
|
|
||||||
ai_snprintf(szBuff, 128, "Mesh %u: Not suitable for vcache optimization", meshNum);
|
|
||||||
ASSIMP_LOG_WARN(szBuff);
|
|
||||||
return static_cast<ai_real>(0.f);
|
|
||||||
}
|
|
||||||
return fACMR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
// Improves the cache coherency of a specific mesh
|
// Improves the cache coherency of a specific mesh
|
||||||
ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int meshNum) {
|
ai_real ImproveCacheLocalityProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshNum) {
|
||||||
// TODO: rewrite this to use std::vector or boost::shared_array
|
// TODO: rewrite this to use std::vector or boost::shared_array
|
||||||
ai_assert(nullptr != pMesh);
|
ai_assert(nullptr != pMesh);
|
||||||
|
|
||||||
|
@ -169,57 +126,91 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
return static_cast<ai_real>(0.f);
|
return static_cast<ai_real>(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pMesh->mNumVertices <= mConfigCacheDepth) {
|
if(pMesh->mNumVertices <= mConfigCacheDepth) {
|
||||||
return static_cast<ai_real>(0.f);
|
return static_cast<ai_real>(0.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
ai_real fACMR = 3.f;
|
ai_real fACMR = 3.f;
|
||||||
const aiFace *const pcEnd = pMesh->mFaces + pMesh->mNumFaces;
|
const aiFace* const pcEnd = pMesh->mFaces+pMesh->mNumFaces;
|
||||||
|
|
||||||
// Input ACMR is for logging purposes only
|
// Input ACMR is for logging purposes only
|
||||||
if (!DefaultLogger::isNullLogger()) {
|
if (!DefaultLogger::isNullLogger()) {
|
||||||
fACMR = calculateInputACMR(pMesh, pcEnd, mConfigCacheDepth, meshNum);
|
|
||||||
|
unsigned int* piFIFOStack = new unsigned int[mConfigCacheDepth];
|
||||||
|
memset(piFIFOStack,0xff,mConfigCacheDepth*sizeof(unsigned int));
|
||||||
|
unsigned int* piCur = piFIFOStack;
|
||||||
|
const unsigned int* const piCurEnd = piFIFOStack + mConfigCacheDepth;
|
||||||
|
|
||||||
|
// count the number of cache misses
|
||||||
|
unsigned int iCacheMisses = 0;
|
||||||
|
for (const aiFace* pcFace = pMesh->mFaces;pcFace != pcEnd;++pcFace) {
|
||||||
|
for (unsigned int qq = 0; qq < 3;++qq) {
|
||||||
|
bool bInCache = false;
|
||||||
|
for (unsigned int* pp = piFIFOStack;pp < piCurEnd;++pp) {
|
||||||
|
if (*pp == pcFace->mIndices[qq]) {
|
||||||
|
// the vertex is in cache
|
||||||
|
bInCache = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!bInCache) {
|
||||||
|
++iCacheMisses;
|
||||||
|
if (piCurEnd == piCur) {
|
||||||
|
piCur = piFIFOStack;
|
||||||
|
}
|
||||||
|
*piCur++ = pcFace->mIndices[qq];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] piFIFOStack;
|
||||||
|
fACMR = (ai_real) iCacheMisses / pMesh->mNumFaces;
|
||||||
|
if (3.0 == fACMR) {
|
||||||
|
char szBuff[128]; // should be sufficiently large in every case
|
||||||
|
|
||||||
|
// the JoinIdenticalVertices process has not been executed on this
|
||||||
|
// mesh, otherwise this value would normally be at least minimally
|
||||||
|
// smaller than 3.0 ...
|
||||||
|
ai_snprintf(szBuff,128,"Mesh %u: Not suitable for vcache optimization",meshNum);
|
||||||
|
ASSIMP_LOG_WARN(szBuff);
|
||||||
|
return static_cast<ai_real>(0.f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// first we need to build a vertex-triangle adjacency list
|
// first we need to build a vertex-triangle adjacency list
|
||||||
VertexTriangleAdjacency adj(pMesh->mFaces, pMesh->mNumFaces, pMesh->mNumVertices, true);
|
VertexTriangleAdjacency adj(pMesh->mFaces,pMesh->mNumFaces, pMesh->mNumVertices,true);
|
||||||
|
|
||||||
// build a list to store per-vertex caching time stamps
|
// build a list to store per-vertex caching time stamps
|
||||||
std::vector<unsigned int> piCachingStamps;
|
unsigned int* const piCachingStamps = new unsigned int[pMesh->mNumVertices];
|
||||||
piCachingStamps.resize(pMesh->mNumVertices);
|
memset(piCachingStamps,0x0,pMesh->mNumVertices*sizeof(unsigned int));
|
||||||
memset(&piCachingStamps[0], 0x0, pMesh->mNumVertices * sizeof(unsigned int));
|
|
||||||
|
|
||||||
// allocate an empty output index buffer. We store the output indices in one large array.
|
// allocate an empty output index buffer. We store the output indices in one large array.
|
||||||
// Since the number of triangles won't change the input faces can be reused. This is how
|
// Since the number of triangles won't change the input faces can be reused. This is how
|
||||||
// we save thousands of redundant mini allocations for aiFace::mIndices
|
// we save thousands of redundant mini allocations for aiFace::mIndices
|
||||||
const unsigned int iIdxCnt = pMesh->mNumFaces * 3;
|
const unsigned int iIdxCnt = pMesh->mNumFaces*3;
|
||||||
std::vector<unsigned int> piIBOutput;
|
unsigned int* const piIBOutput = new unsigned int[iIdxCnt];
|
||||||
piIBOutput.resize(iIdxCnt);
|
unsigned int* piCSIter = piIBOutput;
|
||||||
std::vector<unsigned int>::iterator piCSIter = piIBOutput.begin();
|
|
||||||
|
|
||||||
// allocate the flag array to hold the information
|
// allocate the flag array to hold the information
|
||||||
// whether a face has already been emitted or not
|
// whether a face has already been emitted or not
|
||||||
std::vector<bool> abEmitted(pMesh->mNumFaces, false);
|
std::vector<bool> abEmitted(pMesh->mNumFaces,false);
|
||||||
|
|
||||||
// dead-end vertex index stack
|
// dead-end vertex index stack
|
||||||
std::stack<unsigned int, std::vector<unsigned int>> sDeadEndVStack;
|
std::stack<unsigned int, std::vector<unsigned int> > sDeadEndVStack;
|
||||||
|
|
||||||
// create a copy of the piNumTriPtr buffer
|
// create a copy of the piNumTriPtr buffer
|
||||||
unsigned int *const piNumTriPtr = adj.mLiveTriangles;
|
unsigned int* const piNumTriPtr = adj.mLiveTriangles;
|
||||||
const std::vector<unsigned int> piNumTriPtrNoModify(piNumTriPtr, piNumTriPtr + pMesh->mNumVertices);
|
const std::vector<unsigned int> piNumTriPtrNoModify(piNumTriPtr, piNumTriPtr + pMesh->mNumVertices);
|
||||||
|
|
||||||
// get the largest number of referenced triangles and allocate the "candidate buffer"
|
// get the largest number of referenced triangles and allocate the "candidate buffer"
|
||||||
unsigned int iMaxRefTris = 0;
|
unsigned int iMaxRefTris = 0; {
|
||||||
{
|
const unsigned int* piCur = adj.mLiveTriangles;
|
||||||
const unsigned int *piCur = adj.mLiveTriangles;
|
const unsigned int* const piCurEnd = adj.mLiveTriangles+pMesh->mNumVertices;
|
||||||
const unsigned int *const piCurEnd = adj.mLiveTriangles + pMesh->mNumVertices;
|
for (;piCur != piCurEnd;++piCur) {
|
||||||
for (; piCur != piCurEnd; ++piCur) {
|
iMaxRefTris = std::max(iMaxRefTris,*piCur);
|
||||||
iMaxRefTris = std::max(iMaxRefTris, *piCur);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ai_assert(iMaxRefTris > 0);
|
ai_assert(iMaxRefTris > 0);
|
||||||
std::vector<unsigned int> piCandidates;
|
unsigned int* piCandidates = new unsigned int[iMaxRefTris*3];
|
||||||
piCandidates.resize(iMaxRefTris * 3);
|
|
||||||
unsigned int iCacheMisses = 0;
|
unsigned int iCacheMisses = 0;
|
||||||
|
|
||||||
// ...................................................................................
|
// ...................................................................................
|
||||||
|
@ -254,22 +245,22 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
|
|
||||||
int ivdx = 0;
|
int ivdx = 0;
|
||||||
int ics = 1;
|
int ics = 1;
|
||||||
int iStampCnt = mConfigCacheDepth + 1;
|
int iStampCnt = mConfigCacheDepth+1;
|
||||||
while (ivdx >= 0) {
|
while (ivdx >= 0) {
|
||||||
|
|
||||||
unsigned int icnt = piNumTriPtrNoModify[ivdx];
|
unsigned int icnt = piNumTriPtrNoModify[ivdx];
|
||||||
unsigned int *piList = adj.GetAdjacentTriangles(ivdx);
|
unsigned int* piList = adj.GetAdjacentTriangles(ivdx);
|
||||||
std::vector<unsigned int>::iterator piCurCandidate = piCandidates.begin();
|
unsigned int* piCurCandidate = piCandidates;
|
||||||
|
|
||||||
// get all triangles in the neighborhood
|
// get all triangles in the neighborhood
|
||||||
for (unsigned int tri = 0; tri < icnt; ++tri) {
|
for (unsigned int tri = 0; tri < icnt;++tri) {
|
||||||
|
|
||||||
// if they have not yet been emitted, add them to the output IB
|
// if they have not yet been emitted, add them to the output IB
|
||||||
const unsigned int fidx = *piList++;
|
const unsigned int fidx = *piList++;
|
||||||
if (!abEmitted[fidx]) {
|
if (!abEmitted[fidx]) {
|
||||||
|
|
||||||
// so iterate through all vertices of the current triangle
|
// so iterate through all vertices of the current triangle
|
||||||
const aiFace *pcFace = &pMesh->mFaces[fidx];
|
const aiFace* pcFace = &pMesh->mFaces[ fidx ];
|
||||||
unsigned nind = pcFace->mNumIndices;
|
unsigned nind = pcFace->mNumIndices;
|
||||||
for (unsigned ind = 0; ind < nind; ind++) {
|
for (unsigned ind = 0; ind < nind; ind++) {
|
||||||
unsigned dp = pcFace->mIndices[ind];
|
unsigned dp = pcFace->mIndices[ind];
|
||||||
|
@ -290,7 +281,7 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
*piCSIter++ = dp;
|
*piCSIter++ = dp;
|
||||||
|
|
||||||
// if the vertex is not yet in cache, set its cache count
|
// if the vertex is not yet in cache, set its cache count
|
||||||
if (iStampCnt - piCachingStamps[dp] > mConfigCacheDepth) {
|
if (iStampCnt-piCachingStamps[dp] > mConfigCacheDepth) {
|
||||||
piCachingStamps[dp] = iStampCnt++;
|
piCachingStamps[dp] = iStampCnt++;
|
||||||
++iCacheMisses;
|
++iCacheMisses;
|
||||||
}
|
}
|
||||||
|
@ -306,16 +297,16 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
// get next fanning vertex
|
// get next fanning vertex
|
||||||
ivdx = -1;
|
ivdx = -1;
|
||||||
int max_priority = -1;
|
int max_priority = -1;
|
||||||
for (std::vector<unsigned int>::iterator piCur = piCandidates.begin(); piCur != piCurCandidate; ++piCur) {
|
for (unsigned int* piCur = piCandidates;piCur != piCurCandidate;++piCur) {
|
||||||
const unsigned int dp = *piCur;
|
const unsigned int dp = *piCur;
|
||||||
|
|
||||||
// must have live triangles
|
// must have live triangles
|
||||||
if (piNumTriPtr[dp] > 0) {
|
if (piNumTriPtr[dp] > 0) {
|
||||||
int priority = 0;
|
int priority = 0;
|
||||||
|
|
||||||
// will the vertex be in cache, even after fanning occurs?
|
// will the vertex be in cache, even after fanning occurs?
|
||||||
unsigned int tmp;
|
unsigned int tmp;
|
||||||
if ((tmp = iStampCnt - piCachingStamps[dp]) + 2 * piNumTriPtr[dp] <= mConfigCacheDepth) {
|
if ((tmp = iStampCnt-piCachingStamps[dp]) + 2*piNumTriPtr[dp] <= mConfigCacheDepth) {
|
||||||
priority = tmp;
|
priority = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +324,7 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
while (!sDeadEndVStack.empty()) {
|
while (!sDeadEndVStack.empty()) {
|
||||||
unsigned int iCachedIdx = sDeadEndVStack.top();
|
unsigned int iCachedIdx = sDeadEndVStack.top();
|
||||||
sDeadEndVStack.pop();
|
sDeadEndVStack.pop();
|
||||||
if (piNumTriPtr[iCachedIdx] > 0) {
|
if (piNumTriPtr[ iCachedIdx ] > 0) {
|
||||||
ivdx = iCachedIdx;
|
ivdx = iCachedIdx;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -342,9 +333,9 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
if (-1 == ivdx) {
|
if (-1 == ivdx) {
|
||||||
// well, there isn't such a vertex. Simply get the next vertex in input order and
|
// well, there isn't such a vertex. Simply get the next vertex in input order and
|
||||||
// hope it is not too bad ...
|
// hope it is not too bad ...
|
||||||
while (ics < (int)pMesh->mNumVertices) {
|
while (ics < (int)pMesh->mNumVertices) {
|
||||||
++ics;
|
++ics;
|
||||||
if (piNumTriPtr[ics] > 0) {
|
if (piNumTriPtr[ics] > 0) {
|
||||||
ivdx = ics;
|
ivdx = ics;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,29 +345,29 @@ ai_real ImproveCacheLocalityProcess::ProcessMesh(aiMesh *pMesh, unsigned int mes
|
||||||
}
|
}
|
||||||
ai_real fACMR2 = 0.0f;
|
ai_real fACMR2 = 0.0f;
|
||||||
if (!DefaultLogger::isNullLogger()) {
|
if (!DefaultLogger::isNullLogger()) {
|
||||||
fACMR2 = static_cast<ai_real>(iCacheMisses / pMesh->mNumFaces);
|
fACMR2 = (float)iCacheMisses / pMesh->mNumFaces;
|
||||||
const ai_real averageACMR = ((fACMR - fACMR2) / fACMR) * 100.f;
|
|
||||||
// very intense verbose logging ... prepare for much text if there are many meshes
|
// very intense verbose logging ... prepare for much text if there are many meshes
|
||||||
if (DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
|
if ( DefaultLogger::get()->getLogSeverity() == Logger::VERBOSE) {
|
||||||
ASSIMP_LOG_VERBOSE_DEBUG("Mesh ", meshNum, "| ACMR in: ", fACMR, " out: ", fACMR2, " | average ACMR ", averageACMR);
|
ASSIMP_LOG_VERBOSE_DEBUG("Mesh %u | ACMR in: ", meshNum, " out: ", fACMR, " | ~", fACMR2, ((fACMR - fACMR2) / fACMR) * 100.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
fACMR2 *= pMesh->mNumFaces;
|
fACMR2 *= pMesh->mNumFaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sort the output index buffer back to the input array
|
// sort the output index buffer back to the input array
|
||||||
piCSIter = piIBOutput.begin();
|
piCSIter = piIBOutput;
|
||||||
for (aiFace *pcFace = pMesh->mFaces; pcFace != pcEnd; ++pcFace) {
|
for (aiFace* pcFace = pMesh->mFaces; pcFace != pcEnd;++pcFace) {
|
||||||
unsigned nind = pcFace->mNumIndices;
|
unsigned nind = pcFace->mNumIndices;
|
||||||
unsigned *ind = pcFace->mIndices;
|
unsigned * ind = pcFace->mIndices;
|
||||||
if (nind > 0)
|
if (nind > 0) ind[0] = *piCSIter++;
|
||||||
ind[0] = *piCSIter++;
|
if (nind > 1) ind[1] = *piCSIter++;
|
||||||
if (nind > 1)
|
if (nind > 2) ind[2] = *piCSIter++;
|
||||||
ind[1] = *piCSIter++;
|
|
||||||
if (nind > 2)
|
|
||||||
ind[2] = *piCSIter++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delete temporary storage
|
||||||
|
delete[] piCachingStamps;
|
||||||
|
delete[] piIBOutput;
|
||||||
|
delete[] piCandidates;
|
||||||
|
|
||||||
return fACMR2;
|
return fACMR2;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Assimp
|
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
Open Asset Import Library (assimp)
|
Open Asset Import Library (assimp)
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
Copyright (c) 2006-2023, assimp team
|
Copyright (c) 2006-2022, assimp team
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
|
|
|
@ -51,17 +51,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief An axis-aligned bounding box.
|
* An axis-aligned bounding box.
|
||||||
*/
|
*/
|
||||||
struct aiAABB {
|
struct aiAABB {
|
||||||
/**
|
|
||||||
* @brief The minimum edge position of the axis-aligned bounding-box.
|
|
||||||
*/
|
|
||||||
C_STRUCT aiVector3D mMin;
|
C_STRUCT aiVector3D mMin;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The maximum edge position of the axis-aligned bounding-box.
|
|
||||||
*/
|
|
||||||
C_STRUCT aiVector3D mMax;
|
C_STRUCT aiVector3D mMax;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -78,6 +78,7 @@ struct aiVectorKey {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Construction from a given time and key value.
|
/// @brief Construction from a given time and key value.
|
||||||
|
|
||||||
aiVectorKey(double time, const aiVector3D &value) :
|
aiVectorKey(double time, const aiVector3D &value) :
|
||||||
mTime(time), mValue(value) {
|
mTime(time), mValue(value) {
|
||||||
// empty
|
// empty
|
||||||
|
|
Loading…
Reference in New Issue