mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-05 01:40:44 +01:00
b3d writer can now write 32-bit meshbuffers.
Still can't read it though - reader needs SSkinMeshBuffer which only supports 16 bit so far (changes in loader are just spelling fixes in comments) git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6346 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
8cd7e46506
commit
28e092673f
|
@ -859,7 +859,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
|
||||
while((B3dStack.getLast().startposition + B3dStack.getLast().length) > B3DFile->getPos()) //this chunk repeats
|
||||
{
|
||||
// This is what blitz basic calls a brush, like a Irrlicht Material
|
||||
// This is what blitz basic calls a brush, like an Irrlicht material
|
||||
|
||||
core::stringc name;
|
||||
readString(name);
|
||||
|
@ -933,7 +933,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
|
|||
}
|
||||
}
|
||||
|
||||
//If a preceeding texture slot is empty move the others down:
|
||||
//If a preceding texture slot is empty move the others down:
|
||||
for (i=num_textures; i>0; --i)
|
||||
{
|
||||
for (u32 j=i-1; j<num_textures-1; ++j)
|
||||
|
|
|
@ -255,18 +255,36 @@ bool CB3DMeshWriter::writeMesh(io::IWriteFile* file, IMesh* const mesh, s32 flag
|
|||
file->write(&i, 4);
|
||||
|
||||
u32 numIndices = mb->getIndexCount();
|
||||
const u16 * const idx = (u16 *) mb->getIndices();
|
||||
for (u32 j = 0; j < numIndices; j += 3)
|
||||
if ( mb->getIndexType() == video::EIT_16BIT )
|
||||
{
|
||||
u32 tmp = idx[j] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
const u16 * const idx = mb->getIndices();
|
||||
for (u32 j = 0; j < numIndices; j += 3)
|
||||
{
|
||||
u32 tmp = idx[j] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
|
||||
tmp = idx[j + 1] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
tmp = idx[j + 1] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
|
||||
tmp = idx[j + 2] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
}
|
||||
tmp = idx[j + 2] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
}
|
||||
}
|
||||
else if ( mb->getIndexType() == video::EIT_32BIT )
|
||||
{
|
||||
const u32 * const idx = (const u32*) mb->getIndices();
|
||||
for (u32 j = 0; j < numIndices; j += 3)
|
||||
{
|
||||
u32 tmp = idx[j] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
|
||||
tmp = idx[j + 1] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
|
||||
tmp = idx[j + 2] + currentMeshBufferIndex;
|
||||
file->write(&tmp, sizeof(u32));
|
||||
}
|
||||
}
|
||||
writeSizeFrom(file, trisSizeAdress+4, trisSizeAdress); // TRIS chunk size
|
||||
|
||||
currentMeshBufferIndex += mb->getVertexCount();
|
||||
|
|
Loading…
Reference in New Issue
Block a user