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
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);
|
|
}
|
|
}
|