diff --git a/irr/include/SMaterial.h b/irr/include/SMaterial.h index 2329e2761..3bbc6e946 100644 --- a/irr/include/SMaterial.h +++ b/irr/include/SMaterial.h @@ -20,7 +20,7 @@ class ITexture; //! Flag for MaterialTypeParam (in combination with EMT_ONETEXTURE_BLEND) or for BlendFactor //! BlendFunc = source * sourceFactor + dest * destFactor -enum E_BLEND_FACTOR +enum E_BLEND_FACTOR : u8 { EBF_ZERO = 0, //!< src & dest (0, 0, 0, 0) EBF_ONE, //!< src & dest (1, 1, 1, 1) @@ -36,7 +36,7 @@ enum E_BLEND_FACTOR }; //! Values defining the blend operation -enum E_BLEND_OPERATION +enum E_BLEND_OPERATION : u8 { EBO_NONE = 0, //!< No blending happens EBO_ADD, //!< Default blending adds the color values @@ -51,7 +51,7 @@ enum E_BLEND_OPERATION }; //! MaterialTypeParam: e.g. DirectX: D3DTOP_MODULATE, D3DTOP_MODULATE2X, D3DTOP_MODULATE4X -enum E_MODULATE_FUNC +enum E_MODULATE_FUNC : u8 { EMFN_MODULATE_1X = 1, EMFN_MODULATE_2X = 2, @@ -59,7 +59,7 @@ enum E_MODULATE_FUNC }; //! Comparison function, e.g. for depth buffer test -enum E_COMPARISON_FUNC +enum E_COMPARISON_FUNC : u8 { //! Depth test disabled (disable also write to depth buffer) ECFN_DISABLED = 0, @@ -82,7 +82,7 @@ enum E_COMPARISON_FUNC }; //! Enum values for enabling/disabling color planes for rendering -enum E_COLOR_PLANE +enum E_COLOR_PLANE : u8 { //! No color enabled ECP_NONE = 0, @@ -103,7 +103,7 @@ enum E_COLOR_PLANE //! Source of the alpha value to take /** This is currently only supported in EMT_ONETEXTURE_BLEND. You can use an or'ed combination of values. Alpha values are modulated (multiplied). */ -enum E_ALPHA_SOURCE +enum E_ALPHA_SOURCE : u8 { //! Use no alpha, somewhat redundant with other settings EAS_NONE = 0, @@ -181,7 +181,7 @@ Some drivers don't support a per-material setting of the anti-aliasing modes. In those cases, FSAA/multisampling is defined by the device mode chosen upon creation via irr::SIrrCreationParameters. */ -enum E_ANTI_ALIASING_MODE +enum E_ANTI_ALIASING_MODE : u8 { //! Use to turn off anti-aliasing for this material EAAM_OFF = 0, @@ -202,7 +202,7 @@ const c8 *const PolygonOffsetDirectionNames[] = { }; //! For SMaterial.ZWriteEnable -enum E_ZWRITE +enum E_ZWRITE : u8 { //! zwrite always disabled for this material EZW_OFF = 0, @@ -240,10 +240,10 @@ public: //! Default constructor. Creates a solid material SMaterial() : MaterialType(EMT_SOLID), ColorParam(0, 0, 0, 0), - MaterialTypeParam(0.0f), Thickness(1.0f), ZBuffer(ECFN_LESSEQUAL), - AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), - BlendOperation(EBO_NONE), BlendFactor(0.0f), PolygonOffsetDepthBias(0.f), - PolygonOffsetSlopeScale(0.f), Wireframe(false), PointCloud(false), + MaterialTypeParam(0.0f), Thickness(1.0f), BlendFactor(0.0f), + PolygonOffsetDepthBias(0.f), PolygonOffsetSlopeScale(0.f), + ZBuffer(ECFN_LESSEQUAL), AntiAliasing(EAAM_SIMPLE), ColorMask(ECP_ALL), + BlendOperation(EBO_NONE), Wireframe(false), PointCloud(false), ZWriteEnable(EZW_AUTO), BackfaceCulling(true), FrontfaceCulling(false), FogEnable(false), UseMipMaps(true) @@ -268,28 +268,6 @@ public: //! Thickness of non-3dimensional elements such as lines and points. f32 Thickness; - //! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL - /** If you want to disable depth test for this material - just set this parameter to ECFN_DISABLED. - Values are from E_COMPARISON_FUNC. */ - u8 ZBuffer; - - //! Sets the antialiasing mode - /** Values are chosen from E_ANTI_ALIASING_MODE. Default is - EAAM_SIMPLE, i.e. simple multi-sample anti-aliasing. */ - u8 AntiAliasing; - - //! Defines the enabled color planes - /** Values are defined as or'ed values of the E_COLOR_PLANE enum. - Only enabled color planes will be rendered to the current render - target. Typical use is to disable all colors when rendering only to - depth or stencil buffer, or using Red and Green for Stereo rendering. */ - u8 ColorMask : 4; - - //! Store the blend operation of choice - /** Values to be chosen from E_BLEND_OPERATION. */ - E_BLEND_OPERATION BlendOperation : 4; - //! Store the blend factors /** textureBlendFunc/textureBlendFuncSeparate functions should be used to write properly blending factors to this parameter. @@ -316,6 +294,25 @@ public: and -1.f to pull them towards the camera. */ f32 PolygonOffsetSlopeScale; + //! Is the ZBuffer enabled? Default: ECFN_LESSEQUAL + /** If you want to disable depth test for this material + just set this parameter to ECFN_DISABLED. */ + E_COMPARISON_FUNC ZBuffer : 4; + + //! Sets the antialiasing mode + /** Default is EAAM_SIMPLE, i.e. simple multi-sample anti-aliasing. */ + E_ANTI_ALIASING_MODE AntiAliasing : 4; + + //! Defines the enabled color planes + /** Values are defined as or'ed values of the E_COLOR_PLANE enum. + Only enabled color planes will be rendered to the current render + target. Typical use is to disable all colors when rendering only to + depth or stencil buffer, or using Red and Green for Stereo rendering. */ + E_COLOR_PLANE ColorMask : 4; + + //! Store the blend operation of choice + E_BLEND_OPERATION BlendOperation : 4; + //! Draw as wireframe or filled triangles? Default: false bool Wireframe : 1; diff --git a/irr/include/SMaterialLayer.h b/irr/include/SMaterialLayer.h index 419a8f1e9..4d43bd820 100644 --- a/irr/include/SMaterialLayer.h +++ b/irr/include/SMaterialLayer.h @@ -45,7 +45,7 @@ static const char *const aTextureClampNames[] = { //! Texture minification filter. /** Used when scaling textures down. See the documentation on OpenGL's `GL_TEXTURE_MIN_FILTER` for more information. */ -enum E_TEXTURE_MIN_FILTER +enum E_TEXTURE_MIN_FILTER : u8 { //! Aka nearest-neighbor. ETMINF_NEAREST_MIPMAP_NEAREST = 0, @@ -61,7 +61,7 @@ enum E_TEXTURE_MIN_FILTER /** Used when scaling textures up. See the documentation on OpenGL's `GL_TEXTURE_MAG_FILTER` for more information. Note that mipmaps are only used for minification, not for magnification. */ -enum E_TEXTURE_MAG_FILTER +enum E_TEXTURE_MAG_FILTER : u8 { //! Aka nearest-neighbor. ETMAGF_NEAREST = 0, diff --git a/irr/src/CAnimatedMeshSceneNode.cpp b/irr/src/CAnimatedMeshSceneNode.cpp index dffc867de..6facfcd06 100644 --- a/irr/src/CAnimatedMeshSceneNode.cpp +++ b/irr/src/CAnimatedMeshSceneNode.cpp @@ -253,7 +253,7 @@ void CAnimatedMeshSceneNode::render() // for debug purposes only: if (DebugDataVisible && PassCount == 1) { video::SMaterial debug_mat; - debug_mat.AntiAliasing = 0; + debug_mat.AntiAliasing = video::EAAM_OFF; driver->setMaterial(debug_mat); // show normals if (DebugDataVisible & scene::EDS_NORMALS) { diff --git a/irr/src/CMeshSceneNode.cpp b/irr/src/CMeshSceneNode.cpp index cffdbf855..89220cdc7 100644 --- a/irr/src/CMeshSceneNode.cpp +++ b/irr/src/CMeshSceneNode.cpp @@ -109,7 +109,7 @@ void CMeshSceneNode::render() // for debug purposes only: if (DebugDataVisible && PassCount == 1) { video::SMaterial m; - m.AntiAliasing = 0; + m.AntiAliasing = video::EAAM_OFF; m.ZBuffer = video::ECFN_DISABLED; driver->setMaterial(m); diff --git a/irr/src/CNullDriver.cpp b/irr/src/CNullDriver.cpp index 7a0e006c9..c87d5ae93 100644 --- a/irr/src/CNullDriver.cpp +++ b/irr/src/CNullDriver.cpp @@ -1311,7 +1311,7 @@ void CNullDriver::runOcclusionQuery(scene::ISceneNode *node, bool visible) OcclusionQueries[index].Run = 0; if (!visible) { SMaterial mat; - mat.AntiAliasing = 0; + mat.AntiAliasing = video::EAAM_OFF; mat.ColorMask = ECP_NONE; mat.ZWriteEnable = EZW_OFF; setMaterial(mat); diff --git a/src/client/render/anaglyph.cpp b/src/client/render/anaglyph.cpp index 7baf40322..833ad0114 100644 --- a/src/client/render/anaglyph.cpp +++ b/src/client/render/anaglyph.cpp @@ -18,7 +18,7 @@ void SetColorMaskStep::run(PipelineContext &context) { video::SOverrideMaterial &mat = context.device->getVideoDriver()->getOverrideMaterial(); mat.reset(); - mat.Material.ColorMask = color_mask; + mat.Material.ColorMask = static_cast(color_mask); mat.EnableProps = video::EMP_COLOR_MASK; mat.EnablePasses = scene::ESNRP_SKY_BOX | scene::ESNRP_SOLID | scene::ESNRP_TRANSPARENT | scene::ESNRP_TRANSPARENT_EFFECT; diff --git a/src/client/render/secondstage.cpp b/src/client/render/secondstage.cpp index 616077942..b8744f694 100644 --- a/src/client/render/secondstage.cpp +++ b/src/client/render/secondstage.cpp @@ -21,7 +21,7 @@ PostProcessingStep::PostProcessingStep(u32 _shader_id, const std::vector &_t void PostProcessingStep::configureMaterial() { material.UseMipMaps = false; - material.ZBuffer = true; + material.ZBuffer = video::ECFN_LESSEQUAL; material.ZWriteEnable = video::EZW_ON; for (u32 k = 0; k < texture_map.size(); ++k) { material.TextureLayers[k].AnisotropicFilter = 0; diff --git a/src/client/sky.cpp b/src/client/sky.cpp index 2c9e4234d..958ffa953 100644 --- a/src/client/sky.cpp +++ b/src/client/sky.cpp @@ -27,7 +27,7 @@ static video::SMaterial baseMaterial() video::SMaterial mat; mat.ZBuffer = video::ECFN_DISABLED; mat.ZWriteEnable = video::EZW_OFF; - mat.AntiAliasing = 0; + mat.AntiAliasing = video::EAAM_OFF; mat.TextureLayers[0].TextureWrapU = video::ETC_CLAMP_TO_EDGE; mat.TextureLayers[0].TextureWrapV = video::ETC_CLAMP_TO_EDGE; mat.BackfaceCulling = false;