Commit 96e891f0 authored by cutealien's avatar cutealien

Flip around default parameters in beginScene and setRenderTarget in a way that...

Flip around default parameters in beginScene and setRenderTarget in a way that causes less deprecated warnings, but still does the same in general. That avoids some troubles with function resolution when only first 2 parameters got set (otherwise needed explicit casts to u16).
Use new image->getData in example to avoid warnings.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5205 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 8863d11e
......@@ -598,7 +598,7 @@ void CQuake3EventHandler::createTextures()
for ( i = 0; i != 8; ++i )
{
image = driver->createImage ( video::ECF_A8R8G8B8, dim);
data = (u32*) image->lock ();
data = (u32*) image->getData ();
for ( y = 0; y != dim.Height; ++y )
{
for ( x = 0; x != dim.Width; ++x )
......@@ -607,7 +607,6 @@ void CQuake3EventHandler::createTextures()
}
data = (u32*) ( (u8*) data + image->getPitch() );
}
image->unlock();
snprintf_irr ( buf, 64, "smoke_%02d", i );
driver->addTexture( buf, image );
image->drop ();
......@@ -617,7 +616,7 @@ void CQuake3EventHandler::createTextures()
for ( i = 0; i != 1; ++i )
{
image = driver->createImage ( video::ECF_A8R8G8B8, dim);
data = (u32*) image->lock ();
data = (u32*) image->getData ();
for ( y = 0; y != dim.Height; ++y )
{
for ( x = 0; x != dim.Width; ++x )
......@@ -626,7 +625,6 @@ void CQuake3EventHandler::createTextures()
}
data = (u32*) ( (u8*) data + image->getPitch() );
}
image->unlock();
snprintf_irr ( buf, 64, "fog_%02d", i );
driver->addTexture( buf, image );
image->drop ();
......
......@@ -159,13 +159,17 @@ public:
}
//! Use this to get a pointer to the image data.
/**
\return Pointer to the image data. What type of data is pointed to
depends on the color format of the image. For example if the color
format is ECF_A8R8G8B8, it is of u32. */
void* getData() const
{
return Data;
}
//! Lock function. Use this to get a pointer to the image data.
/** After you don't need the pointer anymore, you must call unlock().
/** Use getData instead.
\return Pointer to the image data. What type of data is pointed to
depends on the color format of the image. For example if the color
format is ECF_A8R8G8B8, it is of u32. Be sure to call unlock() after
......
......@@ -136,7 +136,8 @@ namespace video
ECBF_NONE = 0,
ECBF_COLOR = 1,
ECBF_DEPTH = 2,
ECBF_STENCIL = 4
ECBF_STENCIL = 4,
ECBF_ALL = ECBF_COLOR|ECBF_DEPTH|ECBF_STENCIL
};
//! Enum for the types of fog distributions to choose from
......@@ -233,7 +234,7 @@ namespace video
//! Applications must call this method before performing any rendering.
/** This method can clear the back- and the z-buffer.
\param clearFlag The clear flags.
\param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.
\param clearColor The clear color for the color buffer.
\param clearDepth The clear value for the depth buffer.
\param clearStencil The clear value for the stencil buffer.
......@@ -245,10 +246,11 @@ namespace video
rectangle of the area to be presented. Set to null to present
everything. Note: not implemented in all devices.
\return False if failed. */
virtual bool beginScene(u16 clearFlag, SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0,
virtual bool beginScene(u16 clearFlag=(u16)(ECBF_COLOR|ECBF_DEPTH), SColor clearColor = SColor(255,0,0,0), f32 clearDepth = 1.f, u8 clearStencil = 0,
const SExposedVideoData& videoData=SExposedVideoData(), core::rect<s32>* sourceRect = 0) = 0;
_IRR_DEPRECATED_ bool beginScene(bool backBuffer = true, bool zBuffer = true, SColor color = SColor(255,0,0,0),
//! Old beginScene implementation for downward compatibility. Can't clearn stencil buffer, but otherwise identical to other beginScene
_IRR_DEPRECATED_ bool beginScene(bool backBuffer, bool zBuffer, SColor color = SColor(255,0,0,0),
const SExposedVideoData& videoData = SExposedVideoData(), core::rect<s32>* sourceRect = 0)
{
u16 flag = 0;
......@@ -576,7 +578,7 @@ namespace video
possible to render into a texture between the
IVideoDriver::beginScene() and endScene() method calls.
\param target Render target object.
\param clearFlag The clear flags.
\param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.
\param clearColor The clear color for the color buffer.
\param clearDepth The clear value for the depth buffer.
\param clearStencil The clear value for the stencil buffer.
......@@ -608,16 +610,18 @@ namespace video
IVideoDriver::addRenderTargetTexture(). If set to 0, it sets
the previous render target which was set before the last
setRenderTarget() call.
\param clearFlag The clear flags.
\param clearFlag A combination of the E_CLEAR_BUFFER_FLAG bit-flags.
\param clearColor The clear color for the color buffer.
\param clearDepth The clear value for the depth buffer.
\param clearStencil The clear value for the stencil buffer.
\return True if sucessful and false if not. */
virtual bool setRenderTarget(ITexture* texture, u16 clearFlag, SColor clearColor = SColor(255,0,0,0),
virtual bool setRenderTarget(ITexture* texture, u16 clearFlag=ECBF_COLOR|ECBF_DEPTH, SColor clearColor = SColor(255,0,0,0),
f32 clearDepth = 1.f, u8 clearStencil = 0) = 0;
_IRR_DEPRECATED_ bool setRenderTarget(ITexture* texture, bool clearBackBuffer = true,
bool clearZBuffer = true, SColor color = SColor(255,0,0,0))
//! Sets a new render target.
// Prefer to use the setRenderTarget function taking flags as parameter as this one can't clear the stencil buffer.
// It's still offered for backward compatiblity.
_IRR_DEPRECATED_ bool setRenderTarget(ITexture* texture, bool clearBackBuffer, bool clearZBuffer, SColor color = SColor(255,0,0,0))
{
u16 flag = 0;
......
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