Dali 3D User Interface Engine
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Dali::Internal::SceneGraph::Material Class Reference

#include <scene-graph-material.h>

Inheritance diagram for Dali::Internal::SceneGraph::Material:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::SceneGraph::Material:
Collaboration graph
[legend]

Public Member Functions

virtual ~Material ()
 Destructor. More...
 
void operator delete (void *ptr)
 Overriden delete operator Deletes the material from its global memory pool. More...
 
void Prepare (const ResourceManager &resourceManager)
 Prepare material, check texture loading status, opacity etc. More...
 
void SetShader (Shader *shader)
 Set the shader effect for this material. More...
 
ShaderGetShader () const
 Get the shader effect of this material. More...
 
void AddTexture (const std::string &name, ResourceId id, Render::Sampler *sampler)
 Adds a new texture to be used by the material. More...
 
void RemoveTexture (size_t index)
 Removes a texture from the material. More...
 
void SetTextureImage (size_t index, ResourceId id)
 Sets the image to be used by a given texture. More...
 
void SetTextureSampler (size_t index, Render::Sampler *sampler)
 Set the sampler used by a given texture. More...
 
void SetTextureUniformName (size_t index, const std::string &uniformName)
 Set the uniform name of a given texture. More...
 
bool IsTranslucent () const
 Return whether the textures or the shader require the opacity to be translucent. More...
 
void GetResourcesStatus (bool &resourcesReady, bool &finishedResourceAcquisition)
 Get the material resource status Note, we need two values as it's possible that some resource failed to load in which case resourcesReady is false (the material is not good to be rendered) but finishedResourceAcquisition if true as there is no more loading going on. More...
 
void ConnectToSceneGraph (SceneController &sceneController, BufferIndex bufferIndex)
 Connect the object to the scene graph. More...
 
void DisconnectFromSceneGraph (SceneController &sceneController, BufferIndex bufferIndex)
 Disconnect the object from the scene graph. More...
 
void AddConnectionObserver (ConnectionChangePropagator::Observer &observer)
  More...
 
void RemoveConnectionObserver (ConnectionChangePropagator::Observer &observer)
  More...
 
ResourceId GetTextureId (size_t index)
 Get the ResourceId of a texture used by the material. More...
 
const std::string & GetTextureUniformName (size_t index)
 Get the uniform name of a texture used by the material. More...
 
Render::SamplerGetTextureSampler (size_t index)
 Get the sampler of a texture used by the material. More...
 
size_t GetTextureCount ()
 Get the number of textures used by the material. More...
 
virtual void UniformMappingsChanged (const UniformMap &mappings)
  More...
 
virtual void ConnectionsChanged (PropertyOwner &owner)
 Inform the observers that the connections to the object have changed. More...
 
virtual void ConnectedUniformMapChanged ()
 Inform the observers that the uniform map of this or a connected object has changed. More...
 
- Public Member Functions inherited from Dali::Internal::SceneGraph::PropertyOwner
virtual ~PropertyOwner ()
 Virtual destructor; this is intended as a base class. More...
 
void AddObserver (Observer &observer)
 Add an observer. More...
 
void RemoveObserver (Observer &observer)
 Remove an observer. More...
 
bool IsObserved ()
 This method can be used to determine if there is an animation or constraint that is using this property owner. More...
 
void Destroy ()
 Called just before destruction to disconnect all observers and remove constraints. More...
 
void ConnectToSceneGraph ()
 Notify all observers that the object has been connected This occurs when the object is connected to the scene-graph during UpdateManager::Update(). More...
 
void DisconnectFromSceneGraph (BufferIndex updateBufferIndex)
 Notify all observers that the object has been disconnected and remove constraints. More...
 
void InstallCustomProperty (PropertyBase *property)
 Install a custom property. More...
 
OwnedPropertyContainerGetCustomProperties ()
 Retrieve the custom properties owned by the object. More...
 
const OwnedPropertyContainerGetCustomProperties () const
 Retrieve the custom properties owned by the object. More...
 
void ResetToBaseValues (BufferIndex updateBufferIndex)
 Reset animatable properties to the corresponding base values. More...
 
void ApplyConstraint (ConstraintBase *constraint)
 Apply a constraint. More...
 
void RemoveConstraint (ConstraintBase *constraint)
 Begin removal of constraints. More...
 
