Commit c26cb454 authored by hybrid's avatar hybrid

Merged from 1.5 branch, revisions 2137:2293. Minor bugfixes, some doc updates.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2295 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e862f147
...@@ -107,8 +107,15 @@ namespace scene ...@@ -107,8 +107,15 @@ namespace scene
// animate this node with all animators // animate this node with all animators
core::list<ISceneNodeAnimator*>::Iterator ait = Animators.begin(); core::list<ISceneNodeAnimator*>::Iterator ait = Animators.begin();
for (; ait != Animators.end(); ++ait) while (ait != Animators.end())
(*ait)->animateNode(this, timeMs); {
// continue to the next node before calling animateNode()
// so that the animator may remove itself from the scene
// node without the iterator becoming invalid
ISceneNodeAnimator* anim = *ait;
++ait;
anim->animateNode(this, timeMs);
}
// update absolute position // update absolute position
updateAbsolutePosition(); updateAbsolutePosition();
...@@ -420,8 +427,11 @@ namespace scene ...@@ -420,8 +427,11 @@ namespace scene
} }
//! Gets the relative scale of the scene node. //! Gets the scale of the scene node relative to its parent.
/** \return The scale of the scene node. */ /** This is the scale of this node relative to its parent.
If you want the absolute scale, use
getAbsoluteTransformation().getScale()
\return The scale of the scene node. */
virtual const core::vector3df& getScale() const virtual const core::vector3df& getScale() const
{ {
return RelativeScale; return RelativeScale;
...@@ -429,15 +439,17 @@ namespace scene ...@@ -429,15 +439,17 @@ namespace scene
//! Sets the relative scale of the scene node. //! Sets the relative scale of the scene node.
/** \param scale New scale of the node */ /** \param scale New scale of the node, relative to its parent. */
virtual void setScale(const core::vector3df& scale) virtual void setScale(const core::vector3df& scale)
{ {
RelativeScale = scale; RelativeScale = scale;
} }
//! Gets the rotation of the node. //! Gets the rotation of the node relative to its parent.
/** Note that this is the relative rotation of the node. /** Note that this is the relative rotation of the node.
If you want the absolute rotation, use
getAbsoluteTransformation().getRotation()
\return Current relative rotation of the scene node. */ \return Current relative rotation of the scene node. */
virtual const core::vector3df& getRotation() const virtual const core::vector3df& getRotation() const
{ {
...@@ -445,7 +457,7 @@ namespace scene ...@@ -445,7 +457,7 @@ namespace scene
} }
//! Sets the rotation of the node. //! Sets the rotation of the node relative to its parent.
/** This only modifies the relative rotation of the node. /** This only modifies the relative rotation of the node.
\param rotation New rotation of the node in degrees. */ \param rotation New rotation of the node in degrees. */
virtual void setRotation(const core::vector3df& rotation) virtual void setRotation(const core::vector3df& rotation)
...@@ -454,8 +466,9 @@ namespace scene ...@@ -454,8 +466,9 @@ namespace scene
} }
//! Gets the position of the node. //! Gets the position of the node relative to its parent.
/** Note that the position is relative to the parent. /** Note that the position is relative to the parent. If you want
the position in world coordinates, use getAbsolutePosition() instead.
\return The current position of the node relative to the parent. */ \return The current position of the node relative to the parent. */
virtual const core::vector3df& getPosition() const virtual const core::vector3df& getPosition() const
{ {
...@@ -463,17 +476,19 @@ namespace scene ...@@ -463,17 +476,19 @@ namespace scene
} }
//! Sets the position of the node. //! Sets the position of the node relative to its parent.
/** Note that the position is relative to the parent. /** Note that the position is relative to the parent.
\param newpos New relative postition of the scene node. */ \param newpos New relative position of the scene node. */
virtual void setPosition(const core::vector3df& newpos) virtual void setPosition(const core::vector3df& newpos)
{ {
RelativeTranslation = newpos; RelativeTranslation = newpos;
} }
//! Gets the abolute position of the node. //! Gets the absolute position of the node in world coordinates.
/** \return The current absolute position of the scene node. */ /** If you want the position of the node relative to its parent,
use getPosition() instead.
\return The current absolute position of the scene node. */
virtual core::vector3df getAbsolutePosition() const virtual core::vector3df getAbsolutePosition() const
{ {
return AbsoluteTransformation.getTranslation(); return AbsoluteTransformation.getTranslation();
......
...@@ -18,63 +18,62 @@ namespace video ...@@ -18,63 +18,62 @@ namespace video
{ {
//! Enumeration flags telling the video driver in which format textures //! Enumeration flags telling the video driver in which format textures should be created.
//! should be created.
enum E_TEXTURE_CREATION_FLAG enum E_TEXTURE_CREATION_FLAG
{ {
//! Forces the driver to create 16 bit textures always, independent of /** Forces the driver to create 16 bit textures always, independent of
//! which format the file on disk has. When choosing this you may loose which format the file on disk has. When choosing this you may loose
//! some color detail, but gain much speed and memory. 16 bit textures some color detail, but gain much speed and memory. 16 bit textures can
//! can be transferred twice as fast as 32 bit textures and only use be transferred twice as fast as 32 bit textures and only use half of
//! half of the space in memory. the space in memory.
//! When using this flag, it does not make sense to use the flags When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, ETCF_ALWAYS_32_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or
//! or ETCF_OPTIMIZED_FOR_SPEED at the same time. ETCF_OPTIMIZED_FOR_SPEED at the same time. */
ETCF_ALWAYS_16_BIT = 0x00000001, ETCF_ALWAYS_16_BIT = 0x00000001,
//! Forces the driver to create 32 bit textures always, independent of /** Forces the driver to create 32 bit textures always, independent of
//! which format the file on disk has. Please note that some drivers which format the file on disk has. Please note that some drivers (like
//! (like the software device) will ignore this, because they are only the software device) will ignore this, because they are only able to
//! able to create and use 16 bit textures. create and use 16 bit textures.
//! When using this flag, it does not make sense to use the flags When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, or
//! or ETCF_OPTIMIZED_FOR_SPEED at the same time. ETCF_OPTIMIZED_FOR_SPEED at the same time. */
ETCF_ALWAYS_32_BIT = 0x00000002, ETCF_ALWAYS_32_BIT = 0x00000002,
//! Lets the driver decide in which format the textures are created and /** Lets the driver decide in which format the textures are created and
//! tries to make the textures look as good as possible. tries to make the textures look as good as possible. Usually it simply
//! Usually it simply chooses the format in which the texture was stored on disk. chooses the format in which the texture was stored on disk.
//! When using this flag, it does not make sense to use the flags When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_SPEED at
//! or ETCF_OPTIMIZED_FOR_SPEED at the same time. the same time. */
ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004, ETCF_OPTIMIZED_FOR_QUALITY = 0x00000004,
//! Lets the driver decide in which format the textures are created and /** Lets the driver decide in which format the textures are created and
//! tries to create them maximizing render speed. tries to create them maximizing render speed.
//! When using this flag, it does not make sense to use the flags When using this flag, it does not make sense to use the flags
//! ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY, ETCF_ALWAYS_16_BIT, ETCF_ALWAYS_32_BIT, or ETCF_OPTIMIZED_FOR_QUALITY,
//! at the same time. at the same time. */
ETCF_OPTIMIZED_FOR_SPEED = 0x00000008, ETCF_OPTIMIZED_FOR_SPEED = 0x00000008,
//! Automatically creates mip map levels for the textures. /** Automatically creates mip map levels for the textures. */
ETCF_CREATE_MIP_MAPS = 0x00000010, ETCF_CREATE_MIP_MAPS = 0x00000010,
//! Discard any alpha layer and use non-alpha color format. /** Discard any alpha layer and use non-alpha color format. */
ETCF_NO_ALPHA_CHANNEL = 0x00000020, ETCF_NO_ALPHA_CHANNEL = 0x00000020,
//! Allow the Driver to use Non-Power-2-Textures //! Allow the Driver to use Non-Power-2-Textures
//! BurningVideo can handle Non-Power-2 Textures in 2D (GUI), but not it 3D /** BurningVideo can handle Non-Power-2 Textures in 2D (GUI), but not it 3D. */
ETCF_ALLOW_NON_POWER_2 = 0x00000040, ETCF_ALLOW_NON_POWER_2 = 0x00000040,
//! This flag is never used, it only forces the compiler to /** This flag is never used, it only forces the compiler to compile
//! compile these enumeration values to 32 bit. these enumeration values to 32 bit. */
ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff ETCF_FORCE_32_BIT_DO_NOT_USE = 0x7fffffff
}; };
//! Helper function, helps to get the desired texture creation format from the flags. //! Helper function, helps to get the desired texture creation format from the flags.
//! Returns either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT, ETCF_OPTIMIZED_FOR_QUALITY, /** \return Either ETCF_ALWAYS_32_BIT, ETCF_ALWAYS_16_BIT,
//! or ETCF_OPTIMIZED_FOR_SPEED. ETCF_OPTIMIZED_FOR_QUALITY, or ETCF_OPTIMIZED_FOR_SPEED. */
inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags) inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
{ {
if (flags & ETCF_OPTIMIZED_FOR_SPEED) if (flags & ETCF_OPTIMIZED_FOR_SPEED)
...@@ -90,13 +89,13 @@ inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags) ...@@ -90,13 +89,13 @@ inline E_TEXTURE_CREATION_FLAG getTextureFormatFromFlags(u32 flags)
//! Interface of a Video Driver dependent Texture. //! Interface of a Video Driver dependent Texture.
/** /** An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture
An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture or or IVideoDriver::getTexture. After that, the texture may only be used by this
IVideoDriver::getTexture. After that, the texture may only be used by this VideoDriver. VideoDriver. As you can imagine, textures of the DirectX and the OpenGL device
As you can imagine, textures of the DirectX and the OpenGL device will, e.g., not be compatible. will, e.g., not be compatible. An exception is the Software device and the
An exception is the Software device and the NULL device, their textures are compatible. NULL device, their textures are compatible. If you try to use a texture
If you try to use a texture created by one device with an other device, the device created by one device with an other device, the device will refuse to do that
will refuse to do that and write a warning or an error message to the output buffer. and write a warning or an error message to the output buffer.
*/ */
class ITexture : public virtual IReferenceCounted class ITexture : public virtual IReferenceCounted
{ {
...@@ -125,42 +124,40 @@ public: ...@@ -125,42 +124,40 @@ public:
/** One should avoid to call unlock more than once before another lock. */ /** One should avoid to call unlock more than once before another lock. */
virtual void unlock() = 0; virtual void unlock() = 0;
//! Returns original size of the texture. //! Get original size of the texture.
/** The texture is usually /** The texture is usually scaled, if it was created with an unoptimal
scaled, if it was created with an unoptimal size. For example if the size size. For example if the size of the texture file it was loaded from
of the texture file it was loaded from was not a power of two. This returns was not a power of two. This returns the size of the texture, it had
the size of the texture, it had before it was scaled. Can be useful before it was scaled. Can be useful when drawing 2d images on the
when drawing 2d images on the screen, which should have the exact size screen, which should have the exact size of the original texture. Use
of the original texture. Use ITexture::getSize() if you want to know ITexture::getSize() if you want to know the real size it has now stored
the real size it has now stored in the system. in the system.
\return Returns the original size of the texture. */ \return The original size of the texture. */
virtual const core::dimension2d<u32>& getOriginalSize() const = 0; virtual const core::dimension2d<u32>& getOriginalSize() const = 0;
//! Returns dimension (=size) of the texture. //! Get dimension (=size) of the texture.
/** \return Returns the size of the texture. */ /** \return The size of the texture. */
virtual const core::dimension2d<u32>& getSize() const = 0; virtual const core::dimension2d<u32>& getSize() const = 0;
//! Returns driver type of texture. //! Get driver type of texture.
/** This is the driver, which created the texture. /** This is the driver, which created the texture. This method is used
This method is used internally by the video devices, to check, if they may internally by the video devices, to check, if they may use a texture
use a texture because textures may be incompatible between different because textures may be incompatible between different devices.
devices. \return Driver type of texture. */
\return Returns driver type of texture. */
virtual E_DRIVER_TYPE getDriverType() const = 0; virtual E_DRIVER_TYPE getDriverType() const = 0;
//! Returns the color format of texture. //! Get the color format of texture.
/** \return Returns the color format of texture. */ /** \return The color format of texture. */
virtual ECOLOR_FORMAT getColorFormat() const = 0; virtual ECOLOR_FORMAT getColorFormat() const = 0;
//! Get pitch of texture (in bytes).
//! Returns pitch of texture (in bytes). /** The pitch is the amount of bytes used for a row of pixels in a
/** The pitch is the amount of bytes texture.
used for a row of pixels in a texture. \return Pitch of texture in bytes. */
\return Returns pitch of texture in bytes. */
virtual u32 getPitch() const = 0; virtual u32 getPitch() const = 0;
//! Returns whether the texture has MipMaps //! Check whether the texture has MipMaps
/** \return Returns true if texture has MipMaps, else false. */ /** \return True if texture has MipMaps, else false. */
virtual bool hasMipMaps() const { return false; } virtual bool hasMipMaps() const { return false; }
//! Returns if the texture has an alpha channel //! Returns if the texture has an alpha channel
...@@ -169,14 +166,14 @@ public: ...@@ -169,14 +166,14 @@ public:
} }
//! Regenerates the mip map levels of the texture. //! Regenerates the mip map levels of the texture.
/** Required after locking and modifying the texture */ /** Required after modifying the texture, usually after calling unlock(). */
virtual void regenerateMipMapLevels() = 0; virtual void regenerateMipMapLevels() = 0;
//! Returns whether the texture is a render target //! Check whether the texture is a render target
/** \return Returns true if this is a render target, otherwise false. */ /** \return True if this is a render target, otherwise false. */
virtual bool isRenderTarget() const { return false; } virtual bool isRenderTarget() const { return false; }
//! Returns name of texture (in most cases this is the filename) //! Get name of texture (in most cases this is the filename)
const core::string<c16>& getName() const { return Name; } const core::string<c16>& getName() const { return Name; }
protected: protected:
......
...@@ -96,9 +96,16 @@ directX header files, and directX is only available on windows platforms. If you ...@@ -96,9 +96,16 @@ directX header files, and directX is only available on windows platforms. If you
are using Dev-Cpp, and want to compile this using a DX dev pack, you can define are using Dev-Cpp, and want to compile this using a DX dev pack, you can define
_IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this _IRR_COMPILE_WITH_DX9_DEV_PACK_. So you simply need to add something like this
to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK to the compiler settings: -DIRR_COMPILE_WITH_DX9_DEV_PACK
and this to the linker settings: -ld3dx9 -ld3dx8 **/ and this to the linker settings: -ld3dx9 -ld3dx8
Microsoft have chosen to remove D3D8 headers from their recent DXSDKs, and
so D3D8 support is now disabled by default. If you really want to build
with D3D8 support, then you will have to source a DXSDK with the appropriate
headers, e.g. Summer 2004. This is a Microsoft issue, not an Irrlicht one.
*/
#if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK)) #if defined(_IRR_WINDOWS_API_) && (!defined(__GNUC__) || defined(IRR_COMPILE_WITH_DX9_DEV_PACK))
//! Only define _IRR_COMPILE_WITH_DIRECT3D_8_ if you have an appropriate DXSDK, e.g. Summer 2004
//#define _IRR_COMPILE_WITH_DIRECT3D_8_ //#define _IRR_COMPILE_WITH_DIRECT3D_8_
#define _IRR_COMPILE_WITH_DIRECT3D_9_ #define _IRR_COMPILE_WITH_DIRECT3D_9_
......
...@@ -16,7 +16,7 @@ namespace scene ...@@ -16,7 +16,7 @@ namespace scene
struct SSharedMeshBuffer : public IMeshBuffer struct SSharedMeshBuffer : public IMeshBuffer
{ {
//! constructor //! constructor
SSharedMeshBuffer() : IMeshBuffer(), Vertices(0), ChangedID_Vertex(1), ChangedID_Index(1), MappingHint(EHM_NEVER) SSharedMeshBuffer() : IMeshBuffer(), Vertices(0), ChangedID_Vertex(1), ChangedID_Index(1), MappingHintVertex(EHM_NEVER), MappingHintIndex(EHM_NEVER)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("SSharedMeshBuffer"); setDebugName("SSharedMeshBuffer");
...@@ -127,24 +127,33 @@ namespace scene ...@@ -127,24 +127,33 @@ namespace scene
//! get the current hardware mapping hint //! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint() const virtual E_HARDWARE_MAPPING getHardwareMappingHint_Vertex() const
{ {
return MappingHint; return MappingHintVertex;
}
//! get the current hardware mapping hint
virtual E_HARDWARE_MAPPING getHardwareMappingHint_Index() const
{
return MappingHintIndex;
} }
//! set the hardware mapping hint, for driver //! set the hardware mapping hint, for driver
virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX ) virtual void setHardwareMappingHint( E_HARDWARE_MAPPING NewMappingHint, E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX )
{ {
MappingHint=NewMappingHint; if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
MappingHintVertex=NewMappingHint;
if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
MappingHintIndex=NewMappingHint;
} }
//! flags the mesh as changed, reloads hardware buffers //! flags the mesh as changed, reloads hardware buffers
virtual void setDirty(E_BUFFER_TYPE Buffer=EBT_VERTEX_AND_INDEX) virtual void setDirty(E_BUFFER_TYPE buffer=EBT_VERTEX_AND_INDEX)
{ {
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_VERTEX) if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_VERTEX)
++ChangedID_Vertex; ++ChangedID_Vertex;
if (Buffer==EBT_VERTEX_AND_INDEX || Buffer==EBT_INDEX) if (buffer==EBT_VERTEX_AND_INDEX || buffer==EBT_INDEX)
++ChangedID_Index; ++ChangedID_Index;
} }
...@@ -175,7 +184,8 @@ namespace scene ...@@ -175,7 +184,8 @@ namespace scene
core::aabbox3df BoundingBox; core::aabbox3df BoundingBox;
//! hardware mapping hint //! hardware mapping hint
E_HARDWARE_MAPPING MappingHint; E_HARDWARE_MAPPING MappingHintVertex;
E_HARDWARE_MAPPING MappingHintIndex;
}; };
......
...@@ -432,10 +432,13 @@ namespace io ...@@ -432,10 +432,13 @@ namespace io
\param callback: Callback for file read abstraction. Implement your own \param callback: Callback for file read abstraction. Implement your own
callback to make the xml parser read in other things than just files. See callback to make the xml parser read in other things than just files. See
IFileReadCallBack for more information about this. IFileReadCallBack for more information about this.
\param deleteCallback: if true, the callback will be deleted after the file
has been read. Otherwise the caller si responsible for cleaning it up.
\return Returns a pointer to the created xml parser. This pointer should be \return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occured deleted using 'delete' after no longer needed. Returns 0 if an error occured
and the file could not be opened. */ and the file could not be opened. */
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback); IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback,
bool deleteCallback = false);
//! Creates an instance of an UFT-16 xml parser. //! Creates an instance of an UFT-16 xml parser.
/** This means that /** This means that
...@@ -469,10 +472,13 @@ namespace io ...@@ -469,10 +472,13 @@ namespace io
\param callback: Callback for file read abstraction. Implement your own \param callback: Callback for file read abstraction. Implement your own
callback to make the xml parser read in other things than just files. See callback to make the xml parser read in other things than just files. See
IFileReadCallBack for more information about this. IFileReadCallBack for more information about this.
\param deleteCallback: if true, the callback will be deleted after the file
has been read. Otherwise the caller si responsible for cleaning it up.
\return Returns a pointer to the created xml parser. This pointer should be \return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occured deleted using 'delete' after no longer needed. Returns 0 if an error occured
and the file could not be opened. */ and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback); IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback,
bool deleteCallback = false);
//! Creates an instance of an UFT-32 xml parser. //! Creates an instance of an UFT-32 xml parser.
...@@ -507,10 +513,13 @@ namespace io ...@@ -507,10 +513,13 @@ namespace io
\param callback: Callback for file read abstraction. Implement your own \param callback: Callback for file read abstraction. Implement your own
callback to make the xml parser read in other things than just files. See callback to make the xml parser read in other things than just files. See
IFileReadCallBack for more information about this. IFileReadCallBack for more information about this.
\param deleteCallback: if true, the callback will be deleted after the file
has been read. Otherwise the caller si responsible for cleaning it up.
\return Returns a pointer to the created xml parser. This pointer should be \return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occured deleted using 'delete' after no longer needed. Returns 0 if an error occured
and the file could not be opened. */ and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback); IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback,
bool deleteCallback = false);
/*! \file irrxml.h /*! \file irrxml.h
......
...@@ -28,10 +28,6 @@ The Irrlicht Engine SDK version 1.5 ...@@ -28,10 +28,6 @@ The Irrlicht Engine SDK version 1.5
\doc Documentation of the Irrlicht Engine. \doc Documentation of the Irrlicht Engine.
\examples Examples and tutorials showing how to use the engine with \examples Examples and tutorials showing how to use the engine with
C++. C++.
\example.net Examples and tutorials showing how to use the engine with
.NET languages.
\exporters Exporters and tools for various 3D modelling packages. There
is a readme file with more details in the directory.
\include Header files to include when programming with the engine. \include Header files to include when programming with the engine.
\lib Libs to link with your programs when using the engine. \lib Libs to link with your programs when using the engine.
\media Graphics and sound resources for the demo applications and \media Graphics and sound resources for the demo applications and
......
...@@ -323,7 +323,6 @@ core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename ...@@ -323,7 +323,6 @@ core::string<c16> CFileSystem::getAbsolutePath(const core::string<c16>& filename
p = _fullpath( fpath, filename.c_str(), _MAX_PATH); p = _fullpath( fpath, filename.c_str(), _MAX_PATH);
#endif #endif
#elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_)) #elif (defined(_IRR_POSIX_API_) || defined(_IRR_OSX_PLATFORM_))
c8 fpath[4096]; c8 fpath[4096];
fpath[0]=0; fpath[0]=0;
......
...@@ -131,10 +131,6 @@ CIrrDeviceSDL::~CIrrDeviceSDL() ...@@ -131,10 +131,6 @@ CIrrDeviceSDL::~CIrrDeviceSDL()
for (u32 i=0; i<numJoysticks; ++i) for (u32 i=0; i<numJoysticks; ++i)
SDL_JoystickClose(Joysticks[i]); SDL_JoystickClose(Joysticks[i]);
#endif #endif
// only free surfaces created by us
if (Screen && !CreationParams.WindowId)
SDL_FreeSurface(Screen);
SDL_Quit(); SDL_Quit();
} }
...@@ -424,8 +420,6 @@ bool CIrrDeviceSDL::run() ...@@ -424,8 +420,6 @@ bool CIrrDeviceSDL::run()
{ {
Width = SDL_event.resize.w; Width = SDL_event.resize.w;
Height = SDL_event.resize.h; Height = SDL_event.resize.h;
if (Screen)
SDL_FreeSurface(Screen);
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags ); Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
if (VideoDriver) if (VideoDriver)
VideoDriver->OnResize(core::dimension2d<u32>(Width, Height)); VideoDriver->OnResize(core::dimension2d<u32>(Width, Height));
...@@ -724,8 +718,6 @@ void CIrrDeviceSDL::setResizable(bool resize) ...@@ -724,8 +718,6 @@ void CIrrDeviceSDL::setResizable(bool resize)
SDL_Flags |= SDL_RESIZABLE; SDL_Flags |= SDL_RESIZABLE;
else else
SDL_Flags &= ~SDL_RESIZABLE; SDL_Flags &= ~SDL_RESIZABLE;
if (Screen)
SDL_FreeSurface(Screen);
Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags ); Screen = SDL_SetVideoMode( Width, Height, CreationParams.Bits, SDL_Flags );
Resizable = resize; Resizable = resize;
} }
......
...@@ -235,6 +235,10 @@ IImageWriter* CNullDriver::getImageWriter(u32 n) ...@@ -235,6 +235,10 @@ IImageWriter* CNullDriver::getImageWriter(u32 n)
//! deletes all textures //! deletes all textures
void CNullDriver::deleteAllTextures() void CNullDriver::deleteAllTextures()
{ {
// we need to remove previously set textures which might otherwise be kept in the
// last set material member. Could be optimized to reduce state changes.
setMaterial(SMaterial());
for (u32 i=0; i<Textures.size(); ++i) for (u32 i=0; i<Textures.size(); ++i)
Textures[i].Surface->drop(); Textures[i].Surface->drop();
......
...@@ -20,8 +20,8 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : ...@@ -20,8 +20,8 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
StencilBuffer(false), MultiTextureExtension(false), StencilBuffer(false), MultiTextureExtension(false),
TextureCompressionExtension(false), TextureCompressionExtension(false),
MaxTextureUnits(1), MaxLights(1), MaxAnisotropy(1), MaxUserClipPlanes(0), MaxTextureUnits(1), MaxLights(1), MaxAnisotropy(1), MaxUserClipPlanes(0),
MaxAuxBuffers(0), MaxIndices(65535), MaxTextureSize(1), MaxAuxBuffers(0), MaxIndices(65535), MaxTextureSize(1), MaxTextureLODBias(0.f),
MaxTextureLODBias(0.f), Version(0), ShaderLanguageVersion(0) MaxMultipleRenderTargets(1), Version(0), ShaderLanguageVersion(0)
#ifdef _IRR_OPENGL_USE_EXTPOINTER_ #ifdef _IRR_OPENGL_USE_EXTPOINTER_
,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0), ,pGlActiveTextureARB(0), pGlClientActiveTextureARB(0),
pGlGenProgramsARB(0), pGlBindProgramARB(0), pGlProgramStringARB(0), pGlGenProgramsARB(0), pGlBindProgramARB(0), pGlProgramStringARB(0),
...@@ -44,6 +44,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() : ...@@ -44,6 +44,7 @@ COpenGLExtensionHandler::COpenGLExtensionHandler() :
pGlCheckFramebufferStatusEXT(0), pGlFramebufferTexture2DEXT(0), pGlCheckFramebufferStatusEXT(0), pGlFramebufferTexture2DEXT(0),
pGlBindRenderbufferEXT(0), pGlDeleteRenderbuffersEXT(0), pGlGenRenderbuffersEXT(0), pGlBindRenderbufferEXT(0), pGlDeleteRenderbuffersEXT(0), pGlGenRenderbuffersEXT(0),
pGlRenderbufferStorageEXT(0), pGlFramebufferRenderbufferEXT(0), pGlRenderbufferStorageEXT(0), pGlFramebufferRenderbufferEXT(0),
pGlDrawBuffersARB(0), pGlDrawBuffersATI(0),
pGlGenBuffersARB(0), pGlBindBufferARB(0), pGlBufferDataARB(0), pGlDeleteBuffersARB(0), pGlGenBuffersARB(0), pGlBindBufferARB(0), pGlBufferDataARB(0), pGlDeleteBuffersARB(0),
pGlBufferSubDataARB(0), pGlGetBufferSubDataARB(0), pGlMapBufferARB(0), pGlUnmapBufferARB(0), pGlBufferSubDataARB(0), pGlGetBufferSubDataARB(0), pGlMapBufferARB(0), pGlUnmapBufferARB(0),
pGlIsBufferARB(0), pGlGetBufferParameterivARB(0), pGlGetBufferPointervARB(0) pGlIsBufferARB(0), pGlGetBufferParameterivARB(0), pGlGetBufferPointervARB(0)
...@@ -160,6 +161,8 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -160,6 +161,8 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) wglGetProcAddress("glGenRenderbuffersEXT"); pGlGenRenderbuffersEXT = (PFNGLGENRENDERBUFFERSEXTPROC) wglGetProcAddress("glGenRenderbuffersEXT");
pGlRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) wglGetProcAddress("glRenderbufferStorageEXT"); pGlRenderbufferStorageEXT = (PFNGLRENDERBUFFERSTORAGEEXTPROC) wglGetProcAddress("glRenderbufferStorageEXT");
pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) wglGetProcAddress("glFramebufferRenderbufferEXT"); pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) wglGetProcAddress("glFramebufferRenderbufferEXT");
pGlDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC) wglGetProcAddress("glDrawBuffersARB");
pGlDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC) wglGetProcAddress("glDrawBuffersATI");
// get vertex buffer extension // get vertex buffer extension
pGlGenBuffersARB = (PFNGLGENBUFFERSARBPROC) wglGetProcAddress("glGenBuffersARB"); pGlGenBuffersARB = (PFNGLGENBUFFERSARBPROC) wglGetProcAddress("glGenBuffersARB");
...@@ -349,6 +352,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -349,6 +352,12 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) pGlFramebufferRenderbufferEXT = (PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glFramebufferRenderbufferEXT")); IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glFramebufferRenderbufferEXT"));
pGlDrawBuffersARB = (PFNGLDRAWBUFFERSARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glDrawBuffersARB"));
pGlDrawBuffersATI = (PFNGLDRAWBUFFERSATIPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glDrawBuffersATI"));
pGlGenBuffersARB = (PFNGLGENBUFFERSARBPROC) pGlGenBuffersARB = (PFNGLGENBUFFERSARBPROC)
IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGenBuffersARB")); IRR_OGL_LOAD_EXTENSION(reinterpret_cast<const GLubyte*>("glGenBuffersARB"));
...@@ -419,6 +428,19 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer) ...@@ -419,6 +428,19 @@ void COpenGLExtensionHandler::initExtensions(bool stencilBuffer)
MaxUserClipPlanes=static_cast<u8>(num); MaxUserClipPlanes=static_cast<u8>(num);
glGetIntegerv(GL_AUX_BUFFERS, &num); glGetIntegerv(GL_AUX_BUFFERS, &num);
MaxAuxBuffers=static_cast<u8>(num); MaxAuxBuffers=static_cast<u8>(num);
#ifdef ARB_draw_buffers
if (FeatureAvailable[IRR_ARB_draw_buffers])
{
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, reinterpret_cast<GLint*>(&MaxUserClipPlanes));
MaxMultipleRenderTargets = static_cast<u8>(MaxUserClipPlanes);
}
#elif defined(ATI_draw_buffers)
if (FeatureAvailable[IRR_ATI_draw_buffers])
{
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ATI, reinterpret_cast<GLint*>(&MaxUserClipPlanes));
MaxMultipleRenderTargets = static_cast<u8>(MaxUserClipPlanes);
}
#endif
#if defined(GL_ARB_shading_language_100) || defined (GL_VERSION_2_0) #if defined(GL_ARB_shading_language_100) || defined (GL_VERSION_2_0)
if (FeatureAvailable[IRR_ARB_shading_language_100] || Version>=200) if (FeatureAvailable[IRR_ARB_shading_language_100] || Version>=200)
{ {
......
...@@ -733,6 +733,8 @@ class COpenGLExtensionHandler ...@@ -733,6 +733,8 @@ class COpenGLExtensionHandler
u32 MaxTextureSize; u32 MaxTextureSize;
//! Maximal LOD Bias //! Maximal LOD Bias
f32 MaxTextureLODBias; f32 MaxTextureLODBias;
//! Number of rendertargets available as MRTs
u8 MaxMultipleRenderTargets;
//! OpenGL version as Integer: 100*Major+Minor, i.e. 2.1 becomes 201 //! OpenGL version as Integer: 100*Major+Minor, i.e. 2.1 becomes 201
u16 Version; u16 Version;
...@@ -790,6 +792,7 @@ class COpenGLExtensionHandler ...@@ -790,6 +792,7 @@ class COpenGLExtensionHandler
void extGlRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); void extGlRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
void extGlFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); void extGlFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
void extGlActiveStencilFace(GLenum face); void extGlActiveStencilFace(GLenum face);
void extGlDrawBuffers(GLsizei n, const GLenum *bufs);
// vertex buffer object // vertex buffer object
void extGlGenBuffers(GLsizei n, GLuint *buffers); void extGlGenBuffers(GLsizei n, GLuint *buffers);
...@@ -861,6 +864,8 @@ class COpenGLExtensionHandler ...@@ -861,6 +864,8 @@ class COpenGLExtensionHandler
PFNGLRENDERBUFFERSTORAGEEXTPROC pGlRenderbufferStorageEXT; PFNGLRENDERBUFFERSTORAGEEXTPROC pGlRenderbufferStorageEXT;
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pGlFramebufferRenderbufferEXT; PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC pGlFramebufferRenderbufferEXT;
PFNGLACTIVESTENCILFACEEXTPROC pGlActiveStencilFaceEXT; PFNGLACTIVESTENCILFACEEXTPROC pGlActiveStencilFaceEXT;
PFNGLDRAWBUFFERSARBPROC pGlDrawBuffersARB;
PFNGLDRAWBUFFERSATIPROC pGlDrawBuffersATI;
PFNGLGENBUFFERSARBPROC pGlGenBuffersARB; PFNGLGENBUFFERSARBPROC pGlGenBuffersARB;
PFNGLBINDBUFFERARBPROC pGlBindBufferARB; PFNGLBINDBUFFERARBPROC pGlBindBufferARB;
PFNGLBUFFERDATAARBPROC pGlBufferDataARB; PFNGLBUFFERDATAARBPROC pGlBufferDataARB;
...@@ -1404,6 +1409,22 @@ inline void COpenGLExtensionHandler::extGlActiveStencilFace(GLenum face) ...@@ -1404,6 +1409,22 @@ inline void COpenGLExtensionHandler::extGlActiveStencilFace(GLenum face)
#endif #endif
} }
inline void COpenGLExtensionHandler::extGlDrawBuffers(GLsizei n, const GLenum *bufs)
{
#ifdef _IRR_OPENGL_USE_EXTPOINTER_
if (pGlDrawBuffersARB)
pGlDrawBuffersARB(n, bufs);
else if (pGlDrawBuffersATI)
pGlDrawBuffersATI(n, bufs);
#elif defined(GL_ARB_draw_buffers)
glDrawBuffersARB(n, bufs);
#elif defined(GL_ATI_draw_buffers)
glDrawBuffersATI(n, bufs);
#else
os::Printer::log("glDrawBuffers not supported", ELL_ERROR);
#endif
}
inline void COpenGLExtensionHandler::extGlGenBuffers(GLsizei n, GLuint *buffers) inline void COpenGLExtensionHandler::extGlGenBuffers(GLsizei n, GLuint *buffers)
{ {
......
...@@ -555,7 +555,7 @@ private: ...@@ -555,7 +555,7 @@ private:
long size = callback->getSize(); long size = callback->getSize();
if (size<0) if (size<0)
return false; return false;
size += 4; // We need two terminating 0's at the end. size += 4; // We need four terminating 0's at the end.
// For ASCII we need 1 0's, for UTF-16 2, for UTF-32 4. // For ASCII we need 1 0's, for UTF-16 2, for UTF-32 4.
char* data8 = new char[size]; char* data8 = new char[size];
...@@ -588,35 +588,35 @@ private: ...@@ -588,35 +588,35 @@ private:
{ {
// UTF-32, big endian // UTF-32, big endian
SourceFormat = ETF_UTF32_BE; SourceFormat = ETF_UTF32_BE;
convertTextData(data32+1, data8, (size/4)); // data32+1 because we need to skip the header convertTextData(data32+1, data8, (size/4)-1); // data32+1 because we need to skip the header
} }
else else
if (size >= 4 && data32[0] == (char32)UTF32_LE) if (size >= 4 && data32[0] == (char32)UTF32_LE)
{ {
// UTF-32, little endian // UTF-32, little endian
SourceFormat = ETF_UTF32_LE; SourceFormat = ETF_UTF32_LE;
convertTextData(data32+1, data8, (size/4)); // data32+1 because we need to skip the header convertTextData(data32+1, data8, (size/4)-1); // data32+1 because we need to skip the header
} }
else else
if (size >= 2 && data16[0] == UTF16_BE) if (size >= 2 && data16[0] == UTF16_BE)
{ {
// UTF-16, big endian // UTF-16, big endian
SourceFormat = ETF_UTF16_BE; SourceFormat = ETF_UTF16_BE;
convertTextData(data16+1, data8, (size/2)); // data16+1 because we need to skip the header convertTextData(data16+1, data8, (size/2)-1); // data16+1 because we need to skip the header
} }
else else
if (size >= 2 && data16[0] == UTF16_LE) if (size >= 2 && data16[0] == UTF16_LE)
{ {
// UTF-16, little endian // UTF-16, little endian
SourceFormat = ETF_UTF16_LE; SourceFormat = ETF_UTF16_LE;
convertTextData(data16+1, data8, (size/2)); // data16+1 because we need to skip the header convertTextData(data16+1, data8, (size/2)-1); // data16+1 because we need to skip the header
} }
else else
if (size >= 3 && data8[0] == UTF8[0] && data8[1] == UTF8[1] && data8[2] == UTF8[2]) if (size >= 3 && memcmp(data8,UTF8,3)==0)
{ {
// UTF-8 // UTF-8
SourceFormat = ETF_UTF8; SourceFormat = ETF_UTF8;
convertTextData(data8+3, data8, size); // data8+3 because we need to skip the header convertTextData(data8+3, data8, size-3); // data8+3 because we need to skip the header
} }
else else
{ {
......
...@@ -83,72 +83,96 @@ private: ...@@ -83,72 +83,96 @@ private:
//! Creates an instance of an UFT-8 or ASCII character xml parser. //! Creates an instance of an UFT-8 or ASCII character xml parser.
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename) IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename)
{ {
return createIrrXMLReader(new CFileReadCallBack(filename)); return createIrrXMLReader(new CFileReadCallBack(filename), true);
} }
//! Creates an instance of an UFT-8 or ASCII character xml parser. //! Creates an instance of an UFT-8 or ASCII character xml parser.
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file) IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file)
{ {
return createIrrXMLReader(new CFileReadCallBack(file)); return createIrrXMLReader(new CFileReadCallBack(file), true);
} }
//! Creates an instance of an UFT-8 or ASCII character xml parser. //! Creates an instance of an UFT-8 or ASCII character xml parser.
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback) IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback,
bool deleteCallback)
{ {
if (callback && (callback->getSize() >= 0)) if (callback && (callback->getSize() >= 0))
return new CXMLReaderImpl<char, IXMLBase>(callback, false); {
return new CXMLReaderImpl<char, IXMLBase>(callback, deleteCallback);
}
else else
{
if(callback && deleteCallback)
delete callback;
return 0; return 0;
}
} }
//! Creates an instance of an UTF-16 xml parser. //! Creates an instance of an UTF-16 xml parser.
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename) IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename)
{ {
return createIrrXMLReaderUTF16(new CFileReadCallBack(filename)); return createIrrXMLReaderUTF16(new CFileReadCallBack(filename), true);
} }
//! Creates an instance of an UTF-16 xml parser. //! Creates an instance of an UTF-16 xml parser.
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file) IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file)
{ {
return createIrrXMLReaderUTF16(new CFileReadCallBack(file)); return createIrrXMLReaderUTF16(new CFileReadCallBack(file), true);
} }
//! Creates an instance of an UTF-16 xml parser. //! Creates an instance of an UTF-16 xml parser.
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback) IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback,
bool deleteCallback)
{ {
if (callback && (callback->getSize() >= 0)) if (callback && (callback->getSize() >= 0))
return new CXMLReaderImpl<char16, IXMLBase>(callback, false); {
return new CXMLReaderImpl<char16, IXMLBase>(callback, deleteCallback);
}
else else
{
if(callback && deleteCallback)
delete callback;
return 0; return 0;
}
} }
//! Creates an instance of an UTF-32 xml parser. //! Creates an instance of an UTF-32 xml parser.
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename) IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename)
{ {
return createIrrXMLReaderUTF32(new CFileReadCallBack(filename)); return createIrrXMLReaderUTF32(new CFileReadCallBack(filename), true);
} }
//! Creates an instance of an UTF-32 xml parser. //! Creates an instance of an UTF-32 xml parser.
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file) IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file)
{ {
return createIrrXMLReaderUTF32(new CFileReadCallBack(file)); return createIrrXMLReaderUTF32(new CFileReadCallBack(file), true);
} }
//! Creates an instance of an UTF-32 xml parser. //! Creates an instance of an UTF-32 xml parser.
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback) IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback,
bool deleteCallback)
{ {
if (callback && (callback->getSize() >= 0)) if (callback && (callback->getSize() >= 0))
return new CXMLReaderImpl<char32, IXMLBase>(callback, false); {
return new CXMLReaderImpl<char32, IXMLBase>(callback, deleteCallback);
}
else else
{
if(callback && deleteCallback)
delete callback;
return 0; return 0;
}
} }
......
...@@ -72,15 +72,13 @@ namespace os ...@@ -72,15 +72,13 @@ namespace os
void Printer::print(const c8* message) void Printer::print(const c8* message)
{ {
#if defined (_WIN32_WCE ) #if defined (_WIN32_WCE )
core::stringw tmp ( message ); core::stringw tmp(message);
tmp += L"\n"; tmp += L"\n";
OutputDebugStringW( tmp.c_str() ); OutputDebugStringW(tmp.c_str());
#else #else
c8* tmp = new c8[strlen(message) + 4]; OutputDebugString(message);
sprintf(tmp, "%s\n", message); OutputDebugString("\n");
OutputDebugString(tmp); printf("%s\n", message);
printf(tmp);
delete [] tmp;
#endif #endif
} }
......
...@@ -76,6 +76,7 @@ int main(int argumentCount, char * arguments[]) ...@@ -76,6 +76,7 @@ int main(int argumentCount, char * arguments[])
TEST(cursorSetVisible); TEST(cursorSetVisible);
TEST(transparentAlphaChannelRef); TEST(transparentAlphaChannelRef);
TEST(drawRectOutline); TEST(drawRectOutline);
TEST(removeCustomAnimator);
// Tests available on 1.6+ // Tests available on 1.6+
TEST(collisionResponseAnimator); TEST(collisionResponseAnimator);
......
// Copyright (C) 2008-2009 Colin MacDonald
// No rights reserved: this software is in the public domain.
#include "testUtils.h"
#include "irrlicht.h"
#include <assert.h>
using namespace irr;
using namespace core;
using namespace scene;
class CustomAnimator : public ISceneNodeAnimator
{
void animateNode(ISceneNode* node, u32 timeMs)
{
// Check that I can remove myself from my node durings its animateNode() loop.
node->removeAnimator(this);
}
ISceneNodeAnimator* createClone(ISceneNode* node, ISceneManager* newManager=0) { return 0 ; }
};
/** Test that a custom animator can remove itself cleanly from an ISceneNode during its
* own animateNode() loop.
* http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=32271 */
bool removeCustomAnimator(void)
{
IrrlichtDevice * device = irr::createDevice(video::EDT_NULL, dimension2d<s32>(160, 120));
assert(device);
if(!device)
return false;
ISceneManager * smgr = device->getSceneManager();
ISceneNode * node = smgr->addEmptySceneNode();
CustomAnimator * instantlyElapsing1 = new CustomAnimator();
CustomAnimator * instantlyElapsing2 = new CustomAnimator();
node->addAnimator(instantlyElapsing1);
node->addAnimator(instantlyElapsing2);
// This should result in both custom animators being removed and
// deleted cleanly, without a crash.
node->OnAnimate(0);
device->drop();
// If we didn't crash, then the test passed.
return true;
}
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<Unit filename="md2Animation.cpp" /> <Unit filename="md2Animation.cpp" />
<Unit filename="planeMatrix.cpp" /> <Unit filename="planeMatrix.cpp" />
<Unit filename="relativeTransformations.cpp" /> <Unit filename="relativeTransformations.cpp" />
<Unit filename="removeCustomAnimator.cpp" />
<Unit filename="sceneCollisionManager.cpp" /> <Unit filename="sceneCollisionManager.cpp" />
<Unit filename="sceneNodeAnimator.cpp" /> <Unit filename="sceneNodeAnimator.cpp" />
<Unit filename="softwareDevice.cpp" /> <Unit filename="softwareDevice.cpp" />
......
...@@ -248,6 +248,10 @@ ...@@ -248,6 +248,10 @@
RelativePath=".\planeMatrix.cpp" RelativePath=".\planeMatrix.cpp"
> >
</File> </File>
<File
RelativePath=".\removeCustomAnimator.cpp"
>
</File>
<File <File
RelativePath=".\sceneCollisionManager.cpp" RelativePath=".\sceneCollisionManager.cpp"
> >
......
...@@ -246,6 +246,10 @@ ...@@ -246,6 +246,10 @@
RelativePath=".\planeMatrix.cpp" RelativePath=".\planeMatrix.cpp"
> >
</File> </File>
<File
RelativePath=".\removeCustomAnimator.cpp"
>
</File>
<File <File
RelativePath=".\sceneCollisionManager.cpp" RelativePath=".\sceneCollisionManager.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