Commit ccad8fff authored by hybrid's avatar hybrid

Missed some initializations.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1162 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 91d07a79
...@@ -682,7 +682,7 @@ bool CB3DMeshFileLoader::readChunkBRUS() ...@@ -682,7 +682,7 @@ bool CB3DMeshFileLoader::readChunkBRUS()
// number of texture ids read for Irrlicht // number of texture ids read for Irrlicht
const u32 num_textures = core::min_(n_texs, video::MATERIAL_MAX_TEXTURES); const u32 num_textures = core::min_(n_texs, video::MATERIAL_MAX_TEXTURES);
// number of bytes to skip (for ignored texture ids) // number of bytes to skip (for ignored texture ids)
const u32 n_texs_offset = (num_textures<n_texs)?(n_texs-num_textures)*sizeof(s32):0; const u32 n_texs_offset = (num_textures<n_texs)?(n_texs-num_textures):0;
while((B3dStack.getLast().startposition + B3dStack.getLast().length) > B3DFile->getPos()) //this chunk repeats while((B3dStack.getLast().startposition + B3dStack.getLast().length) > B3DFile->getPos()) //this chunk repeats
{ {
...@@ -715,14 +715,14 @@ bool CB3DMeshFileLoader::readChunkBRUS() ...@@ -715,14 +715,14 @@ bool CB3DMeshFileLoader::readChunkBRUS()
texture_id = os::Byteswap::byteswap(texture_id); texture_id = os::Byteswap::byteswap(texture_id);
#endif #endif
//--- Get pointers to the texture, based on the IDs --- //--- Get pointers to the texture, based on the IDs ---
if (texture_id != -1) if ((u32)texture_id < Textures.size())
B3dMaterial.Textures[i]=&Textures[texture_id]; B3dMaterial.Textures[i]=&Textures[texture_id];
else else
B3dMaterial.Textures[i]=0; B3dMaterial.Textures[i]=0;
} }
// skip other texture ids // skip other texture ids
if (n_texs_offset) if (n_texs_offset)
B3DFile->seek(n_texs_offset, true); B3DFile->seek(n_texs_offset*sizeof(s32), true);
//Fixes problems when the lightmap is on the first texture: //Fixes problems when the lightmap is on the first texture:
if (B3dMaterial.Textures[0] != 0) if (B3dMaterial.Textures[0] != 0)
......
...@@ -75,6 +75,13 @@ private: ...@@ -75,6 +75,13 @@ private:
struct SB3dMaterial struct SB3dMaterial
{ {
SB3dMaterial() : Material(0), red(1.0f), green(1.0f),
blue(1.0f), alpha(1.0f), shininess(0.0f), blend(0),
fx(0)
{
for (u32 i=0; i<video::MATERIAL_MAX_TEXTURES; ++i)
Textures[i]=0;
}
video::SMaterial* Material; video::SMaterial* Material;
f32 red, green, blue, alpha; f32 red, green, blue, alpha;
f32 shininess; f32 shininess;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment