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
master
Rogerborg 2009-01-31 17:01:45 +00:00
parent bd192519d6
commit 17784dd0f8
10 changed files with 83 additions and 8 deletions

View File

@ -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.

View File

@ -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. */

View File

@ -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()
{
@ -1291,21 +1323,21 @@ IImage* CNullDriver::createImageFromData(ECOLOR_FORMAT format,
//! Creates an empty software image.
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, const core::dimension2d<u32>& size)
{
return new CImage(format, size);
return new CImage(format, size);
}
//! Creates a software image from another image.
IImage* CNullDriver::createImage(ECOLOR_FORMAT format, IImage *imageToCopy)
{
return new CImage(format, imageToCopy);
return new CImage(format, imageToCopy);
}
//! Creates a software image from part of another image.
IImage* CNullDriver::createImage(IImage* imageToCopy, const core::position2d<s32>& pos, const core::dimension2d<u32>& size)
{
return new CImage(imageToCopy, pos, size);
return new CImage(imageToCopy, pos, size);
}

View File

@ -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);

View File

@ -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();

View File

@ -1,2 +1,2 @@
Test suite pass at GMT Thu Jan 29 09:25:13 2009
Test suite pass at GMT Sat Jan 31 16:59:34 2009

View File

@ -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" />

View File

@ -1,7 +1,7 @@
<?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>

View File

@ -197,6 +197,10 @@
RelativePath=".\drawRectOutline.cpp"
>
</File>
<File
RelativePath=".\enumerateImageManipulators.cpp"
>
</File>
<File
RelativePath=".\exports.cpp"
>

View File

@ -198,6 +198,10 @@
RelativePath=".\drawRectOutline.cpp"
>
</File>
<File
RelativePath=".\enumerateImageManipulators.cpp"
>
</File>
<File
RelativePath=".\exports.cpp"
>