PixelLightAPI  .
Public Member Functions | Public Attributes | Static Public Attributes
PLRenderer::Material Class Reference

Material resource class. More...

#include <Material.h>

Inheritance diagram for PLRenderer::Material:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual PLRENDERER_API ~Material ()
 Destructor.
MaterialManagerGetMaterialManager () const
 Returns the material manager this material is in.
PLRENDERER_API Materialoperator= (const Material &cSource)
 Copy operator.
PLRENDERER_API ParameterGetParameter (const PLCore::String &sName) const
 Gets a material/effect parameter.
PLRENDERER_API TextureBufferGetParameterTextureBuffer (const PLCore::String &sName) const
 Gets a texture buffer.
ParameterManagerGetParameterManager () const
 Returns the parameter manager of the material.
PLRENDERER_API bool ReloadTextures ()
 Reloads all textures used direct or indirect by the material.
PLCore::uint32 GetNumOfMaterials () const
 Returns the number of materials.
PLRENDERER_API bool AddMaterial (Material &cMaterial)
 Adds a material.
PLRENDERER_API MaterialGetMaterial (PLCore::uint32 nIndex) const
 Returns a material.
PLRENDERER_API bool RemoveMaterial (PLCore::uint32 nIndex)
 Removes a material.
PLRENDERER_API bool RemoveAllMaterials ()
 Removes all materials.
PLRENDERER_API EffectGetEffect () const
 Returns the effect of the material.
PLRENDERER_API void SetEffect (Effect *pFX=nullptr)
 Sets the effect of the material.
PLRENDERER_API bool GetBlend () const
 Returns whether the material should be blend or not.
PLRENDERER_API PLCore::uint32 GetNumOfPasses () const
 Gets the number of render passes the current technique is using.
PLRENDERER_API bool SetupPass (PLCore::uint32 nIndex=0) const
 Setup the given path.
virtual PLRENDERER_API bool LoadByFilename (const PLCore::String &sFilename, const PLCore::String &sParams="", const PLCore::String &sMethod="") override
 Loads the loadable from a file given by filename.
virtual PLRENDERER_API bool Reload () override
 Reloads the loadable.
virtual PLRENDERER_API bool Unload () override
 Unloads the loadable.
virtual PLRENDERER_API
PLCore::String 
GetLoadableTypeName () const override
 Returns the loadable type name.

Public Attributes

PLCore::Event< Parameter & > EventParameterChanged

Static Public Attributes

static PLRENDERER_API const
PLCore::String 
DiffuseMap
static PLRENDERER_API const
PLCore::String 
LightMap
static PLRENDERER_API const
PLCore::String 
AmbientOcclusionMap
static PLRENDERER_API const
PLCore::String 
EmissiveMap
static PLRENDERER_API const
PLCore::String 
ReflectionMap
static PLRENDERER_API const
PLCore::String 
ReflectivityMap
static PLRENDERER_API const
PLCore::String 
NormalMap
static PLRENDERER_API const
PLCore::String 
SpecularMap
static PLRENDERER_API const
PLCore::String 
HeightMap

Detailed Description

Material resource class.

Remarks:
A material is an abstract surface rendering description. Because a material is quite universal, this resource has a special load implementation if a filename is given:
  • If the given filename is a 'real' loadable material, (for instance 'Data/Materials/MyMaterial.mat') a 'Material' loader is used
  • Else, if the given filename is a loadable effect, an 'Effect' loader is used
  • Else, if the given filename is an texture animation 'tani', a texture animation is loaded
  • Else, if the given filename is a loadable image, an 'Image' loader is used to load in a texture
  • If there's a 'Create' in front of the given filename, an automatic texture is created
  • Else, ERROR! :)
  • The public static strings of this class are not any fixed function stuff, their only purpose is to offer some 'standardized' attribute names you should use where ever possible instead of inventing new ones that may lead to confusion!

Constructor & Destructor Documentation

virtual PLRENDERER_API PLRenderer::Material::~Material ( ) [virtual]

Destructor.


Member Function Documentation

Returns the material manager this material is in.

Returns:
The material manager this material is in
PLRENDERER_API Material& PLRenderer::Material::operator= ( const Material cSource)

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
This instance
PLRENDERER_API Parameter* PLRenderer::Material::GetParameter ( const PLCore::String sName) const

Gets a material/effect parameter.

Parameters:
[in]sNameParameter name
Returns:
The requested parameter, a null pointer on error
Remarks:
While ParameterManager::GetParameter(<Name>) ONLY returns parameters within the manager, this function will first look for a parameter with the given name within this material. If there's no such parameter within the material, the function will look for this parameter within it's own material list (sharing material parameters) and finally within the used effect. Because an effect may be used by multiple materials, try to add whenever possible an overwriting parameter to the material instead manipulating the effect parameter by hand.

Gets a texture buffer.

Parameters:
[in]sNameParameter name
Returns:
The requested texture buffer, a null pointer on error
See also:

