Fix Collada (.dae) writing with 32 bit meshbuffers

Was still handling them as 16-bit buffers.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6416 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-08-24 12:55:45 +00:00
parent 9025fcc377
commit 38e5bfe234

@ -1865,12 +1865,16 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
Writer->writeElement("p", false);
const video::E_INDEX_TYPE iType = buffer->getIndexType();
const u16* idx16 = buffer->getIndices();
const u32* idx32 = (u32*)buffer->getIndices();
core::stringc strP;
strP.reserve(100);
for (u32 p=0; p<polyCount; ++p)
{
// Irrlicht uses clockwise, Collada uses counter-clockwise to define front-face
u32 irrIdx = buffer->getIndices()[(p*3) + 2];
u32 irrIdx = iType == video::EIT_16BIT ? idx16[p*3 + 2] : idx32[p*3 + 2];
strP = "";
strP += irrIdx + posIdx;
strP += " ";
@ -1884,7 +1888,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
strP += " ";
}
irrIdx = buffer->getIndices()[(p*3) + 1];
irrIdx = iType == video::EIT_16BIT ? idx16[p*3 + 1] : idx32[p*3 + 1];
strP += irrIdx + posIdx;
strP += " ";
strP += irrIdx + tCoordIdx;
@ -1897,7 +1901,7 @@ void CColladaMeshWriter::writeMeshGeometry(const irr::core::stringc& meshname, s
strP += " ";
}
irrIdx = buffer->getIndices()[(p*3) + 0];
irrIdx = iType == video::EIT_16BIT ? idx16[p*3] : idx32[p*3];
strP += irrIdx + posIdx;
strP += " ";
strP += irrIdx + tCoordIdx;