Dali 3D User Interface Engine
List of all members | Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes
Dali::Internal::Render::Renderer Class Reference

Renderers are used to render meshes These objects are used during RenderManager::Render(), so properties modified during the Update must either be double-buffered, or set via a message added to the RenderQueue. More...

#include <render-renderer.h>

Inheritance diagram for Dali::Internal::Render::Renderer:
Inheritance graph
[legend]
Collaboration diagram for Dali::Internal::Render::Renderer:
Collaboration graph
[legend]

Classes

struct  UniformIndexMap
 

Public Member Functions

void GlContextDestroyed ()
 Reset all GL resources. More...
 
void GlCleanup ()
 Release all GL resources. More...
 
 Renderer (SceneGraph::RenderDataProvider *dataProviders, SceneGraph::RenderGeometry *renderGeometry, unsigned int blendingBitmask, const Vector4 *blendColor, Dali::Renderer::FaceCullingMode faceCullingMode, bool preMultipliedAlphaEnabled)
 Constructor. More...
 
void SetRenderDataProvider (SceneGraph::RenderDataProvider *dataProviders)
 Change the data providers of the renderer. More...
 
void SetGeometry (SceneGraph::RenderGeometry *renderGeometry)
 Change the geometry used by the renderer. More...
 
void Initialize (Context &context, SceneGraph::TextureCache &textureCache, Render::UniformNameCache &uniformNameCache)
 Second-phase construction. More...
 
 ~Renderer ()
 Destructor. More...
 
void SetFaceCullingMode (Dali::Renderer::FaceCullingMode mode)
 Set the face-culling mode. More...
 
void SetBlendingBitMask (unsigned int bitmask)
 Set the bitmask for blending options. More...
 
void SetBlendColor (const Vector4 *color)
 Set the blend color for blending options. More...
 
void EnablePreMultipliedAlpha (bool preMultipled)
 Set whether the Pre-multiplied Alpha Blending is required. More...
 
void SetSampler (unsigned int samplerBitfield)
 Set the sampler used to render the set texture. More...
 
bool RequiresDepthTest () const
 Query whether the derived type of Renderer requires depth testing. More...
 
void Render (Context &context, SceneGraph::TextureCache &textureCache, BufferIndex bufferIndex, const SceneGraph::NodeDataProvider &node, SceneGraph::Shader &defaultShader, const Matrix &modelViewMatrix, const Matrix &viewMatrix, const Matrix &projectionMatrix, bool blend)
 Called to render during RenderManager::Render(). More...
 
void SetSortAttributes (BufferIndex bufferIndex, SceneGraph::RendererWithSortAttributes &sortAttributes) const
 Write the renderer's sort attributes to the passed in reference. More...
 
- Public Member Functions inherited from Dali::Internal::GlResourceOwner
virtual ~GlResourceOwner ()
 Virtual destructor. More...
 

Static Public Member Functions

static RendererNew (SceneGraph::RenderDataProvider *dataProviders, SceneGraph::RenderGeometry *renderGeometry, unsigned int blendingBitmask, const Vector4 *blendColor, Dali::Renderer::FaceCullingMode faceCullingMode, bool preMultipliedAlphaEnabled)
 Create a new renderer instance. More...
 

Public Attributes

OwnerPointer
< SceneGraph::RenderDataProvider
mRenderDataProvider
 

Private Types

typedef Dali::Vector
< UniformIndexMap
UniformIndexMappings
 

Private Member Functions

 Renderer (const Renderer &)
 
Rendereroperator= (const Renderer &rhs)
 
void SetBlending (Context &context, bool blend)
 Sets blending options. More...
 
void SetUniforms (BufferIndex bufferIndex, const SceneGraph::NodeDataProvider &node, Program &program)
 Set the uniforms from properties according to the uniform map. More...
 
void SetUniformFromProperty (BufferIndex bufferIndex, Program &program, UniformIndexMap &map)
 Set the program uniform in the map from the mapped property. More...
 
void BindTextures (SceneGraph::TextureCache &textureCache, Program &program)
 Bind the material textures in the samplers and setup the samplers. More...
 

Private Attributes

ContextmContext
 
SceneGraph::TextureCachemTextureCache
 
Render::UniformNameCachemUniformNameCache
 
SceneGraph::RenderGeometrymRenderGeometry
 
