END_TEST;
}
-int UtcDaliMaterialSetTextureAffectsTransparency(void)
-{
- TestApplication application;
-
- Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
-
- Material material = CreateMaterial();
- material.AddTexture( image, "sTexture" );
-
- Geometry geometry = CreateQuadGeometry();
- Renderer renderer = Renderer::New( geometry, material );
- Actor actor = Actor::New();
- actor.AddRenderer(renderer);
- actor.SetParentOrigin( ParentOrigin::CENTER );
- actor.SetSize(400, 400);
- Stage::GetCurrent().Add( actor );
-
- TestGlAbstraction& gl = application.GetGlAbstraction();
-
- // Test SetAffectsTransparency( false )
- material.SetTextureAffectsTransparency( 0, false );
-
- gl.EnableEnableDisableCallTrace(true);
- application.SendNotification();
- application.Render();
-
- TraceCallStack& glEnableStack = gl.GetEnableDisableTrace();
- std::ostringstream blendStr;
- blendStr << GL_BLEND;
- DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- // Test SetAffectsTransparency( true )
- material.SetTextureAffectsTransparency( 0, true );
-
- glEnableStack.Reset();
- gl.EnableEnableDisableCallTrace(true);
- application.SendNotification();
- application.Render();
-
- DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
-
- END_TEST;
-}
-
int UtcDaliMaterialAddTexture01(void)
{
TestApplication application;
return GetImplementation(*this).GetTextureIndex( uniformName );
}
-void Material::SetTextureAffectsTransparency( size_t index, bool affectsTransparency )
-{
- GetImplementation(*this).SetTextureAffectsTransparency( index, affectsTransparency );
-}
-
std::size_t Material::GetNumberOfTextures() const
{
return GetImplementation(*this).GetNumberOfTextures();
*/
void SetTextureUniformName( size_t index, const std::string& uniformName );
- /**
- * @brief Establish if a given texture will affect the transparency of the material ( true by default )
- *
- * @param[in] index The index of the texture in the array of textures
- * @param[in] affectsTransparency True if the texture affects transparency, false otherwise
- */
- void SetTextureAffectsTransparency( size_t index, bool affectsTransparency );
-
/*
* @brief Retrive the index of a texture given its uniform name
*
return -1;
}
-void Material::SetTextureAffectsTransparency( size_t index, bool affectsTransparency )
-{
- if( index < GetNumberOfTextures() )
- {
- SceneGraph::SetTextureAffectsTransparencyMessage( GetEventThreadServices(), *mSceneObject, index, affectsTransparency );
- }
-}
-
size_t Material::GetNumberOfTextures() const
{
return mTextures.size();
int GetTextureIndex( const std::string& uniformName );
/**
- * @copydoc Dali::Material::SetTextureAffectsTransparency()
- */
- void SetTextureAffectsTransparency( size_t index, bool affectsTransparency );
-
- /**
* @copydoc Dali::Material::GetNumberOfTextures()
*/
size_t GetNumberOfTextures() const;
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 reraly used
+ Vector4* mBlendColor; ///< Local copy of blend color, pointer only as its raraly used
bool mOnStage;
};
mTextureId(),
mUniformName(),
mIsFullyOpaque(),
- mAffectsTransparency(),
mConnectionObservers(),
mFaceCullingMode( Dali::Material::NONE ),
mBlendingMode( Dali::BlendingMode::AUTO ),
{
mBlendPolicy = OPAQUE;
- // @todo MESH_REWORK Add dirty flags to reduce processing.
-
switch( mBlendingMode )
{
case BlendingMode::OFF:
{
bool opaque = true;
- // @todo: MESH_REWORK - Change hints for new SceneGraphShader:
+ // @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( opaque )
{
- unsigned int opaqueCount=0;
- unsigned int affectingCount=0;
size_t textureCount( GetTextureCount() );
for( unsigned int i(0); i<textureCount; ++i )
{
- if( mAffectsTransparency[i] )
+ if( !mIsFullyOpaque[i] )
{
- ++affectingCount;
- if( mIsFullyOpaque[i] )
- {
- ++opaqueCount;
- }
+ opaque = false;
}
}
- opaque = (opaqueCount == affectingCount);
}
mBlendPolicy = opaque ? Material::USE_ACTOR_COLOR : Material::TRANSPARENT;
mUniformName.push_back( name );
mSamplers.PushBack( sampler );
mIsFullyOpaque.PushBack( false );
- mAffectsTransparency.PushBack( true );
mConnectionObservers.ConnectionsChanged(*this);
}
mUniformName.erase( mUniformName.begin() + index );
mSamplers.Erase( mSamplers.Begin()+index );
mIsFullyOpaque.Erase( mIsFullyOpaque.Begin()+index );
- mAffectsTransparency.Erase( mAffectsTransparency.Begin()+index );
mConnectionObservers.ConnectionsChanged( *this );
}
*/
void SetTextureUniformName( size_t index, const std::string& uniformName );
- /**
- * Establish if a given texture will affect the transparency of the object ( true by default )
- * @param[in] index The index of the texture in the array of textures
- * @param[in] affectsTransparency True if the texture affects transparency, false otherwise
- */
- void SetAffectsTransparency( size_t index, bool affectsTransparency )
- {
- mAffectsTransparency[index] = affectsTransparency;
- mConnectionObservers.ConnectionsChanged(*this);
- }
-
public: // Implementation of MaterialDataProvider
/**
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;
- Vector< bool > mAffectsTransparency;
- ConnectionChangePropagator mConnectionObservers;
+ 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
+ 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
};
new (slot) LocalType( &material, &Material::SetTextureUniformName, index, uniformName );
}
-inline void SetTextureAffectsTransparencyMessage( EventThreadServices& eventThreadServices, const Material& material, size_t index, bool affectsTransparency )
-{
- typedef MessageValue2< Material, size_t, bool > LocalType;
-
- // Reserve some memory inside the message queue
- unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &material, &Material::SetAffectsTransparency, index, affectsTransparency );
-}
-
} // namespace SceneGraph
} // namespace Internal