#define DALI_INTERNAL_SCENE_GRAPH_LAYER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
*/
struct Renderable
{
- Renderable()
- : mNode(nullptr),
- mRenderer(nullptr)
- {
- }
+ Renderable() = default;
- Renderable(Node* node, Renderer* renderer)
+ Renderable(Node* node, RendererKey renderer)
: mNode(node),
mRenderer(renderer)
{
}
- Node* mNode;
- Renderer* mRenderer;
+ Node* mNode{nullptr};
+ RendererKey mRenderer{};
+};
+
+} // namespace SceneGraph
+} // Namespace Internal
+
+/// Enable Renderable to be used as a trivial type in Dali::Vector.
+template<>
+struct TypeTraits<Internal::SceneGraph::Renderable> : public Dali::BasicTypes<Internal::SceneGraph::Renderable>
+{
+ enum
+ {
+ IS_TRIVIAL_TYPE = true
+ };
};
+namespace Internal
+{
+namespace SceneGraph
+{
using RenderableContainer = Dali::Vector<Renderable>;
/**
/**
* Enables the reuse of the model view matrices of all renderers for this layer
* @param[in] updateBufferIndex The current update buffer index.
- * @param value to set
+ * @param[in] value to set
*/
void SetReuseRenderers(BufferIndex updateBufferIndex, bool value)
{
}
/**
+ * Get the reuse of the model view matrices of all renderers for this layer is enabled.
+ * @param[in] updateBufferIndex The current update buffer index.
+ * @return Whether all child transform was clean or not.
+ */
+ bool GetReuseRenderers(BufferIndex updateBufferIndex) const
+ {
+ return mAllChildTransformsClean[updateBufferIndex];
+ }
+
+ /**
* Checks if it is ok to reuse renderers. Renderers can be reused if ModelView transform for all the renderers
* has not changed from previous use.
* @param[in] camera A pointer to the camera that we want to use to render the list.
* to use is the same than the one used before ( Otherwise View transform will be different )
*
*/
- bool CanReuseRenderers(Camera* camera)
+ bool CanReuseRenderers(const Camera* camera)
{
bool bReturn(mAllChildTransformsClean[0] && mAllChildTransformsClean[1] && camera == mLastCamera);
mLastCamera = camera;
*/
Layer();
- // Undefined
- Layer(const Layer&);
-
- // Undefined
- Layer& operator=(const Layer& rhs);
+ // Delete copy and move
+ Layer(const Layer&) = delete;
+ Layer(Layer&&) = delete;
+ Layer& operator=(const Layer& rhs) = delete;
+ Layer& operator=(Layer&& rhs) = delete;
public: // For update-algorithms
RenderableContainer colorRenderables;
private:
SortFunctionType mSortFunction; ///< Used to sort semi-transparent geometry
- ClippingBox mClippingBox; ///< The clipping box, in window coordinates
- Camera* mLastCamera; ///< Pointer to the last camera that has rendered the layer
+ ClippingBox mClippingBox; ///< The clipping box, in window coordinates
+ const Camera* mLastCamera; ///< Pointer to the last camera that has rendered the layer
Dali::Layer::Behavior mBehavior; ///< The behavior of the layer