mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-28 06:20:21 +02:00
Material.ZWriteEnable is now of type E_ZWRITE instead of bool and ZWriteFineControl get removed (or merged into ZWriteEnable).
This breaks compiling. To have old values replace false with EZW_OFF and true with EWZ_AUTO. There's a bit history to this change. ZWriteFineControl got introduced after 1.8 so it was never in a released version. Basically it was needed after some changes had been made to allow shaders to have zwrite enabled independent of the material-type (which worked badly for shaders). This had caused other problems as it was then enabled too often instead. So to quickly fix those bugs and avoid breaking compatibility I had introduced a new enum ZWriteFineControl in SMaterial. This worked and didn't break compiling - but I noticed by now that introducing a second flag for this made maintainance for an already very hard to understand problem (figuring out the implementation of transparency and zwriting) even more complicated. So to keep maintance somewhat sane I decided to break compiling now and merge those two flags. The behavior should not be affected by this commit - except for users which set this flag already in their code and have to switch to the enum now. Serialization is switched on loading old files (so SMaterial has enum already and writes that out). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6026 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
@ -247,16 +247,33 @@ namespace video
|
||||
0
|
||||
};
|
||||
|
||||
//! Fine-tuning for SMaterial.ZWriteFineControl
|
||||
enum E_ZWRITE_FINE_CONTROL
|
||||
//! For SMaterial.ZWriteEnable
|
||||
enum E_ZWRITE
|
||||
{
|
||||
//! Default. Only write zbuffer when SMaterial::ZWriteEnable is true and SMaterial::isTransparent() returns false.
|
||||
EZI_ONLY_NON_TRANSPARENT,
|
||||
//! Writing will just be based on SMaterial::ZWriteEnable value, transparency is ignored.
|
||||
//! Needed mostly for certain shader materials where SMaterial::isTransparent always returns false.
|
||||
EZI_ZBUFFER_FLAG
|
||||
//! zwrite always disabled for this material
|
||||
EZW_OFF = 0,
|
||||
|
||||
//! This is the default setting for SMaterial and tries to handle things automatically.
|
||||
//! This is also the value which is set when SMaterial::setFlag(EMF_ZWRITE_ENABLE) is enabled.
|
||||
//! Usually zwriting is enabled non-transparent materials - as far as Irrlicht can recognize those.
|
||||
//! Basically Irrlicht tries to handle the zwriting for you and assumes transparent materials don't need it.
|
||||
//! This is addionally affected by IVideoDriver::setAllowZWriteOnTransparent
|
||||
EZW_AUTO,
|
||||
|
||||
//! zwrite always enabled for this material
|
||||
EZW_ON
|
||||
};
|
||||
|
||||
//! Names for E_ZWRITE
|
||||
const c8* const ZWriteNames[] =
|
||||
{
|
||||
"Off",
|
||||
"Auto",
|
||||
"On",
|
||||
0
|
||||
};
|
||||
|
||||
|
||||
|
||||
//! Maximum number of texture an SMaterial can have.
|
||||
/** SMaterial might ignore some textures in most function, like assignment and comparison,
|
||||
@ -296,9 +313,8 @@ namespace video
|
||||
PolygonOffsetFactor(0), PolygonOffsetDirection(EPO_FRONT),
|
||||
PolygonOffsetDepthBias(0.f), PolygonOffsetSlopeScale(0.f),
|
||||
Wireframe(false), PointCloud(false), GouraudShading(true),
|
||||
Lighting(true), ZWriteEnable(true), BackfaceCulling(true), FrontfaceCulling(false),
|
||||
FogEnable(false), NormalizeNormals(false), UseMipMaps(true),
|
||||
ZWriteFineControl(EZI_ONLY_NON_TRANSPARENT)
|
||||
Lighting(true), ZWriteEnable(EZW_AUTO), BackfaceCulling(true), FrontfaceCulling(false),
|
||||
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)
|
||||
{ }
|
||||
|
||||
//! Copy constructor
|
||||
@ -354,7 +370,6 @@ namespace video
|
||||
PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;
|
||||
PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;
|
||||
UseMipMaps = other.UseMipMaps;
|
||||
ZWriteFineControl = other.ZWriteFineControl;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -508,12 +523,10 @@ namespace video
|
||||
//! Will this material be lighted? Default: true
|
||||
bool Lighting:1;
|
||||
|
||||
//! Is the zbuffer writable or is it read-only. Default: true.
|
||||
/** This flag is forced to false if the MaterialType is a
|
||||
transparent type and the scene parameter
|
||||
ALLOW_ZWRITE_ON_TRANSPARENT is not set. If you set this parameter
|
||||
to true, make sure that ZBuffer value is other than ECFN_DISABLED */
|
||||
bool ZWriteEnable:1;
|
||||
//! Is the zbuffer writable or is it read-only. Default: EZW_AUTO.
|
||||
/** If this parameter is not EZW_OFF, you probably also want to set ZBuffer
|
||||
to values other than ECFN_DISABLED */
|
||||
E_ZWRITE ZWriteEnable:2;
|
||||
|
||||
//! Is backface culling enabled? Default: true
|
||||
bool BackfaceCulling:1;
|
||||
@ -532,11 +545,6 @@ namespace video
|
||||
/** Sometimes, disabling mipmap usage can be useful. Default: true */
|
||||
bool UseMipMaps:1;
|
||||
|
||||
//! Give more control how the ZWriteEnable flag is interpreted
|
||||
/** Note that there is also the global flag AllowZWriteOnTransparent
|
||||
which when set acts like all materials have set EZI_ALLOW_ON_TRANSPARENT. */
|
||||
E_ZWRITE_FINE_CONTROL ZWriteFineControl:1;
|
||||
|
||||
//! Gets the texture transformation matrix for level i
|
||||
/** \param i The desired level. Must not be larger than MATERIAL_MAX_TEXTURES
|
||||
\return Texture matrix for texture level i. */
|
||||
@ -603,7 +611,7 @@ namespace video
|
||||
case EMF_ZBUFFER:
|
||||
ZBuffer = value; break;
|
||||
case EMF_ZWRITE_ENABLE:
|
||||
ZWriteEnable = value; break;
|
||||
ZWriteEnable = value ? EZW_AUTO : EZW_OFF; break;
|
||||
case EMF_BACK_FACE_CULLING:
|
||||
BackfaceCulling = value; break;
|
||||
case EMF_FRONT_FACE_CULLING:
|
||||
@ -684,7 +692,7 @@ namespace video
|
||||
case EMF_ZBUFFER:
|
||||
return ZBuffer!=ECFN_DISABLED;
|
||||
case EMF_ZWRITE_ENABLE:
|
||||
return ZWriteEnable;
|
||||
return ZWriteEnable != EZW_OFF;
|
||||
case EMF_BACK_FACE_CULLING:
|
||||
return BackfaceCulling;
|
||||
case EMF_FRONT_FACE_CULLING:
|
||||
@ -756,8 +764,7 @@ namespace video
|
||||
PolygonOffsetDirection != b.PolygonOffsetDirection ||
|
||||
PolygonOffsetDepthBias != b.PolygonOffsetDepthBias ||
|
||||
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||
|
||||
UseMipMaps != b.UseMipMaps ||
|
||||
ZWriteFineControl != b.ZWriteFineControl;
|
||||
UseMipMaps != b.UseMipMaps
|
||||
;
|
||||
for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)
|
||||
{
|
||||
|
Reference in New Issue
Block a user