From 63f28cf5ff8539d86f05a17982c3581bdfc6527f Mon Sep 17 00:00:00 2001 From: hybrid Date: Wed, 19 Sep 2007 14:35:35 +0000 Subject: [PATCH] Moved material enums into separate files. Disabled randr again, was accidentially activated. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@984 dfc29bdd-3216-0410-991c-e03cc46cb475 --- include/ECullingTypes.h | 4 +- include/EDebugSceneTypes.h | 6 +- include/EDriverFeatures.h | 2 +- include/EDriverTypes.h | 23 +-- include/EGUIElementTypes.h | 4 +- include/EMaterialFlags.h | 74 +++++++++ include/EMaterialTypes.h | 223 +++++++++++++++++++++++++ include/EMeshWriterEnums.h | 4 +- include/EMessageBoxFlags.h | 2 +- include/ESceneNodeAnimatorTypes.h | 5 +- include/ESceneNodeTypes.h | 7 +- include/ETerrainElements.h | 1 + include/IrrCompileConfig.h | 2 +- include/SMaterial.h | 264 +----------------------------- 14 files changed, 330 insertions(+), 291 deletions(-) create mode 100644 include/EMaterialFlags.h create mode 100644 include/EMaterialTypes.h diff --git a/include/ECullingTypes.h b/include/ECullingTypes.h index 91d2b9f5..31d74ac7 100644 --- a/include/ECullingTypes.h +++ b/include/ECullingTypes.h @@ -9,10 +9,10 @@ namespace irr { -namespace scene +namespace scene { - //! An enumeration for all types of automatic culling for built-in scene nodes + //! An enumeration for all types of automatic culling for built-in scene nodes enum E_CULLING_TYPE { EAC_OFF = 0, diff --git a/include/EDebugSceneTypes.h b/include/EDebugSceneTypes.h index d90998bd..4d00a5b3 100644 --- a/include/EDebugSceneTypes.h +++ b/include/EDebugSceneTypes.h @@ -7,11 +7,11 @@ namespace irr { -namespace scene +namespace scene { //! An enumeration for all types of debug data for built-in scene nodes (flags) - enum E_DEBUG_SCENE_TYPE + enum E_DEBUG_SCENE_TYPE { //! No Debug Data ( Default ) EDS_OFF = 0, @@ -28,7 +28,7 @@ namespace scene //! Overlays Mesh Wireframe EDS_MESH_WIRE_OVERLAY = 8, - //! Temporary use transparency Material Type + //! Temporary use transparency Material Type EDS_HALF_TRANSPARENCY = 16, //! Show Bounding Boxes of all MeshBuffers diff --git a/include/EDriverFeatures.h b/include/EDriverFeatures.h index 6a48ea5f..dd5b8c8d 100644 --- a/include/EDriverFeatures.h +++ b/include/EDriverFeatures.h @@ -7,7 +7,7 @@ namespace irr { -namespace video +namespace video { //! enumeration for querying features of the video driver. diff --git a/include/EDriverTypes.h b/include/EDriverTypes.h index d6c1be12..2993de9b 100644 --- a/include/EDriverTypes.h +++ b/include/EDriverTypes.h @@ -7,27 +7,28 @@ namespace irr { -namespace video +namespace video { + //! An enum for all types of drivers the Irrlicht Engine supports. enum E_DRIVER_TYPE { - //! Null device, useful for applications to run the engine without visualisation. + //! Null device, useful for applications to run the engine without visualisation. //! The null device is able to load textures, but does not render and display //! any graphics. - EDT_NULL, + EDT_NULL, //! The Irrlicht Engine Software renderer, runs on all platforms, - //! with every hardware. It should only be used for 2d graphics, - //! but it can also perform some primitive 3d functions. These 3d drawing - //! functions are quite fast, but very inaccurate, and don't even support + //! with every hardware. It should only be used for 2d graphics, + //! but it can also perform some primitive 3d functions. These 3d drawing + //! functions are quite fast, but very inaccurate, and don't even support //! clipping in 3D mode. - EDT_SOFTWARE, + EDT_SOFTWARE, //! The Burning's Software Renderer, an alternative software renderer for Irrlicht. //! Basically it can be described as the Irrlicht Software renderer on steroids. It rasterizes - //! 3D geometry perfectly: It is able to perform correct 3d clipping, perspective - //! correct texture mapping, perspective correct color mapping, and renders + //! 3D geometry perfectly: It is able to perform correct 3d clipping, perspective + //! correct texture mapping, perspective correct color mapping, and renders //! sub pixel correct, sub texel correct primitives. In addition, it does //! bilinear texel filtering and supports more materials than the EDT_SOFTWARE driver. //! This renderer has been written entirely by Thomas Alten, thanks a lot for this huge @@ -36,7 +37,7 @@ namespace video //! Direct3D 8 device, only available on Win32 platforms. //! Performs hardware accelerated rendering of 3D and 2D primitives. - EDT_DIRECT3D8, + EDT_DIRECT3D8, //! Direct3D 9 device, only available on Win32 platforms. //! Performs hardware accelerated rendering of 3D and 2D primitives. @@ -44,7 +45,7 @@ namespace video //! OpenGL device, available on most platforms. //! Performs hardware accelerated rendering of 3D and 2D primitives. - EDT_OPENGL + EDT_OPENGL }; } // end namespace video diff --git a/include/EGUIElementTypes.h b/include/EGUIElementTypes.h index e3957bf9..53faa155 100644 --- a/include/EGUIElementTypes.h +++ b/include/EGUIElementTypes.h @@ -10,7 +10,7 @@ namespace irr namespace gui { -//! List of all basic Irrlicht GUI elements. +//! List of all basic Irrlicht GUI elements. /** An IGUIElement returns this when calling IGUIElement::getType(); */ enum EGUI_ELEMENT_TYPE { @@ -83,7 +83,7 @@ enum EGUI_ELEMENT_TYPE //! Unknown type. EGUIET_ELEMENT, - //! This enum is never used, it only forces the compiler to + //! This enum is never used, it only forces the compiler to //! compile these enumeration values to 32 bit. EGUIET_FORCE_32_BIT = 0x7fffffff diff --git a/include/EMaterialFlags.h b/include/EMaterialFlags.h new file mode 100644 index 00000000..4cb07673 --- /dev/null +++ b/include/EMaterialFlags.h @@ -0,0 +1,74 @@ +// Copyright (C) 2002-2007 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __E_MATERIAL_FLAGS_H_INCLUDED__ +#define __E_MATERIAL_FLAGS_H_INCLUDED__ + +namespace irr +{ +namespace video +{ + + //! Material flags + enum E_MATERIAL_FLAG + { + //! Draw as wireframe or filled triangles? Default: false + EMF_WIREFRAME = 0, + + //! Draw as point cloud or filled triangles? Default: false + EMF_POINTCLOUD, + + //! Flat or Gouraud shading? Default: true + EMF_GOURAUD_SHADING, + + //! Will this material be lighted? Default: true + EMF_LIGHTING, + + //! Is the ZBuffer enabled? Default: true + EMF_ZBUFFER, + + //! May be written to the zbuffer or is it readonly. Default: true + //! This flag is ignored, if the material type is a transparent type. + EMF_ZWRITE_ENABLE, + + //! Is backfaceculling enabled? Default: true + EMF_BACK_FACE_CULLING, + + //! Is bilinear filtering enabled? Default: true + EMF_BILINEAR_FILTER, + + //! Is trilinear filtering enabled? Default: false + //! If the trilinear filter flag is enabled, + //! the bilinear filtering flag is ignored. + EMF_TRILINEAR_FILTER, + + //! Is anisotropic filtering? Default: false + //! In Irrlicht you can use anisotropic texture filtering in + //! conjunction with bilinear or trilinear texture filtering + //! to improve rendering results. Primitives will look less + //! blurry with this flag switched on. + EMF_ANISOTROPIC_FILTER, + + //! Is fog enabled? Default: false + EMF_FOG_ENABLE, + + //! Normalizes normals.You can enable this if you need + //! to scale a dynamic lighted model. Usually, its normals will get scaled + //! too then and it 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, + + //! Access to all layers texture wrap settings. Overwrites separate layer settings. + EMF_TEXTURE_WRAP, + + //! This is not a flag, but a value indicating how much flags there are. + EMF_MATERIAL_FLAG_COUNT + }; + +} // end namespace video +} // end namespace irr + + +#endif // __E_MATERIAL_FLAGS_H_INCLUDED__ + diff --git a/include/EMaterialTypes.h b/include/EMaterialTypes.h new file mode 100644 index 00000000..087c338d --- /dev/null +++ b/include/EMaterialTypes.h @@ -0,0 +1,223 @@ +// Copyright (C) 2002-2007 Nikolaus Gebhardt +// This file is part of the "Irrlicht Engine". +// For conditions of distribution and use, see copyright notice in irrlicht.h + +#ifndef __E_MATERIAL_TYPES_H_INCLUDED__ +#define __E_MATERIAL_TYPES_H_INCLUDED__ + +namespace irr +{ +namespace video +{ + + //! Abstracted and easy to use fixed function/programmable pipeline material modes. + enum E_MATERIAL_TYPE + { + //! Standard solid material. Only first texture is used, which is + //! supposed to be the diffuse material. + EMT_SOLID = 0, + + //! Solid material with 2 texture layers. The second is blended onto the + //! first using the alpha value of the vertex colors. + //! This material is currently not implemented in OpenGL, but it + //! works with DirectX. + EMT_SOLID_2_LAYER, + + //! Material type with standard lightmap technique: + //! There should be 2 textures: The first texture layer is a diffuse map, + //! the second is a light map. Vertex light is ignored. + EMT_LIGHTMAP, + + //! Material type with lightmap technique like EMT_LIGHTMAP, but + //! lightmap and diffuse texture are not modulated, but added instead. + EMT_LIGHTMAP_ADD, + + //! Material type with standard lightmap technique: + //! There should be 2 textures: The first texture layer is a diffuse map, + //! the second is a light map. Vertex light is ignored. + //! The texture colors are effectively multiplyied by 2 for brightening. + //! like known in DirectX as D3DTOP_MODULATE2X. + EMT_LIGHTMAP_M2, + + //! Material type with standard lightmap technique: + //! There should be 2 textures: The first texture layer is a diffuse map, + //! the second is a light map. Vertex light is ignored. + //! The texture colors are effectively multiplyied by 4 for brightening. + //! like known in DirectX as D3DTOP_MODULATE4X. + EMT_LIGHTMAP_M4, + + //! Like EMT_LIGHTMAP, but also supports dynamic lighting. + EMT_LIGHTMAP_LIGHTING, + + //! Like EMT_LIGHTMAP_M2, but also supports dynamic lighting. + EMT_LIGHTMAP_LIGHTING_M2, + + //! Like EMT_LIGHTMAP_4, but also supports dynamic lighting. + EMT_LIGHTMAP_LIGHTING_M4, + + //! Detail mapped material. The first texture is diffuse color map, the + //! second is added to this and usually displayed with a bigger scale value + //! so that it adds more detail. The detail map is added to the diffuse map using + //! ADD_SIGNED, so that it is possible to add and substract color from the diffuse + //! map. For example a value of (127,127,127) will not change the appearance of + //! the diffuse map at all. + //! Often used for terrain rendering. + EMT_DETAIL_MAP, + + //! Makes the material look like it was reflection the environment + //! around it. To make this possible, a texture called 'sphere map' + //! is used, which must be set as Textures[0]. + EMT_SPHERE_MAP, + + //! A reflecting material with an + //! optional additional non reflecting texture layer. The reflection + //! map should be set as Texture 1. + EMT_REFLECTION_2_LAYER, + + //! A transparent material. Only the first texture is used. + //! The new color is calculated by simply adding the source color and + //! the dest color. This means if for example a billboard using a texture with + //! black background and a red circle on it is drawn with this material, the + //! result is that only the red circle will be drawn a little bit transparent, + //! and everything which was black is 100% transparent and not visible. + //! This material type is useful for e.g. particle effects. + EMT_TRANSPARENT_ADD_COLOR, + + //! Makes the material transparent based on the texture alpha channel. + //! The final color is blended together from the destination color and the + //! texture color, using the alpha channel value as blend factor. + //! Only first texture is used. If you are using this material with small + //! textures, it is a good idea to load the texture in 32 bit + //! mode (video::IVideoDriver::setTextureCreationFlag()). + //! Also, an alpha ref is used, which can be manipulated using SMaterial::MaterialTypeParam. + //! If set to 0, the alpha ref gets its default value which is 0.5f and which means + //! that pixels with an alpha value >127 will be written, others not. In other, simple + //! words: this value controls how sharp the edges become when going from a + //! transparent to a solid spot on the texture. + EMT_TRANSPARENT_ALPHA_CHANNEL, + + //! Makes the material transparent based on the texture alpha channel. + //! If the alpha channel value is greater than 127, a pixel is written to the + //! target, otherwise not. This material does not use alpha blending + //! and is a lot faster than EMT_TRANSPARENT_ALPHA_CHANNEL. It + //! is ideal for drawing stuff like leafes of plants, because the borders + //! are not blurry but sharp. + //! Only first texture is used. If you are using this material with small + //! textures and 3d object, it is a good idea to load the texture in 32 bit + //! mode (video::IVideoDriver::setTextureCreationFlag()). + EMT_TRANSPARENT_ALPHA_CHANNEL_REF, + + //! Makes the material transparent based on the vertex alpha value. + EMT_TRANSPARENT_VERTEX_ALPHA, + + //! A transparent reflecting material with an + //! optional additional non reflecting texture layer. The reflection + //! map should be set as Texture 1. The transparency depends on the + //! alpha value in the vertex colors. A texture which will not reflect + //! can be set als Texture 2. + //! Please note that this material type is currently not 100% implemented + //! in OpenGL. It works in Direct3D. + EMT_TRANSPARENT_REFLECTION_2_LAYER, + + //! A solid normal map renderer. First texture is the color map, the + //! second should be the normal map. Note that you should use this material + //! only when drawing geometry consisting of vertices of type S3DVertexTangents + //! (EVT_TANGENTS). You can convert any mesh into this format using + //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). + //! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and + //! falls back on a fixed function lighted material if this hardware is not available. + //! Only two lights are supported by this shader, if there are more, the nearest two + //! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. + EMT_NORMAL_MAP_SOLID, + + //! A transparent normal map renderer. First texture is the color map, the + //! second should be the normal map. Note that you should use this material + //! only when drawing geometry consisting of vertices of type S3DVertexTangents + //! (EVT_TANGENTS). You can convert any mesh into this format using + //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). + //! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and + //! falls back on a fixed function lighted material if this hardware is not available. + //! Only two lights are supported by this shader, if there are more, the nearest two + //! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. + EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, + + //! A transparent (based on the vertex alpha value) normal map renderer. + //! First texture is the color map, the + //! second should be the normal map. Note that you should use this material + //! only when drawing geometry consisting of vertices of type S3DVertexTangents + //! (EVT_TANGENTS). You can convert any mesh into this format using + //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). + //! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and + //! falls back on a fixed function lighted material if this hardware is not available. + //! Only two lights are supported by this shader, if there are more, the nearest two + //! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. + EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, + + //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping too, which + //! looks a lot more realistic. This only works when the hardware supports at + //! least vertex shader 1.1 and pixel shader 1.4. + //! First texture is the color map, the second should be the normal map. + //! The normal map texture should contain the height value in the + //! alpha component. The IVideoDriver::makeNormalMapTexture() method writes + //! this value automaticly when creating normal maps from a heightmap when using a 32 bit + //! texture. + //! The height scale of the material (affecting the bumpiness) is being controlled + //! by the SMaterial::MaterialTypeParam member. + //! If set to zero, the default value (0.02f) will be applied. Otherwise + //! the value set in SMaterial::MaterialTypeParam is taken. This value depends on with which + //! scale the texture is mapped on the material. Too high or low values of MaterialTypeParam + //! can result in strange artifacts. + EMT_PARALLAX_MAP_SOLID, + + //! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using + //! EMT_TRANSPARENT_ADD_COLOR as base material. + EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, + + //! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using + //! EMT_TRANSPARENT_VERTEX_ALPHA as base material. + EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, + + //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) + //! Using only Textures[0]. generic Blender + EMT_ONETEXTURE_BLEND, + + //! This value is not used. It only forces this enumeration to compile in 32 bit. + EMT_FORCE_32BIT = 0x7fffffff + }; + + //! Array holding the built in material type names + const char* const sBuiltInMaterialTypeNames[] = + { + "solid", + "solid_2layer", + "lightmap", + "lightmap_add", + "lightmap_m2", + "lightmap_m4", + "lightmap_light", + "lightmap_light_m2", + "lightmap_light_m4", + "detail_map", + "sphere_map", + "reflection_2layer", + "trans_add", + "trans_alphach", + "trans_alphach_ref", + "trans_vertex_alpha", + "trans_reflection_2layer", + "normalmap_solid", + "normalmap_trans_add", + "normalmap_trans_vertexalpha", + "parallaxmap_solid", + "parallaxmap_trans_add", + "parallaxmap_trans_vertexalpha", + "onetexture_blend", + 0 + }; + +} // end namespace video +} // end namespace irr + + +#endif // __E_MATERIAL_TYPES_H_INCLUDED__ + diff --git a/include/EMeshWriterEnums.h b/include/EMeshWriterEnums.h index 3dcd572b..8028ff48 100644 --- a/include/EMeshWriterEnums.h +++ b/include/EMeshWriterEnums.h @@ -7,10 +7,9 @@ namespace irr { -namespace scene +namespace scene { - //! An enumeration for all supported types of built-in mesh writers /** A scene mesh writers is represented by a four character code such as 'irrm' or 'coll' instead of simple numbers, to avoid @@ -41,7 +40,6 @@ namespace scene EMWF_WRITE_COMPRESSED = 0x2 }; - } // end namespace scene } // end namespace irr diff --git a/include/EMessageBoxFlags.h b/include/EMessageBoxFlags.h index ab0befe8..636a135a 100644 --- a/include/EMessageBoxFlags.h +++ b/include/EMessageBoxFlags.h @@ -25,7 +25,7 @@ enum EMESSAGE_BOX_FLAG //! Flag for the no button EMBF_NO = 0x8, - //! This value is not used. It only forces this enumeration to compile in 32 bit. + //! This value is not used. It only forces this enumeration to compile in 32 bit. EMBF_FORCE_32BIT = 0x7fffffff }; diff --git a/include/ESceneNodeAnimatorTypes.h b/include/ESceneNodeAnimatorTypes.h index 6eebc993..4b9cbae0 100644 --- a/include/ESceneNodeAnimatorTypes.h +++ b/include/ESceneNodeAnimatorTypes.h @@ -7,8 +7,9 @@ namespace irr { -namespace scene +namespace scene { + //! An enumeration for all types of built-in scene node animators enum ESCENE_NODE_ANIMATOR_TYPE { @@ -39,7 +40,7 @@ namespace scene //! Unknown scene node animator ESNAT_UNKNOWN, - //! This enum is never used, it only forces the compiler to + //! This enum is never used, it only forces the compiler to //! compile these enumeration values to 32 bit. ESNAT_FORCE_32_BIT = 0x7fffffff }; diff --git a/include/ESceneNodeTypes.h b/include/ESceneNodeTypes.h index d97647a7..1e74161d 100644 --- a/include/ESceneNodeTypes.h +++ b/include/ESceneNodeTypes.h @@ -9,10 +9,11 @@ namespace irr { -namespace scene +namespace scene { - //! An enumeration for all types of built-in scene nodes - /** A scene node type is represented by a four character code + + //! An enumeration for all types of built-in scene nodes + /** A scene node type is represented by a four character code such as 'cube' or 'mesh' instead of simple numbers, to avoid name clashes with external scene nodes.*/ enum ESCENE_NODE_TYPE diff --git a/include/ETerrainElements.h b/include/ETerrainElements.h index 9b9cd8a6..9644d78b 100644 --- a/include/ETerrainElements.h +++ b/include/ETerrainElements.h @@ -9,6 +9,7 @@ namespace irr { namespace scene { + //! enumeration for patch sizes specifying the size of patches in the TerrainSceneNode enum E_TERRAIN_PATCH_SIZE { diff --git a/include/IrrCompileConfig.h b/include/IrrCompileConfig.h index 312695b0..07d282d8 100644 --- a/include/IrrCompileConfig.h +++ b/include/IrrCompileConfig.h @@ -100,7 +100,7 @@ define out. */ //! to remove the dependencies such that Irrlicht will compile on those systems, too. #if defined(_IRR_LINUX_PLATFORM_) #define _IRR_LINUX_X11_VIDMODE_ -#define _IRR_LINUX_X11_RANDR_ +//#define _IRR_LINUX_X11_RANDR_ #endif //! Define _IRR_COMPILE_WITH_GUI_ to compile the engine with the built-in GUI diff --git a/include/SMaterial.h b/include/SMaterial.h index ac6fe48c..f0923034 100644 --- a/include/SMaterial.h +++ b/include/SMaterial.h @@ -8,6 +8,8 @@ #include "SColor.h" #include "matrix4.h" #include "irrArray.h" +#include "EMaterialTypes.h" +#include "EMaterialFlags.h" namespace irr { @@ -15,212 +17,6 @@ namespace video { class ITexture; - //! Abstracted and easy to use fixed function/programmable pipeline material modes. - enum E_MATERIAL_TYPE - { - //! Standard solid material. Only first texture is used, which is - //! supposed to be the diffuse material. - EMT_SOLID = 0, - - //! Solid material with 2 texture layers. The second is blended onto the - //! first using the alpha value of the vertex colors. - //! This material is currently not implemented in OpenGL, but it - //! works with DirectX. - EMT_SOLID_2_LAYER, - - //! Material type with standard lightmap technique: - //! There should be 2 textures: The first texture layer is a diffuse map, - //! the second is a light map. Vertex light is ignored. - EMT_LIGHTMAP, - - //! Material type with lightmap technique like EMT_LIGHTMAP, but - //! lightmap and diffuse texture are not modulated, but added instead. - EMT_LIGHTMAP_ADD, - - //! Material type with standard lightmap technique: - //! There should be 2 textures: The first texture layer is a diffuse map, - //! the second is a light map. Vertex light is ignored. - //! The texture colors are effectively multiplyied by 2 for brightening. - //! like known in DirectX as D3DTOP_MODULATE2X. - EMT_LIGHTMAP_M2, - - //! Material type with standard lightmap technique: - //! There should be 2 textures: The first texture layer is a diffuse map, - //! the second is a light map. Vertex light is ignored. - //! The texture colors are effectively multiplyied by 4 for brightening. - //! like known in DirectX as D3DTOP_MODULATE4X. - EMT_LIGHTMAP_M4, - - //! Like EMT_LIGHTMAP, but also supports dynamic lighting. - EMT_LIGHTMAP_LIGHTING, - - //! Like EMT_LIGHTMAP_M2, but also supports dynamic lighting. - EMT_LIGHTMAP_LIGHTING_M2, - - //! Like EMT_LIGHTMAP_4, but also supports dynamic lighting. - EMT_LIGHTMAP_LIGHTING_M4, - - //! Detail mapped material. The first texture is diffuse color map, the - //! second is added to this and usually displayed with a bigger scale value - //! so that it adds more detail. The detail map is added to the diffuse map using - //! ADD_SIGNED, so that it is possible to add and substract color from the diffuse - //! map. For example a value of (127,127,127) will not change the appearance of - //! the diffuse map at all. - //! Often used for terrain rendering. - EMT_DETAIL_MAP, - - //! Makes the material look like it was reflection the environment - //! around it. To make this possible, a texture called 'sphere map' - //! is used, which must be set as Textures[0]. - EMT_SPHERE_MAP, - - //! A reflecting material with an - //! optional additional non reflecting texture layer. The reflection - //! map should be set as Texture 1. - EMT_REFLECTION_2_LAYER, - - //! A transparent material. Only the first texture is used. - //! The new color is calculated by simply adding the source color and - //! the dest color. This means if for example a billboard using a texture with - //! black background and a red circle on it is drawn with this material, the - //! result is that only the red circle will be drawn a little bit transparent, - //! and everything which was black is 100% transparent and not visible. - //! This material type is useful for e.g. particle effects. - EMT_TRANSPARENT_ADD_COLOR, - - //! Makes the material transparent based on the texture alpha channel. - //! The final color is blended together from the destination color and the - //! texture color, using the alpha channel value as blend factor. - //! Only first texture is used. If you are using this material with small - //! textures, it is a good idea to load the texture in 32 bit - //! mode (video::IVideoDriver::setTextureCreationFlag()). - //! Also, an alpha ref is used, which can be manipulated using SMaterial::MaterialTypeParam. - //! If set to 0, the alpha ref gets its default value which is 0.5f and which means - //! that pixels with an alpha value >127 will be written, others not. In other, simple - //! words: this value controls how sharp the edges become when going from a - //! transparent to a solid spot on the texture. - EMT_TRANSPARENT_ALPHA_CHANNEL, - - //! Makes the material transparent based on the texture alpha channel. - //! If the alpha channel value is greater than 127, a pixel is written to the - //! target, otherwise not. This material does not use alpha blending - //! and is a lot faster than EMT_TRANSPARENT_ALPHA_CHANNEL. It - //! is ideal for drawing stuff like leafes of plants, because the borders - //! are not blurry but sharp. - //! Only first texture is used. If you are using this material with small - //! textures and 3d object, it is a good idea to load the texture in 32 bit - //! mode (video::IVideoDriver::setTextureCreationFlag()). - EMT_TRANSPARENT_ALPHA_CHANNEL_REF, - - //! Makes the material transparent based on the vertex alpha value. - EMT_TRANSPARENT_VERTEX_ALPHA, - - //! A transparent reflecting material with an - //! optional additional non reflecting texture layer. The reflection - //! map should be set as Texture 1. The transparency depends on the - //! alpha value in the vertex colors. A texture which will not reflect - //! can be set als Texture 2. - //! Please note that this material type is currently not 100% implemented - //! in OpenGL. It works in Direct3D. - EMT_TRANSPARENT_REFLECTION_2_LAYER, - - //! A solid normal map renderer. First texture is the color map, the - //! second should be the normal map. Note that you should use this material - //! only when drawing geometry consisting of vertices of type S3DVertexTangents - //! (EVT_TANGENTS). You can convert any mesh into this format using - //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). - //! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and - //! falls back on a fixed function lighted material if this hardware is not available. - //! Only two lights are supported by this shader, if there are more, the nearest two - //! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. - EMT_NORMAL_MAP_SOLID, - - //! A transparent normal map renderer. First texture is the color map, the - //! second should be the normal map. Note that you should use this material - //! only when drawing geometry consisting of vertices of type S3DVertexTangents - //! (EVT_TANGENTS). You can convert any mesh into this format using - //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). - //! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and - //! falls back on a fixed function lighted material if this hardware is not available. - //! Only two lights are supported by this shader, if there are more, the nearest two - //! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. - EMT_NORMAL_MAP_TRANSPARENT_ADD_COLOR, - - //! A transparent (based on the vertex alpha value) normal map renderer. - //! First texture is the color map, the - //! second should be the normal map. Note that you should use this material - //! only when drawing geometry consisting of vertices of type S3DVertexTangents - //! (EVT_TANGENTS). You can convert any mesh into this format using - //! IMeshManipulator::createMeshWithTangents() (See SpecialFX2 Tutorial). - //! This shader runs on vertex shader 1.1 and pixel shader 1.1 capable hardware and - //! falls back on a fixed function lighted material if this hardware is not available. - //! Only two lights are supported by this shader, if there are more, the nearest two - //! are chosen. Currently, this shader is only implemented for the D3D8 and D3D9 renderers. - EMT_NORMAL_MAP_TRANSPARENT_VERTEX_ALPHA, - - //! Just like EMT_NORMAL_MAP_SOLID, but uses parallax mapping too, which - //! looks a lot more realistic. This only works when the hardware supports at - //! least vertex shader 1.1 and pixel shader 1.4. - //! First texture is the color map, the second should be the normal map. - //! The normal map texture should contain the height value in the - //! alpha component. The IVideoDriver::makeNormalMapTexture() method writes - //! this value automaticly when creating normal maps from a heightmap when using a 32 bit - //! texture. - //! The height scale of the material (affecting the bumpiness) is being controlled - //! by the SMaterial::MaterialTypeParam member. - //! If set to zero, the default value (0.02f) will be applied. Otherwise - //! the value set in SMaterial::MaterialTypeParam is taken. This value depends on with which - //! scale the texture is mapped on the material. Too high or low values of MaterialTypeParam - //! can result in strange artifacts. - EMT_PARALLAX_MAP_SOLID, - - //! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using - //! EMT_TRANSPARENT_ADD_COLOR as base material. - EMT_PARALLAX_MAP_TRANSPARENT_ADD_COLOR, - - //! A material just like EMT_PARALLAX_MAP_SOLID, but it is transparent, using - //! EMT_TRANSPARENT_VERTEX_ALPHA as base material. - EMT_PARALLAX_MAP_TRANSPARENT_VERTEX_ALPHA, - - //! BlendFunc = source * sourceFactor + dest * destFactor ( E_BLEND_FUNC ) - //! Using only Textures[0]. generic Blender - EMT_ONETEXTURE_BLEND, - - //! This value is not used. It only forces this enumeration to compile in 32 bit. - EMT_FORCE_32BIT = 0x7fffffff - }; - - //! Array holding the built in material type names - const char* const sBuiltInMaterialTypeNames[] = - { - "solid", - "solid_2layer", - "lightmap", - "lightmap_add", - "lightmap_m2", - "lightmap_m4", - "lightmap_light", - "lightmap_light_m2", - "lightmap_light_m4", - "detail_map", - "sphere_map", - "reflection_2layer", - "trans_add", - "trans_alphach", - "trans_alphach_ref", - "trans_vertex_alpha", - "trans_reflection_2layer", - "normalmap_solid", - "normalmap_trans_add", - "normalmap_trans_vertexalpha", - "parallaxmap_solid", - "parallaxmap_trans_add", - "parallaxmap_trans_vertexalpha", - "onetexture_blend", - 0 - }; - - //! Flag for EMT_ONETEXTURE_BLEND, ( BlendFactor ) //! BlendFunc = source * sourceFactor + dest * destFactor enum E_BLEND_FACTOR @@ -282,62 +78,6 @@ namespace video dstFact = E_BLEND_FACTOR ( ( state & 0x000000FF ) ); } - //! Material flags - enum E_MATERIAL_FLAG - { - //! Draw as wireframe or filled triangles? Default: false - EMF_WIREFRAME = 0, - - //! Draw as point cloud or filled triangles? Default: false - EMF_POINTCLOUD, - - //! Flat or Gouraud shading? Default: true - EMF_GOURAUD_SHADING, - - //! Will this material be lighted? Default: true - EMF_LIGHTING, - - //! Is the ZBuffer enabled? Default: true - EMF_ZBUFFER, - - //! May be written to the zbuffer or is it readonly. Default: true - //! This flag is ignored, if the material type is a transparent type. - EMF_ZWRITE_ENABLE, - - //! Is backfaceculling enabled? Default: true - EMF_BACK_FACE_CULLING, - - //! Is bilinear filtering enabled? Default: true - EMF_BILINEAR_FILTER, - - //! Is trilinear filtering enabled? Default: false - //! If the trilinear filter flag is enabled, - //! the bilinear filtering flag is ignored. - EMF_TRILINEAR_FILTER, - - //! Is anisotropic filtering? Default: false - //! In Irrlicht you can use anisotropic texture filtering in - //! conjunction with bilinear or trilinear texture filtering - //! to improve rendering results. Primitives will look less - //! blurry with this flag switched on. - EMF_ANISOTROPIC_FILTER, - - //! Is fog enabled? Default: false - EMF_FOG_ENABLE, - - //! Normalizes normals.You can enable this if you need - //! to scale a dynamic lighted model. Usually, its normals will get scaled - //! too then and it 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, - - //! Access to all layers texture wrap settings. Overwrites separate layer settings. - EMF_TEXTURE_WRAP, - - //! This is not a flag, but a value indicating how much flags there are. - EMF_MATERIAL_FLAG_COUNT - }; - //! Maximum number of texture an SMaterial can have. const u32 MATERIAL_MAX_TEXTURES = 4;