UniformIndexMappings mUniformIndexMap
 
Vector< GLintmAttributesLocation
 
BlendingOptions mBlendingOptions
 
Dali::Renderer::FaceCullingMode mFaceCullingMode
 Blending options including blend color, blend func and blend equation. More...
 
unsigned int mSamplerBitfield
 Mode of face culling. More...
 
bool mUpdateAttributesLocation:1
 Indicates attribute locations have changed. More...
 
bool mPremultipledAlphaEnabled:1
 Flag indicating whether the Pre-multiplied Alpha Blending is required. More...
 

Detailed Description

Renderers are used to render meshes These objects are used during RenderManager::Render(), so properties modified during the Update must either be double-buffered, or set via a message added to the RenderQueue.

Definition at line 61 of file render-renderer.h.

Member Typedef Documentation

Definition at line 251 of file render-renderer.h.

Constructor & Destructor Documentation

Dali::Internal::Render::Renderer::Renderer ( SceneGraph::RenderDataProvider dataProviders,
SceneGraph::RenderGeometry renderGeometry,
unsigned int  blendingBitmask,
const Vector4 blendColor,
Dali::Renderer::FaceCullingMode  faceCullingMode,
bool  preMultipliedAlphaEnabled 
)

Constructor.

Parameters
[in]dataProvidersThe data providers for the renderer
[in]renderGeometryThe geometry for the renderer
[in]blendingBitmaskA bitmask of blending options.
[in]blendColorThe blend color to pass to GL
[in]faceCullingModeThe face-culling mode.
[in]preMultipliedAlphaEnabledwhether alpha is pre-multiplied.

Definition at line 122 of file render-renderer.cpp.

References mBlendingOptions, Dali::Internal::BlendingOptions::SetBitmask(), and Dali::Internal::BlendingOptions::SetBlendColor().

Referenced by New().

Here is the call graph for this function:

Here is the caller graph for this function:

Dali::Internal::Render::Renderer::~Renderer ( )

Destructor.

Definition at line 159 of file render-renderer.cpp.

Dali::Internal::Render::Renderer::Renderer ( const Renderer )
private

Member Function Documentation

void Dali::Internal::Render::Renderer::BindTextures ( SceneGraph::TextureCache textureCache,
Program program 
)
private
void Dali::Internal::Render::Renderer::EnablePreMultipliedAlpha ( bool  preMultipled)

Set whether the Pre-multiplied Alpha Blending is required.

Parameters
[in]preMultipledwhether alpha is pre-multiplied.

Definition at line 420 of file render-renderer.cpp.

References mPremultipledAlphaEnabled.

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

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::GlCleanup ( )
virtual

Release all GL resources.

This means releasing buffer objects, textures. etc Context can be used, unless GlContextDestroyed has been called

Precondition
This method can only be called from the render-thread.

Implements Dali::Internal::GlResourceOwner.

Definition at line 216 of file render-renderer.cpp.

void Dali::Internal::Render::Renderer::GlContextDestroyed ( )
virtual

Reset all GL resources.

This method is called when context is or has been deleted. Context cannot be called from this method.

Precondition
This method can only be called from the render-thread.

Implements Dali::Internal::GlResourceOwner.

Definition at line 211 of file render-renderer.cpp.

References Dali::Internal::SceneGraph::RenderGeometry::GlContextDestroyed(), and mRenderGeometry.

Here is the call graph for this function:

void Dali::Internal::Render::Renderer::Initialize ( Context context,
SceneGraph::TextureCache textureCache,
Render::UniformNameCache uniformNameCache 
)

Second-phase construction.

This is called when the renderer is inside render thread

Parameters
[in]contextto use
[in]textureCacheto use
[in]uniformNameCacheto use

Definition at line 152 of file render-renderer.cpp.

References mContext, mTextureCache, and mUniformNameCache.

Referenced by Dali::Internal::SceneGraph::RenderManager::AddRenderer().

Here is the caller graph for this function:

Renderer * Dali::Internal::Render::Renderer::New ( SceneGraph::RenderDataProvider dataProviders,
SceneGraph::RenderGeometry renderGeometry,
unsigned int  blendingBitmask,
const Vector4 blendColor,
Dali::Renderer::FaceCullingMode  faceCullingMode,
bool  preMultipliedAlphaEnabled 
)
static

Create a new renderer instance.

Parameters
[in]dataProvidersThe data providers for the renderer
[in]renderGeometryThe geometry for the renderer
[in]blendingBitmaskA bitmask of blending options.
[in]blendColorThe blend color to pass to GL
[in]faceCullingModeThe face-culling mode.
[in]preMultipliedAlphaEnabledwhether alpha is pre-multiplied.

Definition at line 112 of file render-renderer.cpp.

References Renderer().

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

Here is the call graph for this function:

Here is the caller graph for this function:

Renderer& Dali::Internal::Render::Renderer::operator= ( const Renderer rhs)
private
void Dali::Internal::Render::Renderer::Render ( Context context,
SceneGraph::TextureCache textureCache,
BufferIndex  bufferIndex,
const SceneGraph::NodeDataProvider node,
SceneGraph::Shader defaultShader,
const Matrix modelViewMatrix,
const Matrix viewMatrix,
const Matrix projectionMatrix,
bool  blend 
)

Called to render during RenderManager::Render().

Parameters
[in]contextThe context used for rendering
[in]textureCacheThe texture cache used to get textures
[in]bufferIndexThe index of the previous update buffer.
[in]nodeThe node using this renderer
[in]defaultShaderin case there is no custom shader
[in]modelViewMatrixThe model-view matrix.
[in]viewMatrixThe view matrix.
[in]projectionMatrixThe projection matrix.

Definition at line 430 of file render-renderer.cpp.

References Dali::Vector4::a, Dali::Internal::SceneGraph::RenderGeometry::AttributesChanged(), Dali::Vector4::b, BindTextures(), Dali::Internal::Context::CullFace(), DALI_ASSERT_DEBUG, DALI_LOG_ERROR, Dali::Vector4::g, Dali::Internal::SceneGraph::RenderGeometry::GetAttributeLocationFromProgram(), Dali::Internal::SceneGraph::NodeDataProvider::GetModelMatrix(), Dali::Internal::SceneGraph::Shader::GetProgram(), Dali::Internal::SceneGraph::NodeDataProvider::GetRenderColor(), Dali::Internal::SceneGraph::RenderDataProvider::GetShader(), Dali::Internal::Program::GetUniformLocation(), mAttributesLocation, mFaceCullingMode, mPremultipledAlphaEnabled, mRenderDataProvider, mRenderGeometry, mUpdateAttributesLocation, Dali::Vector4::r, SetBlending(), Dali::Internal::anonymous_namespace{render-renderer.cpp}::SetMatrices(), Dali::Internal::Program::SetUniform4f(), SetUniforms(), Dali::Internal::Program::UNIFORM_COLOR, Dali::Internal::Program::UNIFORM_UNKNOWN, Dali::Internal::SceneGraph::RenderGeometry::UploadAndDraw(), and Dali::Internal::Program::Use().

Referenced by Dali::Internal::Render::ProcessRenderList().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Dali::Internal::Render::Renderer::RequiresDepthTest ( ) const

Query whether the derived type of Renderer requires depth testing.

Returns
True if the renderer requires depth testing.

Definition at line 178 of file render-renderer.cpp.

References mRenderGeometry, and Dali::Internal::SceneGraph::RenderGeometry::RequiresDepthTest().

Referenced by Dali::Internal::SceneGraph::AddColorRenderers(), and Dali::Internal::Render::ProcessRenderList().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetBlendColor ( const Vector4 color)

Set the blend color for blending options.

Parameters
[in]blendColorThe blend color to pass to GL

Definition at line 415 of file render-renderer.cpp.

References mBlendingOptions, and Dali::Internal::BlendingOptions::SetBlendColor().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetBlending ( Context context,
bool  blend 
)
private
void Dali::Internal::Render::Renderer::SetBlendingBitMask ( unsigned int  bitmask)

Set the bitmask for blending options.

Parameters
[in]bitmaskA bitmask of blending options.

Definition at line 410 of file render-renderer.cpp.

References mBlendingOptions, and Dali::Internal::BlendingOptions::SetBitmask().

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

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetFaceCullingMode ( Dali::Renderer::FaceCullingMode  mode)

Set the face-culling mode.

Parameters
[in]modeThe face-culling mode.

Definition at line 405 of file render-renderer.cpp.

References mFaceCullingMode.

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

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetGeometry ( SceneGraph::RenderGeometry renderGeometry)

