GL Studio C++ Runtime API
Effect_DiffNormSpecRefl Class Reference

#include <effect_diff_norm_spec_refl.h>

Inheritance diagram for Effect_DiffNormSpecRefl:
GlsRenderEffect VertexAttribIndexLookup

Classes

class  TextureUVWMatrix
 

Public Member Functions

 Effect_DiffNormSpecRefl (const Effect_DiffNormSpecRefl &)
 Copy constructor.
 
const Effect_DiffNormSpecRefloperator= (const Effect_DiffNormSpecRefl &)
 
bool operator== (const Effect_DiffNormSpecRefl &) const
 
bool operator!= (const Effect_DiffNormSpecRefl &o) const
 
void SetMaterialIndex (unsigned int materialIndex)
 
unsigned int GetMaterialIndex () const
 
void SetUseVertexColor (bool value)
 
bool GetUseVertexColor () const
 
void SetDiffuseTextureIndex (int textureIndex)
 
int GetDiffuseTextureIndex () const
 
void SetNormalTextureIndex (int textureIndex)
 
int GetNormalTextureIndex () const
 
void SetSpecularTextureIndex (int textureIndex)
 
int GetSpecularTextureIndex () const
 
void SetReflectionTextureIndex (int textureIndex)
 
int GetReflectionTextureIndex () const
 
void SetDiffuseAmount (float value)
 
float GetDiffuseAmount () const
 
void SetNormalAmount (float value)
 
float GetNormalAmount () const
 
void SetSpecularAmount (float value)
 
float GetSpecularAmount () const
 
void SetReflectionAmount (float value)
 
float GetReflectionAmount () const
 
void SetNormalMapFlipGreen (bool value)
 
bool GetNormalMapFlipGreen () const
 
void SetDiffuseUVWSettings (float uOffset, float vOffset, float uTiling, float vTiling, float angle)
 
void GetDiffuseUVWSettings (float &uOffset, float &vOffset, float &uTiling, float &vTiling, float &angle)
 
void SetNormalUVWSettings (float uOffset, float vOffset, float uTiling, float vTiling, float angle)
 
void GetNormalUVWSettings (float &uOffset, float &vOffset, float &uTiling, float &vTiling, float &angle)
 
void SetSpecularUVWSettings (float uOffset, float vOffset, float uTiling, float vTiling, float angle)
 
void GetSpecularUVWSettings (float &uOffset, float &vOffset, float &uTiling, float &vTiling, float &angle)
 
void SelectShader ()
 
void TextureUVWSettingsChanged ()
 
bool UsesTextureTransforms ()
 
DistiAttribDictAttributes () DISTI_METHOD_OVERRIDE
 
const std::string & EffectTypeName () DISTI_METHOD_OVERRIDE
 
virtual GLint GetVertexAttribIndexForSemantic (int semanticEnum) DISTI_METHOD_OVERRIDE
 
virtual void AddRef () DISTI_METHOD_OVERRIDE
 Add to this object's reference count. More...
 
virtual void Release () DISTI_METHOD_OVERRIDE
 Release a reference to this object. More...
 
virtual unsigned int GlsRenderEffect_ClassID () const DISTI_METHOD_OVERRIDE
 
virtual void SetupEffect (DynamicArray< Material > &materialPalette, TexturePalette *texturePalette, const TextureSettings &textureSettings, float *viewToWorld3x3, unsigned int maxLightNum, unsigned int activeLightMask) DISTI_METHOD_OVERRIDE
 
virtual void CleanupEffect () DISTI_METHOD_OVERRIDE
 Remove the effect trom the OpenGL state. More...
 
virtual int Compare (const GlsRenderEffect *) const DISTI_METHOD_OVERRIDE
 
virtual GlsRenderEffectClone () const DISTI_METHOD_OVERRIDE
 
virtual void GetReferencedTextures (ReferencedTextureArray &referencedTextures) DISTI_METHOD_OVERRIDE
 
virtual void GetReferencedMaterials (ReferencedMaterialArray &referencedMaterials) DISTI_METHOD_OVERRIDE
 
- Public Member Functions inherited from GlsRenderEffect
virtual void AddRef ()=0
 Add to this object's reference count. More...
 
virtual void Release ()=0
 Release a reference to this object. More...
 
virtual unsigned int GlsRenderEffect_ClassID () const =0
 
virtual void SetupEffect (DynamicArray< Material > &materialPalette, TexturePalette *texturePalette, const TextureSettings &textureSettings, float *viewToWorld3x3, unsigned int maxLightNum, unsigned int activeLightMask)=0
 
virtual void CleanupEffect ()=0
 Remove the effect trom the OpenGL state. More...
 
virtual int Compare (const GlsRenderEffect *other) const =0
 
bool Equals (const GlsRenderEffect *other) const
 
virtual DistiAttribDictAttributes ()=0
 
virtual const std::string & EffectTypeName ()=0
 
virtual GlsRenderEffectClone () const =0
 
virtual void GetReferencedMaterials (ReferencedMaterialArray &referencedMaterials)
 
virtual void GetReferencedTextures (ReferencedTextureArray &referencedTextures)
 
virtual GLint GetVertexAttribIndexForSemantic (int semanticEnum)=0
 

Static Public Attributes

static const std::string EFFECT_TYPE_NAME
 Backing storage for the human readable string for this effect type.
 
static const int INVALID_INDEX = -1
 Value to represent an invalid texture index.
 

Protected Member Functions

void SetupAttribDict ()
 

Protected Attributes

unsigned int _ref_count
 Reference count.
 
MaxLike_Shader * _shader
 shader program to use (if any)
 
unsigned int _materialIndex
 The material index to use.
 
int _diffuseTextureIndex
 INVALID_INDEX, or the texture index to use.
 
int _normalTextureIndex
 INVALID_INDEX, or the texture index to use.
 
int _specularTextureIndex
 INVALID_INDEX, or the texture index to use.
 
int _reflectionTextureIndex
 INVALID_INDEX, or the texture index to use.
 
float _diffuseAmount
 [0.0,1.0] "Weight" of the diffuse map
 
float _normalAmount
 [0.0,1.0] "Weight" of the normal map
 
float _specularAmount
 [0.0,1.0] "Weight" of the specular map
 
float _reflectionAmount
 [0.0,1.0] "Weight" of the reflection map
 
bool _useVertexColors
 true: use vertex color for diffuse rather than material diffuse
 
bool _normalMapFlipGreen
 
DistiAttribDict_attribDict
 The attribute dictionary for this object.
 
TextureUVWMatrix _diffuseUVWMatrix
 The texture transform for the diffuse texture.
 
TextureUVWMatrix _normalUVWMatrix
 The texture transform for the normal texture.
 
TextureUVWMatrix _specularUVWMatrix
 The texture transform for the specular texture.
 

Additional Inherited Members

- Public Types inherited from GlsRenderEffect
typedef bool(* DebugModeChangeCallback) (void *user, const char *modeName, bool value)
 
- Public Types inherited from VertexAttribIndexLookup
enum  AttributeSemanticEnum {
  ATTRIB_UNDEFINED = 0 , ATTRIB_POSITION = 0x80000000 , ATTRIB_NORMAL , ATTRIB_BLENDWEIGHT ,
  ATTRIB_TANGENT , ATTRIB_BINORMAL , ATTRIB_BLENDINDICES , ATTRIB_PSIZE ,
  ATTRIB_TEXCOORD0 , ATTRIB_TEXCOORD1 , ATTRIB_TEXCOORD2 , ATTRIB_TEXCOORD3 ,
  ATTRIB_TEXCOORD4 , ATTRIB_TEXCOORD5 , ATTRIB_TEXCOORD6 , ATTRIB_TEXCOORD7
}
 
- Static Public Member Functions inherited from GlsRenderEffect
static unsigned int SetDebugMode (const char *modeName, bool value)
 
