#define DALI_INTERNAL_SCENE_GRAPH_NODE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Construct a new Node.
+ * @param[in] id The unique ID of the node
*/
- static Node* New();
+ static Node* New( unsigned int id );
/**
* Deletes a Node.
* A value is calculated that can be used during sorting to increase sort speed.
* @param[in] clippingId The Clipping ID of the node to set
* @param[in] clippingDepth The Clipping Depth of the node to set
+ * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
*/
- void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth )
+ void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
{
- // We only set up the sort value if we have a clipping depth, IE. At least 1 clipping node has been hit.
+ // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
// If not, if we traverse down a clipping tree and back up, and there is another
// node on the parent, this will have a non-zero clipping ID that must be ignored
- if( DALI_LIKELY( clippingDepth > 0u ) )
+ if( clippingDepth > 0u )
{
mClippingDepth = clippingDepth;
// If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
mClippingSortModifier = 0u;
}
+
+ // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
+ // For this reason we can always update the member variable.
+ mScissorDepth = scissorDepth;
}
/**
}
/**
+ * Gets the Scissor Clipping Depth for this node.
+ * @return The Scissor Clipping Depth for this node.
+ */
+ uint32_t GetScissorDepth() const
+ {
+ return mScissorDepth;
+ }
+
+ /**
* Sets the clipping mode for this node.
* @param[in] clippingMode The ClippingMode to set
*/
*/
void CreateTransform( SceneGraph::TransformManager* transformManager );
+ /**
+ * Reset dirty flags
+ */
+ void ResetDirtyFlags( BufferIndex updateBufferIndex );
+
protected:
/**
/**
* Protected constructor; See also Node::New()
+ * @param[in] id The Unique ID of the actor creating the node
*/
- Node();
+ Node( unsigned int id );
/**
* Protected virtual destructor; See also Node::Delete( Node* )
Node& operator=(const Node& rhs);
/**
- * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
- */
- virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
-
- /**
* Recursive helper to disconnect a Node and its children.
* Disconnected Nodes have no parent or children.
* @param[in] updateBufferIndex The current update buffer index.
InheritedColor mWorldColor; ///< Full inherited color
uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
+ const unsigned int mId; ///< The Unique ID of the node.
protected:
CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
- uint32_t mClippingDepth; ///< The number of clipping nodes deep this node is
+ uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
+ uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
uint32_t mDepthIndex; ///< Depth index of the node
// flags, compressed to bitfield
unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
- DrawMode::Type mDrawMode:2; ///< How the Node and its children should be drawn
- ColorMode mColorMode:2; ///< Determines whether mWorldColor is inherited, 2 bits is enough
- ClippingMode::Type mClippingMode:2; ///< The clipping mode of this node
+ DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
+ ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
+ ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
bool mIsRoot:1; ///< True if the node cannot have a parent
bool mIsLayer:1; ///< True if the node is a layer
bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
// Template specialisation for OwnerPointer<Node>, because delete is protected
template <>
-void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset();
-
+inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
+{
+ if (mObject != NULL)
+ {
+ Dali::Internal::SceneGraph::Node::Delete(mObject);
+ mObject = NULL;
+ }
+}
} // namespace Internal
// Template specialisations for OwnerContainer<Node*>, because delete is protected
template <>
-void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer );
-
+inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
+{
+ Dali::Internal::SceneGraph::Node::Delete(pointer);
+}
} // namespace Dali
#endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H