ConstraintOwnerContainerGetConstraints ()
 Retrieve the constraints that are currently applied. More...
 
virtual void AddUniformMapping (UniformPropertyMapping *map)
 Add a map to the mappings table. More...
 
virtual void RemoveUniformMapping (const std::string &uniformName)
 Remove a map from the mappings table. More...
 
const UniformMapGetUniformMap () const
 Get the mappings table. More...
 
void AddUniformMapObserver (UniformMap::Observer &observer)
  More...
 
void RemoveUniformMapObserver (UniformMap::Observer &observer)
  More...
 
- Public Member Functions inherited from Dali::Internal::SceneGraph::ConnectionChangePropagator::Observer
virtual void ObservedObjectDestroyed (PropertyOwner &object)
 Inform the observer of the object that the object is about to be destroyed. More...
 

Static Public Member Functions

static MaterialNew ()
 Construct a new Material. More...
 
- Static Public Member Functions inherited from Dali::Internal::SceneGraph::PropertyOwner
static PropertyOwnerNew ()
 Create a property owner. More...
 

Private Member Functions

 Material ()
 Protected constructor; See also Material::New() More...
 

Private Attributes

ShadermShader
 
Vector< Render::Sampler * > mSamplers
 
Vector< ResourceIdmTextureId
 
std::vector< std::string > mUniformName
 
ConnectionChangePropagator mConnectionObservers
 
bool mResourcesReady
 if the material is ready to be rendered More...
 
bool mFinishedResourceAcquisition
 if resource loading is completed More...
 
bool mMaterialChanged
 if the material has changed since the last frame More...
 
bool mIsTranslucent
 if the textures or the shader require the opacity to be translucent More...
 

Additional Inherited Members

- Protected Member Functions inherited from Dali::Internal::SceneGraph::PropertyOwner
 PropertyOwner ()
 Protected constructor. More...
 
- Protected Attributes inherited from Dali::Internal::SceneGraph::PropertyOwner
OwnedPropertyContainer mCustomProperties
 Properties provided with InstallCustomProperty() More...
 
UniformMap mUniformMaps
 Container of owned uniform maps. More...
 

Detailed Description

Definition at line 47 of file scene-graph-material.h.

Constructor & Destructor Documentation

Dali::Internal::SceneGraph::Material::~Material ( )
virtual

Destructor.

Definition at line 64 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::Destroy(), and mConnectionObservers.

Here is the call graph for this function:

Dali::Internal::SceneGraph::Material::Material ( )
private

Protected constructor; See also Material::New()

Definition at line 50 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::PropertyOwner::AddUniformMapObserver().

Referenced by New().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Function Documentation

void Dali::Internal::SceneGraph::Material::AddConnectionObserver ( ConnectionChangePropagator::Observer observer)

Definition at line 217 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::Add(), and mConnectionObservers.

Referenced by Dali::Internal::SceneGraph::Renderer::SetMaterial().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::AddTexture ( const std::string &  name,
ResourceId  id,
Render::Sampler sampler 
)

Adds a new texture to be used by the material.

Parameters
[in]imageThe image used by the texture
[in]uniformNameThe uniform name of the texture
[in]samplerSampling parameters. If not provided the default sampling parameters will be used

Definition at line 163 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), mConnectionObservers, mMaterialChanged, mSamplers, mTextureId, mUniformName, and Dali::Vector< T, IsTrivialType >::PushBack().

Referenced by Dali::Internal::SceneGraph::AddTextureMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::ConnectedUniformMapChanged ( )
virtual

Inform the observers that the uniform map of this or a connected object has changed.

Implements Dali::Internal::SceneGraph::ConnectionChangePropagator::Observer.

Definition at line 242 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectedUniformMapChanged(), and mConnectionObservers.

Here is the call graph for this function:

void Dali::Internal::SceneGraph::Material::ConnectionsChanged ( PropertyOwner owner)
virtual

Inform the observers that the connections to the object have changed.

Parameters
[in]objectThe connection owner

Implements Dali::Internal::SceneGraph::ConnectionChangePropagator::Observer.

Definition at line 234 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), mConnectionObservers, and mMaterialChanged.

Here is the call graph for this function:

void Dali::Internal::SceneGraph::Material::ConnectToSceneGraph ( SceneController sceneController,
BufferIndex  bufferIndex 
)