static unsigned int RegisterNewClassID (const char *debugStr=NULL)
 
static bool RegisterDebugModeChangeCallback (void *param, DebugModeChangeCallback func)
 
static bool UnregisterDebugModeChangeCallback (void *param, DebugModeChangeCallback func)
 

Detailed Description

Render effect that supports diffuse, normal, specular, and reflection maps.

Member Function Documentation

◆ AddRef()

virtual void AddRef ( )
virtual

Add to this object's reference count.

Implements GlsRenderEffect.

◆ Attributes()

DistiAttribDict & Attributes ( )
inlinevirtual
Returns
A reference to the effect's attribute dictionary.

Implements GlsRenderEffect.

◆ CleanupEffect()

virtual void CleanupEffect ( )
virtual

Remove the effect trom the OpenGL state.

Implements GlsRenderEffect.

◆ Clone()

virtual GlsRenderEffect * Clone ( ) const
virtual
Returns
A new instance of the effect with the same settings as this one.

Implements GlsRenderEffect.

◆ Compare()

virtual int Compare ( const GlsRenderEffect other) const
virtual
Returns
0 if the effects are equal, a positive number if this effect should sort after the other effect, or a negative number if this effect should sort before the other effect. The rendering system uses this to sort effects.
Parameters
otherThe effect to compare with.

Implements GlsRenderEffect.

◆ EffectTypeName()

const std::string & EffectTypeName ( )
inlinevirtual
Returns
This effect's type as a readable string.

Implements GlsRenderEffect.

◆ GetDiffuseAmount()

float GetDiffuseAmount ( ) const
inline
Returns
The current weight for the diffuse texture.

◆ GetDiffuseTextureIndex()

int GetDiffuseTextureIndex ( ) const
inline
Returns
The current diffuse color texture index for this effect.

◆ GetDiffuseUVWSettings()

void GetDiffuseUVWSettings ( float &  uOffset,
float &  vOffset,
float &  uTiling,
float &  vTiling,
float &  angle 
)

Get Diffuse Map UV transform parameters.

Parameters
uOffsetReturned u axis translation.
vOffsetReturned v axis translation.
uTilingReturned u axis scaling.
vTilingReturned v axis scaling.
angleReturned x axis rotation in degrees.

◆ GetMaterialIndex()

unsigned int GetMaterialIndex ( ) const
inline
Returns
The current material index for this effect.

◆ GetNormalAmount()

float GetNormalAmount ( ) const
inline
Returns
The current weight for the normal texture.

◆ GetNormalMapFlipGreen()

bool GetNormalMapFlipGreen ( ) const
inline
Returns
The current normal map green channel flip: true for DirectX textures, false for OpenGL textures.

◆ GetNormalTextureIndex()

int GetNormalTextureIndex ( ) const
inline
Returns
The current normal texture index for this effect.

◆ GetNormalUVWSettings()

void GetNormalUVWSettings ( float &  uOffset,
float &  vOffset,
float &  uTiling,
float &  vTiling,
float &  angle 
)

Get Normal Map UV transform parameters.

Parameters
uOffsetReturned u axis translation.
vOffsetReturned v axis translation.
uTilingReturned u axis scaling.
vTilingReturned v axis scaling.
angleReturned W-axis rotation in degrees.

◆ GetReferencedMaterials()

virtual void GetReferencedMaterials ( ReferencedMaterialArray referencedMaterials)
virtual

Checks whether or not the effect is transparent. Implementing is optional Inserts all referenced textures into the array passed in. Implementing is optional.

Parameters
referencedMaterialsA returned array of material indices.

Reimplemented from GlsRenderEffect.

◆ GetReferencedTextures()

virtual void GetReferencedTextures ( ReferencedTextureArray referencedTextures)
virtual

Inserts all referenced textures into the array passed in. Implementing is optional.

Parameters
referencedTexturesA returned array of texture indices.

Reimplemented from GlsRenderEffect.

