7 #ifndef CAFU_MATSYS_MATERIAL_HPP_INCLUDED
8 #define CAFU_MATSYS_MATERIAL_HPP_INCLUDED
10 #include "Expression.hpp"
11 #include "MapComposition.hpp"
26 enum BlendFactorT { None, Zero, One, DstColor, SrcColor, OneMinusDstColor, OneMinusSrcColor, DstAlpha, SrcAlpha, OneMinusDstAlpha, OneMinusSrcAlpha };
27 enum TexCoordGenT { Disabled, ObjectSpacePlane, EyeSpacePlane, SphereMap };
28 enum PolygonModeT { Filled, Wireframe, Points };
30 #if 0 // I think it should be like this:
32 enum SurfacePropertiesT
34 SP_ClipPlayers = 0x0001,
36 SP_BlockBspPortals = ...,
42 enum VolumePropertiesT
53 Clip_Monsters =0x0002,
54 Clip_Moveables =0x0004,
56 Clip_Projectiles=0x0010,
58 Clip_BspPortals =0x0040,
59 Clip_Radiance =0x0080,
60 Clip_AllBlocking=0x00FF,
61 Clip_BlkButUtils=Clip_AllBlocking & ~Clip_BspPortals & ~Clip_Radiance,
79 enum SurfaceTypeT { ST_None, ST_Stone, ST_Metal, ST_Sand, ST_Wood, ST_Liquid, ST_Glass, ST_Plastic };
84 std::string AmbientShaderName;
85 std::string LightShaderName;
145 unsigned int GetPixelSizeX()
const;
146 unsigned int GetPixelSizeY()
const;
148 bool UsesGeneratedLightMap()
const
153 bool UsesGeneratedSHLMap()
const
158 bool HasDefaultBlendFunc()
const
168 void Save(std::ostream& OutStream)
const;
174 mutable unsigned int PixelSizeX;
175 mutable unsigned int PixelSizeY;
MapCompositionT meta_EditorImage
Image shown in CaWE.
Definition: Material.hpp:128
ClipFlagsT ClipFlags
The collision detection (trace) code may want to consider only materials with certain clip flags set...
Definition: Material.hpp:124
bool UseMeshColors
Modulates the RGBA color with the colors specified at the mesh vertices. Normally, the mesh vertex colors are ignored.
Definition: Material.hpp:116
bool meta_EditorSave
If true, this is a material that the user has created and/or manipulated in the editor (CaWE) and tha...
Definition: Material.hpp:129
bool meta_AlphaModulatesRadiosityLight
Makes CaLight handle the DiffMapComps alpha channel and the RGBAGens properly. For fences...
Definition: Material.hpp:135
bool TwoSided
Normally, back-face culling is enabled per default. If TwoSided is true however, culling gets disable...
Definition: Material.hpp:103
ArrayT< ExpressionT > ShaderParamExpr
Parameters for the shader that renders this material. The meanings depend on the shader! ...
Definition: Material.hpp:98
MapCompositionT CubeMap2Comp
This materials 2nd cubemap. Requires Ambient- and/or LightShaderName to be explicitly set – the auto-...
Definition: Material.hpp:96
MapCompositionT LightMapComp
This is normally empty or "$lightmap". Everything else works, too, but doesn't make much sense...
Definition: Material.hpp:92
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.
Definition: Material.hpp:119
float meta_SunLight_Dir[3]
The direction of the incoming sunlight rays. The z-component should be negative.
Definition: Material.hpp:134
MapCompositionT meta_RadiantExitance_ByImage_FileName
Radiant Exitance RGB values from image file. Used by CaLight.
Definition: Material.hpp:131
MapCompositionT CubeMap1Comp
This materials 1st cubemap. Requires Ambient- and/or LightShaderName to be explicitly set – the auto-...
Definition: Material.hpp:95
float meta_RadiantExitance_ByImage_Scale
Radiant Exitance intensity (scale) for the RGB values from image file. Used by CaLight.
Definition: Material.hpp:132
This class represents a surface material ("A datastructural representation of a scripts material def...
Definition: Material.hpp:22
float DepthOffset
Depth buffer offset to combat z-fighting. Useful e.g. for decals or CaWE materials.
Definition: Material.hpp:104
A typed expression class.
Definition: Expression.hpp:43
float meta_RadiantExitance_Values[3]
Radiant Exitance RGB values in [W/m^2]. Used by CaLight.
Definition: Material.hpp:130
bool NoDraw
If true, this material does not render at all. Mostly useful for debugging.
Definition: Material.hpp:102
MapCompositionT SHLMapComp
This is normally empty or "$shlmap". Everything else works, too, but doesn't make much sense...
Definition: Material.hpp:93
std::string GetString() const
Returns a string description of this MapCompositionT (quasi the counter-piece to the constructor)...
Definition: MapComposition.cpp:659
bool AmbientMask[5]
Buffer mask for the ambient contribution. Elements 0 to 4 correspond to red, green, blue, alpha and depth.
Definition: Material.hpp:115
bool LightMask[5]
Buffer mask for the lighting contribution. Elements 0 to 4 correspond to red, green, blue, alpha and depth.
Definition: Material.hpp:121
BlendFactorT BlendFactorSrc
The source factor of the blend function for the ambient contribution.
Definition: Material.hpp:109
bool NoShadows
Meshes with this material applied won't cast any (stencil-buffer) shadows if this is true...
Definition: Material.hpp:120
A MapCompositionT is a description of how a SINGLE texture map image is composited from several sourc...
Definition: MapComposition.hpp:18
float meta_SunLight_Irr[3]
Irradiance of the sunlight in Watt/m^2 that comes (or shines) through this material.
Definition: Material.hpp:133
void Save(std::ostream &OutStream) const
Saves the material into the given stream.
Definition: Material.cpp:473
SurfaceTypeT SurfaceType
The game code usually wants to play footstep sounds and ricochet effects according to the surface typ...
Definition: Material.hpp:125
MaterialT()
The default constructor.
Definition: Material.cpp:44
BlendFactorT BlendFactorDst
The destination factor of the blend function for the ambient contribution.
Definition: Material.hpp:110
PolygonModeT PolygonMode
The mode in which the polygon is rendered: filled, wireframe, or as points. Applies to both the front...
Definition: Material.hpp:105
ArrayT< MapCompositionT > ShaderParamMapC
Parameters for the shader that renders this material. The meanings depend on the shader! ...
Definition: Material.hpp:99
ExpressionT AlphaTestValue
The value for the alpha test (alpha > AmbientTestValue?). Negative for no test.
Definition: Material.hpp:108
This is a class for parsing text.
Definition: TextParser.hpp:21