Castor3D  ..
Classes | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
Castor3D::Pass Class Reference

Definition of a material pass. More...

+ Inheritance diagram for Castor3D::Pass:
+ Collaboration diagram for Castor3D::Pass:

Classes

class  BinaryParser
 Pass loader. More...
 
class  TextLoader
 Pass loader. More...
 

Public Member Functions

C3D_API Pass (Engine &p_engine, MaterialSPtr p_parent=nullptr)
 Constructor. More...
 
C3D_API ~Pass ()
 Destructor. More...
 
C3D_API void Initialise ()
 Initialises the pass and all it's dependencies. More...
 
C3D_API void Cleanup ()
 Cleans up the pass and all it's dependencies. More...
 
C3D_API void BindToNode (RenderNode &p_node)
 Binds this pass to given render node. More...
 
C3D_API void BindToNode (SceneRenderNode &p_node)
 Binds this pass to given render node. More...
 
C3D_API void Render ()
 Applies the pass. More...
 
C3D_API void Render2D ()
 Applies the pass for 2D render. More...
 
C3D_API void EndRender ()
 Removes the pass (to avoid it from interfering with other passes) More...
 
C3D_API void AddTextureUnit (TextureUnitSPtr p_unit)
 Adds a texture unit. More...
 
C3D_API TextureUnitSPtr GetTextureUnit (eTEXTURE_CHANNEL p_channel)
 Retrieves the TextureUnit at wanted channel. More...
 
C3D_API bool DestroyTextureUnit (uint32_t p_index)
 Destroys a TextureUnit at the given index. More...
 
C3D_API TextureUnitSPtr GetTextureUnit (uint32_t p_index) const
 Retrieves the TextureUnit at the given index. More...
 
C3D_API Castor::String GetTexturePath (uint32_t p_index)
 Retrieves the image path of the TextureUnit at the given index. More...
 
C3D_API bool HasAlphaBlending () const
 Tells if the pass needs alpha blending. More...
 
C3D_API void Bind ()
 Binds the program and the textures. More...
 
C3D_API void FillShaderVariables (RenderNode &p_node)
 Fills shader variables. More...
 
C3D_API void PrepareTextures ()
 Reduces the textures. More...
 
uint32_t GetTextureFlags () const
 Retrieves the texture channels flags combination. More...
 
bool HasAutomaticShader () const
 Tells whether the pass shader is automatically generated or not. More...
 
void SetDiffuse (Castor::Colour const &p_clrColour)
 Sets the diffuse colour. More...
 
void SetAmbient (Castor::Colour const &p_clrColour)
 Sets the ambient colour. More...
 
void SetSpecular (Castor::Colour const &p_clrColour)
 Sets the specular colour. More...
 
void SetEmissive (Castor::Colour const &p_clrColour)
 Sets the emissive colour. More...
 
void SetShininess (float p_fShininess)
 Sets the shininess. More...
 
void SetTwoSided (bool p_bDouble)
 Sets the two sided status. More...
 
void SetAlpha (float p_fAlpha)
 Sets the global alpha value. More...
 
void SetAlphaBlendMode (eBLEND_MODE p_value)
 Sets the alpha blend mode. More...
 
void SetColourBlendMode (eBLEND_MODE p_value)
 Sets the colour blend mode. More...
 
BlendStateSPtr GetBlendState () const
 Retrieves the blend state. More...
 
float GetShininess () const
 Retrieves the shniness. More...
 
uint32_t GetTextureUnitsCount () const
 Retrieves the texture units count. More...
 
bool IsTwoSided () const
 Tells if the pass is two sided. More...
 
MaterialSPtr GetParent () const
 Retrieves the parent material. More...
 
float GetAlpha () const
 Retrieves the global alpha value. More...
 
eBLEND_MODE GetAlphaBlendMode () const
 Retrieves the alpha blend mode. More...
 
eBLEND_MODE GetColourBlendMode () const
 Retrieves the colour blend mode. More...
 
Castor::Colour const & GetDiffuse () const
 Retrieves the diffuse colour. More...
 
Castor::Colour const & GetAmbient () const
 Retrieves the ambient colour. More...
 
Castor::Colour const & GetSpecular () const
 Retrieves the specular colour. More...
 
Castor::Colour const & GetEmissive () const
 Retrieves the emissive colour. More...
 
Castor::Colour & GetDiffuse ()
 Retrieves the diffuse colour. More...
 
Castor::Colour & GetAmbient ()
 Retrieves the ambient colour. More...
 
Castor::Colour & GetSpecular ()
 Retrieves the specular colour. More...
 
Castor::Colour & GetEmissive ()
 Retrieves the emissive colour. More...
 

Protected Types

typedef std::pair< TextureUnitWPtr, OneIntFrameVariableWPtr > UnitVariablePair
 

