Page 1 of 1

Update to 3ds loader

Posted: Wed Jan 14, 2004 4:44 pm
by JoeWright
Here's a suggested update to the 3ds loader that gets the colour information. Changes are in bold.

You have to manually set the ambient value (e.g. to black) because the default ambient value makes the object completely white. The 3ds loader doesn't currently bring in the ambient values.

We need normals to be read in for those nice curved surfaces.

Joe


bool C3DSMeshFileLoader::readColorChunk(io::IReadFile* file, ChunkData* chunk,
video::SColor& out)
{
ChunkData data;
readChunkData(file, data);

u8 c[3];

if (sizeof(c) != data.header.length - data.read)
{
os::Printer::log("Unknown size of color chunk in 3Ds file.", ELL_WARNING);
file->seek(data.header.length - data.read, true);
data.read += data.header.length - data.read;
}
else
{
file->read(c, data.header.length - data.read);
out.set(255, c[0], c[1], c[2]);
data.read += data.header.length - data.read;
}

chunk->read += data.read;

return true;
}