Commit 17784dd0 authored by Rogerborg's avatar Rogerborg

https://sourceforge.net/tracker2/?func=detail&aid=2552603&group_id=74339&atid=540678

Add IVideoDriver methods to enumerate the available image loaders and writers.  Unit test added.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2174 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bd192519
......@@ -463,6 +463,8 @@ Changes in version 1.6, TA
Changes in version 1.6
- IVideoDriver has methods to enumerate the available image loaders and writers.
- Octtree scene nodes are now IMeshSceneNodes rather than ISceneNodes, and so you can call getMesh() on them.
- New scene parameter B3D_LOADER_IGNORE_MIPMAP_FLAG to ignore the often missing mipmap flag in b3d files. If this parameter is true, the old pre Irrlicht-1.5 behavior is restored.
......
......@@ -173,6 +173,26 @@ namespace video
\return Matrix describing the transformation. */
virtual const core::matrix4& getTransform(E_TRANSFORMATION_STATE state) const =0;
//! Retrieve the number of image loaders
/** \return Number of image loaders */
virtual u32 getImageLoaderCount() const = 0;
//! Retrieve the given image loader
/** \param n The index of the loader to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified loader, 0 if the index is uncorrect. */
virtual IImageLoader* getImageLoader(u32 n) = 0;
//! Retrieve the number of image writers
/** \return Number of image writers */
virtual u32 getImageWriterCount() const = 0;
//! Retrieve the given image writer
/** \param n The index of the writer to retrieve. This parameter is an 0-based
array index.
\return A pointer to the specified writer, 0 if the index is uncorrect. */
virtual IImageWriter* getImageWriter(u32 n) = 0;
//! Sets a material.
/** All 3d drawing functions will draw geometry using this material thereafter.
\param material: Material to be used from now on. */
......
......@@ -193,6 +193,38 @@ void CNullDriver::addExternalImageWriter(IImageWriter* writer)
}
//! Retrieve the number of image loaders
u32 CNullDriver::getImageLoaderCount() const
{
return SurfaceLoader.size();
}
//! Retrieve the given image loader
IImageLoader* CNullDriver::getImageLoader(u32 n)
{
if(n < SurfaceLoader.size())
return SurfaceLoader[n];
return 0;
}
//! Retrieve the number of image writers
u32 CNullDriver::getImageWriterCount() const
{
return SurfaceWriter.size();
}
//! Retrieve the given image writer
IImageWriter* CNullDriver::getImageWriter(u32 n)
{
if(n < SurfaceWriter.size())
return SurfaceWriter[n];
return 0;
}
//! deletes all textures
void CNullDriver::deleteAllTextures()
{
......
......@@ -60,6 +60,18 @@ namespace video
//! sets transformation
virtual void setTransform(E_TRANSFORMATION_STATE state, const core::matrix4& mat);
//! Retrieve the number of image loaders
virtual u32 getImageLoaderCount() const;
//! Retrieve the given image loader
virtual IImageLoader* getImageLoader(u32 n);
//! Retrieve the number of image writers
virtual u32 getImageWriterCount() const;
//! Retrieve the given image writer
virtual IImageWriter* getImageWriter(u32 n);
//! sets a material
virtual void setMaterial(const SMaterial& material);
......
......@@ -86,7 +86,7 @@ int main(int argumentCount, char * arguments[])
TEST(vectorPositionDimension2d);
TEST(writeImageToFile);
TEST(flyCircleAnimator);
// TEST(relativeTransformations);
TEST(enumerateImageManipulators);
const unsigned int numberOfTests = tests.size();
......
Test suite pass at GMT Thu Jan 29 09:25:13 2009
Test suite pass at GMT Sat Jan 31 16:59:34 2009
......@@ -44,6 +44,7 @@
<Unit filename="disambiguateTextures.cpp" />
<Unit filename="drawPixel.cpp" />
<Unit filename="drawRectOutline.cpp" />
<Unit filename="enumerateImageManipulators.cpp" />
<Unit filename="exports.cpp" />
<Unit filename="fast_atof.cpp" />
<Unit filename="flyCircleAnimator.cpp" />
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="tests">
<Project filename="..\source\Irrlicht\Irrlicht-gcc.cbp" />
<Project filename="tests.cbp" active="1" />
<Project filename="..\source\Irrlicht\Irrlicht-gcc.cbp" active="1" />
<Project filename="tests.cbp" />
</Workspace>
</CodeBlocks_workspace_file>
......@@ -197,6 +197,10 @@
RelativePath=".\drawRectOutline.cpp"
>
</File>
<File
RelativePath=".\enumerateImageManipulators.cpp"
>
</File>
<File
RelativePath=".\exports.cpp"
>
......
......@@ -198,6 +198,10 @@
RelativePath=".\drawRectOutline.cpp"
>
</File>
<File
RelativePath=".\enumerateImageManipulators.cpp"
>
</File>
<File
RelativePath=".\exports.cpp"
>
......
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