Material

Engine/source/materials/materialDefinition.h

The basic material definition.

More...

Classes:

Public User Defined

bool

If true, show footprints when walking on surface with this material. Defaults to false.

bool

If true, show dust emitters (footpuffs, hover trails, etc) when on surface with this material. Defaults to false.

mEffectColor [NUM_EFFECT_COLOR_STAGES]

Color to use for particle effects and such when located on this material.

Footstep sound to play when walking on surface with this material.

Sound effect to play when walking on surface with this material.

Friction coefficient when moving along surface.

Amount of volume occlusion on direct sounds.

Amount of volume occlusion on reverb sounds.

Public Types

enum
AnimType {
  Scroll = 1
  Rotate = 2
  Wave = 4
  Scale = 8
  Sequence = 16
}
enum
BlendOp {
  None = 0
  Mul 
  Add 
  AddAlpha 
  Sub 
  LerpAlpha 
  ToneMap 
  NumBlendTypes 
}
enum
Constants {
  MAX_TEX_PER_PASS = 8
  MAX_STAGES = 4
  NUM_EFFECT_COLOR_STAGES = 2
}
enum
TexType {
  NoTexture = 0
  Standard = 1
  Detail 
  Bump 
  DetailBump 
  Env 
  Cube 
  SGCube 
  Lightmap 
  ToneMapTex 
  Mask 
  BackBuff 
  ReflectBuff 
  Misc 
  DynamicLight 
  DynamicLightMask 
  NormalizeCube 
  TexTarget 
  AccuMap 
  DynamicShadowMap 
}
enum
WaveType {
  Sin = 0
  Triangle 
  Square 
}

Private Types

Public Attributes

mAccuCoverage [MAX_STAGES]
mAccuDirection [MAX_STAGES]
bool
mAccuEnabled [MAX_STAGES]
mAccuScale [MAX_STAGES]
mAccuSpecular [MAX_STAGES]
mAccuStrength [MAX_STAGES]
mAnimFlags [MAX_STAGES]
bool

A generic setting which tells the system to skip generation of shadows from this material.

mCellIndex [MAX_STAGES]
mCellLayout [MAX_STAGES]
mCellSize [MAX_STAGES]

A second normal map which repeats at the detail map scale and blended with the base normal map.

The strength scalar for the detail normal map.

mDetailScale [MAX_STAGES]

The repetition scale of the detail texture over the base texture.

mDiffuse [MAX_STAGES]

This color is the diffuse color of the material or if it has a texture it is multiplied against the diffuse texture color.

bool
mEmissive [MAX_STAGES]
bool
mGlow [MAX_STAGES]

Specual imposter rendering paramters.

Special array of UVs for imposter rendering.

mMatInfoFlags [MAX_STAGES]
mMinnaertConstant [MAX_STAGES]
bool
mNormalMapAtlas [MAX_STAGES]
mParallaxScale [MAX_STAGES]
bool
mPixelSpecular [MAX_STAGES]
mRotPivotOffset [MAX_STAGES]
mRotPos [MAX_STAGES]
mRotSpeed [MAX_STAGES]
mScrollDir [MAX_STAGES]
mScrollOffset [MAX_STAGES]
mScrollSpeed [MAX_STAGES]
mSeqFramePerSec [MAX_STAGES]
mSeqSegSize [MAX_STAGES]
mSpecular [MAX_STAGES]
mSpecularPower [MAX_STAGES]
mSpecularStrength [MAX_STAGES]
bool
mSubSurface [MAX_STAGES]
mSubSurfaceColor [MAX_STAGES]
mSubSurfaceRolloff [MAX_STAGES]
bool
mUseAnisotropic [MAX_STAGES]

If the stage should use anisotropic filtering.

bool
mUseMetalness [MAX_STAGES]
bool
mVertColor [MAX_STAGES]

If true for a stage, vertex colors are multiplied against diffuse colors.

bool
mVertLit [MAX_STAGES]
mWaveAmp [MAX_STAGES]
mWaveFreq [MAX_STAGES]
mWavePos [MAX_STAGES]
mWaveType [MAX_STAGES]