Protected Member Functions

 DECLARE_MAP (eTEXTURE_CHANNEL, UnitVariablePair, UnitVariableChannel)
 

Protected Attributes

Castor::Colour m_clrDiffuse
 Diffuse material colour. More...
 
Castor::Colour m_clrAmbient
 Ambient material colour. More...
 
Castor::Colour m_clrSpecular
 Specular material colour. More...
 
Castor::Colour m_clrEmissive
 Emissive material colour. More...
 
float m_fShininess
 The shininess value. More...
 
float m_fAlpha
 The alpha value. More...
 
bool m_bDoubleFace
 Tells if the pass is two sided. More...
 
TextureUnitPtrArray m_arrayTextureUnits
 Texture units. More...
 
MaterialWPtr m_parent
 The parent material. More...
 
UnitVariableChannelMap m_mapUnits
 The current shader variables and associated texture units, ordered by channel. More...
 
BlendStateSPtr m_pBlendState
 Blend states. More...
 
uint32_t m_textureFlags
 Bitwise ORed eTEXTURE_CHANNEL. More...
 
bool m_bAutomaticShader
 Tells the pass shader is an automatically generated one. More...
 
eBLEND_MODE m_alphaBlendMode
 The alpha blend mode. More...
 
eBLEND_MODE m_colourBlendMode
 The colour blend mode. More...
 
bool m_texturesReduced
 Tells if the pass' textures are reduced. More...
 

Friends

class Material
 

Detailed Description

Definition of a material pass.

Author
Sylvain DOREMUS
Version
0.1
Date
09/02/2010
Remarks
A pass is composed of : base colours (ambient, diffuse, specular, emissive), shininess,
texture units. Shader programs can also be applied.

Member Typedef Documentation

◆ UnitVariablePair

typedef std::pair< TextureUnitWPtr, OneIntFrameVariableWPtr > Castor3D::Pass::UnitVariablePair
protected

Constructor & Destructor Documentation

◆ Pass()

C3D_API Castor3D::Pass::Pass ( Engine p_engine,
MaterialSPtr  p_parent = nullptr 
)

Constructor.

Remarks
Used by Material, don't use it.
Parameters
[in]p_engineThe core engine
[in]p_parentThe parent material

◆ ~Pass()

C3D_API Castor3D::Pass::~Pass ( )

Destructor.

Member Function Documentation

◆ AddTextureUnit()

C3D_API void Castor3D::Pass::AddTextureUnit ( TextureUnitSPtr  p_unit)

Adds a texture unit.

Parameters
[in]p_unitThe texture unit.

◆ Bind()

C3D_API void Castor3D::Pass::Bind ( )

Binds the program and the textures.

Remarks
The frame variable buffers are not bound. A call to FillShaderVariables must be done before the draw call.

◆ BindToNode() [1/2]

C3D_API void Castor3D::Pass::BindToNode ( RenderNode p_node)

Binds this pass to given render node.

Parameters
[in]p_nodeThe render node.

◆ BindToNode() [2/2]

C3D_API void Castor3D::Pass::BindToNode ( SceneRenderNode p_node)

Binds this pass to given render node.

Parameters
[in]p_nodeThe render node.

◆ Cleanup()

C3D_API void Castor3D::Pass::Cleanup ( )

Cleans up the pass and all it's dependencies.

◆ DECLARE_MAP()

Castor3D::Pass::DECLARE_MAP ( eTEXTURE_CHANNEL  ,
UnitVariablePair  ,
UnitVariableChannel   
)
protected

◆ DestroyTextureUnit()

C3D_API bool Castor3D::Pass::DestroyTextureUnit ( uint32_t  p_index)

Destroys a TextureUnit at the given index.

Parameters
[in]p_indexthe index of the TextureUnit to destroy
Returns
false if the index was out of bounds

◆ EndRender()

C3D_API void Castor3D::Pass::EndRender ( )

Removes the pass (to avoid it from interfering with other passes)

◆ FillShaderVariables()

C3D_API void Castor3D::Pass::FillShaderVariables ( RenderNode p_node)

Fills shader variables.

◆ GetAlpha()

float Castor3D::Pass::GetAlpha ( ) const
inline

Retrieves the global alpha value.

Returns
The value

References m_fAlpha.

◆ GetAlphaBlendMode()

eBLEND_MODE Castor3D::Pass::GetAlphaBlendMode ( ) const
inline

Retrieves the alpha blend mode.

Returns
The value

References m_alphaBlendMode.

◆ GetAmbient() [1/2]

Castor::Colour const& Castor3D::Pass::GetAmbient ( ) const
inline

Retrieves the ambient colour.

Returns
The value

References m_clrAmbient.

◆ GetAmbient() [2/2]

Castor::Colour& Castor3D::Pass::GetAmbient ( )
inline

