SDK/ParticleGroupComponent: Add [Add|Remove]Emitter methods taking an entity
The entity must have a ParticleEmitterComponent Former-commit-id: cc5fcde30bf8085b28aba18974854768f3ef5a46 [formerly 94cd3ac4099952d7186a49bf61b9fa1a9051484f] [formerly 8253250c28e3c890893072cf06ac032c55f95381 [formerly a2d435c184491dd50cd3fb2fd0174ee96a50321d]] Former-commit-id: 80dd6d0c2ea2f0229aacbf51cabd0067b5903b1f [formerly 42ca331d5712afca14f444f595fd14c2b3d3e1dd] Former-commit-id: 3c716c6d7ec3fb1e4ec5f4cf435c3fcc8a9dec8e
This commit is contained in:
parent
3913ead4bf
commit
ded4d6c35d
|
|
@ -25,6 +25,12 @@ namespace Ndk
|
||||||
ParticleGroupComponent(const ParticleGroupComponent&) = default;
|
ParticleGroupComponent(const ParticleGroupComponent&) = default;
|
||||||
~ParticleGroupComponent() = default;
|
~ParticleGroupComponent() = default;
|
||||||
|
|
||||||
|
void AddEmitter(Entity* emitter);
|
||||||
|
using ParticleGroup::AddEmitter;
|
||||||
|
|
||||||
|
void RemoveEmitter(Entity* emitter);
|
||||||
|
using ParticleGroup::RemoveEmitter;
|
||||||
|
|
||||||
static ComponentIndex componentIndex;
|
static ComponentIndex componentIndex;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
#include "ParticleGroupComponent.hpp"
|
|
||||||
// Copyright (C) 2015 Jérôme Leclercq
|
// Copyright (C) 2015 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Development Kit"
|
// This file is part of the "Nazara Development Kit"
|
||||||
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
// For conditions of distribution and use, see copyright notice in Prerequesites.hpp
|
||||||
|
|
||||||
|
#include <NDK/Components/ParticleGroupComponent.hpp>
|
||||||
|
#include <NDK/Components/ParticleEmitterComponent.hpp>
|
||||||
|
#include <Nazara/Core/Error.hpp>
|
||||||
|
|
||||||
namespace Ndk
|
namespace Ndk
|
||||||
{
|
{
|
||||||
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) :
|
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) :
|
||||||
|
|
@ -14,4 +17,22 @@ namespace Ndk
|
||||||
ParticleGroup(maxParticleCount, std::move(declaration))
|
ParticleGroup(maxParticleCount, std::move(declaration))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void ParticleGroupComponent::AddEmitter(Entity* emitter)
|
||||||
|
{
|
||||||
|
NazaraAssert(emitter && emitter->IsValid(), "Invalid entity");
|
||||||
|
NazaraAssert(emitter->HasComponent<ParticleEmitterComponent>(), "Entity must have a NodeComponent");
|
||||||
|
|
||||||
|
auto& emitterComponent = emitter->GetComponent<ParticleEmitterComponent>();
|
||||||
|
ParticleGroup::AddEmitter(&emitterComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter)
|
||||||
|
{
|
||||||
|
NazaraAssert(emitter && emitter->IsValid(), "Invalid entity");
|
||||||
|
NazaraAssert(emitter->HasComponent<ParticleEmitterComponent>(), "Entity must have a NodeComponent");
|
||||||
|
|
||||||
|
auto& emitterComponent = emitter->GetComponent<ParticleEmitterComponent>();
|
||||||
|
ParticleGroup::RemoveEmitter(&emitterComponent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue