{
TestApplication application;
- tet_infoline("Test SetDepthIndex, GetCurrentDepthIndex");
+ tet_infoline("Test SetDepthIndex, GetDepthIndex");
Material material = CreateMaterial(1.0f);
Geometry geometry = CreateQuadGeometry();
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentDepthIndex(), 0, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetDepthIndex(), 0, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 0, TEST_LOCATION );
renderer.SetDepthIndex(1);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentDepthIndex(), 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetDepthIndex(), 1, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 1, TEST_LOCATION );
renderer.SetDepthIndex(10);
application.SendNotification();
application.Render(0);
- DALI_TEST_EQUALS( renderer.GetCurrentDepthIndex(), 10, TEST_LOCATION );
+ DALI_TEST_EQUALS( renderer.GetDepthIndex(), 10, TEST_LOCATION );
DALI_TEST_EQUALS( renderer.GetProperty<int>(Renderer::Property::DEPTH_INDEX), 10, TEST_LOCATION );
END_TEST;
* |name |type |writable|animatable|constraint-input|enum for index-checking|
*/
DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "depth-index", INTEGER, true, true, true, Dali::Renderer::Property::DEPTH_INDEX )
+DALI_PROPERTY( "depth-index", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX )
DALI_PROPERTY_TABLE_END( DEFAULT_OBJECT_PROPERTY_START_INDEX )
const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> RENDERER_IMPL = { DEFAULT_PROPERTY_DETAILS };
void Renderer::SetDepthIndex( int depthIndex )
{
- SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
+ if ( mDepthIndex != depthIndex )
+ {
+ mDepthIndex = depthIndex;
+ SetDepthIndexMessage( GetEventThreadServices(), *mSceneObject, depthIndex );
+ }
}
-int Renderer::GetCurrentDepthIndex() const
+int Renderer::GetDepthIndex() const
{
- int depthIndex = 0;
- if( mSceneObject )
- {
- BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
- depthIndex = mSceneObject->mDepthIndex[bufferIndex];
- }
- return depthIndex;
+ return mDepthIndex;
}
SceneGraph::RendererAttachment* Renderer::GetRendererSceneObject()
{
case Dali::Renderer::Property::DEPTH_INDEX:
{
- value = GetCurrentDepthIndex();
+ value = GetDepthIndex();
}
break;
}
&Renderer::FindAnimatableProperty,
&Renderer::FindCustomProperty,
index );
-
- if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
- {
- switch(index)
- {
- case Dali::Renderer::Property::DEPTH_INDEX:
- {
- property = &mSceneObject->mDepthIndex;
- }
- break;
- }
- }
}
return property;
&Renderer::FindCustomProperty,
index );
property = static_cast<const PropertyInputImpl*>( baseProperty );
-
- if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
- {
- switch(index)
- {
- case Dali::Renderer::Property::DEPTH_INDEX:
- {
- property = &mSceneObject->mDepthIndex;
- }
- break;
- }
- }
}
return property;
Renderer::Renderer()
: mSceneObject(NULL),
+ mDepthIndex(0),
mOnStage(false)
{
}
void SetDepthIndex( int depthIndex );
/**
- * @copydoc Dali::Renderer::GetCurrentDepthIndex()
+ * @copydoc Dali::Renderer::GetDepthIndex()
*/
- int GetCurrentDepthIndex() const;
+ int GetDepthIndex() const;
/**
* @brief Get the scene graph object ( the node attachment )
SceneGraph::RendererAttachment* mSceneObject;
ObjectConnector<Geometry> mGeometryConnector; ///< Connector that holds the geometry used by this renderer
ObjectConnector<Material> mMaterialConnector; ///< Connector that holds the material used by this renderer
+ int mDepthIndex;
bool mOnStage;
};
{
if ( actor.GetRendererCount() )
{
- hit.depth = actor.GetRendererAt( 0 ).GetCurrentDepthIndex();
+ hit.depth = actor.GetRendererAt( 0 ).GetDepthIndex();
}
else
{
RenderItem& item = renderList.GetNextFreeItem();
const Renderer& renderer = renderable.GetRenderer();
item.SetRenderer( const_cast< Renderer* >( &renderer ) );
- item.SetDepthIndex( renderable.GetDepthIndex(updateBufferIndex) );
+ item.SetDepthIndex( renderable.GetDepthIndex() );
// save MV matrix onto the item
Matrix& modelViewMatrix = item.GetModelViewMatrix();
BufferIndex bufferIndex = mSceneGraphBuffers.GetUpdateBufferIndex();
node.ResetToBaseValues( bufferIndex );
-
- // @todo MESH_REWORK Only perform this step for RendererAttachments - consider
- // storing them again? Split out to separate scene graph object (called e.g. RendererPropertyOwner) owned by UpdateManager
- // It is after all, a property owner, and always requires resetting...
- // The depth index should not be an animatable property... and probably not even
- // a constraint input? (Double buffering will slow down the sort algorithm slightly)
- if( node.HasAttachment() )
- {
- node.GetAttachment().ResetToBaseValues( bufferIndex );
- }
}
void UpdateManager::ResetProperties()
// Update methods
/**
- * Called to reset attachment's properties to base values.
- * Attachments without properties should not override this method
- */
- virtual void ResetToBaseValues(BufferIndex bufferIndex) { }
-
- /**
* Called when the attachment or it's owning node is flagged as dirty during scene graph updates.
* Allows derived classes to perform extra processing
* @param[in] updateBufferIndex The current update buffer index.
* Get the depth index for the attachment
* @param[in] bufferIndex The current update buffer index.
*/
- virtual int GetDepthIndex(BufferIndex bufferIndex)
+ virtual int GetDepthIndex()
{
return static_cast<int>( mSortModifier );
}
sortAttributes.geometry = mGeometry;
}
-void RendererAttachment::SetDepthIndex( BufferIndex updateBufferIndex, int depthIndex )
+void RendererAttachment::SetDepthIndex( int depthIndex )
{
- mDepthIndex.Bake(updateBufferIndex, depthIndex);
+ mDepthIndex = depthIndex;
if( mParent )
{
}
}
-void RendererAttachment::ResetToBaseValues( BufferIndex updateBufferIndex )
-{
- mDepthIndex.ResetToBaseValue( updateBufferIndex );
-}
-
Renderer& RendererAttachment::GetRenderer()
{
return *mRenderer;
/**
* Set the depth index
- * @param[in] bufferIndex The buffer index
* @param[in] depthIndex the new depth index to use
*/
- void SetDepthIndex( BufferIndex bufferIndex, int depthIndex );
+ void SetDepthIndex( int depthIndex );
protected: // From NodeAttachment
/**
- * @copydoc NodeAttachment::ResetToBaseValues
- */
- virtual void ResetToBaseValues( BufferIndex updateBufferIndex );
-
- /**
- * @param[in] bufferIndex The buffer index
+ * @brief Get the depth index
+ * @return The depth index
*/
- virtual int GetDepthIndex( BufferIndex bufferIndex )
+ virtual int GetDepthIndex()
{
- return mDepthIndex[bufferIndex];
+ return mDepthIndex;
}
/**
public: // Properties
- AnimatableProperty<int> mDepthIndex; ///< Used only in PrepareRenderInstructions
+ int mDepthIndex; ///< Used only in PrepareRenderInstructions
};
// Messages for RendererAttachment
inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const RendererAttachment& attachment, int depthIndex )
{
- typedef MessageDoubleBuffered1< RendererAttachment, int > LocalType;
+ typedef MessageValue1< RendererAttachment, int > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
GetImplementation(*this).SetDepthIndex( depthIndex );
}
-int Renderer::GetCurrentDepthIndex()
+int Renderer::GetDepthIndex()
{
- return GetImplementation(*this).GetCurrentDepthIndex();
+ return GetImplementation(*this).GetDepthIndex();
}
Renderer::Renderer( Internal::Renderer* pointer )
* @sa SetDepthIndex()
* @return the depth index
*/
- int GetCurrentDepthIndex();
+ int GetDepthIndex();
public:
/**