Change the geometry used by the renderer.

Parameters
[in]renderGeometryThe new geometry

Definition at line 169 of file render-renderer.cpp.

References mRenderGeometry, and mUpdateAttributesLocation.

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

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetRenderDataProvider ( SceneGraph::RenderDataProvider dataProviders)

Change the data providers of the renderer.

Parameters
[in]dataProvidersThe data providers

Definition at line 163 of file render-renderer.cpp.

References mRenderDataProvider, and mUpdateAttributesLocation.

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

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetSampler ( unsigned int  samplerBitfield)

Set the sampler used to render the set texture.

Parameters
[in]samplerBitfieldThe packed sampler options used to render.

Definition at line 425 of file render-renderer.cpp.

References mSamplerBitfield.

void Dali::Internal::Render::Renderer::SetSortAttributes ( BufferIndex  bufferIndex,
SceneGraph::RendererWithSortAttributes sortAttributes 
) const

Write the renderer's sort attributes to the passed in reference.

Parameters
[in]bufferIndexThe current update buffer index.
[out]sortAttributes

Definition at line 496 of file render-renderer.cpp.

References Dali::Internal::SceneGraph::RendererWithSortAttributes::geometry, Dali::Internal::SceneGraph::RenderDataProvider::GetShader(), Dali::Internal::SceneGraph::RenderDataProvider::GetTextures(), Dali::Integration::InvalidResourceId, mRenderDataProvider, mRenderGeometry, Dali::Internal::SceneGraph::RendererWithSortAttributes::shader, and Dali::Internal::SceneGraph::RendererWithSortAttributes::textureResourceId.

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

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Internal::Render::Renderer::SetUniformFromProperty ( BufferIndex  bufferIndex,
Program program,
UniformIndexMap map 
)
private
void Dali::Internal::Render::Renderer::SetUniforms ( BufferIndex  bufferIndex,
const SceneGraph::NodeDataProvider node,
Program program 
)
private

Member Data Documentation

Vector<GLint> Dali::Internal::Render::Renderer::mAttributesLocation
private

Definition at line 254 of file render-renderer.h.

Referenced by Render().

BlendingOptions Dali::Internal::Render::Renderer::mBlendingOptions
private

Definition at line 256 of file render-renderer.h.

Referenced by Renderer(), SetBlendColor(), SetBlending(), and SetBlendingBitMask().

Context* Dali::Internal::Render::Renderer::mContext
private

Definition at line 240 of file render-renderer.h.

Referenced by Initialize().

Dali::Renderer::FaceCullingMode Dali::Internal::Render::Renderer::mFaceCullingMode
private

Blending options including blend color, blend func and blend equation.

Definition at line 257 of file render-renderer.h.

Referenced by Render(), and SetFaceCullingMode().

bool Dali::Internal::Render::Renderer::mPremultipledAlphaEnabled
private

Flag indicating whether the Pre-multiplied Alpha Blending is required.

Definition at line 261 of file render-renderer.h.

Referenced by EnablePreMultipliedAlpha(), and Render().

OwnerPointer< SceneGraph::RenderDataProvider > Dali::Internal::Render::Renderer::mRenderDataProvider
SceneGraph::RenderGeometry* Dali::Internal::Render::Renderer::mRenderGeometry
private
unsigned int Dali::Internal::Render::Renderer::mSamplerBitfield
private

Mode of face culling.

Sampler options used for texture filtering

Definition at line 259 of file render-renderer.h.

Referenced by SetSampler().

SceneGraph::TextureCache* Dali::Internal::Render::Renderer::mTextureCache
private

Definition at line 241 of file render-renderer.h.

Referenced by Initialize().

UniformIndexMappings Dali::Internal::Render::Renderer::mUniformIndexMap
private

Definition at line 252 of file render-renderer.h.

Referenced by SetUniforms().

Render::UniformNameCache* Dali::Internal::Render::Renderer::mUniformNameCache
private

Definition at line 242 of file render-renderer.h.

Referenced by BindTextures(), and Initialize().

bool Dali::Internal::Render::Renderer::mUpdateAttributesLocation
private

Indicates attribute locations have changed.

Definition at line 260 of file render-renderer.h.

Referenced by Render(), SetGeometry(), and SetRenderDataProvider().


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