#include "EMaterialTypes.h"\r
#include "EMaterialFlags.h"\r
#include "SMaterialLayer.h"\r
+#include "IrrCompileConfig.h" // for IRRLICHT_API\r
\r
namespace irr\r
{\r
/** SMaterial might ignore some textures in most function, like assignment and comparison,\r
when SIrrlichtCreationParameters::MaxTextureUnits is set to a lower number.\r
*/\r
- const u32 MATERIAL_MAX_TEXTURES = _IRR_MATERIAL_MAX_TEXTURES_;\r
-\r
- //! By default this is identical to MATERIAL_MAX_TEXTURES\r
- /** Users can modify this value if they are certain they don't need all\r
- available textures per material in their application. For example if you\r
- never need more than 2 textures per material you can set this to 2.\r
-\r
- We (mostly) avoid dynamic memory in SMaterial, so the extra memory\r
- will still be allocated. But by lowering MATERIAL_MAX_TEXTURES_USED the\r
- material comparisons and assignments can be faster. Also several other\r
- places in the engine can be faster when reducing this value to the limit\r
- you need.\r
-\r
- NOTE: This should only be changed once and before any call to createDevice.\r
- NOTE: Do not set it below 1 or above the value of _IRR_MATERIAL_MAX_TEXTURES_.\r
- NOTE: Going below 4 is usually not worth it.\r
- */\r
- IRRLICHT_API extern u32 MATERIAL_MAX_TEXTURES_USED;\r
+ const u32 MATERIAL_MAX_TEXTURES = 4;\r
\r
//! Struct for holding parameters for a material renderer\r
// Note for implementors: Serialization is in CNullDriver\r
FogEnable(false), NormalizeNormals(false), UseMipMaps(true)\r
{ }\r
\r
- //! Copy constructor\r
- /** \param other Material to copy from. */\r
- SMaterial(const SMaterial& other)\r
- {\r
- // These pointers are checked during assignment\r
- for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
- TextureLayer[i].TextureMatrix = 0;\r
- *this = other;\r
- }\r
-\r
//! Texture layer array.\r
SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];\r
\r
f32 Shininess;\r
\r
//! Free parameter, dependent on the material type.\r
- /** Mostly ignored, used for example in EMT_PARALLAX_MAP_SOLID,\r
+ /** Mostly ignored, used for example in\r
EMT_TRANSPARENT_ALPHA_CHANNEL and EMT_ONETEXTURE_BLEND. */\r
f32 MaterialTypeParam;\r
\r
FrontfaceCulling = value; break;\r
case EMF_BILINEAR_FILTER:\r
{\r
- for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
+ for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
TextureLayer[i].BilinearFilter = value;\r
}\r
break;\r
case EMF_TRILINEAR_FILTER:\r
{\r
- for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
+ for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
TextureLayer[i].TrilinearFilter = value;\r
}\r
break;\r
case EMF_ANISOTROPIC_FILTER:\r
{\r
if (value)\r
- for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
+ for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
TextureLayer[i].AnisotropicFilter = 0xFF;\r
else\r
- for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
+ for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
TextureLayer[i].AnisotropicFilter = 0;\r
}\r
break;\r
NormalizeNormals = value; break;\r
case EMF_TEXTURE_WRAP:\r
{\r
- for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
+ for (u32 i=0; i<MATERIAL_MAX_TEXTURES; ++i)\r
{\r
TextureLayer[i].TextureWrapU = (E_TEXTURE_CLAMP)value;\r
TextureLayer[i].TextureWrapV = (E_TEXTURE_CLAMP)value;\r
PolygonOffsetSlopeScale != b.PolygonOffsetSlopeScale ||\r
UseMipMaps != b.UseMipMaps\r
;\r
- for (u32 i=0; (i<MATERIAL_MAX_TEXTURES_USED) && !different; ++i)\r
+ for (u32 i=0; (i<MATERIAL_MAX_TEXTURES) && !different; ++i)\r
{\r
different |= (TextureLayer[i] != b.TextureLayer[i]);\r
}\r