Commit fb196550 authored by hybrid's avatar hybrid

Workaround avoiding wrong renderstate with culling modes.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1669 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 8b8efafc
...@@ -29,37 +29,40 @@ namespace video ...@@ -29,37 +29,40 @@ namespace video
EMF_ZBUFFER, EMF_ZBUFFER,
//! May be written to the zbuffer or is it readonly. Default: true //! May be written to the zbuffer or is it readonly. Default: true
//! This flag is ignored, if the material type is a transparent type. /** This flag is ignored, if the material type is a transparent type. */
EMF_ZWRITE_ENABLE, EMF_ZWRITE_ENABLE,
//! Is backface culling enabled? Default: true //! Is backface culling enabled? Default: true
EMF_BACK_FACE_CULLING, EMF_BACK_FACE_CULLING,
//! Is frontface culling enabled? Default: false //! Is frontface culling enabled? Default: false
/** Overrides EMF_BACK_FACE_CULLING if both are enabled. */
EMF_FRONT_FACE_CULLING, EMF_FRONT_FACE_CULLING,
//! Is bilinear filtering enabled? Default: true //! Is bilinear filtering enabled? Default: true
EMF_BILINEAR_FILTER, EMF_BILINEAR_FILTER,
//! Is trilinear filtering enabled? Default: false //! Is trilinear filtering enabled? Default: false
//! If the trilinear filter flag is enabled, /** If the trilinear filter flag is enabled,
//! the bilinear filtering flag is ignored. the bilinear filtering flag is ignored. */
EMF_TRILINEAR_FILTER, EMF_TRILINEAR_FILTER,
//! Is anisotropic filtering? Default: false //! Is anisotropic filtering? Default: false
//! In Irrlicht you can use anisotropic texture filtering in /** In Irrlicht you can use anisotropic texture filtering in
//! conjunction with bilinear or trilinear texture filtering conjunction with bilinear or trilinear texture filtering
//! to improve rendering results. Primitives will look less to improve rendering results. Primitives will look less
//! blurry with this flag switched on. blurry with this flag switched on. */
EMF_ANISOTROPIC_FILTER, EMF_ANISOTROPIC_FILTER,
//! Is fog enabled? Default: false //! Is fog enabled? Default: false
EMF_FOG_ENABLE, EMF_FOG_ENABLE,
//! Normalizes normals.You can enable this if you need //! Normalizes normals. Default: false
//! to scale a dynamic lighted model. Usually, its normals will get scaled /** You can enable this if you need to scale a dynamic lighted
//! too then and it will get darker. If you enable the EMF_NORMALIZE_NORMALS flag, model. Usually, its normals will get scaled too then and it
//! the normals will be normalized again, and the model will look as bright as it should. will get darker. If you enable the EMF_NORMALIZE_NORMALS flag,
the normals will be normalized again, and the model will look
as bright as it should. */
EMF_NORMALIZE_NORMALS, EMF_NORMALIZE_NORMALS,
//! Access to all layers texture wrap settings. Overwrites separate layer settings. //! Access to all layers texture wrap settings. Overwrites separate layer settings.
......
...@@ -1409,9 +1409,9 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria ...@@ -1409,9 +1409,9 @@ void CD3D8Driver::setBasicRenderStates(const SMaterial& material, const SMateria
if (resetAllRenderstates || (lastmaterial.FrontfaceCulling != material.FrontfaceCulling) || (lastmaterial.BackfaceCulling != material.BackfaceCulling)) if (resetAllRenderstates || (lastmaterial.FrontfaceCulling != material.FrontfaceCulling) || (lastmaterial.BackfaceCulling != material.BackfaceCulling))
{ {
if (material.FrontfaceCulling && material.BackfaceCulling) // if (material.FrontfaceCulling && material.BackfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW|D3DCULL_CCW); // pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW|D3DCULL_CCW);
else // else
if (material.FrontfaceCulling) if (material.FrontfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
else else
......
...@@ -716,14 +716,14 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture, ...@@ -716,14 +716,14 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture,
// check for valid render target // check for valid render target
CD3D9Texture* tex = (CD3D9Texture*)texture; if (texture && !texture->isRenderTarget())
if (texture && !tex->isRenderTarget())
{ {
os::Printer::log("Fatal Error: Tried to set a non render target texture as render target.", ELL_ERROR); os::Printer::log("Fatal Error: Tried to set a non render target texture as render target.", ELL_ERROR);
return false; return false;
} }
CD3D9Texture* tex = static_cast<CD3D9Texture*>(texture);
if (texture && (tex->getSize().Width > CurrentDepthBufferSize.Width || if (texture && (tex->getSize().Width > CurrentDepthBufferSize.Width ||
tex->getSize().Height > CurrentDepthBufferSize.Height)) tex->getSize().Height > CurrentDepthBufferSize.Height))
{ {
...@@ -1707,9 +1707,9 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria ...@@ -1707,9 +1707,9 @@ void CD3D9Driver::setBasicRenderStates(const SMaterial& material, const SMateria
if (resetAllRenderstates || (lastmaterial.FrontfaceCulling != material.FrontfaceCulling) || (lastmaterial.BackfaceCulling != material.BackfaceCulling)) if (resetAllRenderstates || (lastmaterial.FrontfaceCulling != material.FrontfaceCulling) || (lastmaterial.BackfaceCulling != material.BackfaceCulling))
{ {
if (material.FrontfaceCulling && material.BackfaceCulling) // if (material.FrontfaceCulling && material.BackfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW|D3DCULL_CCW); // pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW|D3DCULL_CCW);
else // else
if (material.FrontfaceCulling) if (material.FrontfaceCulling)
pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW); pID3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
else else
......
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