master merged
This commit is contained in:
parent
867c6c665f
commit
0ceb85e522
5 changed files with 23 additions and 1 deletions
|
@ -58,6 +58,8 @@ ParticleEmitter::ParticleEmitter(Entity entity, Universe& universe, IAllocator&
|
|||
m_spawn_period.to = 2;
|
||||
m_initial_life.from = 1;
|
||||
m_initial_life.to = 2;
|
||||
m_initial_size.from = 1;
|
||||
m_initial_size.to = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,7 +77,7 @@ void ParticleEmitter::spawnParticle()
|
|||
m_position.push(m_universe.getPosition(m_entity));
|
||||
m_life.push(m_initial_life.getRandom());
|
||||
m_velocity.push(Vec3(0, 0, 0));
|
||||
m_size.push(1);
|
||||
m_size.push(m_initial_size.getRandom());
|
||||
for (auto* module : m_modules)
|
||||
{
|
||||
module->spawnParticle(m_life.size() - 1);
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
Interval m_spawn_period;
|
||||
Interval m_initial_life;
|
||||
Interval m_initial_size;
|
||||
Entity m_entity;
|
||||
|
||||
private:
|
||||
|
|
|
@ -699,6 +699,18 @@ public:
|
|||
}
|
||||
|
||||
|
||||
virtual void setParticleEmitterInitialSize(ComponentIndex cmp, const Vec2& value) override
|
||||
{
|
||||
m_particle_emitters[cmp]->m_initial_size = value;
|
||||
}
|
||||
|
||||
|
||||
virtual Vec2 getParticleEmitterInitialSize(ComponentIndex cmp) override
|
||||
{
|
||||
return m_particle_emitters[cmp]->m_initial_size;
|
||||
}
|
||||
|
||||
|
||||
virtual void setParticleEmitterSpawnPeriod(ComponentIndex cmp, const Vec2& value) override
|
||||
{
|
||||
m_particle_emitters[cmp]->m_spawn_period = value;
|
||||
|
|
|
@ -178,8 +178,10 @@ public:
|
|||
|
||||
virtual Vec2 getParticleEmitterInitialLife(ComponentIndex cmp) = 0;
|
||||
virtual Vec2 getParticleEmitterSpawnPeriod(ComponentIndex cmp) = 0;
|
||||
virtual Vec2 getParticleEmitterInitialSize(ComponentIndex cmp) = 0;
|
||||
virtual void setParticleEmitterInitialLife(ComponentIndex cmp, const Vec2& value) = 0;
|
||||
virtual void setParticleEmitterSpawnPeriod(ComponentIndex cmp, const Vec2& value) = 0;
|
||||
virtual void setParticleEmitterInitialSize(ComponentIndex cmp, const Vec2& value) = 0;
|
||||
|
||||
virtual DelegateList<void(ComponentIndex)>& renderableCreated() = 0;
|
||||
virtual DelegateList<void(ComponentIndex)>& renderableDestroyed() = 0;
|
||||
|
|
|
@ -264,6 +264,11 @@ struct RendererImpl : public Renderer
|
|||
&RenderScene::getParticleEmitterInitialLife,
|
||||
&RenderScene::setParticleEmitterInitialLife,
|
||||
allocator));
|
||||
m_engine.registerProperty("particle_emitter",
|
||||
LUMIX_NEW(allocator, Vec2PropertyDescriptor<RenderScene>)("Initial size",
|
||||
&RenderScene::getParticleEmitterInitialSize,
|
||||
&RenderScene::setParticleEmitterInitialSize,
|
||||
allocator));
|
||||
m_engine.registerProperty("particle_emitter",
|
||||
LUMIX_NEW(allocator, Vec2PropertyDescriptor<RenderScene>)("Spawn period",
|
||||
&RenderScene::getParticleEmitterSpawnPeriod,
|
||||
|
|
Loading…
Reference in a new issue