Merging r5623 through r5649 from trunk to ogl-es
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@5650 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
59699aa05c
commit
5a4274203b
|
@ -9,6 +9,10 @@ Changes in ogl-es (not yet released - will be merged with trunk at some point)
|
|||
|
||||
--------------------------
|
||||
Changes in 1.9 (not yet released)
|
||||
- Add serialization for ToolTip to IGUIElement. Thanks @chronologicaldot for patch (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=2&t=52374)
|
||||
- Try recovering lost device in D3D9 for 3 seconds when device reset fails after resizing Window.
|
||||
- Add typedefs like value_type and size_type to array, list and map like std containers have. Thanks @SLC for idea (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=52363)
|
||||
- Remove unused enum E_LOST_RESOURCE
|
||||
- CGUIComboBox uses now EGDS_SCROLLBAR_SIZE instead of EGDS_WINDOW_BUTTON_WIDTH for the width of the listbox button to allow changing that without changing window topbar height.
|
||||
Thanks @LunaRebirth for reporting. (Forum: http://irrlicht.sourceforge.net/forum/viewtopic.php?f=1&t=52297&p=303682#p303682)
|
||||
- CGUIListbox, CGUITreeView and CGUITable now resize scrollbars when EGDS_SCROLLBAR_SIZE in the skin changes without having to re-create the elements.
|
||||
|
@ -213,6 +217,7 @@ should now be fps independentn
|
|||
|
||||
--------------------------
|
||||
Changes in 1.8.5
|
||||
- Fix serialization of OverrideTextColorEnabled flag in CGUITab. Thanks @ chronologicaldot for reporting (http://irrlicht.sourceforge.net/forum/viewtopic.php?f=7&t=52344&p=303891#p303891)
|
||||
- CFileSystem::getAbsolutePath no longer wrongly converts an empty filename to "/" on unix platforms.
|
||||
This fixes the bug that CFileSystem::createAndOpenFile("") returned a (strange behaving) non-null file pointer.
|
||||
Additional check also added in createAndOpenFile to early out on empty names.
|
||||
|
|
|
@ -774,6 +774,7 @@ public:
|
|||
out->addString("Name", Name.c_str());
|
||||
out->addInt("Id", ID );
|
||||
out->addString("Caption", getText());
|
||||
out->addString("ToolTip", getToolTipText().c_str());
|
||||
out->addRect("Rect", DesiredRect);
|
||||
out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
|
||||
out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
|
||||
|
@ -798,6 +799,7 @@ public:
|
|||
setName(in->getAttributeAsString("Name"));
|
||||
setID(in->getAttributeAsInt("Id"));
|
||||
setText(in->getAttributeAsStringW("Caption").c_str());
|
||||
setToolTipText(in->getAttributeAsStringW("ToolTip").c_str());
|
||||
setVisible(in->getAttributeAsBool("Visible"));
|
||||
setEnabled(in->getAttributeAsBool("Enabled"));
|
||||
IsTabStop = in->getAttributeAsBool("TabStop");
|
||||
|
|
|
@ -15,6 +15,17 @@ namespace video
|
|||
{
|
||||
class ITexture;
|
||||
|
||||
//! Enumeration of cube texture surfaces
|
||||
enum E_CUBE_SURFACE
|
||||
{
|
||||
ECS_POSX = 0,
|
||||
ECS_NEGX,
|
||||
ECS_POSY,
|
||||
ECS_NEGY,
|
||||
ECS_POSZ,
|
||||
ECS_NEGZ
|
||||
};
|
||||
|
||||
//! Interface of a Render Target.
|
||||
class IRenderTarget : public virtual IReferenceCounted
|
||||
{
|
||||
|
@ -41,8 +52,10 @@ namespace video
|
|||
/** Set multiple textures for the render target.
|
||||
\param texture Array of texture objects. These textures are used for a color outputs.
|
||||
\param depthStencil Depth or packed depth-stencil texture. This texture is used as depth
|
||||
or depth-stencil buffer. */
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil) = 0;
|
||||
or depth-stencil buffer.
|
||||
\param cubeSurfaces When rendering to cube textures, set the surface to be used for each texture. Can be empty otherwise.
|
||||
*/
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces = core::array<E_CUBE_SURFACE>()) = 0;
|
||||
|
||||
//! Set one texture.
|
||||
void setTexture(ITexture* texture, ITexture* depthStencil)
|
||||
|
@ -53,6 +66,18 @@ namespace video
|
|||
setTexture(textureArray, depthStencil);
|
||||
}
|
||||
|
||||
//! Set one cube surface texture.
|
||||
void setTexture(ITexture* texture, ITexture* depthStencil, E_CUBE_SURFACE cubeSurface)
|
||||
{
|
||||
core::array<ITexture*> textureArray(1);
|
||||
textureArray.push_back(texture);
|
||||
|
||||
core::array<E_CUBE_SURFACE> cubeSurfaces(1);
|
||||
cubeSurfaces.push_back(cubeSurface);
|
||||
|
||||
setTexture(textureArray, depthStencil, cubeSurfaces);
|
||||
}
|
||||
|
||||
//! Get driver type of render target.
|
||||
E_DRIVER_TYPE getDriverType() const
|
||||
{
|
||||
|
@ -67,6 +92,9 @@ namespace video
|
|||
//! Depth or packed depth-stencil texture assigned to render target.
|
||||
ITexture* DepthStencil;
|
||||
|
||||
//! Active surface of cube textures
|
||||
core::array<E_CUBE_SURFACE> CubeSurfaces;
|
||||
|
||||
//! Driver type of render target.
|
||||
E_DRIVER_TYPE DriverType;
|
||||
|
||||
|
|
|
@ -821,7 +821,7 @@ namespace scene
|
|||
}
|
||||
|
||||
//! Name of the scene node.
|
||||
core::stringc Name = "";
|
||||
core::stringc Name;
|
||||
|
||||
//! Absolute transformation of the node.
|
||||
core::matrix4 AbsoluteTransformation;
|
||||
|
|
|
@ -66,9 +66,11 @@ enum E_TEXTURE_CREATION_FLAG
|
|||
ETCF_ALLOW_NON_POWER_2 = 0x00000040,
|
||||
|
||||
//! Allow the driver to keep a copy of the texture in memory
|
||||
/** This makes calls to ITexture::lock a lot faster, but costs main memory.
|
||||
Default is off, except for font-texture which always enable this flag.
|
||||
Currently only used in combination with OpenGL drivers. */
|
||||
/** Enabling this makes calls to ITexture::lock a lot faster, but costs main memory.
|
||||
Currently only used in combination with OpenGL drivers.
|
||||
NOTE: Disabling this does not yet work correctly with alpha-textures.
|
||||
So the default is off for now (but might change with Irrlicht 1.9 if we get the alpha-troubles fixed).
|
||||
*/
|
||||
ETCF_ALLOW_MEMORY_COPY = 0x00000080,
|
||||
|
||||
/** This flag is never used, it only forces the compiler to compile
|
||||
|
|
|
@ -86,22 +86,6 @@ namespace video
|
|||
ETS_COUNT
|
||||
};
|
||||
|
||||
//! enumeration for signaling resources which were lost after the last render cycle
|
||||
/** These values can be signaled by the driver, telling the app that some resources
|
||||
were lost and need to be recreated. Irrlicht will sometimes recreate the actual objects,
|
||||
but the content needs to be recreated by the application. */
|
||||
enum E_LOST_RESOURCE
|
||||
{
|
||||
//! The whole device/driver is lost
|
||||
ELR_DEVICE = 1,
|
||||
//! All texture are lost, rare problem
|
||||
ELR_TEXTURES = 2,
|
||||
//! The Render Target Textures are lost, typical problem for D3D
|
||||
ELR_RTTS = 4,
|
||||
//! The HW buffers are lost, will be recreated automatically, but might require some more time this frame
|
||||
ELR_HW_BUFFERS = 8
|
||||
};
|
||||
|
||||
//! Special render targets, which usually map to dedicated hardware
|
||||
/** These render targets (besides 0 and 1) need not be supported by gfx cards */
|
||||
enum E_RENDER_TARGET
|
||||
|
@ -391,6 +375,18 @@ namespace video
|
|||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
|
||||
|
||||
//! Adds a new render target texture with 6 sides for a cubemap map to the texture cache.
|
||||
/** NOTE: Only supported on D3D9 so far.
|
||||
\param sideLen Length of one cubemap side.
|
||||
\param name A name for the texture. Later calls of getTexture() with this name will return this texture.
|
||||
The name can _not_ be empty.
|
||||
\param format The color format of the render target. Floating point formats are supported.
|
||||
\return Pointer to the created texture or 0 if the texture
|
||||
could not be created. This pointer should not be dropped. See
|
||||
IReferenceCounted::drop() for more information. */
|
||||
virtual ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name = "rt", const ECOLOR_FORMAT format = ECF_UNKNOWN) =0;
|
||||
|
||||
//! Removes a texture from the texture cache and deletes it.
|
||||
/** This method can free a lot of memory!
|
||||
Please note that after calling this, the pointer to the
|
||||
|
|
|
@ -604,6 +604,9 @@ public:
|
|||
other.is_sorted = helper_is_sorted;
|
||||
}
|
||||
|
||||
typedef TAlloc allocator_type;
|
||||
typedef T value_type;
|
||||
typedef u32 size_type;
|
||||
|
||||
private:
|
||||
T* data;
|
||||
|
|
|
@ -394,6 +394,8 @@ public:
|
|||
core::swap(allocator, other.allocator); // memory is still released by the same allocator used for allocation
|
||||
}
|
||||
|
||||
typedef T value_type;
|
||||
typedef u32 size_type;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -664,6 +664,11 @@ class map
|
|||
clear();
|
||||
}
|
||||
|
||||
// typedefs
|
||||
typedef KeyType key_type;
|
||||
typedef ValueType value_type;
|
||||
typedef u32 size_type;
|
||||
|
||||
//------------------------------
|
||||
// Public Commands
|
||||
//------------------------------
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
The Irrlicht Engine SDK version 1.9
|
||||
==========================================================================
|
||||
|
||||
Welcome the Irrlicht Engine SDK.
|
||||
Welcome to the Irrlicht Engine SDK.
|
||||
|
||||
Content of this file:
|
||||
|
||||
|
|
|
@ -466,11 +466,7 @@ bool CD3D9Driver::initDriver(HWND hwnd, bool pureSoftware)
|
|||
setRenderStates3DMode();
|
||||
|
||||
// store the screen's depth buffer descriptor
|
||||
if (SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&DepthStencilSurface)))
|
||||
{
|
||||
DepthStencilSurface->Release();
|
||||
}
|
||||
else
|
||||
if (!SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&DepthStencilSurface)))
|
||||
{
|
||||
os::Printer::log("Was not able to get main depth buffer.", ELL_ERROR);
|
||||
return false;
|
||||
|
@ -512,19 +508,8 @@ bool CD3D9Driver::beginScene(u16 clearFlag, SColor clearColor, f32 clearDepth, u
|
|||
HRESULT hr;
|
||||
if (DeviceLost)
|
||||
{
|
||||
if (FAILED(hr = pID3DDevice->TestCooperativeLevel()))
|
||||
{
|
||||
if (hr == D3DERR_DEVICELOST)
|
||||
{
|
||||
Sleep(100);
|
||||
hr = pID3DDevice->TestCooperativeLevel();
|
||||
if (hr == D3DERR_DEVICELOST)
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((hr == D3DERR_DEVICENOTRESET) && !reset())
|
||||
return false;
|
||||
}
|
||||
if ( !retrieveDevice(1) )
|
||||
return false;
|
||||
}
|
||||
|
||||
clearBuffers(clearFlag, clearColor, clearDepth, clearStencil);
|
||||
|
@ -2871,6 +2856,35 @@ void CD3D9Driver::draw3DBox( const core::aabbox3d<f32>& box, SColor color)
|
|||
pID3DDevice->DrawPrimitiveUP(D3DPT_LINELIST, 12, v, sizeof(S3DVertex));
|
||||
}
|
||||
|
||||
bool CD3D9Driver::retrieveDevice(int numTries, int msSleepBetweenTries)
|
||||
{
|
||||
while ( numTries > 0)
|
||||
{
|
||||
HRESULT hr;
|
||||
if ( FAILED(hr = pID3DDevice->TestCooperativeLevel()) )
|
||||
{
|
||||
// hr can be: D3DERR_DEVICELOST, D3DERR_DEVICENOTRESET or D3DERR_DRIVERINTERNALERROR
|
||||
switch ( hr )
|
||||
{
|
||||
case D3DERR_DEVICENOTRESET:
|
||||
if ( reset() )
|
||||
return true;
|
||||
// when reset fails, just try again, maybe device got lost in between TestCooperativeLevel and reset calls?
|
||||
break;
|
||||
case D3DERR_DEVICELOST:
|
||||
break;
|
||||
case D3DERR_DRIVERINTERNALERROR:
|
||||
return false;
|
||||
}
|
||||
|
||||
Sleep(msSleepBetweenTries);
|
||||
--numTries;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//! resets the device
|
||||
bool CD3D9Driver::reset()
|
||||
|
@ -2927,7 +2941,10 @@ bool CD3D9Driver::reset()
|
|||
ActiveRenderTarget[i] = false;
|
||||
|
||||
if (DepthStencilSurface)
|
||||
{
|
||||
DepthStencilSurface->Release();
|
||||
DepthStencilSurface = 0;
|
||||
}
|
||||
|
||||
if (BackBufferSurface)
|
||||
{
|
||||
|
@ -2938,14 +2955,53 @@ bool CD3D9Driver::reset()
|
|||
DriverWasReset=true;
|
||||
|
||||
HRESULT hr = pID3DDevice->Reset(&present);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (hr == D3DERR_DEVICELOST)
|
||||
{
|
||||
DeviceLost = true;
|
||||
os::Printer::log("Resetting failed due to device lost.", ELL_WARNING);
|
||||
}
|
||||
#ifdef D3DERR_DEVICEREMOVED
|
||||
else if (hr == D3DERR_DEVICEREMOVED)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to device removed.", ELL_WARNING);
|
||||
}
|
||||
#endif
|
||||
else if (hr == D3DERR_DRIVERINTERNALERROR)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to internal error.", ELL_WARNING);
|
||||
}
|
||||
else if (hr == D3DERR_OUTOFVIDEOMEMORY)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to out of memory.", ELL_WARNING);
|
||||
}
|
||||
else if (hr == D3DERR_DEVICENOTRESET)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to not reset.", ELL_WARNING);
|
||||
}
|
||||
else if (hr == D3DERR_INVALIDCALL)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to invalid call", "You need to release some more surfaces.", ELL_WARNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Resetting failed due to unknown reason.", core::stringc((int)hr).c_str(), ELL_WARNING);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
DeviceLost = false;
|
||||
|
||||
// reset bridge calls.
|
||||
if (BridgeCalls)
|
||||
BridgeCalls->reset();
|
||||
|
||||
// restore screen depthbuffer descriptor
|
||||
if (SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&DepthStencilSurface)))
|
||||
DepthStencilSurface->Release();
|
||||
if (!SUCCEEDED(pID3DDevice->GetDepthStencilSurface(&DepthStencilSurface)))
|
||||
{
|
||||
os::Printer::log("Was not able to get main depth buffer.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// restore RTTs
|
||||
for (i=0; i<Textures.size(); ++i)
|
||||
|
@ -2982,43 +3038,6 @@ bool CD3D9Driver::reset()
|
|||
pID3DDevice->CreateQuery(D3DQUERYTYPE_OCCLUSION, reinterpret_cast<IDirect3DQuery9**>(&OcclusionQueries[i].PID));
|
||||
}
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (hr == D3DERR_DEVICELOST)
|
||||
{
|
||||
DeviceLost = true;
|
||||
os::Printer::log("Resetting failed due to device lost.", ELL_WARNING);
|
||||
}
|
||||
#ifdef D3DERR_DEVICEREMOVED
|
||||
else if (hr == D3DERR_DEVICEREMOVED)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to device removed.", ELL_WARNING);
|
||||
}
|
||||
#endif
|
||||
else if (hr == D3DERR_DRIVERINTERNALERROR)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to internal error.", ELL_WARNING);
|
||||
}
|
||||
else if (hr == D3DERR_OUTOFVIDEOMEMORY)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to out of memory.", ELL_WARNING);
|
||||
}
|
||||
else if (hr == D3DERR_DEVICENOTRESET)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to not reset.", ELL_WARNING);
|
||||
}
|
||||
else if (hr == D3DERR_INVALIDCALL)
|
||||
{
|
||||
os::Printer::log("Resetting failed due to invalid call", "You need to release some more surfaces.", ELL_WARNING);
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Resetting failed due to unknown reason.", core::stringc((int)hr).c_str(), ELL_WARNING);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
DeviceLost = false;
|
||||
ResetRenderStates = true;
|
||||
LastVertexType = (E_VERTEX_TYPE)-1;
|
||||
|
||||
|
@ -3043,7 +3062,13 @@ void CD3D9Driver::OnResize(const core::dimension2d<u32>& size)
|
|||
present.BackBufferWidth = size.Width;
|
||||
present.BackBufferHeight = size.Height;
|
||||
|
||||
reset();
|
||||
if ( !reset() )
|
||||
{
|
||||
if ( !retrieveDevice(20, 200) ) // retrying for 3 seconds, I hope that's long enough?
|
||||
{
|
||||
os::Printer::log("Failed to retrieve device in OnResize.", ELL_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -3221,7 +3246,7 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size
|
|||
const io::path& name,
|
||||
const ECOLOR_FORMAT format)
|
||||
{
|
||||
CD3D9Texture* tex = new CD3D9Texture(this, size, name, format);
|
||||
CD3D9Texture* tex = new CD3D9Texture(this, size, name, ETT_2D, format);
|
||||
if (tex)
|
||||
{
|
||||
if (!tex->Texture)
|
||||
|
@ -3236,6 +3261,24 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size
|
|||
return tex;
|
||||
}
|
||||
|
||||
ITexture* CD3D9Driver::addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format)
|
||||
{
|
||||
CD3D9Texture* tex = new CD3D9Texture(this, core::dimension2d<u32>(sideLen, sideLen), name, ETT_CUBEMAP, format);
|
||||
if (tex)
|
||||
{
|
||||
if (!tex->CubeTexture)
|
||||
{
|
||||
tex->drop();
|
||||
return 0;
|
||||
}
|
||||
|
||||
addTexture(tex);
|
||||
tex->drop();
|
||||
}
|
||||
return tex;
|
||||
}
|
||||
|
||||
void CD3D9Driver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil)
|
||||
{
|
||||
DWORD internalFlag = 0;
|
||||
|
|
|
@ -266,6 +266,10 @@ namespace video
|
|||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates a render target texture for a cubemap
|
||||
ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format) _IRR_OVERRIDE_;
|
||||
|
||||
virtual void clearBuffers(u16 flag, SColor color = SColor(255,0,0,0), f32 depth = 1.f, u8 stencil = 0) _IRR_OVERRIDE_;
|
||||
|
||||
//! Returns an image created from the last rendered frame.
|
||||
|
@ -349,6 +353,9 @@ namespace video
|
|||
//! resets the device
|
||||
bool reset();
|
||||
|
||||
//! Try to get back a lost device
|
||||
bool retrieveDevice(int numTries, int msSleepBetweenTries=100);
|
||||
|
||||
virtual ITexture* createDeviceDependentTexture(const io::path& name, IImage* image) _IRR_OVERRIDE_;
|
||||
|
||||
virtual ITexture* createDeviceDependentTextureCubemap(const io::path& name, const core::array<IImage*>& image) _IRR_OVERRIDE_;
|
||||
|
|
|
@ -49,9 +49,9 @@ namespace irr
|
|||
DepthStencil->drop();
|
||||
}
|
||||
|
||||
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil)
|
||||
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
bool textureUpdate = (Texture != texture) ? true : false;
|
||||
bool textureUpdate = (Texture != texture) || (CubeSurfaces != cubeSurfaces) ? true : false;
|
||||
bool depthStencilUpdate = (DepthStencil != depthStencil) ? true : false;
|
||||
|
||||
if (textureUpdate || depthStencilUpdate)
|
||||
|
@ -60,6 +60,8 @@ namespace irr
|
|||
|
||||
if (textureUpdate)
|
||||
{
|
||||
CubeSurfaces = cubeSurfaces;
|
||||
|
||||
if (texture.size() > Driver->ActiveRenderTarget.size())
|
||||
{
|
||||
core::stringc message = "This GPU supports up to ";
|
||||
|
@ -92,13 +94,15 @@ namespace irr
|
|||
CD3D9Texture* currentTexture = (texture[i] && texture[i]->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(texture[i]) : 0;
|
||||
|
||||
IDirect3DTexture9* textureID = 0;
|
||||
IDirect3DCubeTexture9* cubeTextureId = 0;
|
||||
UINT level = 0; // no support for rendering to to other mip-levels so far
|
||||
|
||||
if (currentTexture)
|
||||
{
|
||||
if (currentTexture->getType() == ETT_2D)
|
||||
textureID = currentTexture->getDX9Texture();
|
||||
else
|
||||
os::Printer::log("This driver doesn't support render to cubemaps.", ELL_WARNING);
|
||||
else if ( currentTexture->getType() == ETT_CUBEMAP )
|
||||
cubeTextureId = currentTexture->getDX9CubeTexture();
|
||||
}
|
||||
|
||||
if (textureID)
|
||||
|
@ -107,7 +111,18 @@ namespace irr
|
|||
Texture[i]->grab();
|
||||
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
textureID->GetSurfaceLevel(0, ¤tSurface);
|
||||
textureID->GetSurfaceLevel(level, ¤tSurface);
|
||||
|
||||
Surface[i] = currentSurface;
|
||||
}
|
||||
else if ( cubeTextureId )
|
||||
{
|
||||
Texture[i] = texture[i];
|
||||
Texture[i]->grab();
|
||||
|
||||
IDirect3DSurface9* currentSurface = 0;
|
||||
D3DCUBEMAP_FACES face = (D3DCUBEMAP_FACES)CubeSurfaces[i]; // we use same numbering
|
||||
cubeTextureId->GetCubeMapSurface(face, level, ¤tSurface);
|
||||
|
||||
Surface[i] = currentSurface;
|
||||
}
|
||||
|
@ -146,7 +161,7 @@ namespace irr
|
|||
if (currentTexture->getType() == ETT_2D)
|
||||
textureID = currentTexture->getDX9Texture();
|
||||
else
|
||||
os::Printer::log("This driver doesn't support render to cubemaps.", ELL_WARNING);
|
||||
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
|
||||
}
|
||||
|
||||
if (textureID)
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace irr
|
|||
CD3D9RenderTarget(CD3D9Driver* driver);
|
||||
virtual ~CD3D9RenderTarget();
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil) _IRR_OVERRIDE_;
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
|
||||
|
||||
const core::dimension2d<u32>& getSize() const;
|
||||
|
||||
|
|
|
@ -74,10 +74,10 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
|||
switch (Type)
|
||||
{
|
||||
case ETT_2D:
|
||||
Device->CreateTexture(Size.Width, Size.Height, HasMipMaps ? 0 : 1, flags, InternalFormat, D3DPOOL_MANAGED, &Texture, NULL);
|
||||
hr = Device->CreateTexture(Size.Width, Size.Height, HasMipMaps ? 0 : 1, flags, InternalFormat, D3DPOOL_MANAGED, &Texture, NULL);
|
||||
break;
|
||||
case ETT_CUBEMAP:
|
||||
Device->CreateCubeTexture(Size.Width, HasMipMaps ? 0 : 1, flags, InternalFormat, D3DPOOL_MANAGED, &CubeTexture, NULL);
|
||||
hr = Device->CreateCubeTexture(Size.Width, HasMipMaps ? 0 : 1, flags, InternalFormat, D3DPOOL_MANAGED, &CubeTexture, NULL);
|
||||
break;
|
||||
default:
|
||||
_IRR_DEBUG_BREAK_IF(true)
|
||||
|
@ -104,7 +104,20 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
|||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Could not create DIRECT3D9 Texture.", ELL_WARNING);
|
||||
switch (hr )
|
||||
{
|
||||
case D3DERR_INVALIDCALL:
|
||||
os::Printer::log("Could not create DIRECT3D9 Texture. D3DERR_INVALIDCALL", ELL_WARNING);
|
||||
break;
|
||||
case D3DERR_OUTOFVIDEOMEMORY:
|
||||
os::Printer::log("Could not create DIRECT3D9 Texture. D3DERR_OUTOFVIDEOMEMORY", ELL_WARNING);
|
||||
break;
|
||||
case E_OUTOFMEMORY:
|
||||
os::Printer::log("Could not create DIRECT3D9 Texture. E_OUTOFMEMORY", ELL_WARNING);
|
||||
break;
|
||||
default:
|
||||
os::Printer::log("Could not create DIRECT3D9 Texture.", ELL_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if (releaseImageData)
|
||||
|
@ -114,8 +127,8 @@ CD3D9Texture::CD3D9Texture(const io::path& name, const core::array<IImage*>& ima
|
|||
}
|
||||
}
|
||||
|
||||
CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, const ECOLOR_FORMAT format)
|
||||
: ITexture(name, ETT_2D), Driver(driver), InternalFormat(D3DFMT_UNKNOWN), LockReadOnly(false), LockData(0), LockLayer(0),
|
||||
CD3D9Texture::CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, E_TEXTURE_TYPE type, const ECOLOR_FORMAT format)
|
||||
: ITexture(name, type), Driver(driver), InternalFormat(D3DFMT_UNKNOWN), LockReadOnly(false), LockData(0), LockLayer(0),
|
||||
AutoGenerateMipMaps(false), Device(0), Texture(0), CubeTexture(0), RTTSurface(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
@ -344,23 +357,46 @@ void CD3D9Texture::releaseTexture()
|
|||
|
||||
void CD3D9Texture::generateRenderTarget()
|
||||
{
|
||||
if (!Texture)
|
||||
DWORD flags = (IImage::isDepthFormat(ColorFormat)) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET;
|
||||
|
||||
HRESULT hr = 0;
|
||||
|
||||
switch (Type)
|
||||
{
|
||||
DWORD flag = (IImage::isDepthFormat(ColorFormat)) ? D3DUSAGE_DEPTHSTENCIL : D3DUSAGE_RENDERTARGET;
|
||||
case ETT_2D:
|
||||
if (!Texture )
|
||||
hr = Device->CreateTexture(Size.Width, Size.Height, 1, flags, InternalFormat, D3DPOOL_DEFAULT, &Texture, NULL);
|
||||
break;
|
||||
case ETT_CUBEMAP:
|
||||
if (!CubeTexture)
|
||||
hr = Device->CreateCubeTexture(Size.Width, 1, flags, InternalFormat, D3DPOOL_DEFAULT, &CubeTexture, NULL);
|
||||
break;
|
||||
default:
|
||||
_IRR_DEBUG_BREAK_IF(true)
|
||||
break;
|
||||
}
|
||||
|
||||
HRESULT hr = Device->CreateTexture(Size.Width, Size.Height, 1, flag, InternalFormat, D3DPOOL_DEFAULT, &Texture, NULL);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (D3DERR_INVALIDCALL == hr)
|
||||
os::Printer::log("Could not create render target texture", "Invalid Call", irr::ELL_ERROR);
|
||||
else if (D3DERR_OUTOFVIDEOMEMORY == hr)
|
||||
os::Printer::log("Could not create render target texture", "Out of Video Memory", irr::ELL_ERROR);
|
||||
else if (E_OUTOFMEMORY == hr)
|
||||
os::Printer::log("Could not create render target texture", "Out of Memory", irr::ELL_ERROR);
|
||||
else
|
||||
os::Printer::log("Could not create render target texture", irr::ELL_ERROR);
|
||||
}
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (D3DERR_INVALIDCALL == hr)
|
||||
os::Printer::log("Could not create render target texture", "Invalid Call", irr::ELL_ERROR);
|
||||
else if (D3DERR_OUTOFVIDEOMEMORY == hr)
|
||||
os::Printer::log("Could not create render target texture", "Out of Video Memory", irr::ELL_ERROR);
|
||||
else if (E_OUTOFMEMORY == hr)
|
||||
os::Printer::log("Could not create render target texture", "Out of Memory", irr::ELL_ERROR);
|
||||
else
|
||||
os::Printer::log("Could not create render target texture", irr::ELL_ERROR);
|
||||
core::stringc params("Width:");
|
||||
params += (unsigned int)Size.Width;
|
||||
params += " Height: ";
|
||||
params += (unsigned int)Size.Height;
|
||||
params += " flag: ";
|
||||
params += (unsigned int)flags;
|
||||
params += " format";
|
||||
params += (unsigned int)InternalFormat;
|
||||
params += " Type: ";
|
||||
params += (unsigned int)Type;
|
||||
os::Printer::log(params.c_str(), irr::ELL_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ class CD3D9Texture : public ITexture
|
|||
public:
|
||||
CD3D9Texture(const io::path& name, const core::array<IImage*>& image, E_TEXTURE_TYPE type, CD3D9Driver* driver);
|
||||
|
||||
CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
CD3D9Texture(CD3D9Driver* driver, const core::dimension2d<u32>& size, const io::path& name, E_TEXTURE_TYPE type, const ECOLOR_FORMAT format = ECF_UNKNOWN);
|
||||
|
||||
virtual ~CD3D9Texture();
|
||||
|
||||
|
|
|
@ -54,14 +54,6 @@ void CGUITab::setNumber(s32 n)
|
|||
Number = n;
|
||||
}
|
||||
|
||||
void CGUITab::refreshSkinColors()
|
||||
{
|
||||
if ( !OverrideTextColorEnabled )
|
||||
{
|
||||
TextColor = Environment->getSkin()->getColor(EGDC_BUTTON_TEXT);
|
||||
}
|
||||
}
|
||||
|
||||
//! draws the element and its children
|
||||
void CGUITab::draw()
|
||||
{
|
||||
|
@ -101,10 +93,12 @@ void CGUITab::setTextColor(video::SColor c)
|
|||
|
||||
video::SColor CGUITab::getTextColor() const
|
||||
{
|
||||
return TextColor;
|
||||
if ( OverrideTextColorEnabled )
|
||||
return TextColor;
|
||||
else
|
||||
return Environment->getSkin()->getColor(EGDC_BUTTON_TEXT);
|
||||
}
|
||||
|
||||
|
||||
//! returns true if the tab is drawing its background, false if not
|
||||
bool CGUITab::isDrawingBackground() const
|
||||
{
|
||||
|
@ -141,12 +135,9 @@ void CGUITab::deserializeAttributes(io::IAttributes* in, io::SAttributeReadWrite
|
|||
setNumber(in->getAttributeAsInt("TabNumber"));
|
||||
setDrawBackground(in->getAttributeAsBool("DrawBackground"));
|
||||
setBackgroundColor(in->getAttributeAsColor("BackColor"));
|
||||
bool override = in->getAttributeAsBool("OverrideTextColorEnabled");
|
||||
bool overrideColor = in->getAttributeAsBool("OverrideTextColorEnabled", OverrideTextColorEnabled);
|
||||
setTextColor(in->getAttributeAsColor("TextColor"));
|
||||
if ( !override )
|
||||
{
|
||||
OverrideTextColorEnabled = false;
|
||||
}
|
||||
OverrideTextColorEnabled = overrideColor; // because setTextColor does set OverrideTextColorEnabled always to true
|
||||
|
||||
if (Parent && Parent->getType() == EGUIET_TAB_CONTROL)
|
||||
{
|
||||
|
@ -634,9 +625,6 @@ void CGUITabControl::draw()
|
|||
|
||||
pos += len;
|
||||
|
||||
if ( text )
|
||||
Tabs[i]->refreshSkinColors();
|
||||
|
||||
if ((s32)i == ActiveTab)
|
||||
{
|
||||
// for active button just remember values
|
||||
|
|
|
@ -65,9 +65,6 @@ namespace gui
|
|||
//! Reads attributes of the element
|
||||
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
|
||||
|
||||
//! only for internal use by CGUITabControl
|
||||
void refreshSkinColors();
|
||||
|
||||
private:
|
||||
|
||||
s32 Number;
|
||||
|
|
|
@ -1623,6 +1623,10 @@ void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
|
|||
else
|
||||
out.append("Microsoft Windows Server 2008 R2 ");
|
||||
}
|
||||
else if (osvi.dwMinorVersion == 2)
|
||||
{
|
||||
out.append("Microsoft Windows 8 or later ");
|
||||
}
|
||||
}
|
||||
|
||||
if (bOsVersionInfoEx)
|
||||
|
|
|
@ -114,6 +114,7 @@ CNullDriver::CNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& scre
|
|||
|
||||
setTextureCreationFlag(ETCF_ALWAYS_32_BIT, true);
|
||||
setTextureCreationFlag(ETCF_CREATE_MIP_MAPS, true);
|
||||
setTextureCreationFlag(ETCF_ALLOW_MEMORY_COPY, true);
|
||||
|
||||
ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(screenSize));
|
||||
|
||||
|
@ -2614,6 +2615,12 @@ ITexture* CNullDriver::addRenderTargetTexture(const core::dimension2d<u32>& size
|
|||
return 0;
|
||||
}
|
||||
|
||||
ITexture* CNullDriver::addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CNullDriver::clearBuffers(u16 flag, SColor color, f32 depth, u8 stencil)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -322,6 +322,10 @@ namespace video
|
|||
virtual ITexture* addRenderTargetTexture(const core::dimension2d<u32>& size,
|
||||
const io::path& name, const ECOLOR_FORMAT format = ECF_UNKNOWN) _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates a render target texture for a cubemap
|
||||
ITexture* addRenderTargetTextureCubemap(const irr::u32 sideLen,
|
||||
const io::path& name, const ECOLOR_FORMAT format) _IRR_OVERRIDE_;
|
||||
|
||||
//! Creates an 1bit alpha channel of the texture based of an color key.
|
||||
virtual void makeColorKeyTexture(video::ITexture* texture, video::SColor color, bool zeroTexels) const _IRR_OVERRIDE_;
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
DepthStencil->drop();
|
||||
}
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil) _IRR_OVERRIDE_
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_
|
||||
{
|
||||
bool textureUpdate = (Texture != texture) ? true : false;
|
||||
bool depthStencilUpdate = (DepthStencil != depthStencil) ? true : false;
|
||||
|
|
|
@ -129,7 +129,7 @@ CSoftwareRenderTarget::~CSoftwareRenderTarget()
|
|||
Texture[0]->drop();
|
||||
}
|
||||
|
||||
void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil)
|
||||
void CSoftwareRenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
if (Texture != texture)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
CSoftwareRenderTarget(CSoftwareDriver* driver);
|
||||
virtual ~CSoftwareRenderTarget();
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil) _IRR_OVERRIDE_;
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
|
||||
|
||||
ITexture* getTexture() const;
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ CSoftwareRenderTarget2::~CSoftwareRenderTarget2()
|
|||
Texture[0]->drop();
|
||||
}
|
||||
|
||||
void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil)
|
||||
void CSoftwareRenderTarget2::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
if (Texture != texture)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
CSoftwareRenderTarget2(CBurningVideoDriver* driver);
|
||||
virtual ~CSoftwareRenderTarget2();
|
||||
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil) _IRR_OVERRIDE_;
|
||||
virtual void setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces) _IRR_OVERRIDE_;
|
||||
|
||||
ITexture* getTexture() const;
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ VERSION_RELEASE = 0
|
|||
#
|
||||
# make win32
|
||||
#
|
||||
# Or as MinGW by default has CC set to cc - but has no compiler by that name - you might have to do:
|
||||
# make CC=gcc win32
|
||||
|
||||
#List of object files, separated based on engine architecture
|
||||
IRRMESHLOADER = CBSPMeshFileLoader.o CMD2MeshFileLoader.o CMD3MeshFileLoader.o CMS3DMeshFileLoader.o CB3DMeshFileLoader.o C3DSMeshFileLoader.o COgreMeshFileLoader.o COBJMeshFileLoader.o CColladaFileLoader.o CCSMLoader.o CDMFLoader.o CLMTSMeshFileLoader.o CMY3DMeshFileLoader.o COCTLoader.o CXMeshFileLoader.o CIrrMeshFileLoader.o CSTLMeshFileLoader.o CLWOMeshFileLoader.o CPLYMeshFileLoader.o CSMFMeshFileLoader.o CMeshTextureLoader.o
|
||||
|
|
Loading…
Reference in New Issue