obj writer can now write 32 bit buffers

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6334 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2022-04-14 14:39:31 +00:00
parent c58afe8038
commit 8447d3f531
2 changed files with 20 additions and 4 deletions

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- obj meshloader can now load 32-bit buffers when setPreferredIndexType is set to EIT_32BIT.
- obj writer can now write 32 bit buffers
- obj meshloader can now load 32 bit buffers when setPreferredIndexType is set to EIT_32BIT.
It's 16 bit meshes use now also an IDynamicMeshbuffer instead of an SMeshBuffer.
- Add IMeshLoader::setPreferredIndexType and getPreferredIndexType to allow setting hints for the loaders if users prefer 16 or 32 bit meshbuffers.
- Add IMeshBuffer::getType to allow finding out which class type a meshbuffer has (similar to ISceneNode::getType).

@ -130,8 +130,23 @@ bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
const u32 indexCount = buffer->getIndexCount();
for (j=0; j<indexCount; j+=3)
{
unsigned int idx2, idx1, idx0;
switch(buffer->getIndexType())
{
case video::EIT_16BIT:
idx2 = buffer->getIndices()[j+2]+allVertexCount;
idx1 = buffer->getIndices()[j+1]+allVertexCount;
idx0 = buffer->getIndices()[j+0]+allVertexCount;
break;
case video::EIT_32BIT:
idx2 = ((u32*)buffer->getIndices())[j+2]+allVertexCount;
idx1 = ((u32*)buffer->getIndices())[j+1]+allVertexCount;
idx0 = ((u32*)buffer->getIndices())[j+0]+allVertexCount;
break;
}
file->write("f ",2);
num = core::stringc(buffer->getIndices()[j+2]+allVertexCount);
num = core::stringc(idx2);
file->write(num.c_str(), num.size());
file->write("/",1);
file->write(num.c_str(), num.size());
@ -139,7 +154,7 @@ bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
file->write(num.c_str(), num.size());
file->write(" ",1);
num = core::stringc(buffer->getIndices()[j+1]+allVertexCount);
num = core::stringc(idx1);
file->write(num.c_str(), num.size());
file->write("/",1);
file->write(num.c_str(), num.size());
@ -147,7 +162,7 @@ bool COBJMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 fla
file->write(num.c_str(), num.size());
file->write(" ",1);
num = core::stringc(buffer->getIndices()[j+0]+allVertexCount);
num = core::stringc(idx0);
file->write(num.c_str(), num.size());
file->write("/",1);
file->write(num.c_str(), num.size());