#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/common/dali-common.h>
-#include <dali/integration-api/resource-declarations.h>
-
#include <dali/internal/common/message.h>
#include <dali/internal/common/type-abstraction-enums.h>
#include <dali/internal/common/shader-saver.h>
struct NodeDepths
{
- std::vector<NodeDepthPair> nodeDepths;
NodeDepths( int reserveSize )
{
nodeDepths.reserve(reserveSize);
{
nodeDepths.push_back( NodeDepthPair( node, sortedDepth ) );
}
+
+ std::vector<NodeDepthPair> nodeDepths;
};
* @param[in] systemLevel True if using the system-level overlay.
* @post The node is owned by UpdateManager.
*/
- void InstallRoot( Layer* layer, bool systemLevel );
+ void InstallRoot( OwnerPointer<Layer>& layer, bool systemLevel );
/**
* Add a Node; UpdateManager takes ownership.
* @pre The node does not have a parent.
+ * @note even though nodes are pool allocated, they also contain other heap allocated data, thus using OwnerPointer when transferring the data
* @param[in] node The node to add.
*/
- void AddNode( Node* node );
+ void AddNode( OwnerPointer<Node>& node );
/**
* Connect a Node to the scene-graph.
* Add a camera on scene
* @param[in] camera to add
*/
- void AddCamera( Camera* camera );
+ void AddCamera( OwnerPointer< Camera >& camera );
/**
* Remove a camera from scene
* @param[in] object The object to add.
* @post The object is owned by UpdateManager.
*/
- void AddObject( PropertyOwner* object );
+ void AddObject( OwnerPointer<PropertyOwner>& object );
/**
* Remove an object.
* @param[in] animation The animation to add.
* @post The animation is owned by UpdateManager.
*/
- void AddAnimation( Animation* animation );
+ void AddAnimation( OwnerPointer< SceneGraph::Animation >& animation );
/**
* Stop an animation.
* @param[in] propertyNotification The notification to add
* @post The propertyNotification is owned by UpdateManager.
*/
- void AddPropertyNotification( PropertyNotification* propertyNotification );
+ void AddPropertyNotification( OwnerPointer< PropertyNotification >& propertyNotification );
/**
* Remove a property notification
* @param[in] shader The shader to add.
* @post The shader is owned by the UpdateManager.
*/
- void AddShader(Shader* shader);
+ void AddShader( OwnerPointer< Shader >& shader );
/**
* Remove a shader.
* @param[in] shader The shader to remove.
* @post The shader is destroyed.
*/
- void RemoveShader(Shader* shader);
+ void RemoveShader( Shader* shader );
/**
* Set the shader program for a Shader object
* Add a new renderer to scene
* @param renderer to add
*/
- void AddRenderer( Renderer* renderer );
+ void AddRenderer( OwnerPointer< Renderer >& renderer );
/**
* Add a renderer from scene
* @param[in] textureSet The texture set to add.
* @post The TextureSet is owned by the UpdateManager.
*/
- void AddTextureSet( TextureSet* textureSet );
+ void AddTextureSet( OwnerPointer< TextureSet >& textureSet );
/**
* Remove a TextureSet.
* @post Sends a message to RenderManager to add the sampler.
* The sampler will be owned by RenderManager
*/
- void AddSampler( Render::Sampler* sampler );
+ void AddSampler( OwnerPointer< Render::Sampler >& sampler );
/**
* Removes an existing sampler from RenderManager
* @post Sends a message to RenderManager to add the property buffer.
* The property buffer will be owned by RenderManager
*/
- void AddPropertyBuffer( Render::PropertyBuffer* propertryBuffer );
+ void AddPropertyBuffer( OwnerPointer< Render::PropertyBuffer >& propertryBuffer );
/**
* Removes an existing PropertyBuffer from RenderManager
* @param[in] format The new format of the buffer
* @post Sends a message to RenderManager to set the new format to the property buffer.
*/
- void SetPropertyBufferFormat(Render::PropertyBuffer* propertyBuffer, Render::PropertyBuffer::Format* format );
+ void SetPropertyBufferFormat( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format );
/**
* Sets the data of an existing property buffer
* @param[in] size The new size of the buffer
* @post Sends a message to RenderManager to set the new data to the property buffer.
*/
- void SetPropertyBufferData(Render::PropertyBuffer* propertyBuffer, Dali::Vector<char>* data, size_t size);
+ void SetPropertyBufferData( Render::PropertyBuffer* propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size );
/**
* Adds a geometry to the RenderManager
* @post Sends a message to RenderManager to add the Geometry
* The geometry will be owned by RenderManager
*/
- void AddGeometry( Render::Geometry* geometry );
+ void AddGeometry( OwnerPointer< Render::Geometry >& geometry );
/**
* Removes an existing Geometry from RenderManager
void SetIndexBuffer( Render::Geometry* geometry, Dali::Vector<unsigned short>& indices );
/**
- * Adds a vertex buffer to a geomtry
+ * Adds a vertex buffer to a geometry
* @param[in] geometry The geometry
* @param[in] propertyBuffer The property buffer
*/
- void AddVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
+ void AttachVertexBuffer( Render::Geometry* geometry, Render::PropertyBuffer* propertyBuffer );
/**
* Removes a vertex buffer from a geometry
* @param[in] texture The texture to add
* The texture will be owned by RenderManager
*/
- void AddTexture( Render::Texture* texture );
+ void AddTexture( OwnerPointer< Render::Texture >& texture );
/**
* Removes a texture from the render manager
* Set the depth indices of all nodes (in LayerUI's)
* @param[in] nodeDepths A vector of nodes and associated depth indices
*/
- void SetDepthIndices( NodeDepths* nodeDepths );
+ void SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths );
private:
// Messages for UpdateManager
-inline void InstallRootMessage( UpdateManager& manager, Layer& root, bool systemLevel )
+inline void InstallRootMessage( UpdateManager& manager, OwnerPointer<Layer>& root, bool systemLevel )
{
// Message has ownership of Layer while in transit from event -> update
typedef MessageValue2< UpdateManager, OwnerPointer<Layer>, bool > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::InstallRoot, &root, systemLevel );
+ new (slot) LocalType( &manager, &UpdateManager::InstallRoot, root, systemLevel );
}
-inline void AddNodeMessage( UpdateManager& manager, Node& node )
+inline void AddNodeMessage( UpdateManager& manager, OwnerPointer<Node>& node )
{
// Message has ownership of Node while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer<Node> > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddNode, &node );
+ new (slot) LocalType( &manager, &UpdateManager::AddNode, node );
}
inline void ConnectNodeMessage( UpdateManager& manager, const Node& constParent, const Node& constChild )
new (slot) LocalType( &manager, &UpdateManager::DestroyNode, &node );
}
-inline void AddCameraMessage( UpdateManager& manager, const Camera* constCamera )
+inline void AddCameraMessage( UpdateManager& manager, OwnerPointer< Camera >& camera )
{
// Message has ownership of Camera while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Camera > > LocalType;
- Camera* camera = const_cast<Camera*>( constCamera );
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::RemoveCamera, camera );
}
-inline void AddObjectMessage( UpdateManager& manager, PropertyOwner* object )
+inline void AddObjectMessage( UpdateManager& manager, OwnerPointer<PropertyOwner>& object )
{
// Message has ownership of object while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer<PropertyOwner> > LocalType;
new (slot) LocalType( &manager, &UpdateManager::RemoveObject, object );
}
-inline void AddAnimationMessage( UpdateManager& manager, Animation* animation )
+inline void AddAnimationMessage( UpdateManager& manager, OwnerPointer< SceneGraph::Animation >& animation )
{
- typedef MessageValue1< UpdateManager, Animation* > LocalType;
+ typedef MessageValue1< UpdateManager, OwnerPointer< SceneGraph::Animation > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
new (slot) LocalType( &manager, &UpdateManager::RemoveAnimation, &animation );
}
-inline void AddPropertyNotificationMessage( UpdateManager& manager, PropertyNotification* propertyNotification )
+inline void AddPropertyNotificationMessage( UpdateManager& manager, OwnerPointer< PropertyNotification >& propertyNotification )
{
// Message has ownership of PropertyNotification while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< PropertyNotification > > LocalType;
}
// The render thread can safely change the Shader
-inline void AddShaderMessage( UpdateManager& manager, Shader& shader )
+inline void AddShaderMessage( UpdateManager& manager, OwnerPointer< Shader >& shader )
{
typedef MessageValue1< UpdateManager, OwnerPointer< Shader > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddShader, &shader );
+ new (slot) LocalType( &manager, &UpdateManager::AddShader, shader );
}
// The render thread can safely change the Shader
new (slot) LocalType( &manager, &UpdateManager::SetLayerDepths, layers, systemLevel );
}
-inline void AddRendererMessage( UpdateManager& manager, Renderer& object )
+inline void AddRendererMessage( UpdateManager& manager, OwnerPointer< Renderer >& object )
{
typedef MessageValue1< UpdateManager, OwnerPointer< Renderer > > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddRenderer, &object );
+ new (slot) LocalType( &manager, &UpdateManager::AddRenderer, object );
}
inline void RemoveRendererMessage( UpdateManager& manager, Renderer& object )
}
// The render thread can safely change the Shader
-inline void AddTextureSetMessage( UpdateManager& manager, TextureSet& textureSet )
+inline void AddTextureSetMessage( UpdateManager& manager, OwnerPointer< TextureSet >& textureSet )
{
typedef MessageValue1< UpdateManager, OwnerPointer< TextureSet > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, &textureSet );
+ new (slot) LocalType( &manager, &UpdateManager::AddTextureSet, textureSet );
}
// The render thread can safely change the Shader
new (slot) LocalType( &manager, &UpdateManager::RemoveTextureSet, &textureSet );
}
-inline void AddSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
+inline void AddSamplerMessage( UpdateManager& manager, OwnerPointer< Render::Sampler >& sampler )
{
// Message has ownership of Sampler while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Sampler > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddSampler, &sampler );
+ new (slot) LocalType( &manager, &UpdateManager::AddSampler, sampler );
}
inline void RemoveSamplerMessage( UpdateManager& manager, Render::Sampler& sampler )
new (slot) LocalType( &manager, &UpdateManager::SetWrapMode, &sampler, rWrapMode, sWrapMode, tWrapMode );
}
-inline void AddPropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
+inline void AddPropertyBuffer( UpdateManager& manager, OwnerPointer< Render::PropertyBuffer >& propertyBuffer )
{
// Message has ownership of propertyBuffer while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::PropertyBuffer > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, &propertyBuffer );
+ new (slot) LocalType( &manager, &UpdateManager::AddPropertyBuffer, propertyBuffer );
}
inline void RemovePropertyBuffer( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer )
new (slot) LocalType( &manager, &UpdateManager::RemovePropertyBuffer, &propertyBuffer );
}
-inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Render::PropertyBuffer::Format* format )
+inline void SetPropertyBufferFormat( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Render::PropertyBuffer::Format>& format )
{
// Message has ownership of PropertyBuffer::Format while in transit from event -> update
typedef MessageValue2< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Render::PropertyBuffer::Format> > LocalType;
new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferFormat, &propertyBuffer, format );
}
-inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, Vector<char>* data, size_t size )
+inline void SetPropertyBufferData( UpdateManager& manager, Render::PropertyBuffer& propertyBuffer, OwnerPointer< Vector<char> >& data, size_t size )
{
// Message has ownership of PropertyBuffer data while in transit from event -> update
typedef MessageValue3< UpdateManager, Render::PropertyBuffer*, OwnerPointer< Vector<char> >, size_t > LocalType;
new (slot) LocalType( &manager, &UpdateManager::SetPropertyBufferData, &propertyBuffer, data, size );
}
-inline void AddGeometry( UpdateManager& manager, Render::Geometry& geometry )
+inline void AddGeometry( UpdateManager& manager, OwnerPointer< Render::Geometry >& geometry )
{
// Message has ownership of Geometry while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Geometry > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddGeometry, &geometry );
+ new (slot) LocalType( &manager, &UpdateManager::AddGeometry, geometry );
}
inline void RemoveGeometry( UpdateManager& manager, Render::Geometry& geometry )
new (slot) LocalType( &manager, &UpdateManager::RemoveGeometry, &geometry );
}
-inline void AddVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
+inline void AttachVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
{
typedef MessageValue2< UpdateManager, Render::Geometry*, Render::PropertyBuffer* > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
+ new (slot) LocalType( &manager, &UpdateManager::AttachVertexBuffer, &geometry, const_cast<Render::PropertyBuffer*>(&vertexBuffer) );
}
inline void RemoveVertexBufferMessage( UpdateManager& manager, Render::Geometry& geometry, const Render::PropertyBuffer& vertexBuffer )
new (slot) LocalType( &manager, &UpdateManager::SetGeometryType, &geometry, geometryType );
}
-inline void AddTexture( UpdateManager& manager, Render::Texture& texture )
+inline void AddTexture( UpdateManager& manager, OwnerPointer< Render::Texture >& texture )
{
// Message has ownership of Texture while in transit from event -> update
typedef MessageValue1< UpdateManager, OwnerPointer< Render::Texture > > LocalType;
unsigned int* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::AddTexture, &texture );
+ new (slot) LocalType( &manager, &UpdateManager::AddTexture, texture );
}
inline void RemoveTexture( UpdateManager& manager, Render::Texture& texture )
new (slot) LocalType( &manager, &UpdateManager::AttachColorTextureToFrameBuffer, &frameBuffer, texture, mipmapLevel, layer );
}
-inline void SetDepthIndicesMessage( UpdateManager& manager, NodeDepths* nodeDepths )
+inline void SetDepthIndicesMessage( UpdateManager& manager, OwnerPointer< NodeDepths >& nodeDepths )
{
typedef MessageValue1< UpdateManager, OwnerPointer< NodeDepths > > LocalType;
new (slot) LocalType( &manager, &UpdateManager::SetDepthIndices, nodeDepths );
}
-
} // namespace SceneGraph
} // namespace Internal