The entity must have a ParticleEmitterComponent Former-commit-id: 4b6398f047dfee8d04d94f15634b9038078a609f [formerly 36b19eaef4fea6c2d16268c03a369c4797328693] [formerly c8a88f2feb4f80f88899d0ec8c3c0ff1bfad7723 [formerly dd95678311adfaa838dec8a31582f034e6321912]] Former-commit-id: 11cd0fb53279a586f39bafcf205289a945e4c568 [formerly f698d4deae6a0a0a06759acef864af778b7967ca] Former-commit-id: 660b25d6021b2f770d8d2c94240dbdacfa41f48a
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
// Copyright (C) 2015 Jérôme Leclercq
|
|
// This file is part of the "Nazara Development Kit"
|
|
// 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
|
|
{
|
|
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) :
|
|
ParticleGroup(maxParticleCount, layout)
|
|
{
|
|
}
|
|
|
|
inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleDeclarationConstRef 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);
|
|
}
|
|
}
|