1 #ifndef DALI_INTERNAL_ACTORS_ACTOR_RENDERER_CONTAINER_H
2 #define DALI_INTERNAL_ACTORS_ACTOR_RENDERER_CONTAINER_H
5 * Copyright (c) 2021 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>
23 namespace Dali::Internal
25 using RendererPtr = IntrusivePtr<Renderer>;
34 * Class to contain an actor's renderers.
35 * Enables actor to set the blending for all renderers at once.
37 class RendererContainer
43 * @param[in] eventThreadServices - thread services for sending messages
45 RendererContainer(EventThreadServices& eventThreadServices);
48 * Add a renderer to this actor & actor's node, with blending applied if necessary.
49 * @param[in] node The node to add this renderer's scene graph object to
50 * @param[in] renderer the renderer to add
51 * @param[in] blending If blending equation should be applied to this renderer
52 * @param[in] blendEquation The current blending equation
54 uint32_t Add(const SceneGraph::Node& node, Renderer& renderer, bool blending, DevelBlendEquation::Type blendEquation);
57 * Remove the renderer, if present
58 * @param[in] node The node to remove this renderer's scene graph object from
59 * @param[in] renderer The renderer to remove
61 void Remove(const SceneGraph::Node& node, Renderer& renderer);
64 * Remove the renderer at given index
65 * @param[in] node The node to remove this renderer's scene graph object from
66 * @param[in] index The index of the renderer to remove
68 void Remove(const SceneGraph::Node& node, uint32_t index);
71 * Return the number of renderers
72 * @return the number of renderers
74 uint32_t GetCount() const;
77 * @return true if there aren't any renderers
81 return mRenderers.empty();
85 * Get the renderer at the given index, if in range.
86 * @param[in] index The index of the renderer to return
87 * @return A renderer at the given index, or nullptr if out of range
89 RendererPtr GetRendererAt(uint32_t index) const;
92 * Set the blending equation for all renderers
94 void SetBlending(DevelBlendEquation::Type blendEquation);
97 EventThreadServices& mEventThreadServices; ///< The event thread services (for sending messages)
98 std::vector<RendererPtr> mRenderers; ///< The contained renderers
101 } // namespace Dali::Internal
103 #endif //DALI_INTERNAL_ACTORS_ACTOR_RENDERER_CONTAINER_H