Connect the object to the scene graph.

Parameters
[in]sceneControllerThe scene controller - used for sending messages to render thread
[in]bufferIndexThe current buffer index - used for sending messages to render thread

Definition at line 209 of file scene-graph-material.cpp.

void Dali::Internal::SceneGraph::Material::DisconnectFromSceneGraph ( SceneController sceneController,
BufferIndex  bufferIndex 
)

Disconnect the object from the scene graph.

Parameters
[in]sceneControllerThe scene controller - used for sending messages to render thread
[in]bufferIndexThe current buffer index - used for sending messages to render thread

Definition at line 213 of file scene-graph-material.cpp.

void Dali::Internal::SceneGraph::Material::GetResourcesStatus ( bool &  resourcesReady,
bool &  finishedResourceAcquisition 
)

Get the material resource status Note, we need two values as it's possible that some resource failed to load in which case resourcesReady is false (the material is not good to be rendered) but finishedResourceAcquisition if true as there is no more loading going on.

Parameters
[out]resourcesReadyif the material is ready to be rendered
[out]finishedResourceAcquisitionif

Definition at line 203 of file scene-graph-material.cpp.

References mFinishedResourceAcquisition, and mResourcesReady.

Referenced by Dali::Internal::SceneGraph::Renderer::PrepareRender().

Here is the caller graph for this function:

Shader * Dali::Internal::SceneGraph::Material::GetShader ( ) const

Get the shader effect of this material.

Returns
the shader effect;

Definition at line 153 of file scene-graph-material.cpp.

References mShader.

Referenced by Dali::Internal::SceneGraph::AddRendererToRenderList(), Dali::Internal::SceneGraph::Renderer::NewRenderDataProvider(), and Dali::Internal::SceneGraph::Renderer::PrepareRender().

Here is the caller graph for this function:

size_t Dali::Internal::SceneGraph::Material::GetTextureCount ( )
inline

Get the number of textures used by the material.

Returns
The number of textures

Definition at line 202 of file scene-graph-material.h.

References mTextureId, and Dali::VectorBase::Size().

Referenced by Dali::Internal::SceneGraph::Renderer::NewRenderDataProvider().

Here is the call graph for this function:

Here is the caller graph for this function:

ResourceId Dali::Internal::SceneGraph::Material::GetTextureId ( size_t  index)
inline

Get the ResourceId of a texture used by the material.

Parameters
[in]indexThe index of the texture in the textures array
Returns
the ResourceId

Definition at line 173 of file scene-graph-material.h.

References mTextureId.

Referenced by Dali::Internal::SceneGraph::Renderer::NewRenderDataProvider().

Here is the caller graph for this function:

Render::Sampler* Dali::Internal::SceneGraph::Material::GetTextureSampler ( size_t  index)
inline

Get the sampler of a texture used by the material.

Parameters
[in]indexThe index of the texture in the textures array
Returns
the sampler used by the texture

Definition at line 193 of file scene-graph-material.h.

References mSamplers.

Referenced by Dali::Internal::SceneGraph::Renderer::NewRenderDataProvider().

Here is the caller graph for this function:

const std::string& Dali::Internal::SceneGraph::Material::GetTextureUniformName ( size_t  index)
inline

Get the uniform name of a texture used by the material.

Parameters
[in]indexThe index of the texture in the textures array
Returns
the uniform name

Definition at line 183 of file scene-graph-material.h.

References mUniformName.

Referenced by Dali::Internal::SceneGraph::Renderer::NewRenderDataProvider().

Here is the caller graph for this function:

bool Dali::Internal::SceneGraph::Material::IsTranslucent ( ) const

Return whether the textures or the shader require the opacity to be translucent.

Returns
The material's blend policy

Definition at line 158 of file scene-graph-material.cpp.

References mIsTranslucent.

Referenced by Dali::Internal::SceneGraph::Renderer::GetOpacity().

Here is the caller graph for this function:

Material * Dali::Internal::SceneGraph::Material::New ( )
static

Construct a new Material.

Definition at line 45 of file scene-graph-material.cpp.

References anonymous_namespace{scene-graph-material.cpp}::gMaterialMemoryPool, and Material().

Referenced by Dali::Internal::Material::Initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::operator delete ( void *  ptr)

Overriden delete operator Deletes the material from its global memory pool.

