1 #ifndef DALI_TOOLKIT_PARTICLE_SYSTEM_INTERNAL_PARTICLE_RENDERER_H
2 #define DALI_TOOLKIT_PARTICLE_SYSTEM_INTERNAL_PARTICLE_RENDERER_H
4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include <dali-toolkit/public-api/particle-system/particle-emitter.h>
23 #include <dali-toolkit/public-api/particle-system/particle-renderer.h>
24 #include <dali-toolkit/public-api/particle-system/particle.h>
26 #include <dali/public-api/actors/actor.h>
27 #include <dali/public-api/object/base-object.h>
28 #include <dali/public-api/rendering/renderer.h>
29 #include <dali/public-api/rendering/vertex-buffer.h>
30 #include <dali/public-api/signals/render-callback.h>
32 namespace Dali::Graphics
36 } // namespace Dali::Graphics
38 namespace Dali::Toolkit::ParticleSystem
40 class ParticleEmitter;
43 namespace Dali::Toolkit::ParticleSystem::Internal
45 class ParticleEmitter;
46 class ParticleRenderer;
49 class ParticleRenderer : public Dali::BaseObject
59 void SetTexture(const Dali::Texture& texture);
61 void SetBlendingMode(BlendingMode blendingMode);
67 void SetEmitter(ParticleSystem::Internal::ParticleEmitter* emitter);
69 void UpdateParticlesTask(Internal::ParticleList& list,
70 uint32_t particleStartIndex,
71 uint32_t particleCount,
74 [[nodiscard]] Renderer GetRenderer() const;
76 uint32_t OnStreamBufferUpdate(void* data, size_t size);
78 bool mUsingStreamDivisor{true}; ///< If attribute divisor is supported, it's going to be used
80 Internal::ParticleEmitter* mEmitter{nullptr}; ///< Emitter implementation that uses the renderer
82 Dali::Texture mTexture;
83 Dali::TextureSet mTextureSet;
84 Dali::Renderer mRenderer;
86 Dali::Geometry mGeometry;
87 Dali::VertexBuffer mVertexBuffer;
88 Dali::VertexBuffer mStreamBuffer;
89 BlendingMode mBlendingMode{BlendingMode::DEFAULT};
91 std::unique_ptr<Dali::VertexBufferUpdateCallback> mStreamBufferUpdateCallback;
93 bool mInitialized{false};
95 } // namespace Dali::Toolkit::ParticleSystem::Internal
98 inline Toolkit::ParticleSystem::Internal::ParticleRenderer& GetImplementation(Toolkit::ParticleSystem::ParticleRenderer& source)
100 DALI_ASSERT_ALWAYS(source && "ParticleRenderer handle is empty");
102 BaseObject& handle = source.GetBaseObject();
104 return static_cast<Toolkit::ParticleSystem::Internal::ParticleRenderer&>(handle);
107 inline const Toolkit::ParticleSystem::Internal::ParticleRenderer& GetImplementation(const Toolkit::ParticleSystem::ParticleRenderer& source)
109 DALI_ASSERT_ALWAYS(source && "ParticleRenderer handle is empty");
111 const BaseObject& handle = source.GetBaseObject();
113 return static_cast<const Toolkit::ParticleSystem::Internal::ParticleRenderer&>(handle);
118 #endif // DALI_TOOLKIT_PARTICLE_SYSTEM_INTERNAL_PARTICLE_RENDERER_H