Returns the parameter manager of the material.

Returns:
The parameter manager of the material
PLRENDERER_API bool PLRenderer::Material::ReloadTextures ( )

Reloads all textures used direct or indirect by the material.

Returns:
'true' if all went fine, else 'false'
PLCore::uint32 PLRenderer::Material::GetNumOfMaterials ( ) const [inline]

Returns the number of materials.

Returns:
The number of materials
PLRENDERER_API bool PLRenderer::Material::AddMaterial ( Material cMaterial)

Adds a material.

Parameters:
[in]cMaterialMaterial to add
Returns:
'true' if all went fine, else 'false'
PLRENDERER_API Material* PLRenderer::Material::GetMaterial ( PLCore::uint32  nIndex) const

Returns a material.

Parameters:
[in]nIndexIndex of the material to return
Returns:
Pointer to the requested material, a null pointer on error
PLRENDERER_API bool PLRenderer::Material::RemoveMaterial ( PLCore::uint32  nIndex)

Removes a material.

Parameters:
[in]nIndexIndex of the material to remove
Returns:
'true' if all went fine, else 'false'

Removes all materials.

Returns:
'true' if all went fine, else 'false'
PLRENDERER_API Effect* PLRenderer::Material::GetEffect ( ) const

Returns the effect of the material.

Returns:
The effect of the material, a null pointer if there's no effect
PLRENDERER_API void PLRenderer::Material::SetEffect ( Effect pFX = nullptr)

Sets the effect of the material.

Parameters:
[in]pFXThe effect of the material, a null pointer if there's no effect
PLRENDERER_API bool PLRenderer::Material::GetBlend ( ) const

Returns whether the material should be blend or not.

Returns:
'true' if the pass should be blend, else 'false'
Remarks:
This only a general setting whether the material is blend or not. Because transparent objects should be rendered after all solid objects this setting indicates when the object should be rendered.
PLRENDERER_API PLCore::uint32 PLRenderer::Material::GetNumOfPasses ( ) const

Gets the number of render passes the current technique is using.

Returns:
Number of passes
PLRENDERER_API bool PLRenderer::Material::SetupPass ( PLCore::uint32  nIndex = 0) const

Setup the given path.

Parameters:
[in]nIndexIndex of the path to setup
Returns:
'true' if all went fine, else 'false'
virtual PLRENDERER_API bool PLRenderer::Material::LoadByFilename ( const PLCore::String sFilename,
const PLCore::String sParams = "",
const PLCore::String sMethod = "" 
) [override, virtual]

Loads the loadable from a file given by filename.

Parameters:
[in]sFilenameLoadable filename
[in]sParamsOptional load method parameters, can be an empty string
[in]sMethodOptional name of the load method to use, can be an empty string
Returns:
'true' if all went fine, else 'false'
Note:
  • If no method name was provided, 'Load' if sParams is empty, or 'LoadParams' if sParams is not empty is used automatically

Reimplemented from PLCore::Loadable.

virtual PLRENDERER_API bool PLRenderer::Material::Reload ( ) [override, virtual]

Reloads the loadable.

Returns:
'true' if all went fine, else 'false' (maybe there's nothing loaded?)
Note:
  • Same as pLoadable->Load(pLoadable->GetAbsFilename())

Reimplemented from PLCore::Loadable.

virtual PLRENDERER_API bool PLRenderer::Material::Unload ( ) [override, virtual]

Unloads the loadable.

Returns:
'true' if all went fine, else 'false'

Reimplemented from PLCore::Loadable.

virtual PLRENDERER_API PLCore::String PLRenderer::Material::GetLoadableTypeName ( ) const [override, virtual]

Returns the loadable type name.

Returns:
The loadable type name

Reimplemented from PLCore::Loadable.


Member Data Documentation

PLRENDERER_API const PLCore::String PLRenderer::Material::DiffuseMap [static]

'DiffuseMap' string (other usual name: 'decal map')

PLRENDERER_API const PLCore::String PLRenderer::Material::LightMap [static]

'LightMap' string (global ambient lighting)

'AmbientOcclusionMap' string (global ambient occlusion)

PLRENDERER_API const PLCore::String PLRenderer::Material::EmissiveMap [static]

'EmissiveMap' string (other usual name: 'self illumination map')

PLRENDERER_API const PLCore::String PLRenderer::Material::ReflectionMap [static]

'ReflectionMap' string (other usual name: 'environment map')

'ReflectivityMap' string

PLRENDERER_API const PLCore::String PLRenderer::Material::NormalMap [static]

'NormalMap' string

PLRENDERER_API const PLCore::String PLRenderer::Material::SpecularMap [static]

'SpecularMap' string

PLRENDERER_API const PLCore::String PLRenderer::Material::HeightMap [static]

'HeightMap' string (other usual name: 'bump map')

Parameter changed (created, destroyed, value changed) event, changed parameter as parameter


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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:22
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported