You.i Engine
CYIMaterial Class Reference

Detailed Description

CYIMaterial is a place holder for all the drawing parameters required by the renderer to draw a mesh/shape.

The CYIMaterial is a component of the CYISceneNode, which describes what material to use to draw itself. This object is implicitly sharable.

#include <renderer/YiMaterial.h>

Inheritance diagram for CYIMaterial:

Public Member Functions

 CYIMaterial ()
 
 ~CYIMaterial ()
 
std::shared_ptr< CYIAssetTextureBaseGetTexture (uint32_t slot) const
 
void SetTexture (uint32_t slot, const std::shared_ptr< CYIAssetTextureBase > &pTexture, float *pTextureMatrix=nullptr)
 
void SetTexture (uint32_t slot, const std::shared_ptr< CYIAssetTextureBase > &pTexture, const glm::mat3 textureMatrix)
 
const glm::mat3 & GetTextureMatrix (uint32_t slot) const
 
const std::shared_ptr< CYIAssetShaderProgram > & GetShaderProgram () const
 
const std::shared_ptr< IYIUniformBufferObject > & GetShaderUniforms () const
 
void SetShaderProgram (const std::shared_ptr< CYIAssetShaderProgram > &pShaderProgram)
 
const std::map< uint32_t, std::shared_ptr< CYIAssetTextureBase > > & GetTextureBindings () const
 
void ClearTextureSlot (uint32_t slot)
 
void SetBlendMode (CYIRenderSystem::YI_BLEND_MODE mode)
 
CYIRenderSystem::YI_BLEND_MODE GetBlendMode () const
 
void SetColor (const CYIColor &color)
 
const CYIColorGetColor () const
 
void SetCullFace (CYIRenderSystem::YI_CULL_FACE eCullingMode)
 
CYIRenderSystem::YI_CULL_FACE GetCullFace () const
 
bool IsLoaded () const
 
- Public Member Functions inherited from CYIScriptableObject
 CYIScriptableObject ()
 
 CYIScriptableObject (const CYIScriptableObject &other)
 
CYIScriptableObjectoperator= (const CYIScriptableObject &other)
 
virtual ~CYIScriptableObject ()
 
CYIBindingImplementationGetBindingImplementation () const
 
void SetBindingImplementation (CYIBindingImplementation *pBindingImplementation)
 
virtual const CYIRuntimeTypeInfoGetRuntimeTypeInfoForScriptObject () const
 

Constructor & Destructor Documentation

CYIMaterial::CYIMaterial ( )

Constructor

CYIMaterial::~CYIMaterial ( )

Destructor

Member Function Documentation

void CYIMaterial::ClearTextureSlot ( uint32_t  slot)

Clear the data in the indicated texture slot, this data will no longer be sent to the renderer or accessible in any shader programs

CYIRenderSystem::YI_BLEND_MODE CYIMaterial::GetBlendMode ( ) const

Returns the blending mode for this material

const CYIColor& CYIMaterial::GetColor ( ) const

Get the color for this material

CYIRenderSystem::YI_CULL_FACE CYIMaterial::GetCullFace ( ) const

Get the culling mode used for this material.

const std::shared_ptr<CYIAssetShaderProgram>& CYIMaterial::GetShaderProgram ( ) const

Gets the shader program. If no shader program was set, it will return null. This function should typically be used only by the renderer.

const std::shared_ptr<IYIUniformBufferObject>& CYIMaterial::GetShaderUniforms ( ) const

Gets the shader uniform buffer object. This construct is used to set shader uniform values that will be applied when this material is used in the renderer.

std::shared_ptr<CYIAssetTextureBase> CYIMaterial::GetTexture ( uint32_t  slot) const

Gets the texture assigned to texture slot. If no texture were assigned to the given slot, it will return null. Slot should be between 0 and the maximum amount of texture units available on your target platform

const std::map<uint32_t, std::shared_ptr<CYIAssetTextureBase> >& CYIMaterial::GetTextureBindings ( ) const

Returns the configured texture bindings for this material as an ordered map of the form (textureSlot, textureObject)

const glm::mat3& CYIMaterial::GetTextureMatrix ( uint32_t  slot) const

Returns the texture matrix for the texture in slot slot.

bool CYIMaterial::IsLoaded ( ) const

Returns true if all the available textures and shader programs are uploaded to the GPU, false otherwise.

void CYIMaterial::SetBlendMode ( CYIRenderSystem::YI_BLEND_MODE  mode)

Set the blending mode for this material

void CYIMaterial::SetColor ( const CYIColor color)

Set the color for this material

void CYIMaterial::SetCullFace ( CYIRenderSystem::YI_CULL_FACE  eCullingMode)

Set the cullingMode to be used for this material.

void CYIMaterial::SetShaderProgram ( const std::shared_ptr< CYIAssetShaderProgram > &  pShaderProgram)

Sets the shader program. Null shader program is allowed, but won't deallocate the previously set shader program.

void CYIMaterial::SetTexture ( uint32_t  slot,
const std::shared_ptr< CYIAssetTextureBase > &  pTexture,
float *  pTextureMatrix = nullptr 
)

Assigns a texture to a texture slot. Null textures are allowed, but won't deallocate the previously set texture. Slot should be between 0 and the maximum amount of texture units available on your target platform.

Each texture has an associated 3x3 pTextureMatrix, which can be used to re-map texture coordinates to a different space inside the texture, this is useful for things like animated textures or texture atlases. Passing nullptr for this matrix equates to using the identity matrix. For platforms that don't support non-power-of-two textures, the matrix will be scaled to re-map the coordinate space to the subregion of the power-of-two texture that contains the image.

The provided pTexture will be bound to the slot sampler location.

void CYIMaterial::SetTexture ( uint32_t  slot,
const std::shared_ptr< CYIAssetTextureBase > &  pTexture,
const glm::mat3  textureMatrix 
)

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