Public Static Attributes

Protected Attributes

Private Static Attributes

Public Static Functions

bool
_setAccuEnabled(void * object, const char * index, const char * data)

Public Functions

Material interface.

bool

Allocates and returns a BaseMatInstance for this material.

Called after any property of the object is changed in the world editor.

bool

Called when the object is added to the sim.

Called when the object is removed from the sim.

Re-initializes all the material instances that use this material.

setAutoGenerated(bool isAutoGenerated)

Called to update time based parameters for a material.

bool
writeField(StringTableEntry fieldname, const char * value)

Determine whether or not a field should be written.

Protected Functions

Map this material to the texture specified in the "mapTo" data variable.

Detailed Description

The basic material definition.

Public User Defined

bool mShowFootprints 

If true, show footprints when walking on surface with this material. Defaults to false.

Behavioral properties.

bool mShowDust 

If true, show dust emitters (footpuffs, hover trails, etc) when on surface with this material. Defaults to false.

ColorF mEffectColor [NUM_EFFECT_COLOR_STAGES]

Color to use for particle effects and such when located on this material.

S32 mFootstepSoundId 

Footstep sound to play when walking on surface with this material.

Numeric ID of footstep sound defined on player datablock (0 == soft, 1 == hard, 2 == metal, 3 == snow). Defaults to -1 which deactivates default sound.

S32 mImpactSoundId 
SFXTrack * mFootstepSoundCustom 

Sound effect to play when walking on surface with this material.

If defined, overrides mFootstepSoundId.

SFXTrack * mImpactSoundCustom 
F32 mFriction 

Friction coefficient when moving along surface.

F32 mDirectSoundOcclusion 

Amount of volume occlusion on direct sounds.

F32 mReverbSoundOcclusion 

Amount of volume occlusion on reverb sounds.

Public Types

AnimType

Enumerator

Scroll = 1
Rotate = 2
Wave = 4
Scale = 8
Sequence = 16
BlendOp

Enumerator

None = 0
Mul
Add
AddAlpha
Sub
LerpAlpha
ToneMap
NumBlendTypes
Constants

Enumerator

MAX_TEX_PER_PASS = 8

Number of textures per pass.

MAX_STAGES = 4
NUM_EFFECT_COLOR_STAGES = 2

Number of effect color definitions for transitioning effects.

TexType

Enumerator

NoTexture = 0
Standard = 1
Detail
Bump
DetailBump
Env
Cube
SGCube
Lightmap
ToneMapTex
Mask
BackBuff
ReflectBuff
Misc
DynamicLight
DynamicLightMask
NormalizeCube
TexTarget
AccuMap
DynamicShadowMap
WaveType

Enumerator

Sin = 0
Triangle
Square

Private Types

typedef BaseMaterialDefinition Parent 

Public Attributes

F32 mAccuCoverage [MAX_STAGES]
F32 mAccuDirection [MAX_STAGES]
bool mAccuEnabled [MAX_STAGES]
F32 mAccuScale [MAX_STAGES]
F32 mAccuSpecular [MAX_STAGES]
F32 mAccuStrength [MAX_STAGES]
U32 mAlphaRef 
bool mAlphaTest 
U32 mAnimFlags [MAX_STAGES]
bool mAutoGenerated 
bool mCastDynamicShadows 
bool mCastShadows 

A generic setting which tells the system to skip generation of shadows from this material.

Point2I mCellIndex [MAX_STAGES]
Point2I mCellLayout [MAX_STAGES]
U32 mCellSize [MAX_STAGES]
CubemapData * mCubemapData 
String mCubemapName 
FileName mDetailMapFilename [MAX_STAGES]
FileName mDetailNormalMapFilename [MAX_STAGES]

A second normal map which repeats at the detail map scale and blended with the base normal map.

F32 mDetailNormalMapStrength [MAX_STAGES]

The strength scalar for the detail normal map.

Point2F mDetailScale [MAX_STAGES]

The repetition scale of the detail texture over the base texture.

ColorF mDiffuse [MAX_STAGES]

This color is the diffuse color of the material or if it has a texture it is multiplied against the diffuse texture color.

