Graphics: Rename ParticleSystem to ParticleGroup
Preparing for integration into the ECS Former-commit-id: 9ca871117d0be3d4c655225d3f3dad6b0277cdd8 [formerly 9343fd818957da74e0bb7a5715a2172eefc325e5] Former-commit-id: 93cf58c80f0cd396211df0c95063f0ad05449e75
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#include <Nazara/Graphics/ParticleSystem.hpp>
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <Catch/catch.hpp>
|
||||
|
||||
#include <Nazara/Core/SparsePtr.hpp>
|
||||
@@ -8,7 +8,7 @@ class TestParticleController : public Nz::ParticleController
|
||||
{
|
||||
public:
|
||||
// Be aware that the interval is [startId, endId] and NOT [startId, endId)
|
||||
void Apply(Nz::ParticleSystem& system, Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId, float elapsedTime) override
|
||||
void Apply(Nz::ParticleGroup& system, Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId, float elapsedTime) override
|
||||
{
|
||||
Nz::SparsePtr<Nz::Vector3f> positionPtr = mapper.GetComponentPtr<Nz::Vector3f>(Nz::ParticleComponent_Position);
|
||||
Nz::SparsePtr<Nz::Vector3f> velocityPtr = mapper.GetComponentPtr<Nz::Vector3f>(Nz::ParticleComponent_Velocity);
|
||||
@@ -32,7 +32,7 @@ class TestParticleEmitter : public Nz::ParticleEmitter
|
||||
public:
|
||||
~TestParticleEmitter() override = default;
|
||||
|
||||
void Emit(Nz::ParticleSystem& system, float elapsedTime) const override
|
||||
void Emit(Nz::ParticleGroup& system, float elapsedTime) const override
|
||||
{
|
||||
system.GenerateParticles(GetEmissionCount());
|
||||
}
|
||||
@@ -49,7 +49,7 @@ class TestParticleGenerator : public Nz::ParticleGenerator
|
||||
~TestParticleGenerator() override = default;
|
||||
|
||||
// Be aware that the interval is [startId, endId] and NOT [startId, endId)
|
||||
void Generate(Nz::ParticleSystem& system, Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId) override
|
||||
void Generate(Nz::ParticleGroup& system, Nz::ParticleMapper& mapper, unsigned int startId, unsigned int endId) override
|
||||
{
|
||||
Nz::SparsePtr<Nz::Vector3f> positionPtr = mapper.GetComponentPtr<Nz::Vector3f>(Nz::ParticleComponent_Position);
|
||||
Nz::SparsePtr<Nz::Vector3f> velocityPtr = mapper.GetComponentPtr<Nz::Vector3f>(Nz::ParticleComponent_Velocity);
|
||||
@@ -68,35 +68,35 @@ class TestParticleGenerator : public Nz::ParticleGenerator
|
||||
}
|
||||
};
|
||||
|
||||
SCENARIO("ParticleSystem", "[GRAPHICS][PARTICLESYSTEM]")
|
||||
SCENARIO("ParticleGroup", "[GRAPHICS][PARTICLEGROUP]")
|
||||
{
|
||||
GIVEN("A particle system of maximum 10 billboards with its generators")
|
||||
{
|
||||
// These need to be alive longer than the particle system
|
||||
TestParticleController particleController;
|
||||
TestParticleGenerator particleGenerator;
|
||||
Nz::ParticleSystem particleSystem(10, Nz::ParticleLayout_Billboard);
|
||||
Nz::ParticleGroup particleGroup(10, Nz::ParticleLayout_Billboard);
|
||||
|
||||
particleSystem.AddController(&particleController);
|
||||
particleGroup.AddController(&particleController);
|
||||
TestParticleEmitter particleEmitter;
|
||||
particleEmitter.SetEmissionCount(10);
|
||||
particleSystem.AddEmitter(&particleEmitter);
|
||||
particleGroup.AddEmitter(&particleEmitter);
|
||||
|
||||
particleSystem.AddGenerator(&particleGenerator);
|
||||
particleGroup.AddGenerator(&particleGenerator);
|
||||
|
||||
WHEN("We update to generate 10 particles")
|
||||
{
|
||||
particleSystem.Update(1.f);
|
||||
particleGroup.Update(1.f);
|
||||
|
||||
THEN("There must be 10 particles")
|
||||
{
|
||||
REQUIRE(particleSystem.GetParticleCount() == 10);
|
||||
REQUIRE(particleGroup.GetParticleCount() == 10);
|
||||
}
|
||||
|
||||
AND_THEN("We update to make them die")
|
||||
{
|
||||
particleSystem.Update(2.f);
|
||||
REQUIRE(particleSystem.GetParticleCount() == 0);
|
||||
particleGroup.Update(2.f);
|
||||
REQUIRE(particleGroup.GetParticleCount() == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user