]> git.lizzy.rs Git - irrlicht.git/blobdiff - include/SMaterial.h
Support GLES2
[irrlicht.git] / include / SMaterial.h
index 29bc3327facfe88d7c3baf51264542590f736391..88460e008f74a38c8da3e12e39768ccdf5a5a4b2 100644 (file)
@@ -12,6 +12,7 @@
 #include "EMaterialTypes.h"\r
 #include "EMaterialFlags.h"\r
 #include "SMaterialLayer.h"\r
+#include "IrrCompileConfig.h" // for IRRLICHT_API\r
 \r
 namespace irr\r
 {\r
@@ -280,24 +281,7 @@ namespace video
        /** 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
@@ -318,63 +302,6 @@ namespace video
                        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
-               //! Assignment operator\r
-               /** \param other Material to copy from. */\r
-               SMaterial& operator=(const SMaterial& other)\r
-               {\r
-                       // Check for self-assignment!\r
-                       if (this == &other)\r
-                               return *this;\r
-\r
-                       MaterialType = other.MaterialType;\r
-\r
-                       AmbientColor = other.AmbientColor;\r
-                       DiffuseColor = other.DiffuseColor;\r
-                       EmissiveColor = other.EmissiveColor;\r
-                       SpecularColor = other.SpecularColor;\r
-                       Shininess = other.Shininess;\r
-                       MaterialTypeParam = other.MaterialTypeParam;\r
-                       MaterialTypeParam2 = other.MaterialTypeParam2;\r
-                       Thickness = other.Thickness;\r
-                       for (u32 i=0; i<MATERIAL_MAX_TEXTURES_USED; ++i)\r
-                       {\r
-                               TextureLayer[i] = other.TextureLayer[i];\r
-                       }\r
-\r
-                       Wireframe = other.Wireframe;\r
-                       PointCloud = other.PointCloud;\r
-                       GouraudShading = other.GouraudShading;\r
-                       Lighting = other.Lighting;\r
-                       ZWriteEnable = other.ZWriteEnable;\r
-                       BackfaceCulling = other.BackfaceCulling;\r
-                       FrontfaceCulling = other.FrontfaceCulling;\r
-                       FogEnable = other.FogEnable;\r
-                       NormalizeNormals = other.NormalizeNormals;\r
-                       ZBuffer = other.ZBuffer;\r
-                       AntiAliasing = other.AntiAliasing;\r
-                       ColorMask = other.ColorMask;\r
-                       ColorMaterial = other.ColorMaterial;\r
-                       BlendOperation = other.BlendOperation;\r
-                       BlendFactor = other.BlendFactor;\r
-                       PolygonOffsetFactor = other.PolygonOffsetFactor;\r
-                       PolygonOffsetDirection = other.PolygonOffsetDirection;\r
-                       PolygonOffsetDepthBias = other.PolygonOffsetDepthBias;\r
-                       PolygonOffsetSlopeScale = other.PolygonOffsetSlopeScale;\r
-                       UseMipMaps = other.UseMipMaps;\r
-\r
-                       return *this;\r
-               }\r
-\r
                //! Texture layer array.\r
                SMaterialLayer TextureLayer[MATERIAL_MAX_TEXTURES];\r
 \r
@@ -415,24 +342,11 @@ namespace video
                The specular color of the dynamic lights\r
                (SLight::SpecularColor) will influence the the highlight color\r
                too, but they are set to a useful value by default when\r
-               creating the light scene node. Here is a simple example on how\r
-               to use specular highlights:\r
-               \code\r
-               // load and display mesh\r
-               scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(\r
-               smgr->getMesh("data/faerie.md2"));\r
-               node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture\r
-               node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting\r
-               node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights\r
-\r
-               // add white light\r
-               scene::ILightSceneNode* light = smgr->addLightSceneNode(0,\r
-                       core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f));\r
-               \endcode */\r
+               creating the light scene node.*/\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
@@ -625,23 +539,23 @@ namespace video
                                        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
@@ -651,7 +565,7 @@ namespace video
                                        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
@@ -773,7 +687,7 @@ namespace video
                                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