Definition at line 69 of file scene-graph-material.cpp.

References anonymous_namespace{scene-graph-material.cpp}::gMaterialMemoryPool.

void Dali::Internal::SceneGraph::Material::Prepare ( const ResourceManager resourceManager)
void Dali::Internal::SceneGraph::Material::RemoveConnectionObserver ( ConnectionChangePropagator::Observer observer)

Definition at line 222 of file scene-graph-material.cpp.

References mConnectionObservers, and Dali::Internal::SceneGraph::ConnectionChangePropagator::Remove().

Referenced by Dali::Internal::SceneGraph::Renderer::~Renderer().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::RemoveTexture ( size_t  index)

Removes a texture from the material.

Parameters
[in]indexThe index of the texture in the array of textures

Definition at line 173 of file scene-graph-material.cpp.

References Dali::Vector< T, IsTrivialType >::Begin(), Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), Dali::Vector< T, IsTrivialType >::Erase(), mConnectionObservers, mMaterialChanged, mSamplers, mTextureId, and mUniformName.

Referenced by Dali::Internal::SceneGraph::RemoveTextureMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::SetShader ( Shader shader)

Set the shader effect for this material.

Parameters
[in]shaderThe shader effect to use

Definition at line 142 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::PropertyOwner::AddUniformMapObserver(), Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), mConnectionObservers, mMaterialChanged, and mShader.

Referenced by Dali::Internal::SceneGraph::SetShaderMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::SetTextureImage ( size_t  index,
ResourceId  id 
)

Sets the image to be used by a given texture.

Parameters
[in]indexThe index of the texture in the array of textures
[in]imageThe new image

Definition at line 182 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), mConnectionObservers, mMaterialChanged, and mTextureId.

Referenced by Dali::Internal::SceneGraph::SetTextureImageMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::SetTextureSampler ( size_t  index,
Render::Sampler sampler 
)

Set the sampler used by a given texture.

Parameters
[in]indexThe index of the texture in the array of textures
[in]samplerThe new sampler

Definition at line 189 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), mConnectionObservers, and mSamplers.

Referenced by Dali::Internal::SceneGraph::SetTextureSamplerMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::SetTextureUniformName ( size_t  index,
const std::string &  uniformName 
)

Set the uniform name of a given texture.

Parameters
[in]indexThe index of the texture in the array of textures
[in]uniformNameThe new uniform name

Definition at line 196 of file scene-graph-material.cpp.

References Dali::Internal::SceneGraph::ConnectionChangePropagator::ConnectionsChanged(), mConnectionObservers, and mUniformName.

Referenced by Dali::Internal::SceneGraph::SetTextureUniformNameMessage().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::SceneGraph::Material::UniformMappingsChanged ( const UniformMap mappings)
virtual

Member Data Documentation

ConnectionChangePropagator Dali::Internal::SceneGraph::Material::mConnectionObservers
private
bool Dali::Internal::SceneGraph::Material::mFinishedResourceAcquisition
private

if resource loading is completed

Definition at line 240 of file scene-graph-material.h.

Referenced by GetResourcesStatus(), and Prepare().

bool Dali::Internal::SceneGraph::Material::mIsTranslucent
private

if the textures or the shader require the opacity to be translucent

Definition at line 242 of file scene-graph-material.h.

Referenced by IsTranslucent(), and Prepare().

bool Dali::Internal::SceneGraph::Material::mMaterialChanged
private

if the material has changed since the last frame

Definition at line 241 of file scene-graph-material.h.

Referenced by AddTexture(), ConnectionsChanged(), Prepare(), RemoveTexture(), SetShader(), and SetTextureImage().

bool Dali::Internal::SceneGraph::Material::mResourcesReady
private

if the material is ready to be rendered

Definition at line 239 of file scene-graph-material.h.

Referenced by GetResourcesStatus(), and Prepare().

Vector< Render::Sampler* > Dali::Internal::SceneGraph::Material::mSamplers
private
Shader* Dali::Internal::SceneGraph::Material::mShader
private

Definition at line 234 of file scene-graph-material.h.

Referenced by GetShader(), Prepare(), and SetShader().

Vector< ResourceId > Dali::Internal::SceneGraph::Material::mTextureId
private
std::vector< std::string > Dali::Internal::SceneGraph::Material::mUniformName
private

The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali