From 0668988a0f44606e7eb7e2c75bd3da2361b3dd36 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 10 Aug 2016 22:52:29 +0200 Subject: [PATCH] SDK/ParticleGroupComponent: Add [Add|Remove]Emitter methods taking an entity 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 --- .../NDK/Components/ParticleGroupComponent.hpp | 6 +++++ .../NDK/Components/ParticleGroupComponent.inl | 23 ++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.hpp b/SDK/include/NDK/Components/ParticleGroupComponent.hpp index 638f877d3..0dce5dd23 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.hpp +++ b/SDK/include/NDK/Components/ParticleGroupComponent.hpp @@ -25,6 +25,12 @@ namespace Ndk ParticleGroupComponent(const ParticleGroupComponent&) = default; ~ParticleGroupComponent() = default; + void AddEmitter(Entity* emitter); + using ParticleGroup::AddEmitter; + + void RemoveEmitter(Entity* emitter); + using ParticleGroup::RemoveEmitter; + static ComponentIndex componentIndex; }; } diff --git a/SDK/include/NDK/Components/ParticleGroupComponent.inl b/SDK/include/NDK/Components/ParticleGroupComponent.inl index 7aefdad56..c6e0cba7b 100644 --- a/SDK/include/NDK/Components/ParticleGroupComponent.inl +++ b/SDK/include/NDK/Components/ParticleGroupComponent.inl @@ -1,8 +1,11 @@ -#include "ParticleGroupComponent.hpp" // 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 +#include +#include + namespace Ndk { inline ParticleGroupComponent::ParticleGroupComponent(unsigned int maxParticleCount, Nz::ParticleLayout layout) : @@ -14,4 +17,22 @@ namespace Ndk ParticleGroup(maxParticleCount, std::move(declaration)) { } + + inline void ParticleGroupComponent::AddEmitter(Entity* emitter) + { + NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); + NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + + auto& emitterComponent = emitter->GetComponent(); + ParticleGroup::AddEmitter(&emitterComponent); + } + + inline void ParticleGroupComponent::RemoveEmitter(Entity* emitter) + { + NazaraAssert(emitter && emitter->IsValid(), "Invalid entity"); + NazaraAssert(emitter->HasComponent(), "Entity must have a NodeComponent"); + + auto& emitterComponent = emitter->GetComponent(); + ParticleGroup::RemoveEmitter(&emitterComponent); + } }