Retrieves the ambient colour.

Returns
The value

References m_clrAmbient.

◆ GetBlendState()

BlendStateSPtr Castor3D::Pass::GetBlendState ( ) const
inline

Retrieves the blend state.

Returns
The value

References m_pBlendState.

◆ GetColourBlendMode()

eBLEND_MODE Castor3D::Pass::GetColourBlendMode ( ) const
inline

Retrieves the colour blend mode.

Returns
The value

References m_colourBlendMode.

◆ GetDiffuse() [1/2]

Castor::Colour const& Castor3D::Pass::GetDiffuse ( ) const
inline

Retrieves the diffuse colour.

Returns
The value

References m_clrDiffuse.

◆ GetDiffuse() [2/2]

Castor::Colour& Castor3D::Pass::GetDiffuse ( )
inline

Retrieves the diffuse colour.

Returns
The value

References m_clrDiffuse.

◆ GetEmissive() [1/2]

Castor::Colour const& Castor3D::Pass::GetEmissive ( ) const
inline

Retrieves the emissive colour.

Returns
The value

References m_clrEmissive.

◆ GetEmissive() [2/2]

Castor::Colour& Castor3D::Pass::GetEmissive ( )
inline

Retrieves the emissive colour.

Returns
The value

References m_clrEmissive.

◆ GetParent()

MaterialSPtr Castor3D::Pass::GetParent ( ) const
inline

Retrieves the parent material.

Returns
The value

References m_parent.

◆ GetShininess()

float Castor3D::Pass::GetShininess ( ) const
inline

Retrieves the shniness.

Returns
The value

References m_fShininess.

◆ GetSpecular() [1/2]

Castor::Colour const& Castor3D::Pass::GetSpecular ( ) const
inline

Retrieves the specular colour.

Returns
The value

References m_clrSpecular.

◆ GetSpecular() [2/2]

Castor::Colour& Castor3D::Pass::GetSpecular ( )
inline

Retrieves the specular colour.

Returns
The value

References m_clrSpecular.

◆ GetTextureFlags()

uint32_t Castor3D::Pass::GetTextureFlags ( ) const
inline

Retrieves the texture channels flags combination.

Returns
The value

References m_textureFlags.

◆ GetTexturePath()

C3D_API Castor::String Castor3D::Pass::GetTexturePath ( uint32_t  p_index)

Retrieves the image path of the TextureUnit at the given index.

Parameters
[in]p_indexThe index of the TextureUnit we want the image path
Returns
The path, void if none

◆ GetTextureUnit() [1/2]

C3D_API TextureUnitSPtr Castor3D::Pass::GetTextureUnit ( eTEXTURE_CHANNEL  p_channel)

Retrieves the TextureUnit at wanted channel.

Remarks
If more than one TextureUnits are found at given channel, the first one is returned
Parameters
[in]p_channelThe channel
Returns
nullptr if no TextureUnit at wanted channel

◆ GetTextureUnit() [2/2]

C3D_API TextureUnitSPtr Castor3D::Pass::GetTextureUnit ( uint32_t  p_index) const

Retrieves the TextureUnit at the given index.

Parameters
[in]p_indexThe index of the TextureUnit to retrieve
Returns
The retrieved TextureUnit, nullptr if none

◆ GetTextureUnitsCount()

uint32_t Castor3D::Pass::GetTextureUnitsCount ( ) const
inline

Retrieves the texture units count.

Returns
The value

References m_arrayTextureUnits.

◆ HasAlphaBlending()

C3D_API bool Castor3D::Pass::HasAlphaBlending ( ) const

Tells if the pass needs alpha blending.

Returns
true if at least one texture unit has an alpha channel

◆ HasAutomaticShader()

bool Castor3D::Pass::HasAutomaticShader ( ) const
inline

Tells whether the pass shader is automatically generated or not.

Returns
The value

References m_bAutomaticShader.

◆ Initialise()

C3D_API void Castor3D::Pass::Initialise ( )

Initialises the pass and all it's dependencies.

◆ IsTwoSided()

bool Castor3D::Pass::IsTwoSided ( ) const
inline

Tells if the pass is two sided.

References m_bDoubleFace.

◆ PrepareTextures()

C3D_API void Castor3D::Pass::PrepareTextures ( )

Reduces the textures.

◆ Render()

C3D_API void Castor3D::Pass::Render ( )

Applies the pass.

◆ Render2D()

C3D_API void Castor3D::Pass::Render2D ( )

Applies the pass for 2D render.

◆ SetAlpha()

void Castor3D::Pass::SetAlpha ( float  p_fAlpha)
inline

Sets the global alpha value.

Parameters
[in]p_fAlphaThe new value

References m_clrAmbient, m_clrDiffuse, m_clrEmissive, m_clrSpecular, and m_fAlpha.