◆ GetReflectionAmount()

float GetReflectionAmount ( ) const
inline
Returns
The current weight for the reflection texture.

◆ GetReflectionTextureIndex()

int GetReflectionTextureIndex ( ) const
inline
Returns
The current reflection texture index for this effect.

◆ GetSpecularAmount()

float GetSpecularAmount ( ) const
inline
Returns
The current weight for the specular texture.

◆ GetSpecularTextureIndex()

int GetSpecularTextureIndex ( ) const
inline
Returns
The current specular texture index for this effect.

◆ GetSpecularUVWSettings()

void GetSpecularUVWSettings ( float &  uOffset,
float &  vOffset,
float &  uTiling,
float &  vTiling,
float &  angle 
)

Get Specular Map UV transform parameters.

Parameters
uOffsetReturned u axis translation.
vOffsetReturned v axis translation.
uTilingReturned u axis scaling.
vTilingReturned v axis scaling.
angleReturned W-axis rotation in degrees.

◆ GetUseVertexColor()

bool GetUseVertexColor ( ) const
inline
Returns
Whether the effect is using vertex colors, rather than material colors.

◆ GetVertexAttribIndexForSemantic()

virtual GLint GetVertexAttribIndexForSemantic ( int  semanticEnum)
virtual
Returns
The attributeIndex that should be used to pass the vertex attributes or -1 if they are not needed (see glVertexAttrib)
Parameters
semanticEnumThe sematic value (see AttributeSemanticEnum)

Implements VertexAttribIndexLookup.

◆ GlsRenderEffect_ClassID()

virtual unsigned int GlsRenderEffect_ClassID ( ) const
virtual

Allows for static casting in compare functions

See also
RegisterNewClassID
Returns
A unique identifier associated with this effect type.

Implements GlsRenderEffect.

◆ operator!=()

bool operator!= ( const Effect_DiffNormSpecRefl o) const
inline

Inequality operator

Parameters
oThe object to compare.
Returns
Whether or not the objects are not equal.

◆ operator=()

const Effect_DiffNormSpecRefl & operator= ( const Effect_DiffNormSpecRefl )

Assignment operator

Returns
the resulting object (this)

◆ operator==()

bool operator== ( const Effect_DiffNormSpecRefl ) const

Equality operator

Returns
Whether or not the objects are equal.

◆ Release()

virtual void Release ( )
virtual

Release a reference to this object.

Implements GlsRenderEffect.

◆ SelectShader()

void SelectShader ( )

Selects the shader to use based on the current effect parameters.

Note
Not normally called by users.

◆ SetDiffuseAmount()

void SetDiffuseAmount ( float  value)
inline

Set the weight of the diffuse texture from 0.0 to 1.0.

Parameters
valueThe new weight to set.

◆ SetDiffuseTextureIndex()

void SetDiffuseTextureIndex ( int  textureIndex)
inline

Set the texture index that will provide the diffuse color for the effect.

Parameters
textureIndexThe new texture index to set.

◆ SetDiffuseUVWSettings()

void SetDiffuseUVWSettings ( float  uOffset,
float  vOffset,
float  uTiling,
float  vTiling,
float  angle 
)

Set Diffuse Map UV transform parameters.

Note
Scaling and rotation are performed from the center of the texture.
Parameters
uOffsetU axis translation.
vOffsetV axis translation.
uTilingU axis scaling.
vTilingV axis scaling.
angleX axis rotation in degrees.

◆ SetMaterialIndex()

void SetMaterialIndex ( unsigned int  materialIndex)
inline

Set the material index for this effect.

Parameters
materialIndexThe new material index for this effect.

◆ SetNormalAmount()

void SetNormalAmount ( float  value)
inline

Set the weight of the normal texture from 0.0 to 1.0.

Parameters
valueThe new weight to set.

◆ SetNormalMapFlipGreen()

void SetNormalMapFlipGreen ( bool  value)
inline

