Commit 3ef53bc2 authored by hybrid's avatar hybrid

Some fixes for CSM loading.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2537 dfc29bdd-3216-0410-991c-e03cc46cb475
parent b3a75128
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
#include "SAnimatedMesh.h" #include "SAnimatedMesh.h"
#include "SMeshBufferLightMap.h" #include "SMeshBufferLightMap.h"
#ifdef _DEBUG
#define _IRR_DEBUG_CSM_LOADER_
#endif
namespace irr namespace irr
{ {
namespace scene namespace scene
...@@ -32,15 +36,38 @@ namespace scene ...@@ -32,15 +36,38 @@ namespace scene
s32 green; s32 green;
s32 blue; s32 blue;
void clear() color_rgb_t() : red(0), green(0), blue(0) {}
void clear() { red=0; green=0; blue=0; }
video::SColor toSColor() const { return video::SColor(255, red, green, blue); }
};
//
// A Binary File Reader
//
class BinaryFileReader
{
public:
BinaryFileReader(io::IReadFile* pFile) : file(pFile) { }
s32 readBuffer(void* buffer, s32 len)
{ {
red = 0; return file->read(buffer,len);
green = 0;
blue = 0;
} }
};
class BinaryFileReader; s32 readLong();
f32 readFloat();
void readString(core::stringc &str);
void readVec3f(core::vector3df* v);
void readVec2f(core::vector2df* v);
void readColorRGB(color_rgb_t* color);
private:
io::IReadFile *file;
};
// //
// The file header // The file header
...@@ -49,15 +76,20 @@ namespace scene ...@@ -49,15 +76,20 @@ namespace scene
{ {
public: public:
static const s32 VERSION_4; enum E_CSM_VERSION
static const s32 VERSION_4_1; {
VERSION_4 = 4,
VERSION_4_1 = 5
};
Header(){ clear(); } Header(){ clear(); }
virtual ~Header(){ clear(); }
s32 getVersion() const{ return version; } s32 getVersion() const { return version; }
void clear(){ version = 0; } void clear(){ version = 0; }
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader)
{
version = pReader->readLong();
}
private: private:
...@@ -73,7 +105,7 @@ namespace scene ...@@ -73,7 +105,7 @@ namespace scene
public: public:
Group(){ clear(); } Group(){ clear(); }
virtual ~Group(){ clear(); } ~Group(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
...@@ -81,7 +113,7 @@ namespace scene ...@@ -81,7 +113,7 @@ namespace scene
s32 getFlags() const { return flags; } s32 getFlags() const { return flags; }
s32 getParentGroupID() const { return parentGroup; } s32 getParentGroupID() const { return parentGroup; }
const core::stringc& getProperties() const { return props; } const core::stringc& getProperties() const { return props; }
const color_rgb_t* getColor() const { return &color; } video::SColor getColor() const { return color.toSColor(); }
private: private:
...@@ -100,13 +132,13 @@ namespace scene ...@@ -100,13 +132,13 @@ namespace scene
public: public:
VisGroup(){ clear(); } VisGroup(){ clear(); }
virtual ~VisGroup(){ clear(); } ~VisGroup(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
s32 getFlags() const{ return flags; } s32 getFlags() const{ return flags; }
const core::stringc& getName() const{ return name; } const core::stringc& getName() const{ return name; }
const color_rgb_t* getColor() const{ return &color; } video::SColor getColor() const{ return color.toSColor(); }
private: private:
...@@ -124,7 +156,7 @@ namespace scene ...@@ -124,7 +156,7 @@ namespace scene
public: public:
LightMap() : pixelData(0){ clear(); } LightMap() : pixelData(0){ clear(); }
virtual ~LightMap(){ clear(); } ~LightMap(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
s32 getWidth() const{ return width; } s32 getWidth() const{ return width; }
...@@ -155,13 +187,13 @@ namespace scene ...@@ -155,13 +187,13 @@ namespace scene
public: public:
Vertex(){ clear(); } Vertex(){ clear(); }
virtual ~Vertex(){ clear(); } ~Vertex(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
const core::vector3df* getPosition() const { return &position; } const core::vector3df* getPosition() const { return &position; }
const core::vector3df* getNormal() const { return &normal; } const core::vector3df* getNormal() const { return &normal; }
const color_rgb_t* getColor() const { return &color; } video::SColor getColor() const { return color.toSColor(); }
const core::vector3df* getTextureCoordinates() const { return &texCoords; } const core::vector3df* getTextureCoordinates() const { return &texCoords; }
const core::vector3df* getLightMapCoordinates() const { return &lmapCoords; } const core::vector3df* getLightMapCoordinates() const { return &lmapCoords; }
...@@ -180,7 +212,7 @@ namespace scene ...@@ -180,7 +212,7 @@ namespace scene
public: public:
Surface() { clear(); } Surface() { clear(); }
virtual ~Surface(){ clear(); } ~Surface(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader *pReader); void load(BinaryFileReader *pReader);
...@@ -216,7 +248,7 @@ namespace scene ...@@ -216,7 +248,7 @@ namespace scene
public: public:
Mesh(){ clear(); } Mesh(){ clear(); }
virtual ~Mesh(){ clear(); } ~Mesh(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader, bool bReadVisGroups); void load(BinaryFileReader* pReader, bool bReadVisGroups);
...@@ -224,7 +256,7 @@ namespace scene ...@@ -224,7 +256,7 @@ namespace scene
s32 getFlags() const { return flags; } s32 getFlags() const { return flags; }
s32 getGroupID() const { return groupId; } s32 getGroupID() const { return groupId; }
const core::stringc& getProperties() const { return props; } const core::stringc& getProperties() const { return props; }
const color_rgb_t* getColor() const { return &color; } video::SColor getColor() const { return color.toSColor(); }
const core::vector3df* getPosition() const { return &position; } const core::vector3df* getPosition() const { return &position; }
s32 getVisgroupID() const { return visgroupId; } s32 getVisgroupID() const { return visgroupId; }
s32 getSurfaceCount() const { return surfaces.size(); } s32 getSurfaceCount() const { return surfaces.size(); }
...@@ -247,7 +279,7 @@ namespace scene ...@@ -247,7 +279,7 @@ namespace scene
public: public:
Entity() { clear(); } Entity() { clear(); }
virtual ~Entity() { clear(); } ~Entity() { clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
...@@ -270,7 +302,7 @@ namespace scene ...@@ -270,7 +302,7 @@ namespace scene
public: public:
CameraData(){ clear(); } CameraData(){ clear(); }
virtual ~CameraData(){ clear(); } ~CameraData(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
...@@ -294,25 +326,25 @@ namespace scene ...@@ -294,25 +326,25 @@ namespace scene
public: public:
CSMFile(){ clear(); } CSMFile(){ clear(); }
virtual ~CSMFile(){ clear(); } ~CSMFile(){ clear(); }
void clear(); void clear();
void load(BinaryFileReader* pReader); void load(BinaryFileReader* pReader);
const Header* getHeader() const{ return &header; } const Header* getHeader() const{ return &header; }
s32 getGroupCount() const{ return groups.size(); } u32 getGroupCount() const{ return groups.size(); }
const Group* getGroupAt(const s32 index) const{ return groups[index]; } const Group* getGroupAt(const s32 index) const{ return groups[index]; }
s32 getVisGroupCount() const{ return visgroups.size(); } u32 getVisGroupCount() const{ return visgroups.size(); }
const VisGroup* getVisGroupAt(const s32 index) const{ return visgroups[index]; } const VisGroup* getVisGroupAt(const s32 index) const{ return visgroups[index]; }
s32 getLightMapCount() const{ return lightmaps.size(); } u32 getLightMapCount() const{ return lightmaps.size(); }
const LightMap* getLightMapAt(const s32 index) const { return lightmaps[index]; } const LightMap* getLightMapAt(const s32 index) const { return lightmaps[index]; }
s32 getMeshCount() const{ return meshes.size(); } u32 getMeshCount() const{ return meshes.size(); }
const Mesh* getMeshAt(const s32 index) const{ return meshes[index]; } const Mesh* getMeshAt(const s32 index) const{ return meshes[index]; }
s32 getEntityCount() const{ return entities.size(); } u32 getEntityCount() const{ return entities.size(); }
const Entity* getEntityAt(const s32 index) const{ return entities[index]; } const Entity* getEntityAt(const s32 index) const{ return entities[index]; }
const CameraData* getCameraData() const{ return &cameraData; } const CameraData* getCameraData() const{ return &cameraData; }
...@@ -328,35 +360,6 @@ namespace scene ...@@ -328,35 +360,6 @@ namespace scene
CameraData cameraData; CameraData cameraData;
}; };
//
// A Binary File Reader
//
class BinaryFileReader
{
public:
BinaryFileReader(io::IReadFile* pFile, bool closeWhenDone=true);
virtual ~BinaryFileReader();
virtual s32 readBuffer(void* buffer, s32 len);
s32 readLong();
f32 readFloat();
u8 readByte();
core::stringc readString();
void readVec3f(core::vector3df* v);
void readVec2f(core::vector2df* v);
void readColorRGB(color_rgb_t* color);
private:
io::IReadFile *file;
bool autoClose;
};
CCSMLoader::CCSMLoader(scene::ISceneManager* manager, io::IFileSystem* fs) CCSMLoader::CCSMLoader(scene::ISceneManager* manager, io::IFileSystem* fs)
: FileSystem(fs), SceneManager(manager) : FileSystem(fs), SceneManager(manager)
{ {
...@@ -366,9 +369,6 @@ namespace scene ...@@ -366,9 +369,6 @@ namespace scene
#endif #endif
} }
CCSMLoader::~CCSMLoader()
{
}
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".bsp") //! based on the file extension (e.g. ".bsp")
...@@ -377,11 +377,10 @@ namespace scene ...@@ -377,11 +377,10 @@ namespace scene
return core::hasFileExtension ( filename, "csm" ); return core::hasFileExtension ( filename, "csm" );
} }
//! creates/loads an animated mesh from the file. //! creates/loads an animated mesh from the file.
IAnimatedMesh* CCSMLoader::createMesh(io::IReadFile* file) IAnimatedMesh* CCSMLoader::createMesh(io::IReadFile* file)
{ {
file->grab(); // originally, this loader created the file on its own.
scene::IMesh* m = createCSMMesh(file); scene::IMesh* m = createCSMMesh(file);
if (!m) if (!m)
...@@ -401,34 +400,29 @@ namespace scene ...@@ -401,34 +400,29 @@ namespace scene
if (!file) if (!file)
return 0; return 0;
if(file) BinaryFileReader reader(file);
{
BinaryFileReader reader(file, true);
CSMFile csmFile; CSMFile csmFile;
csmFile.load(&reader); csmFile.load(&reader);
scene::IMesh* pMesh = createIrrlichtMesh(&csmFile, return createIrrlichtMesh(&csmFile,
SceneManager->getParameters()->getAttributeAsString(CSM_TEXTURE_PATH), SceneManager->getParameters()->getAttributeAsString(CSM_TEXTURE_PATH),
core::stringc ( file->getFileName() ).c_str() ); file->getFileName());
return pMesh;
} }
return 0;
}
scene::IMesh* CCSMLoader::createIrrlichtMesh(const CSMFile* csmFile, scene::IMesh* CCSMLoader::createIrrlichtMesh(const CSMFile* csmFile,
core::stringc textureRoot, const c8* lmprefix) const core::stringc& textureRoot, const core::string<c16>& lmprefix)
{ {
scene::SMesh *pMesh = new scene::SMesh(); scene::SMesh *pMesh = new scene::SMesh();
video::IVideoDriver* driver = SceneManager->getVideoDriver(); video::IVideoDriver* driver = SceneManager->getVideoDriver();
for(s32 l = 0; l<csmFile->getLightMapCount(); l++) for(u32 l = 0; l<csmFile->getLightMapCount(); l++)
{ {
const LightMap* lmap = csmFile->getLightMapAt(l); const LightMap* lmap = csmFile->getLightMapAt(l);
core::stringc lmapName = lmprefix; core::stringc<c16> lmapName = lmprefix;
lmapName += "LMAP_"; lmapName += "LMAP_";
lmapName += (int)(l+1); lmapName += core::string<c16>(l+1);
os::Printer::log("CCSMLoader loading light map", lmapName.c_str()); os::Printer::log("CCSMLoader loading light map", lmapName.c_str());
video::IImage* lmapImg = driver->createImageFromData( video::IImage* lmapImg = driver->createImageFromData(
...@@ -438,10 +432,9 @@ namespace scene ...@@ -438,10 +432,9 @@ namespace scene
driver->addTexture(lmapName.c_str(), lmapImg); driver->addTexture(lmapName.c_str(), lmapImg);
lmapImg->drop(); lmapImg->drop();
} }
for(s32 m = 0; m<csmFile->getMeshCount(); m++) for(u32 m = 0; m<csmFile->getMeshCount(); m++)
{ {
const Mesh* mshPtr = csmFile->getMeshAt(m); const Mesh* mshPtr = csmFile->getMeshAt(m);
...@@ -449,17 +442,31 @@ namespace scene ...@@ -449,17 +442,31 @@ namespace scene
{ {
const Surface* surface = mshPtr->getSurfaceAt(s); const Surface* surface = mshPtr->getSurfaceAt(s);
core::stringc texName = textureRoot; core::stringc texName;
texName+= "/"; if (textureRoot.size())
{
texName += textureRoot;
texName += "/";
}
texName+= surface->getTextureName(); texName+= surface->getTextureName();
video::ITexture* texture = driver->getTexture(texName); video::ITexture* texture = 0;
if (FileSystem->existFile(texName))
driver->getTexture(texName);
else if (FileSystem->existFile(surface->getTextureName()))
driver->getTexture(surface->getTextureName());
else if (FileSystem->existFile(FileSystem->getFileBasename(surface->getTextureName())))
driver->getTexture(FileSystem->getFileBasename(surface->getTextureName()));
else if (FileSystem->existFile(FileSystem->getFileDir(lmprefix)+"/"+surface->getTextureName()))
driver->getTexture(FileSystem->getFileDir(lmprefix)+"/"+surface->getTextureName());
else
driver->getTexture(FileSystem->getFileDir(lmprefix)+"/"+FileSystem->getFileBasename(surface->getTextureName()));
scene::SMeshBufferLightMap *buffer = new scene::SMeshBufferLightMap(); scene::SMeshBufferLightMap *buffer = new scene::SMeshBufferLightMap();
//material //material
core::stringc lmapName = lmprefix; core::string<c16> lmapName = lmprefix;
lmapName += "LMAP_"; lmapName += "LMAP_";
lmapName += (int)surface->getLightMapId(); lmapName += core::string<c16>(surface->getLightMapId());
buffer->Material.setTexture(0, texture); buffer->Material.setTexture(0, texture);
buffer->Material.setTexture(1, driver->getTexture(lmapName)); buffer->Material.setTexture(1, driver->getTexture(lmapName));
...@@ -472,7 +479,7 @@ namespace scene ...@@ -472,7 +479,7 @@ namespace scene
video::S3DVertex2TCoords vtx; video::S3DVertex2TCoords vtx;
vtx.Pos = *(vtxPtr->getPosition()); vtx.Pos = *(vtxPtr->getPosition());
vtx.Normal = *(vtxPtr->getPosition()); vtx.Normal = *(vtxPtr->getPosition());
vtx.Color.set(255,vtxPtr->getColor()->red,vtxPtr->getColor()->green,vtxPtr->getColor()->blue); vtx.Color=vtxPtr->getColor();
vtx.TCoords.set(vtxPtr->getTextureCoordinates()->X,vtxPtr->getTextureCoordinates()->Y); vtx.TCoords.set(vtxPtr->getTextureCoordinates()->X,vtxPtr->getTextureCoordinates()->Y);
vtx.TCoords2.set(vtxPtr->getLightMapCoordinates()->X,0.0f - vtxPtr->getLightMapCoordinates()->Y); vtx.TCoords2.set(vtxPtr->getLightMapCoordinates()->X,0.0f - vtxPtr->getLightMapCoordinates()->Y);
...@@ -497,14 +504,6 @@ namespace scene ...@@ -497,14 +504,6 @@ namespace scene
return pMesh; return pMesh;
} }
const s32 Header::VERSION_4 = 4;
const s32 Header::VERSION_4_1 = 5;
void Header::load(BinaryFileReader* pReader)
{
version = pReader->readLong();
}
void Group::clear() void Group::clear()
{ {
color.clear(); color.clear();
...@@ -517,7 +516,7 @@ namespace scene ...@@ -517,7 +516,7 @@ namespace scene
{ {
flags = pReader->readLong(); flags = pReader->readLong();
parentGroup = pReader->readLong(); parentGroup = pReader->readLong();
props = pReader->readString(); pReader->readString(props);
pReader->readColorRGB(&color); pReader->readColorRGB(&color);
} }
...@@ -531,18 +530,15 @@ namespace scene ...@@ -531,18 +530,15 @@ namespace scene
void VisGroup::load(BinaryFileReader* pReader) void VisGroup::load(BinaryFileReader* pReader)
{ {
name = pReader->readString(); pReader->readString(name);
flags = pReader->readLong(); flags = pReader->readLong();
pReader->readColorRGB(&color); pReader->readColorRGB(&color);
} }
void LightMap::clear() void LightMap::clear()
{
if(pixelData)
{ {
delete[] pixelData; delete[] pixelData;
pixelData = 0; pixelData = 0;
}
width = height = 0; width = height = 0;
} }
...@@ -564,12 +560,9 @@ namespace scene ...@@ -564,12 +560,9 @@ namespace scene
position.set(0,0,0); position.set(0,0,0);
for(u32 s = 0; s < surfaces.size(); s++) for(u32 s = 0; s < surfaces.size(); s++)
{
if(surfaces[s])
{ {
delete surfaces[s]; delete surfaces[s];
} }
}
surfaces.clear(); surfaces.clear();
} }
...@@ -577,7 +570,7 @@ namespace scene ...@@ -577,7 +570,7 @@ namespace scene
{ {
flags = pReader->readLong(); flags = pReader->readLong();
groupId = pReader->readLong(); groupId = pReader->readLong();
props = pReader->readString(); pReader->readString(props);
pReader->readColorRGB(&color); pReader->readColorRGB(&color);
pReader->readVec3f(&position); pReader->readVec3f(&position);
if(bReadVisGroups) if(bReadVisGroups)
...@@ -615,7 +608,8 @@ namespace scene ...@@ -615,7 +608,8 @@ namespace scene
void Surface::load(BinaryFileReader* pReader) void Surface::load(BinaryFileReader* pReader)
{ {
flags = pReader->readLong(); flags = pReader->readLong();
textureName = pReader->readString(); pReader->readString(textureName);
textureName.replace('\\', '/');
lightMapId = pReader->readLong(); lightMapId = pReader->readLong();
pReader->readVec2f(&uvOffset); pReader->readVec2f(&uvOffset);
...@@ -678,7 +672,7 @@ namespace scene ...@@ -678,7 +672,7 @@ namespace scene
{ {
visgroupId = pReader->readLong(); visgroupId = pReader->readLong();
groupId = pReader->readLong(); groupId = pReader->readLong();
props = pReader->readString(); pReader->readString(props);
pReader->readVec3f(&position); pReader->readVec3f(&position);
} }
...@@ -736,8 +730,13 @@ namespace scene ...@@ -736,8 +730,13 @@ namespace scene
//groups //groups
{ {
s32 count = pReader->readLong(); const s32 count = pReader->readLong();
#ifdef _IRR_DEBUG_CSM_LOADER_
os::Printer::log("CSM Version", core::stringc(header.getVersion()).c_str());
os::Printer::log("Loading groups. Count", core::stringc(count));
#endif
groups.reallocate(count);
for (s32 i = 0; i < count; i++) for (s32 i = 0; i < count; i++)
{ {
Group* grp = new Group(); Group* grp = new Group();
...@@ -745,13 +744,17 @@ namespace scene ...@@ -745,13 +744,17 @@ namespace scene
groups.push_back(grp); groups.push_back(grp);
} }
} }
bool bHasVGroups = (header.getVersion() == Header::VERSION_4_1); const bool bHasVGroups = (header.getVersion() == Header::VERSION_4_1);
if (bHasVGroups) if (bHasVGroups)
{ {
//visgroups //visgroups
s32 count = pReader->readLong(); const s32 count = pReader->readLong();
#ifdef _IRR_DEBUG_CSM_LOADER_
os::Printer::log("Loading visgroups. Count", core::stringc(count));
#endif
visgroups.reallocate(count);
for (s32 i = 0; i < count; i++) for (s32 i = 0; i < count; i++)
{ {
VisGroup* grp = new VisGroup(); VisGroup* grp = new VisGroup();
...@@ -762,66 +765,57 @@ namespace scene ...@@ -762,66 +765,57 @@ namespace scene
//lightmaps //lightmaps
{ {
s32 count = pReader->readLong(); const s32 count = pReader->readLong();
#ifdef _IRR_DEBUG_CSM_LOADER_
os::Printer::log("Loading lightmaps. Count", core::stringc(count));
#endif
lightmaps.reallocate(count);
for(s32 i = 0; i < count; i++) for(s32 i = 0; i < count; i++)
{ {
LightMap* grp = new LightMap(); LightMap* lm = new LightMap();
grp->load(pReader); lm->load(pReader);
lightmaps.push_back(grp); lightmaps.push_back(lm);
} }
} }
//meshes //meshes
{ {
s32 count = pReader->readLong(); const s32 count = pReader->readLong();
#ifdef _IRR_DEBUG_CSM_LOADER_
os::Printer::log("Loading meshes. Count", core::stringc(count));
#endif
meshes.reallocate(count);
for(s32 i = 0; i < count; i++) for(s32 i = 0; i < count; i++)
{ {
Mesh* grp = new Mesh(); Mesh* mesh = new Mesh();
grp->load(pReader,bHasVGroups); mesh->load(pReader,bHasVGroups);
meshes.push_back(grp); meshes.push_back(mesh);
} }
} }
//entities //entities
{ {
s32 count = pReader->readLong(); const s32 count = pReader->readLong();
#ifdef _IRR_DEBUG_CSM_LOADER_
os::Printer::log("Loading entitites. Count", core::stringc(count));
#endif
entities.reallocate(count);
for(s32 i = 0; i < count; i++) for(s32 i = 0; i < count; i++)
{ {
Entity* grp = new Entity(); Entity* ent = new Entity();
grp->load(pReader); ent->load(pReader);
entities.push_back(grp); entities.push_back(ent);
} }
} }
//camera data //camera data
#ifdef _IRR_DEBUG_CSM_LOADER_
os::Printer::log("Loading camera data.");
#endif
cameraData.load(pReader); cameraData.load(pReader);
}
BinaryFileReader::BinaryFileReader(io::IReadFile* pFile,
bool closeWhenDone)
: file(pFile), autoClose(closeWhenDone)
{
}
BinaryFileReader::~BinaryFileReader()
{
if(autoClose && file)
{
file->drop();
file = 0;
}
}
s32 BinaryFileReader::readBuffer(void* buffer, s32 len)
{
return file->read(buffer,len);
} }
s32 BinaryFileReader::readLong() s32 BinaryFileReader::readLong()
...@@ -838,23 +832,16 @@ namespace scene ...@@ -838,23 +832,16 @@ namespace scene
return (f32)ret; return (f32)ret;
} }
u8 BinaryFileReader::readByte() void BinaryFileReader::readString(core::stringc &str)
{
char ret = 0;
readBuffer(&ret,sizeof(char));
return (u8)ret;
}
core::stringc BinaryFileReader::readString()
{ {
core::stringc str = ""; str = "";
c8 c = (c8)readByte(); c8 c;
readBuffer(&c,sizeof(char));
while(c != 0) while(c != 0)
{ {
str += c; str += c;
c = (c8)readByte(); readBuffer(&c,sizeof(char));
} }
return str;
} }
void BinaryFileReader::readVec3f(core::vector3df* v) void BinaryFileReader::readVec3f(core::vector3df* v)
......
...@@ -56,7 +56,6 @@ namespace scene ...@@ -56,7 +56,6 @@ namespace scene
public: public:
CCSMLoader(ISceneManager* manager, io::IFileSystem* fs); CCSMLoader(ISceneManager* manager, io::IFileSystem* fs);
virtual ~CCSMLoader();
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".bsp") //! based on the file extension (e.g. ".bsp")
...@@ -70,7 +69,7 @@ namespace scene ...@@ -70,7 +69,7 @@ namespace scene
scene::IMesh* createCSMMesh(io::IReadFile* file); scene::IMesh* createCSMMesh(io::IReadFile* file);
scene::IMesh* createIrrlichtMesh(const CSMFile* csmFile, scene::IMesh* createIrrlichtMesh(const CSMFile* csmFile,
core::stringc textureRoot, const c8* lmprefix); const core::stringc& textureRoot, const core::string<c16>& lmprefix);
io::IFileSystem* FileSystem; io::IFileSystem* FileSystem;
scene::ISceneManager* SceneManager; scene::ISceneManager* SceneManager;
......
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