cod5-sdk/deffiles/materials/mtl_phong_flag.template

134 lines
3.8 KiB
Text
Raw Normal View History

2008-11-20 00:00:00 +00:00
#if "@formatNormal@" == "<auto compression>"
#if TARGET_PLATFORM == "xenon"
#define NORMAL_MAP_FORMAT "DXN"
#else
#define NORMAL_MAP_FORMAT "DXT5"
#endif
#else
#define NORMAL_MAP_FORMAT "@formatNormal@"
#endif
//
// default images
//
#if ("$normalMap$" == "" || "$normalMap$" == "$identityNormalMap") && "$specColorMap$" == "" && "$cosinePowerMap$" == ""
#define NORMAL_MAP_TILE "tile both"
#define NORMAL_MAP_FILTER "nomip nearest"
#define NORMAL_MAP_IMAGE "$identityNormalMap"
#define NORMAL_MAP_ANIMRATE 0
#define NORMAL_MAP_NOPICMIP 1
#define USE_SPEC_MAP 0
#define NORMAL_SUFFIX ""
#define SPEC_SUFFIX ""
#else
#if "$normalMap$" == "" || "$normalMap$" == "$identityNormalMap"
#define NORMAL_MAP_TILE "tile both"
#define NORMAL_MAP_FILTER "nomip nearest"
#define NORMAL_MAP_IMAGE "$identityNormalMap"
#define NORMAL_MAP_NOPICMIP 1
#define NORMAL_SUFFIX ""
#else
#define NORMAL_MAP_TILE "@tileNormal@"
#define NORMAL_MAP_FILTER "@filterNormal@"
#define NORMAL_MAP_IMAGE "$normalMap$"
#define NORMAL_MAP_NOPICMIP @nopicmipNormal@
#define NORMAL_SUFFIX "n0"
#endif
#endif
#if "$specColorMap$" != ""
#define SPEC_COLOR_IMAGE "$specColorMap$"
#else
#define SPEC_COLOR_IMAGE "$white"
#endif
#if "$cosinePowerMap$" != ""
#define COSINE_POWER_IMAGE "$cosinePowerMap$"
#else
#define COSINE_POWER_IMAGE "$white"
#endif
#if "@formatSpecular@" == "<auto compression>"
#define SPECULAR_FORMAT "DXT5"
#else
#define SPECULAR_FORMAT "@formatSpecular@"
#endif
#if SPEC_COLOR_IMAGE != "$white"
#define COSINE_POWER_SCALE (30.5 / 32.0)
#else
#define COSINE_POWER_SCALE 1
#endif
#define USE_SPECULAR 1
#define USE_DETAIL_MAP ("$detailMap$" != "")
#if USE_DETAIL_MAP
#error "flag materials do not currently support detail maps"
#endif
#include "commonsetup.template"
#if @texScroll@
#error "flag materials do not support texture scrolling"
#endif
#if "@blendFunc@" == "Replace"
#if "@alphaTest@" == "GE128"
techniqueSet( "l_sm_flag_t0c0n0s0" );
#else
#error "flag materials only support alphaTest GE128"
#endif
#elif "@blendFunc@" == "Blend"
#error "flag materials only support blendFunc Replace"
#endif
textureTable
{
#if "$colorMap$" == ""
#error "colorMap may not be blank in phong materials"
#endif
"colorMap" = map( "@tileColor@", "@filterColor@", "$colorMap$", @nopicmipColor@ ) "@formatColor@" : "colorMap";
#if USE_DETAIL_MAP
"detailMap" = map( "tile both", "@filterDetail@", "$detailMap$", @nopicmipDetail@ ) "@formatDetail@" : "colorMap";
#endif
#if NORMAL_MAP_IMAGE == "$identityNormalMap"
"normalMap" = map( "tile both", "nomip nearest", "$identityNormalMap", true ) "<auto compression>" : "normalMap";
#else
"normalMap" = normalMap( NORMAL_MAP_TILE, NORMAL_MAP_FILTER, NORMAL_MAP_IMAGE, NORMAL_MAP_NOPICMIP ) NORMAL_MAP_FORMAT : "normalMap";
#endif
#if USE_SPECULAR
"specularMap" = composite
(
map( "@tileSpecular@", "@filterSpecular@", SPEC_COLOR_IMAGE, @nopicmipSpecular@ ).r,
map( "@tileSpecular@", "@filterSpecular@", SPEC_COLOR_IMAGE, @nopicmipSpecular@ ).g,
map( "@tileSpecular@", "@filterSpecular@", SPEC_COLOR_IMAGE, @nopicmipSpecular@ ).b,
map( "@tileSpecular@", "@filterSpecular@", COSINE_POWER_IMAGE, @nopicmipSpecular@ ) * COSINE_POWER_SCALE
) SPECULAR_FORMAT : "specularMap";
#endif
}
constantTable
{
#if USE_DETAIL_MAP
"detailScale" = float4( @detailScaleX@, @detailScaleY@, 0, 0 );
#endif
#if USE_SPECULAR
#if @envMapMin@ > @envMapMax@
#error "Minimum reflectance greater than maximum reflectance"
#endif
#define SUN_INTENSITY 2.5
"envMapParms" = float4( @envMapMin@, @envMapMax@ - @envMapMin@, @envMapExponent@ * -1.7, SUN_INTENSITY );
#endif
"colorTint" = float4( @,colorTint@ );
}
allocReflectionProbe();
refImage( "$colorMap$" );