FileName mDiffuseMapFilename [MAX_STAGES]
bool mDoubleSided 
bool mDynamicCubemap 
bool mEmissive [MAX_STAGES]
bool mGlow [MAX_STAGES]
Point4F mImposterLimits 

Specual imposter rendering paramters.

Vector< RectF > mImposterUVs 

Special array of UVs for imposter rendering.

FileName mLightMapFilename [MAX_STAGES]
String mMapTo 
F32 mMatInfoFlags [MAX_STAGES]
F32 mMinnaertConstant [MAX_STAGES]
bool mNormalMapAtlas [MAX_STAGES]
FileName mNormalMapFilename [MAX_STAGES]
FileName mOverlayMapFilename [MAX_STAGES]
F32 mParallaxScale [MAX_STAGES]
bool mPixelSpecular [MAX_STAGES]
bool mPlanarReflection 
Point2F mRotPivotOffset [MAX_STAGES]
F32 mRotPos [MAX_STAGES]
F32 mRotSpeed [MAX_STAGES]
Point2F mScrollDir [MAX_STAGES]
Point2F mScrollOffset [MAX_STAGES]
F32 mScrollSpeed [MAX_STAGES]
F32 mSeqFramePerSec [MAX_STAGES]
F32 mSeqSegSize [MAX_STAGES]
ColorF mSpecular [MAX_STAGES]
FileName mSpecularMapFilename [MAX_STAGES]
F32 mSpecularPower [MAX_STAGES]
F32 mSpecularStrength [MAX_STAGES]
bool mSubSurface [MAX_STAGES]
ColorF mSubSurfaceColor [MAX_STAGES]
F32 mSubSurfaceRolloff [MAX_STAGES]
FileName mToneMapFilename [MAX_STAGES]
bool mTranslucent 
BlendOp mTranslucentBlendOp 
bool mTranslucentZWrite 
bool mUseAnisotropic [MAX_STAGES]

If the stage should use anisotropic filtering.

bool mUseMetalness [MAX_STAGES]
bool mVertColor [MAX_STAGES]

If true for a stage, vertex colors are multiplied against diffuse colors.

bool mVertLit [MAX_STAGES]
F32 mWaveAmp [MAX_STAGES]
F32 mWaveFreq [MAX_STAGES]
F32 mWavePos [MAX_STAGES]
U32 mWaveType [MAX_STAGES]

Public Static Attributes

bool sAllowTextureTargetAssignment 

Protected Attributes

U32 mLastUpdateTime 
String mPath 

Protected Static Attributes

EnumTable mAnimFlagTable 
EnumTable mBlendOpTable 
EnumTable mWaveTypeTable 

Private Static Attributes

GFXCubemapHandle smNormalizeCube 

Public Static Functions

_setAccuEnabled(void * object, const char * index, const char * data)

GetNormalizeCube()

initPersistFields()

Public Functions

Material()

Material interface.

castsDynamicShadows()

Reimplemented from: BaseMaterialDefinition

castsShadows()

Reimplemented from: BaseMaterialDefinition

createMatInstance()

Reimplemented from: BaseMaterialDefinition

DECLARE_CONOBJECT(Material )

flush()

getPath()

inspectPostApply()

Reimplemented from: SimObject

isAutoGenerated()

isDoubleSided()

Reimplemented from: BaseMaterialDefinition

isLightmapped()

Reimplemented from: BaseMaterialDefinition

isTranslucent()

Reimplemented from: BaseMaterialDefinition

onAdd()

Reimplemented from: SimObject

Reimplemented by: CustomMaterial

onRemove()

Reimplemented from: SimObject

Reimplemented by: CustomMaterial

reload()

Re-initializes all the material instances that use this material.

setAutoGenerated(bool isAutoGenerated)

updateTimeBasedParams()

Called to update time based parameters for a material.

Ensures that it only happens once per tick.

writeField(StringTableEntry fieldname, const char * value)

Reimplemented from: SimObject

Protected Functions

_mapMaterial()

Map this material to the texture specified in the "mapTo" data variable.

Reimplemented by: CustomMaterial