Set flipping the normal map green channel for DirectX textures (true) or OpenGL textures (false).

Parameters
valueThe new flip value.

◆ SetNormalTextureIndex()

void SetNormalTextureIndex ( int  textureIndex)
inline

Set the texture index that will provide normals for the effect

Parameters
textureIndexThe new texture index to set.

◆ SetNormalUVWSettings()

void SetNormalUVWSettings ( float  uOffset,
float  vOffset,
float  uTiling,
float  vTiling,
float  angle 
)

Set Normal Map UV transform parameters.

Note
Scaling and rotation are performed from the center of the texture.
Parameters
uOffsetU axis translation.
vOffsetV axis translation.
uTilingU axis scaling.
vTilingV axis scaling.
angleW-axis rotation in degrees.

◆ SetReflectionAmount()

void SetReflectionAmount ( float  value)
inline

Set the weight of the reflection texture from 0.0 to 1.0.

Parameters
valueThe new weight to set.

◆ SetReflectionTextureIndex()

void SetReflectionTextureIndex ( int  textureIndex)
inline

Set the texture index that will provide reflections for this effect.

Parameters
textureIndexThe new texture index to set.

◆ SetSpecularAmount()

void SetSpecularAmount ( float  value)
inline

Set the weight of the specular texture from 0.0 to 1.0.

Parameters
valueThe new weight to set.

◆ SetSpecularTextureIndex()

void SetSpecularTextureIndex ( int  textureIndex)
inline

Set the texture index that will provide specular for this effect.

Parameters
textureIndexThe new texture index to set.

◆ SetSpecularUVWSettings()

void SetSpecularUVWSettings ( float  uOffset,
float  vOffset,
float  uTiling,
float  vTiling,
float  angle 
)

Set Specular Map UV transform parameters.

Note
Scaling and rotation are performed from the center of the texture.
Parameters
uOffsetU axis translation.
vOffsetV axis translation.
uTilingU axis scaling.
vTilingV axis scaling.
angleW-axis rotation in degrees.

◆ SetupAttribDict()

void SetupAttribDict ( )
protected

Called to add this object's attributes to the dictionary.

Note
Not normally called by users.

◆ SetupEffect()

virtual void SetupEffect ( DynamicArray< Material > &  materialPalette,
TexturePalette texturePalette,
const TextureSettings textureSettings,
float *  viewToWorld3x3,
unsigned int  maxLightNum,
unsigned int  activeLightMask 
)
virtual

Apply the effect to the OpenGL state

Parameters
materialPaletteUsed to access material settings
texturePaletteUsed to access texture maps
textureSettingsThe object-level texture settings
viewToWorld3x3A 3x3 matrix containing the current viewToWorld transfrom. Used for environment mapping effects.
maxLightNumThe number of active lights in the scene. Used to speed up light calculations.
activeLightMaskA bit mask of which lights are active in the scene (Ex. GL_LIGHT0, GL_LIGHT2, GL_LIGHT3 and GL_LIGHT7 are active: activeLightMask = ...10001101 last 8 bits in binary = 141u)

Implements GlsRenderEffect.

◆ SetUseVertexColor()

void SetUseVertexColor ( bool  value)
inline

Set whether or not to use vertex colors, rather than material colors.

Parameters
valueThe new value to set.

◆ TextureUVWSettingsChanged()

void TextureUVWSettingsChanged ( )

Recalculate the texture transform matrices.

Note
Not normally called by users.

◆ UsesTextureTransforms()

bool UsesTextureTransforms ( )
Returns
true if the effect has non-default texture transform settings
Note
Not normally called by users.

Member Data Documentation

◆ _normalMapFlipGreen

bool _normalMapFlipGreen
protected

true: expect 'DirectX' format normal maps (positive Green points down) false: expect 'OpenGL' format normal maps (positive Green points up) Note: the sense is backwards from the Max 'Normal Bump' 'Flip Green' option because Max defaults to 'DirectX' format and GL Studio defaults to 'OpenGL' format


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