This class represents a surface material ("A datastructural representation of a scripts material def."). More...
#include "Material.hpp"
Public Member Functions | |
MaterialT () | |
The default constructor. More... | |
MaterialT (const std::string &MaterialName, const std::string &BaseDir, TextParserT &TP, const ArrayT< TableT * > &ListOfTables) | |
A constructor. Throws TextParserT::ParseError on failure. More... | |
unsigned int | GetPixelSizeX () const |
unsigned int | GetPixelSizeY () const |
bool | UsesGeneratedLightMap () const |
bool | UsesGeneratedSHLMap () const |
bool | HasDefaultBlendFunc () const |
void | Save (std::ostream &OutStream) const |
Saves the material into the given stream. More... | |
Public Attributes | |
std::string | Name |
std::string | AmbientShaderName |
std::string | LightShaderName |
MapCompositionT | DiffMapComp |
MapCompositionT | NormMapComp |
MapCompositionT | SpecMapComp |
MapCompositionT | LumaMapComp |
MapCompositionT | LightMapComp |
This is normally empty or "$lightmap". Everything else works, too, but doesn't make much sense. More... | |
MapCompositionT | SHLMapComp |
This is normally empty or "$shlmap". Everything else works, too, but doesn't make much sense. More... | |
MapCompositionT | CubeMap1Comp |
This materials 1st cubemap. Requires Ambient- and/or LightShaderName to be explicitly set – the auto-detection doesn't take cubemaps into account. Use '#' as a placeholder for the actual side suffixes. More... | |
MapCompositionT | CubeMap2Comp |
This materials 2nd cubemap. Requires Ambient- and/or LightShaderName to be explicitly set – the auto-detection doesn't take cubemaps into account. Use '#' as a placeholder for the actual side suffixes. More... | |
ArrayT< ExpressionT > | ShaderParamExpr |
Parameters for the shader that renders this material. The meanings depend on the shader! More... | |
ArrayT< MapCompositionT > | ShaderParamMapC |
Parameters for the shader that renders this material. The meanings depend on the shader! More... | |
bool | NoDraw |
If true, this material does not render at all. Mostly useful for debugging. More... | |
bool | TwoSided |
Normally, back-face culling is enabled per default. If TwoSided is true however, culling gets disabled. More... | |
float | DepthOffset |
Depth buffer offset to combat z-fighting. Useful e.g. for decals or CaWE materials. More... | |
PolygonModeT | PolygonMode |
The mode in which the polygon is rendered: filled, wireframe, or as points. Applies to both the front- and back-side of the polygon. More... | |
ExpressionT | AlphaTestValue |
The value for the alpha test (alpha > AmbientTestValue?). Negative for no test. More... | |
BlendFactorT | BlendFactorSrc |
The source factor of the blend function for the ambient contribution. More... | |
BlendFactorT | BlendFactorDst |
The destination factor of the blend function for the ambient contribution. More... | |
ExpressionT | RedGen |
ExpressionT | GreenGen |
ExpressionT | BlueGen |
ExpressionT | AlphaGen |
bool | AmbientMask [5] |
Buffer mask for the ambient contribution. Elements 0 to 4 correspond to red, green, blue, alpha and depth. More... | |
bool | UseMeshColors |
Modulates the RGBA color with the colors specified at the mesh vertices. Normally, the mesh vertex colors are ignored. More... | |
bool | NoDynLight |
Entirely turns off per-lightsource interaction, that is, the complete light shader. If true, this material does not receive (or rather, reflect) light by dynamic light sources, only the ambient contribution is rendered. Useful e.g. for sky domes, additive effects like particles, translucent surfaces like glass etc. It may still cast shadows, though. More... | |
bool | NoShadows |
Meshes with this material applied won't cast any (stencil-buffer) shadows if this is true. This should in a sense actually be a "meta" parameter, as it is taken into account only by the code that computes the shadow volumes, not by the MatSys! (It can't - materials are usually unknown to it while rendering stencil shadow volumes.) More... | |
bool | LightMask [5] |
Buffer mask for the lighting contribution. Elements 0 to 4 correspond to red, green, blue, alpha and depth. More... | |
ClipFlagsT | ClipFlags |
The collision detection (trace) code may want to consider only materials with certain clip flags set. More... | |
SurfaceTypeT | SurfaceType |
The game code usually wants to play footstep sounds and ricochet effects according to the surface type. More... | |
MapCompositionT | meta_EditorImage |
Image shown in CaWE. More... | |
bool | meta_EditorSave |
If true , this is a material that the user has created and/or manipulated in the editor (CaWE) and that the editor thus should save, possibly overwriting a previous definition. This flag is used for keeping such materials separate from custom, hand-crafted material definitions that the editor should not touch or overwrite. The editor saves such materials typically in a separate file whose name ends like _editor.cmat that in turn is included from another .cmat file. More... | |
float | meta_RadiantExitance_Values [3] |
Radiant Exitance RGB values in [W/m^2]. Used by CaLight. More... | |
MapCompositionT | meta_RadiantExitance_ByImage_FileName |
Radiant Exitance RGB values from image file. Used by CaLight. More... | |
float | meta_RadiantExitance_ByImage_Scale |
Radiant Exitance intensity (scale) for the RGB values from image file. Used by CaLight. More... | |
float | meta_SunLight_Irr [3] |
Irradiance of the sunlight in Watt/m^2 that comes (or shines) through this material. More... | |
float | meta_SunLight_Dir [3] |
The direction of the incoming sunlight rays. The z-component should be negative. More... | |
bool | meta_AlphaModulatesRadiosityLight |
Makes CaLight handle the DiffMapComps alpha channel and the RGBAGens properly. For fences, grates, glass, water, etc. More... | |
This class represents a surface material ("A datastructural representation of a scripts material def.").
It's definition is usually obtained with the help of the MaterialManager from a material script file (.cmat). Note that materials are entirely independent from the renderer implementation!
MaterialT::MaterialT | ( | ) |
The default constructor.
MaterialT::MaterialT | ( | const std::string & | MaterialName, |
const std::string & | BaseDir, | ||
TextParserT & | TP, | ||
const ArrayT< TableT * > & | ListOfTables | ||
) |
A constructor. Throws TextParserT::ParseError on failure.
void MaterialT::Save | ( | std::ostream & | OutStream | ) | const |
Saves the material into the given stream.
ExpressionT MaterialT::AlphaTestValue |
The value for the alpha test (alpha > AmbientTestValue?). Negative for no test.
bool MaterialT::AmbientMask[5] |
Buffer mask for the ambient contribution. Elements 0 to 4 correspond to red, green, blue, alpha and depth.
BlendFactorT MaterialT::BlendFactorDst |
The destination factor of the blend function for the ambient contribution.
BlendFactorT MaterialT::BlendFactorSrc |
The source factor of the blend function for the ambient contribution.
ClipFlagsT MaterialT::ClipFlags |
The collision detection (trace) code may want to consider only materials with certain clip flags set.
MapCompositionT MaterialT::CubeMap1Comp |
This materials 1st cubemap. Requires Ambient- and/or LightShaderName to be explicitly set – the auto-detection doesn't take cubemaps into account. Use '#' as a placeholder for the actual side suffixes.
MapCompositionT MaterialT::CubeMap2Comp |
This materials 2nd cubemap. Requires Ambient- and/or LightShaderName to be explicitly set – the auto-detection doesn't take cubemaps into account. Use '#' as a placeholder for the actual side suffixes.
float MaterialT::DepthOffset |
Depth buffer offset to combat z-fighting. Useful e.g. for decals or CaWE materials.
MapCompositionT MaterialT::LightMapComp |
This is normally empty or "$lightmap". Everything else works, too, but doesn't make much sense.
bool MaterialT::LightMask[5] |
Buffer mask for the lighting contribution. Elements 0 to 4 correspond to red, green, blue, alpha and depth.
bool MaterialT::meta_AlphaModulatesRadiosityLight |
Makes CaLight handle the DiffMapComps alpha channel and the RGBAGens properly. For fences, grates, glass, water, etc.
MapCompositionT MaterialT::meta_EditorImage |
Image shown in CaWE.
bool MaterialT::meta_EditorSave |
If true
, this is a material that the user has created and/or manipulated in the editor (CaWE) and that the editor thus should save, possibly overwriting a previous definition. This flag is used for keeping such materials separate from custom, hand-crafted material definitions that the editor should not touch or overwrite. The editor saves such materials typically in a separate file whose name ends like _editor.cmat
that in turn is included from another .cmat
file.
MapCompositionT MaterialT::meta_RadiantExitance_ByImage_FileName |
Radiant Exitance RGB values from image file. Used by CaLight.
float MaterialT::meta_RadiantExitance_ByImage_Scale |
Radiant Exitance intensity (scale) for the RGB values from image file. Used by CaLight.
float MaterialT::meta_RadiantExitance_Values[3] |
Radiant Exitance RGB values in [W/m^2]. Used by CaLight.
float MaterialT::meta_SunLight_Dir[3] |
The direction of the incoming sunlight rays. The z-component should be negative.
float MaterialT::meta_SunLight_Irr[3] |
Irradiance of the sunlight in Watt/m^2 that comes (or shines) through this material.
bool MaterialT::NoDraw |
If true, this material does not render at all. Mostly useful for debugging.
bool MaterialT::NoDynLight |
Entirely turns off per-lightsource interaction, that is, the complete light shader. If true, this material does not receive (or rather, reflect) light by dynamic light sources, only the ambient contribution is rendered. Useful e.g. for sky domes, additive effects like particles, translucent surfaces like glass etc. It may still cast shadows, though.
bool MaterialT::NoShadows |
Meshes with this material applied won't cast any (stencil-buffer) shadows if this is true. This should in a sense actually be a "meta" parameter, as it is taken into account only by the code that computes the shadow volumes, not by the MatSys! (It can't - materials are usually unknown to it while rendering stencil shadow volumes.)
PolygonModeT MaterialT::PolygonMode |
The mode in which the polygon is rendered: filled, wireframe, or as points. Applies to both the front- and back-side of the polygon.
ArrayT<ExpressionT> MaterialT::ShaderParamExpr |
Parameters for the shader that renders this material. The meanings depend on the shader!
ArrayT<MapCompositionT> MaterialT::ShaderParamMapC |
Parameters for the shader that renders this material. The meanings depend on the shader!
MapCompositionT MaterialT::SHLMapComp |
This is normally empty or "$shlmap". Everything else works, too, but doesn't make much sense.
SurfaceTypeT MaterialT::SurfaceType |
The game code usually wants to play footstep sounds and ricochet effects according to the surface type.
bool MaterialT::TwoSided |
Normally, back-face culling is enabled per default. If TwoSided is true however, culling gets disabled.
bool MaterialT::UseMeshColors |
Modulates the RGBA color with the colors specified at the mesh vertices. Normally, the mesh vertex colors are ignored.