◆ SetAlphaBlendMode()

void Castor3D::Pass::SetAlphaBlendMode ( eBLEND_MODE  p_value)
inline

Sets the alpha blend mode.

Parameters
[in]p_valueThe value

References m_alphaBlendMode.

◆ SetAmbient()

void Castor3D::Pass::SetAmbient ( Castor::Colour const &  p_clrColour)
inline

Sets the ambient colour.

Parameters
[in]p_clrColourThe new value

References m_clrAmbient.

◆ SetColourBlendMode()

void Castor3D::Pass::SetColourBlendMode ( eBLEND_MODE  p_value)
inline

Sets the colour blend mode.

Parameters
[in]p_valueThe value

References m_colourBlendMode.

◆ SetDiffuse()

void Castor3D::Pass::SetDiffuse ( Castor::Colour const &  p_clrColour)
inline

Sets the diffuse colour.

Parameters
[in]p_clrColourThe new value

References m_clrDiffuse.

◆ SetEmissive()

void Castor3D::Pass::SetEmissive ( Castor::Colour const &  p_clrColour)
inline

Sets the emissive colour.

Parameters
[in]p_clrColourThe new value

References m_clrEmissive.

◆ SetShininess()

void Castor3D::Pass::SetShininess ( float  p_fShininess)
inline

Sets the shininess.

Parameters
[in]p_fShininessThe new value

References m_fShininess.

◆ SetSpecular()

void Castor3D::Pass::SetSpecular ( Castor::Colour const &  p_clrColour)
inline

Sets the specular colour.

Parameters
[in]p_clrColourThe new value

References m_clrSpecular.

◆ SetTwoSided()

void Castor3D::Pass::SetTwoSided ( bool  p_bDouble)
inline

Sets the two sided status.

Parameters
[in]p_bDoubleThe new value

References m_bDoubleFace.

Friends And Related Function Documentation

◆ Material

friend class Material
friend

Member Data Documentation

◆ m_alphaBlendMode

eBLEND_MODE Castor3D::Pass::m_alphaBlendMode
protected

The alpha blend mode.

Referenced by GetAlphaBlendMode(), and SetAlphaBlendMode().

◆ m_arrayTextureUnits

TextureUnitPtrArray Castor3D::Pass::m_arrayTextureUnits
protected

Texture units.

Referenced by GetTextureUnitsCount().

◆ m_bAutomaticShader

bool Castor3D::Pass::m_bAutomaticShader
protected

Tells the pass shader is an automatically generated one.

Referenced by HasAutomaticShader().

◆ m_bDoubleFace

bool Castor3D::Pass::m_bDoubleFace
protected

Tells if the pass is two sided.

Referenced by IsTwoSided(), and SetTwoSided().

◆ m_clrAmbient

Castor::Colour Castor3D::Pass::m_clrAmbient
protected

Ambient material colour.

Referenced by GetAmbient(), SetAlpha(), and SetAmbient().

◆ m_clrDiffuse

Castor::Colour Castor3D::Pass::m_clrDiffuse
protected

Diffuse material colour.

Referenced by GetDiffuse(), SetAlpha(), and SetDiffuse().

◆ m_clrEmissive

Castor::Colour Castor3D::Pass::m_clrEmissive
protected

Emissive material colour.

Referenced by GetEmissive(), SetAlpha(), and SetEmissive().

◆ m_clrSpecular

Castor::Colour Castor3D::Pass::m_clrSpecular
protected

Specular material colour.

Referenced by GetSpecular(), SetAlpha(), and SetSpecular().

◆ m_colourBlendMode

eBLEND_MODE Castor3D::Pass::m_colourBlendMode
protected

The colour blend mode.

Referenced by GetColourBlendMode(), and SetColourBlendMode().

◆ m_fAlpha

float Castor3D::Pass::m_fAlpha
protected

The alpha value.

Referenced by GetAlpha(), and SetAlpha().

◆ m_fShininess

float Castor3D::Pass::m_fShininess
protected

The shininess value.

Referenced by GetShininess(), and SetShininess().

◆ m_mapUnits

UnitVariableChannelMap Castor3D::Pass::m_mapUnits
protected

The current shader variables and associated texture units, ordered by channel.

◆ m_parent

MaterialWPtr Castor3D::Pass::m_parent
protected

The parent material.

Referenced by GetParent().

◆ m_pBlendState

BlendStateSPtr Castor3D::Pass::m_pBlendState
protected

Blend states.

Referenced by GetBlendState().

◆ m_textureFlags

uint32_t Castor3D::Pass::m_textureFlags
protected

Bitwise ORed eTEXTURE_CHANNEL.

Referenced by GetTextureFlags().

◆ m_texturesReduced

bool Castor3D::Pass::m_texturesReduced
protected

Tells if the pass' textures are reduced.


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