void* GetByIndex(uint32_t streamIndex);
- uint32_t GetIndex() const;
+ [[nodiscard]] uint32_t GetIndex() const;
private:
Internal::ParticleList& mOwnerList;
namespace Dali::Toolkit::ParticleSystem::Internal
{
-
template<>
ParticleStream::StreamDataType StreamDataTypeWrapper<Vector3>::GetType()
{
}
if(streamFlags & ParticleStream::LIFETIME_STREAM_BIT)
{
- AddStream(0.0f, "aStreamLifetime", false);
+ AddStream(0.0f, "aStreamLifetime", true);
mBuiltInStreamMap[uint32_t(ParticleStream::LIFETIME_STREAM_BIT)] = mDataStreams.size() - 1;
}
+ if(streamFlags & ParticleStream::LIFETIME_STREAM_BIT)
+ {
+ AddStream(0.0f, "aStreamLifetimeBase", true);
+ mBuiltInStreamMap[uint32_t(ParticleStream::LIFETIME_BASE_STREAM_BIT)] = mDataStreams.size() - 1;
+ }
// create free chain
mFreeChain.resize(capacity);
particle.Get<float>(ParticleStream::LIFETIME_STREAM_BIT) = lifetime;
+ // Store initial lifetime
+ particle.Get<float>(ParticleStream::LIFETIME_BASE_STREAM_BIT) = lifetime;
+
return mParticles.back();
}
return {nullptr};
// Point at this slot of memory as next free slot
auto& p = *it;
- if(mFreeIndex)
+ if(mFreeIndex > -1)
{
mFreeChain[p.GetIndex()] = mFreeIndex;
- mFreeIndex = p.GetIndex();
}
+ mFreeIndex = p.GetIndex();
// Remove particle from the list
mParticles.erase(it);
{
mTexture = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 2u, 2u);
auto* pixelArray = new uint32_t[4]{
- 0xFF0000FF, 0xFF0000FF, 0xFF0000FF, 0xFF0000FF};
+ 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF};
auto pixelData = PixelData::New(reinterpret_cast<uint8_t*>(pixelArray), 16, 2, 2, Pixel::Format::RGBA8888, PixelData::DELETE_ARRAY);
mTexture.Upload(pixelData);
}
-
mTextureSet = TextureSet::New();
mTextureSet.SetTexture(0, mTexture);
- // mTextureSet.SetSampler(0, Sampler());
-
mRenderer.SetTextures(mTextureSet);
+ mTextureSet.SetSampler(0, Sampler());
+
// Attach renderer to the parent actor
mEmitter->GetActor().AddRenderer(mRenderer);
else
{
// Partial to handle
- [[maybe_unused]] auto partialSize = (particleCount / workerCount);
+ auto partialSize = (particleCount / workerCount);
struct UpdateTask
{
}
tasks.emplace_back(*this, list, index, count, streamData);
- taskQueue.emplace_back([&t = tasks.back()](uint32_t threadId)
- { t.Update(); });
+ taskQueue.emplace_back([&t = tasks.back()](uint32_t threadId) { t.Update(); });
}
// Execute worker tasks
#include <dali-toolkit/public-api/particle-system/particle-emitter.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/particle-system/particle-source.h>
#include <dali-toolkit/internal/particle-system/particle-emitter-impl.h>
+#include <dali-toolkit/public-api/particle-system/particle-source.h>
// EXTERNAL INCLUDES
#include <utility>
namespace Dali::Toolkit::ParticleSystem
{
-
ParticleEmitter ParticleEmitter::New()
{
return {new Dali::Toolkit::ParticleSystem::Internal::ParticleEmitter()};
namespace ParticleStream DALI_TOOLKIT_API
{
-constexpr ParticleStreamTypeFlagBit POSITION_STREAM_BIT = 1 << 0; ///< 3D Position stream
-constexpr ParticleStreamTypeFlagBit ROTATION_STREAM_BIT = 1 << 1; ///< 3D Rotation stream
-constexpr ParticleStreamTypeFlagBit SCALE_STREAM_BIT = 1 << 2; ///< 3D Scale stream
-constexpr ParticleStreamTypeFlagBit SIZE_STREAM_BIT = 1 << 3;
-constexpr ParticleStreamTypeFlagBit COLOR_STREAM_BIT = 1 << 4;
-constexpr ParticleStreamTypeFlagBit OPACITY_STREAM_BIT = 1 << 5;
-constexpr ParticleStreamTypeFlagBit VELOCITY_STREAM_BIT = 1 << 6;
-constexpr ParticleStreamTypeFlagBit LIFETIME_STREAM_BIT = 1 << 7;
-constexpr ParticleStreamTypeFlagBit ALL_STREAMS = 255;
-constexpr ParticleStreamTypeFlagBit DEFAULT_STREAMS = 255; ///< Default streams
+constexpr ParticleStreamTypeFlagBit POSITION_STREAM_BIT = 1 << 0; ///< 3D Position stream
+constexpr ParticleStreamTypeFlagBit ROTATION_STREAM_BIT = 1 << 1; ///< 3D Rotation stream
+constexpr ParticleStreamTypeFlagBit SCALE_STREAM_BIT = 1 << 2; ///< 3D Scale stream
+constexpr ParticleStreamTypeFlagBit SIZE_STREAM_BIT = 1 << 3;
+constexpr ParticleStreamTypeFlagBit COLOR_STREAM_BIT = 1 << 4;
+constexpr ParticleStreamTypeFlagBit OPACITY_STREAM_BIT = 1 << 5;
+constexpr ParticleStreamTypeFlagBit VELOCITY_STREAM_BIT = 1 << 6;
+constexpr ParticleStreamTypeFlagBit LIFETIME_STREAM_BIT = 1 << 7;
+constexpr ParticleStreamTypeFlagBit LIFETIME_BASE_STREAM_BIT = 1 << 8;
+constexpr ParticleStreamTypeFlagBit ALL_STREAMS = 255;
+constexpr ParticleStreamTypeFlagBit DEFAULT_STREAMS = 255; ///< Default streams
/**
* Stream data types
INT4
};
-} // namespace ParticleStream DALI_TOOLKIT_API
+} // namespace ParticleStream
} // namespace Dali::Toolkit::ParticleSystem
#endif // DALI_TOOLKIT_PARTICLE_SYSTEM_PARTICLE_TYPES_H
\ No newline at end of file