Dali::Material::FaceCullingMode mFaceCullingMode; ///< Local copy of face culling mode
BlendingMode::Type mBlendingMode; ///< Local copy of blending mode
BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask
- Vector4* mBlendColor; ///< Local copy of blend color, pointer only as its raraly used
+ Vector4* mBlendColor; ///< Local copy of blend color, pointer only as its rarely used
bool mOnStage;
};
{
context.SetCustomBlendColor( *blendColor );
}
+ else
+ {
+ context.SetDefaultBlendColor();
+ }
const BlendingOptions& blending = material.GetBlendingOptions();
// Set blend source & destination factors
/**
* The UniformMap class is used to map uniform names to property values. It is available
* in all of the classes responsible for rendering:
- * Actor, Renderer, Geometry, PropertyBuffer, Material, Sampler, Shader.
+ * Actor, Renderer, Geometry, Material, Shader.
*
* It can be observed for changes to the mapping table.
*/
mSamplers(),
mTextureId(),
mUniformName(),
- mIsFullyOpaque(),
mConnectionObservers(),
mFaceCullingMode( Dali::Material::NONE ),
mBlendingMode( Dali::BlendingMode::AUTO ),
mBlendingOptions(), // initializes to defaults
- mBlendPolicy( OPAQUE )
+ mBlendPolicy( OPAQUE ),
+ mTexturesRequireBlending( false )
{
// Observe own property-owner's uniform map
AddUniformMapObserver( *this );
}
case BlendingMode::AUTO:
{
- bool opaque = true;
-
// @todo: Change hints for new SceneGraphShader:
// If shader hint OUTPUT_IS_OPAQUE is enabled, set policy to ALWAYS_OPAQUE
// If shader hint OUTPUT_IS_TRANSPARENT is enabled, set policy to ALWAYS_TRANSPARENT
// else test remainder, and set policy to either ALWAYS_TRANSPARENT or USE_ACTOR_COLOR
- if( mShader->GeometryHintEnabled( Dali::ShaderEffect::HINT_BLENDING ) )
+ if( mTexturesRequireBlending ||
+ mShader->GeometryHintEnabled( Dali::ShaderEffect::HINT_BLENDING ) )
{
- opaque = false;
+ mBlendPolicy = Material::TRANSPARENT;
}
-
- if( opaque )
+ else
{
- size_t textureCount( GetTextureCount() );
- for( unsigned int i(0); i<textureCount; ++i )
- {
- if( !mIsFullyOpaque[i] )
- {
- opaque = false;
- }
- }
+ mBlendPolicy = Material::USE_ACTOR_COLOR;
}
-
- mBlendPolicy = opaque ? Material::USE_ACTOR_COLOR : Material::TRANSPARENT;
}
}
}
mTextureId.PushBack( id );
mUniformName.push_back( name );
mSamplers.PushBack( sampler );
- mIsFullyOpaque.PushBack( false );
mConnectionObservers.ConnectionsChanged(*this);
}
mTextureId.Erase( mTextureId.Begin()+index );
mUniformName.erase( mUniformName.begin() + index );
mSamplers.Erase( mSamplers.Begin()+index );
- mIsFullyOpaque.Erase( mIsFullyOpaque.Begin()+index );
mConnectionObservers.ConnectionsChanged( *this );
}
mConnectionObservers.ConnectedUniformMapChanged();
}
+void Material::SetTexturesRequireBlending( bool texturesRequireBlending )
+{
+ mTexturesRequireBlending = texturesRequireBlending;
+}
+
} // namespace SceneGraph
} // namespace Internal
*/
virtual void ConnectedUniformMapChanged();
-public: // PropertyOwner implementation
+public:
- void SetIsFullyOpaque( size_t index, bool isFullyOpaque )
- {
- mIsFullyOpaque[index] = isFullyOpaque;
- }
+ /**
+ * @param texturesRequireBlending, true if any of the textures requires blending
+ */
+ void SetTexturesRequireBlending( bool texturesRequireBlending );
private: // Data
- Shader* mShader;
- Vector4* mBlendColor; // not double buffered as its not animateable and not frequently changed
- Vector< Render::Sampler* > mSamplers; // Not owned
- Vector< ResourceId > mTextureId;
- std::vector< std::string > mUniformName;
- Vector< bool > mIsFullyOpaque;
- ConnectionChangePropagator mConnectionObservers;
- Dali::Material::FaceCullingMode mFaceCullingMode; // not double buffered as its not animateable and not frequently changed
- BlendingMode::Type mBlendingMode; // not double buffered as its not animateable and not frequently changed
- BlendingOptions mBlendingOptions; // not double buffered as its not animateable and not frequently changed
- BlendPolicy mBlendPolicy; ///< The blend policy as determined by PrepareRender
+ Shader* mShader;
+ Vector4* mBlendColor; // not double buffered as its not animateable and not frequently changed
+ Vector< Render::Sampler* > mSamplers; // Not owned
+ Vector< ResourceId > mTextureId;
+ std::vector< std::string > mUniformName;
+ ConnectionChangePropagator mConnectionObservers;
+ Dali::Material::FaceCullingMode mFaceCullingMode; // not double buffered as its not animateable and not frequently changed
+ BlendingMode::Type mBlendingMode; // not double buffered as its not animateable and not frequently changed
+ BlendingOptions mBlendingOptions; // not double buffered as its not animateable and not frequently changed
+ BlendPolicy mBlendPolicy; ///< The blend policy as determined by PrepareRender
+ bool mTexturesRequireBlending;
};
CompleteStatusManager& completeStatusManager = mSceneController->GetCompleteStatusManager();
mResourcesReady = false;
-
mFinishedResourceAcquisition = false;
// Can only be considered ready when all the scene graph objects are connected to the renderer
unsigned int frameBufferCount = 0;
size_t textureCount( mMaterial->GetTextureCount() );
- for( unsigned int i(0); i<textureCount; ++i )
+ if( textureCount > 0 )
{
- ResourceId textureId = mMaterial->GetTextureId(i);
- BitmapMetadata metaData = resourceManager.GetBitmapMetadata( textureId );
-
- mMaterial->SetIsFullyOpaque( i, metaData.IsFullyOpaque() );
-
- switch( completeStatusManager.GetStatus( textureId ) )
+ unsigned int opaqueCount = 0;
+ for( unsigned int i(0); i<textureCount; ++i )
{
- case CompleteStatusManager::NOT_READY:
+ ResourceId textureId = mMaterial->GetTextureId(i);
+ BitmapMetadata metaData = resourceManager.GetBitmapMetadata( textureId );
+ if( metaData.IsFullyOpaque() )
{
- if( metaData.GetIsFramebuffer() )
- {
- frameBufferCount++;
- }
- if( completeStatusManager.FindResourceTracker(textureId) != NULL )
+ ++opaqueCount;
+ }
+
+ switch( completeStatusManager.GetStatus( textureId ) )
+ {
+ case CompleteStatusManager::NOT_READY:
{
- bool found = false;
- std::size_t numTrackedResources = mTrackedResources.Count();
- for( size_t i=0; i < numTrackedResources; ++i )
+ if( metaData.GetIsFramebuffer() )
{
- if(mTrackedResources[i] == textureId)
+ frameBufferCount++;
+ }
+ if( completeStatusManager.FindResourceTracker(textureId) != NULL )
+ {
+ bool found = false;
+ std::size_t numTrackedResources = mTrackedResources.Count();
+ for( size_t i=0; i < numTrackedResources; ++i )
+ {
+ if(mTrackedResources[i] == textureId)
+ {
+ found = true;
+ break;
+ }
+ }
+ if( ! found )
{
- found = true;
- break;
+ mTrackedResources.PushBack( textureId );
}
}
- if( ! found )
+ else
{
- mTrackedResources.PushBack( textureId );
+ mHasUntrackedResources = true;
}
}
- else
+ break;
+
+ case CompleteStatusManager::COMPLETE:
{
- mHasUntrackedResources = true;
+ completeCount++;
}
- }
- break;
-
- case CompleteStatusManager::COMPLETE:
- {
- completeCount++;
- }
- break;
+ break;
- case CompleteStatusManager::NEVER:
- {
- neverCount++;
+ case CompleteStatusManager::NEVER:
+ {
+ neverCount++;
+ }
+ break;
}
- break;
}
+ mMaterial->SetTexturesRequireBlending( opaqueCount != textureCount );
}
// We are ready if all samplers are complete, or those that aren't are framebuffers