Fixed two things from a previous commit that were not working. Some minor comment changes.
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@680 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
parent
002dd4523d
commit
1e0ea7012b
@ -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:
|
||||
|
@ -20,7 +20,7 @@ namespace scene
|
||||
|
||||
//! The mesh cache stores already loaded meshes and provides an interface to them.
|
||||
/** You can access it using ISceneManager::getMeshCache(). All existing scene managers
|
||||
will return a pointer to the same mesh cache, because it is shared between them. With
|
||||
will return a pointer to the same mesh cache, because it is shared between them. With
|
||||
this interface, it is possible to manually add new loaded meshes (if
|
||||
ISceneManager::getMesh() is not sufficient), to remove them and to iterate through
|
||||
already loaded meshes. */
|
||||
@ -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.
|
||||
@ -39,9 +39,9 @@ namespace scene
|
||||
has been loaded. This method can be used for example by mesh loaders who need to
|
||||
load more than one mesh with one call. They can add additional meshes with this
|
||||
method to the scene manager. The COLLADA loader for example uses this method.
|
||||
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
|
||||
parameter, the method will return the mesh parameter given with this method.
|
||||
\param mesh: Pointer to a mesh which will now be referenced by this name. */
|
||||
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
|
||||
parameter, the method will return the mesh parameter given with this method.
|
||||
\param mesh: Pointer to a mesh which will now be referenced by this name. */
|
||||
virtual void addMesh(const c8* filename, IAnimatedMesh* mesh) = 0;
|
||||
|
||||
//! Removes a mesh from the cache.
|
||||
@ -55,7 +55,7 @@ namespace scene
|
||||
virtual void removeMesh(const IMesh* const mesh) = 0;
|
||||
|
||||
//! Returns amount of loaded meshes in the cache.
|
||||
/** You can load new meshes into the cache using getMesh() and addMesh().
|
||||
/** You can load new meshes into the cache using getMesh() and addMesh().
|
||||
If you ever need to access the internal mesh cache, you can do this using
|
||||
removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */
|
||||
virtual u32 getMeshCount() const = 0;
|
||||
@ -67,7 +67,7 @@ namespace scene
|
||||
virtual s32 getMeshIndex(const IMesh* const mesh) const = 0;
|
||||
|
||||
//! Returns a mesh based on its index number.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
Note that this number is only valid until a new mesh is loaded or removed *
|
||||
\return Returns pointer to the mesh or 0 if there is none with this number. */
|
||||
virtual IAnimatedMesh* getMeshByIndex(u32 index) = 0;
|
||||
@ -76,8 +76,8 @@ namespace scene
|
||||
/** \return Returns pointer to the mesh or 0 if there is none with this number. */
|
||||
virtual IAnimatedMesh* getMeshByFilename(const c8* filename) = 0;
|
||||
|
||||
//! Returns name of a mesh based on its index number.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
//! Returns name of a mesh based on its index number.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
Note that this is only valid until a new mesh is loaded */
|
||||
virtual const c8* getMeshFilename(u32 index) const = 0;
|
||||
|
||||
@ -107,11 +107,11 @@ namespace scene
|
||||
getMeshIndex() or taken by some methods will change. */
|
||||
virtual bool setMeshFilename(const IMesh* const mesh, const c8* filename) = 0;
|
||||
|
||||
//! returns if a mesh already was loaded
|
||||
virtual bool isMeshLoaded(const c8* filename);
|
||||
//! returns if a mesh already was loaded
|
||||
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()
|
||||
/** All meshes will be reloaded completely when using ISceneManager::getMesh()
|
||||
after calling this method. */
|
||||
virtual void clear() = 0;
|
||||
};
|
||||
|
@ -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,6 +32,40 @@ void CMeshCache::addMesh(const c8* filename, IAnimatedMesh* mesh)
|
||||
}
|
||||
|
||||
|
||||
//! 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//! Returns amount of loaded meshes
|
||||
u32 CMeshCache::getMeshCount() const
|
||||
{
|
||||
@ -39,28 +73,7 @@ u32 CMeshCache::getMeshCount() 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 current number of the mesh
|
||||
//! Returns current number of the mesh
|
||||
s32 CMeshCache::getMeshIndex(const IAnimatedMesh* const mesh) const
|
||||
{
|
||||
for (u32 i=0; i<Meshes.size(); ++i)
|
||||
@ -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()
|
||||
{
|
||||
|
@ -27,9 +27,9 @@ namespace scene
|
||||
has been loaded. This method can be used for example by mesh loaders who need to
|
||||
load more than one mesh with one call. They can add additional meshes with this
|
||||
method to the scene manager. The COLLADA loader for example uses this method.
|
||||
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
|
||||
parameter, the method will return the mesh parameter given with this method.
|
||||
\param mesh: Pointer to a mesh which will now be referenced by this name. */
|
||||
\param filename: Filename of the mesh. When called ISceneManager::getMesh() with this
|
||||
parameter, the method will return the mesh parameter given with this method.
|
||||
\param mesh: Pointer to a mesh which will now be referenced by this name. */
|
||||
virtual void addMesh(const c8* filename, IAnimatedMesh* mesh);
|
||||
|
||||
//! Removes a mesh from the cache.
|
||||
@ -43,7 +43,7 @@ namespace scene
|
||||
virtual void removeMesh(const IMesh* const mesh);
|
||||
|
||||
//! Returns amount of loaded meshes in the cache.
|
||||
/** You can load new meshes into the cache using getMesh() and addMesh().
|
||||
/** You can load new meshes into the cache using getMesh() and addMesh().
|
||||
If you ever need to access the internal mesh cache, you can do this using
|
||||
removeMesh(), getMeshNumber(), getMeshByIndex() and getMeshFilename() */
|
||||
virtual u32 getMeshCount() const;
|
||||
@ -55,7 +55,7 @@ namespace scene
|
||||
virtual s32 getMeshIndex(const IMesh* const mesh) const;
|
||||
|
||||
//! Returns a mesh based on its index number.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
Note that this number is only valid until a new mesh is loaded or removed *
|
||||
\return Returns pointer to the mesh or 0 if there is none with this number. */
|
||||
virtual IAnimatedMesh* getMeshByIndex(u32 index);
|
||||
@ -64,8 +64,8 @@ namespace scene
|
||||
/** \return Returns pointer to the mesh or 0 if there is none with this number. */
|
||||
virtual IAnimatedMesh* getMeshByFilename(const c8* filename);
|
||||
|
||||
//! Returns name of a mesh based on its index number.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
//! Returns name of a mesh based on its index number.
|
||||
/** \param index: Index of the mesh, number between 0 and getMeshCount()-1.
|
||||
Note that this is only valid until a new mesh is loaded */
|
||||
virtual const c8* getMeshFilename(u32 index) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user