Commit 6b0daf79 authored by hybrid's avatar hybrid

Fixed some nasty bugs I introduced the last days.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@875 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b55f911e
......@@ -839,10 +839,10 @@ bool C3DSMeshFileLoader::readObjectChunk(io::IReadFile* file, ChunkData* parent)
case C3DS_TRISMOOTH: // TODO
{
SmoothingGroups = new u32[CountFaces];
file->read(&SmoothingGroups, CountFaces*sizeof(u32));
file->read(SmoothingGroups, CountFaces*sizeof(u32));
#ifdef __BIG_ENDIAN__
for (u16 i=0; i<CountFaces; ++i)
flags = os::Byteswap::byteswap(flags);
SmoothingGroups[i] = os::Byteswap::byteswap(SmoothingGroups[i]);
#endif
data.read += CountFaces*sizeof(u32);
}
......
......@@ -210,8 +210,10 @@ video::SMaterial CXAnimationPlayer::getMaterialFromXMaterial(const CXFileReader:
if (xmat.TextureFileName.size() != 0)
{
// use name from .x file
mat.Textures[0] = Driver->getTexture(xmat.TextureFileName.c_str());
if (mat.Textures[0] == 0)
// use path from .x file with texture name
mat.Textures[0] = Driver->getTexture(getTextureFileName(xmat.TextureFileName).c_str());
}
......@@ -372,6 +374,7 @@ s32 CXAnimationPlayer::getJointNumberFromName(const core::stringc& name) const
//! Use .x file path as prefix for texture
core::stringc CXAnimationPlayer::getTextureFileName(const core::stringc& texture)
{
s32 idx = -1;
......@@ -383,7 +386,7 @@ core::stringc CXAnimationPlayer::getTextureFileName(const core::stringc& texture
if (idx == -1)
return texture;
return FileName.subString(idx+1, texture.size()-idx);
return FileName.subString(0, idx+1)+texture;
}
......
......@@ -143,6 +143,7 @@ namespace scene
void addFrameToMesh(CXFileReader::SXFrame& frame);
video::SMaterial getMaterialFromXMaterial(const CXFileReader::SXMaterial& xmat);
void addFacesToBuffer(s32 meshbuffernr, CXFileReader::SXMesh& mesh, s32 matnr, const CXFileReader::SXFrame& frame);
//! use .x file path as prefix for texture
core::stringc getTextureFileName(const core::stringc& texture);
s32 getJointNumberFromName(const core::stringc& name) const;
......
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