1 #ifndef DALI_INTERNAL_ACTORS_ACTOR_RENDERER_CONTAINER_H
2 #define DALI_INTERNAL_ACTORS_ACTOR_RENDERER_CONTAINER_H
5 * Copyright (c) 2022 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <dali/devel-api/rendering/renderer-devel.h>
21 #include <dali/internal/event/common/event-thread-services.h>
22 #include <dali/public-api/common/vector-wrapper.h>
24 namespace Dali::Internal
26 using RendererPtr = IntrusivePtr<Renderer>;
35 * Class to contain an actor's renderers.
36 * Enables actor to set the blending for all renderers at once.
38 class RendererContainer
44 * @param[in] eventThreadServices - thread services for sending messages
46 RendererContainer(EventThreadServices& eventThreadServices);
49 * Add a renderer to this actor & actor's node, with blending applied if necessary.
50 * @param[in] node The node to add this renderer's scene graph object to
51 * @param[in] renderer the renderer to add
52 * @param[in] blending If blending equation should be applied to this renderer
53 * @param[in] blendEquation The current blending equation
55 uint32_t Add(const SceneGraph::Node& node, Renderer& renderer, bool blending, DevelBlendEquation::Type blendEquation);
58 * Remove the renderer, if present
59 * @param[in] node The node to remove this renderer's scene graph object from
60 * @param[in] renderer The renderer to remove
62 void Remove(const SceneGraph::Node& node, Renderer& renderer);
65 * Remove the renderer at given index
66 * @param[in] node The node to remove this renderer's scene graph object from
67 * @param[in] index The index of the renderer to remove
69 void Remove(const SceneGraph::Node& node, uint32_t index);
72 * Return the number of renderers
73 * @return the number of renderers
75 uint32_t GetCount() const;
78 * @return true if there aren't any renderers
82 return mRenderers.empty();
86 * Get the renderer at the given index, if in range.
87 * @param[in] index The index of the renderer to return
88 * @return A renderer at the given index, or nullptr if out of range
90 RendererPtr GetRendererAt(uint32_t index) const;
93 * Set the blending equation for all renderers
95 void SetBlending(DevelBlendEquation::Type blendEquation);
98 EventThreadServices& mEventThreadServices; ///< The event thread services (for sending messages)
99 std::vector<RendererPtr> mRenderers; ///< The contained renderers
102 } // namespace Dali::Internal
104 #endif //DALI_INTERNAL_ACTORS_ACTOR_RENDERER_CONTAINER_H