My Project
Public Types | Public Member Functions | Public Attributes | List of all members
ParaEngine::CParaXMaterial Struct Reference

the material information for ParaX file More...

#include <ParaXMaterial.h>

Public Types

enum  AttributeBits {
  MATERIAL_BLENDING = 0x1, MATERIAL_ALPHATESTING = 0x1 << 1, MATERIAL_ZMASKING = 0x1 << 2, MATERIAL_NORMALMAP = 0x1 << 3,
  MATERIAL_ENVIRONMENTMAP = 0x1 << 4, MATERIAL_REFLECTION = 0x1 << 5, MATERIAL_LIGHTMAP = 0x1 << 6, MATERIAL_DISABLE_PHYSICS = 0x1 << 7,
  MATERIAL_DISABLE_LIGHTING = 0x1 << 8, MATERIAL_ADDITIVE = 0x1 << 9, MATERIAL_BILLBOARD = 0x1 << 10, MATERIAL_BILLBOARD_AA = 0x1 << 11,
  MATERIAL_TRANSLUCENT_SORT = 0x1 << 12, MATERIAL_SKIP_RENDER = 0x1 << 13
}
 

Public Member Functions

 CParaXMaterial ()
 default constructor
 
float GetReflectivity ()
 Get the reflectivity of environment or reflection map. More...
 
void SetReflectivity (float fReflectivity)
 Set the reflectivity of environment or reflection map. More...
 
bool hasAlphaBlending ()
 
bool hasAlphaTesting ()
 
bool hasZMask ()
 
bool hasNormalMap ()
 
bool hasEnvironmentMap ()
 
bool hasReflectionMap ()
 
bool hasLightMap ()
 
bool hasPhysics ()
 
bool hasLighting ()
 
bool hasTranslucentSort ()
 
bool hasAdditive ()
 
bool hasAnyBillboard ()
 
bool hasBillboard ()
 
bool hasBillboardAA ()
 
bool isSkipRendering ()
 
bool CheckAttribute (DWORD attribute)
 whether a material attribute is enabled. More...
 
void EnableAttribute (DWORD attribute, bool bTurnOn=true)
 enable or disable a given attribute
 
int GetPhysicsGroup ()
 get the physics group. More...
 
void SetMaterial (const ParaMaterial &material)
 read from material, whether to use blend, alpha test or global textures, etc. More...
 

Public Attributes

ParaMaterial mat
 basic material information in the original DirectX format.
 
DWORD dwAttribute
 a bitwise mask of AttributeBits. More...
 
asset_ptr< TextureEntitym_pTexture1
 first texture.
 
asset_ptr< TextureEntitym_pTexture2
 secondary texture: such as cube map and normal map.
 
int m_nReplaceableTextureID
 if this is -1, no replaceable texture is used. More...
 
int m_nTranslucentFaceGroupIndex
 index into the mesh object's m_faceGroups. More...
 
int m_nPhysicsGroup
 the physics group. More...
 
float m_fRelectionHeight
 reflection surface height in model space
 
Vector3 m_vPivot
 only used in billboarded and axis aligned billboarded materials. More...
 

Detailed Description

the material information for ParaX file

Member Enumeration Documentation

§ AttributeBits

Enumerator
MATERIAL_BLENDING 

whether to enable alpha blending, i.e. whether the texture alpha is used for blending.

MATERIAL_ALPHATESTING 

whether to enable alpha testing. i.e. whether the texture alpha is used for alpha testing.

MATERIAL_ZMASKING 

whether to turn off z buffer write, when it is rendered with alpha blending.

if this attribute bit is set, z-buffer write will be turned off when the material has blending attribute.

MATERIAL_NORMALMAP 

whether has normal mapping.

The normal map always has the same texture file name plus a "Norm". e.g. main texture is "face.dds", normal map is "faceNorm.dds".

MATERIAL_ENVIRONMENTMAP 

whether do environment mapping.

The reflectivity of the map is encoded in the alpha value of specular light color. The environment map always has the same texture file name plus a "Env". e.g. main texture is "face.dds", environment map is "faceEnv.dds".

MATERIAL_REFLECTION 

whether do reflection mapping. The reflectivity of the map is encoded in the red value of the emissive color.

MATERIAL_LIGHTMAP 

whether do light mapping.

The light map always has the same texture file name plus a "LightMap". the mesh must contain a second set of UV in order to use light map.

MATERIAL_DISABLE_PHYSICS 

whether physics is disabled.

MATERIAL_DISABLE_LIGHTING 

whether lighting is disabled.

MATERIAL_ADDITIVE 

whether additive alpha or one alpha blending is enabled. if MATERIAL_BLENDING, it is ADDITIVE_ALPHA, otherwise, it is ADDITIVE_ONE

MATERIAL_BILLBOARD 

billboarded

MATERIAL_BILLBOARD_AA 

axis aligned billboarded

MATERIAL_TRANSLUCENT_SORT 

(added automatically) whether use translucent sorting. If set, it will use face group sorting for translucent face groups.

MATERIAL_SKIP_RENDER 

(added automatically if mesh texture file ends with _pg[1-9].xxx).

fully transparent mesh face such as clickthrough mesh physics faces. skip rendering (in non-debug mode) regardless of what the texture is.

Member Function Documentation

§ CheckAttribute()

bool ParaEngine::CParaXMaterial::CheckAttribute ( DWORD  attribute)
inline

whether a material attribute is enabled.

Parameters
attribute
Returns
true if enabled

§ GetPhysicsGroup()

int ParaEngine::CParaXMaterial::GetPhysicsGroup ( )
inline

get the physics group.

§ GetReflectivity()

float ParaEngine::CParaXMaterial::GetReflectivity ( )
inline

Get the reflectivity of environment or reflection map.

§ SetMaterial()

void ParaEngine::CParaXMaterial::SetMaterial ( const ParaMaterial material)
inline

read from material, whether to use blend, alpha test or global textures, etc.

these information is currently encoded in the bits of specular power component of mat. TODO: I guess X file reference will support it in its future release. or maybe I shall manually parse X-file to add explicit support.

§ SetReflectivity()

void ParaEngine::CParaXMaterial::SetReflectivity ( float  fReflectivity)
inline

Set the reflectivity of environment or reflection map.

Member Data Documentation

§ dwAttribute

DWORD ParaEngine::CParaXMaterial::dwAttribute

a bitwise mask of AttributeBits.

§ m_nPhysicsGroup

int ParaEngine::CParaXMaterial::m_nPhysicsGroup

the physics group.

default to 0.

§ m_nReplaceableTextureID

int ParaEngine::CParaXMaterial::m_nReplaceableTextureID

if this is -1, no replaceable texture is used.

if not, it is the ID or index into the replaceable texture array. generally speaking, replaceable ID 0 is used for general purpose replaceable texture, ID 1 is for user defined. ID 2 is for custom skins.

§ m_nTranslucentFaceGroupIndex

int ParaEngine::CParaXMaterial::m_nTranslucentFaceGroupIndex

index into the mesh object's m_faceGroups.

This value is only valid when MATERIAL_TRANSLUCENT_SORT attribute is set.

§ m_vPivot

Vector3 ParaEngine::CParaXMaterial::m_vPivot

only used in billboarded and axis aligned billboarded materials.


The documentation for this struct was generated from the following file: