Commit 23986b2c authored by hybrid's avatar hybrid

Fixed two things from a previous commit that were not working. Some minor comment changes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@680 dfc29bdd-3216-0410-991c-e03cc46cb475
parent c4ec0b52
......@@ -207,7 +207,7 @@ struct SEvent
};
//! Interface of an object wich can receive events.
//! Interface of an object which can receive events.
class IEventReceiver
{
public:
......
......@@ -29,7 +29,7 @@ namespace scene
public:
//! destructor
virtual ~IMeshCache() = 0;
virtual ~IMeshCache() {};
//! Adds a mesh to the internal list of loaded meshes.
/** Usually, ISceneManager::getMesh() is called to load a mesh from a file.
......@@ -108,7 +108,7 @@ namespace scene
virtual bool setMeshFilename(const IMesh* const mesh, const c8* filename) = 0;
//! returns if a mesh already was loaded
virtual bool isMeshLoaded(const c8* filename);
virtual bool isMeshLoaded(const c8* filename) = 0;
//! Clears the whole mesh cache, removing all meshes.
/** All meshes will be reloaded completely when using ISceneManager::getMesh()
......
......@@ -2071,14 +2071,13 @@ namespace irr
namespace video
{
#ifdef _IRR_WINDOWS_API_
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
//! creates a video driver
IVideoDriver* createDirectX8Driver(const core::dimension2d<s32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer,
io::IFileSystem* io, bool pureSoftware, bool highPrecisionFPU,
bool vsync, bool antiAlias)
{
#ifdef _IRR_COMPILE_WITH_DIRECT3D_8_
CD3D8Driver* dx8 = new CD3D8Driver(screenSize, window, fullscreen,
stencilbuffer, io, pureSoftware);
......@@ -2090,14 +2089,8 @@ IVideoDriver* createDirectX8Driver(const core::dimension2d<s32>& screenSize, HWN
}
return dx8;
#else
return 0;
#endif // _IRR_COMPILE_WITH_DIRECT3D_8_
}
#endif // _IRR_WINDOWS_API_
#endif // _IRR_COMPILE_WITH_DIRECT3D_8_
} // end namespace video
} // end namespace irr
......
......@@ -2170,14 +2170,13 @@ namespace irr
namespace video
{
#if defined(_IRR_WINDOWS_)
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
//! creates a video driver
IVideoDriver* createDirectX9Driver(const core::dimension2d<s32>& screenSize, HWND window,
u32 bits, bool fullscreen, bool stencilbuffer,
io::IFileSystem* io, bool pureSoftware, bool highPrecisionFPU,
bool vsync, bool antiAlias)
{
#ifdef _IRR_COMPILE_WITH_DIRECT3D_9_
CD3D9Driver* dx9 = new CD3D9Driver(screenSize, window, fullscreen, stencilbuffer, io, pureSoftware);
if (!dx9->initDriver(screenSize, window, bits, fullscreen, pureSoftware, highPrecisionFPU, vsync, antiAlias))
{
......@@ -2186,14 +2185,8 @@ IVideoDriver* createDirectX9Driver(const core::dimension2d<s32>& screenSize, HWN
}
return dx9;
#else
return 0;
#endif // _IRR_COMPILE_WITH_DIRECT3D_9_
}
#endif
#endif // _IRR_COMPILE_WITH_DIRECT3D_9_
} // end namespace video
} // end namespace irr
......
......@@ -13,7 +13,7 @@
namespace irr
{
//! Interface for logging messages, warnings and errors
//! Class for logging messages, warnings and errors to stdout
class CLogger : public ILogger
{
public:
......
......@@ -32,31 +32,44 @@ void CMeshCache::addMesh(const c8* filename, IAnimatedMesh* mesh)
}
//! Returns amount of loaded meshes
u32 CMeshCache::getMeshCount() const
//! Removes a mesh from the cache.
void CMeshCache::removeMesh(const IAnimatedMesh* const mesh)
{
return Meshes.size();
if ( !mesh )
return;
for (u32 i=0; i<Meshes.size(); ++i)
{
if (Meshes[i].Mesh == mesh)
{
Meshes[i].Mesh->drop();
Meshes.erase(i);
return;
}
}
}
//! Returns a mesh based on its index number
IAnimatedMesh* CMeshCache::getMeshByIndex(u32 number)
//! Removes a mesh from the cache.
void CMeshCache::removeMesh(const IMesh* const mesh)
{
if (number >= Meshes.size())
return 0;
return Meshes[number].Mesh;
if ( !mesh )
return;
for (u32 i=0; i<Meshes.size(); ++i)
{
if (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh)
{
Meshes[i].Mesh->drop();
Meshes.erase(i);
return;
}
}
}
//! Returns a mesh based on its file name.
IAnimatedMesh* CMeshCache::getMeshByFilename(const c8* filename)
//! Returns amount of loaded meshes
u32 CMeshCache::getMeshCount() const
{
MeshEntry e;
e.Name = filename;
e.Name.make_lower();
s32 id = Meshes.binary_search(e);
return (id != -1) ? Meshes[id].Mesh : 0;
return Meshes.size();
}
......@@ -85,6 +98,27 @@ s32 CMeshCache::getMeshIndex(const IMesh* const mesh) const
}
//! Returns a mesh based on its index number
IAnimatedMesh* CMeshCache::getMeshByIndex(u32 number)
{
if (number >= Meshes.size())
return 0;
return Meshes[number].Mesh;
}
//! Returns a mesh based on its file name.
IAnimatedMesh* CMeshCache::getMeshByFilename(const c8* filename)
{
MeshEntry e;
e.Name = filename;
e.Name.make_lower();
s32 id = Meshes.binary_search(e);
return (id != -1) ? Meshes[id].Mesh : 0;
}
//! Returns name of a mesh based on its index number
const c8* CMeshCache::getMeshFilename(u32 number) const
{
......@@ -123,47 +157,6 @@ const c8* CMeshCache::getMeshFilename(const IMesh* const mesh) const
//! returns if a mesh already was loaded
bool CMeshCache::isMeshLoaded(const c8* filename)
{
return getMeshByFilename(filename) != 0;
}
//! Removes a mesh from the cache.
void CMeshCache::removeMesh(const IAnimatedMesh* const mesh)
{
if ( !mesh )
return;
for (u32 i=0; i<Meshes.size(); ++i)
{
if (Meshes[i].Mesh == mesh)
{
Meshes[i].Mesh->drop();
Meshes.erase(i);
return;
}
}
}
//! Removes a mesh from the cache.
void CMeshCache::removeMesh(const IMesh* const mesh)
{
if ( !mesh )
return;
for (u32 i=0; i<Meshes.size(); ++i)
{
if (Meshes[i].Mesh && Meshes[i].Mesh->getMesh(0) == mesh)
{
Meshes[i].Mesh->drop();
Meshes.erase(i);
return;
}
}
}
//! Renames a loaded mesh, if possible.
bool CMeshCache::setMeshFilename(u32 index, const c8* filename)
{
......@@ -209,6 +202,14 @@ bool CMeshCache::setMeshFilename(const IMesh* const mesh, const c8* filename)
return false;
}
//! returns if a mesh already was loaded
bool CMeshCache::isMeshLoaded(const c8* filename)
{
return getMeshByFilename(filename) != 0;
}
//! Clears the whole mesh cache, removing all meshes.
void CMeshCache::clear()
{
......
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