Graphics: Rename ParticleSystem to ParticleGroup
Preparing for integration into the ECS Former-commit-id: 201e28c9f00ee31f809d9de3d9a37f57a7fe740c [formerly 9b88616308f9801482fc8811a9a19a7231dce2a7] Former-commit-id: 579f4e9597f94620f922fb145931202d8fc9cc96
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
#include <Nazara/Graphics/ParticleMapper.hpp>
|
||||
#include <Nazara/Graphics/ParticleSystem.hpp>
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <Nazara/Graphics/Debug.hpp>
|
||||
@@ -41,7 +41,7 @@ namespace Nz
|
||||
* \param elapsedTime Delta time between the previous frame
|
||||
*/
|
||||
|
||||
void ParticleEmitter::Emit(ParticleSystem& system, float elapsedTime) const
|
||||
void ParticleEmitter::Emit(ParticleGroup& system, float elapsedTime) const
|
||||
{
|
||||
if (m_emissionRate > 0.f)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// This file is part of the "Nazara Engine - Graphics module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Graphics/ParticleSystem.hpp>
|
||||
#include <Nazara/Graphics/ParticleGroup.hpp>
|
||||
#include <Nazara/Core/CallOnExit.hpp>
|
||||
#include <Nazara/Core/ErrorFlags.hpp>
|
||||
#include <Nazara/Core/StringStream.hpp>
|
||||
@@ -26,8 +26,8 @@ namespace Nz
|
||||
* \param layout Enumeration for the layout of data information for the particles
|
||||
*/
|
||||
|
||||
ParticleSystem::ParticleSystem(unsigned int maxParticleCount, ParticleLayout layout) :
|
||||
ParticleSystem(maxParticleCount, ParticleDeclaration::Get(layout))
|
||||
ParticleGroup::ParticleGroup(unsigned int maxParticleCount, ParticleLayout layout) :
|
||||
ParticleGroup(maxParticleCount, ParticleDeclaration::Get(layout))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Nz
|
||||
* \param declaration Data information for the particles
|
||||
*/
|
||||
|
||||
ParticleSystem::ParticleSystem(unsigned int maxParticleCount, ParticleDeclarationConstRef declaration) :
|
||||
ParticleGroup::ParticleGroup(unsigned int maxParticleCount, ParticleDeclarationConstRef declaration) :
|
||||
m_declaration(std::move(declaration)),
|
||||
m_processing(false),
|
||||
m_maxParticleCount(maxParticleCount),
|
||||
@@ -58,7 +58,7 @@ namespace Nz
|
||||
* \param system ParticleSystem to copy into this
|
||||
*/
|
||||
|
||||
ParticleSystem::ParticleSystem(const ParticleSystem& system) :
|
||||
ParticleGroup::ParticleGroup(const ParticleGroup& system) :
|
||||
Renderable(system),
|
||||
m_controllers(system.m_controllers),
|
||||
m_generators(system.m_generators),
|
||||
@@ -77,7 +77,7 @@ namespace Nz
|
||||
std::memcpy(m_buffer.data(), system.m_buffer.data(), system.m_particleCount*m_particleSize);
|
||||
}
|
||||
|
||||
ParticleSystem::~ParticleSystem() = default;
|
||||
ParticleGroup::~ParticleGroup() = default;
|
||||
|
||||
/*!
|
||||
* \brief Adds a controller to the particles
|
||||
@@ -87,7 +87,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraAssert if controller is invalid
|
||||
*/
|
||||
|
||||
void ParticleSystem::AddController(ParticleControllerRef controller)
|
||||
void ParticleGroup::AddController(ParticleControllerRef controller)
|
||||
{
|
||||
NazaraAssert(controller, "Invalid particle controller");
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraAssert if emitter is invalid
|
||||
*/
|
||||
|
||||
void ParticleSystem::AddEmitter(ParticleEmitter* emitter)
|
||||
void ParticleGroup::AddEmitter(ParticleEmitter* emitter)
|
||||
{
|
||||
NazaraAssert(emitter, "Invalid particle emitter");
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraAssert if generator is invalid
|
||||
*/
|
||||
|
||||
void ParticleSystem::AddGenerator(ParticleGeneratorRef generator)
|
||||
void ParticleGroup::AddGenerator(ParticleGeneratorRef generator)
|
||||
{
|
||||
NazaraAssert(generator, "Invalid particle generator");
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraAssert if renderQueue is invalid
|
||||
*/
|
||||
|
||||
void ParticleSystem::AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& transformMatrix) const
|
||||
void ParticleGroup::AddToRenderQueue(AbstractRenderQueue* renderQueue, const Matrix4f& transformMatrix) const
|
||||
{
|
||||
NazaraAssert(m_renderer, "Invalid particle renderer");
|
||||
NazaraAssert(renderQueue, "Invalid renderqueue");
|
||||
@@ -155,7 +155,7 @@ namespace Nz
|
||||
* \param elapsedTime Delta time between the previous frame
|
||||
*/
|
||||
|
||||
void ParticleSystem::ApplyControllers(ParticleMapper& mapper, unsigned int particleCount, float elapsedTime)
|
||||
void ParticleGroup::ApplyControllers(ParticleMapper& mapper, unsigned int particleCount, float elapsedTime)
|
||||
{
|
||||
m_processing = true;
|
||||
|
||||
@@ -190,7 +190,7 @@ namespace Nz
|
||||
* \return Pointer to the particle memory buffer
|
||||
*/
|
||||
|
||||
void* ParticleSystem::CreateParticle()
|
||||
void* ParticleGroup::CreateParticle()
|
||||
{
|
||||
return CreateParticles(1);
|
||||
}
|
||||
@@ -200,7 +200,7 @@ namespace Nz
|
||||
* \return Pointer to the first particle memory buffer
|
||||
*/
|
||||
|
||||
void* ParticleSystem::CreateParticles(unsigned int count)
|
||||
void* ParticleGroup::CreateParticles(unsigned int count)
|
||||
{
|
||||
if (count == 0)
|
||||
return nullptr;
|
||||
@@ -219,7 +219,7 @@ namespace Nz
|
||||
* \return Pointer to the particle memory buffer
|
||||
*/
|
||||
|
||||
void* ParticleSystem::GenerateParticle()
|
||||
void* ParticleGroup::GenerateParticle()
|
||||
{
|
||||
return GenerateParticles(1);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ namespace Nz
|
||||
* \return Pointer to the first particle memory buffer
|
||||
*/
|
||||
|
||||
void* ParticleSystem::GenerateParticles(unsigned int count)
|
||||
void* ParticleGroup::GenerateParticles(unsigned int count)
|
||||
{
|
||||
void* ptr = CreateParticles(count);
|
||||
if (!ptr)
|
||||
@@ -247,7 +247,7 @@ namespace Nz
|
||||
* \return Particle declaration
|
||||
*/
|
||||
|
||||
const ParticleDeclarationConstRef& ParticleSystem::GetDeclaration() const
|
||||
const ParticleDeclarationConstRef& ParticleGroup::GetDeclaration() const
|
||||
{
|
||||
return m_declaration;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ namespace Nz
|
||||
* \return Current fixed step size
|
||||
*/
|
||||
|
||||
float ParticleSystem::GetFixedStepSize() const
|
||||
float ParticleGroup::GetFixedStepSize() const
|
||||
{
|
||||
return m_stepSize;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ namespace Nz
|
||||
* \return Current maximum number
|
||||
*/
|
||||
|
||||
unsigned int ParticleSystem::GetMaxParticleCount() const
|
||||
unsigned int ParticleGroup::GetMaxParticleCount() const
|
||||
{
|
||||
return m_maxParticleCount;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ namespace Nz
|
||||
* \return Current number
|
||||
*/
|
||||
|
||||
unsigned int ParticleSystem::GetParticleCount() const
|
||||
unsigned int ParticleGroup::GetParticleCount() const
|
||||
{
|
||||
return m_particleCount;
|
||||
}
|
||||
@@ -287,7 +287,7 @@ namespace Nz
|
||||
* \return Current size
|
||||
*/
|
||||
|
||||
unsigned int ParticleSystem::GetParticleSize() const
|
||||
unsigned int ParticleGroup::GetParticleSize() const
|
||||
{
|
||||
return m_particleSize;
|
||||
}
|
||||
@@ -297,7 +297,7 @@ namespace Nz
|
||||
* \return true If it is the case
|
||||
*/
|
||||
|
||||
bool ParticleSystem::IsFixedStepEnabled() const
|
||||
bool ParticleGroup::IsFixedStepEnabled() const
|
||||
{
|
||||
return m_fixedStepEnabled;
|
||||
}
|
||||
@@ -308,7 +308,7 @@ namespace Nz
|
||||
* \param index Index of the particle
|
||||
*/
|
||||
|
||||
void ParticleSystem::KillParticle(unsigned int index)
|
||||
void ParticleGroup::KillParticle(unsigned int index)
|
||||
{
|
||||
///FIXME: Verify the index
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace Nz
|
||||
* \brief Kills every particles
|
||||
*/
|
||||
|
||||
void ParticleSystem::KillParticles()
|
||||
void ParticleGroup::KillParticles()
|
||||
{
|
||||
m_particleCount = 0;
|
||||
}
|
||||
@@ -339,7 +339,7 @@ namespace Nz
|
||||
* \param controller Controller for the particles to remove
|
||||
*/
|
||||
|
||||
void ParticleSystem::RemoveController(ParticleController* controller)
|
||||
void ParticleGroup::RemoveController(ParticleController* controller)
|
||||
{
|
||||
auto it = std::find(m_controllers.begin(), m_controllers.end(), controller);
|
||||
if (it != m_controllers.end())
|
||||
@@ -352,7 +352,7 @@ namespace Nz
|
||||
* \param emitter Emitter for the particles to remove
|
||||
*/
|
||||
|
||||
void ParticleSystem::RemoveEmitter(ParticleEmitter* emitter)
|
||||
void ParticleGroup::RemoveEmitter(ParticleEmitter* emitter)
|
||||
{
|
||||
auto it = std::find(m_emitters.begin(), m_emitters.end(), emitter);
|
||||
if (it != m_emitters.end())
|
||||
@@ -365,7 +365,7 @@ namespace Nz
|
||||
* \param generator Generator for the particles to remove
|
||||
*/
|
||||
|
||||
void ParticleSystem::RemoveGenerator(ParticleGenerator* generator)
|
||||
void ParticleGroup::RemoveGenerator(ParticleGenerator* generator)
|
||||
{
|
||||
auto it = std::find(m_generators.begin(), m_generators.end(), generator);
|
||||
if (it != m_generators.end())
|
||||
@@ -378,7 +378,7 @@ namespace Nz
|
||||
* \param stepSize Fixed step size
|
||||
*/
|
||||
|
||||
void ParticleSystem::SetFixedStepSize(float stepSize)
|
||||
void ParticleGroup::SetFixedStepSize(float stepSize)
|
||||
{
|
||||
m_stepSize = stepSize;
|
||||
}
|
||||
@@ -389,7 +389,7 @@ namespace Nz
|
||||
* \param renderer Renderer for the particles
|
||||
*/
|
||||
|
||||
void ParticleSystem::SetRenderer(ParticleRenderer* renderer)
|
||||
void ParticleGroup::SetRenderer(ParticleRenderer* renderer)
|
||||
{
|
||||
m_renderer = renderer;
|
||||
}
|
||||
@@ -400,7 +400,7 @@ namespace Nz
|
||||
* \param elapsedTime Delta time between the previous frame
|
||||
*/
|
||||
|
||||
void ParticleSystem::Update(float elapsedTime)
|
||||
void ParticleGroup::Update(float elapsedTime)
|
||||
{
|
||||
// Emission
|
||||
for (ParticleEmitter* emitter : m_emitters)
|
||||
@@ -421,7 +421,7 @@ namespace Nz
|
||||
* \param transformMatrix Matrix transformation for our bounding volume
|
||||
*/
|
||||
|
||||
void ParticleSystem::UpdateBoundingVolume(const Matrix4f& transformMatrix)
|
||||
void ParticleGroup::UpdateBoundingVolume(const Matrix4f& transformMatrix)
|
||||
{
|
||||
NazaraUnused(transformMatrix);
|
||||
|
||||
@@ -435,7 +435,7 @@ namespace Nz
|
||||
* \param system The other ParticleSystem
|
||||
*/
|
||||
|
||||
ParticleSystem& ParticleSystem::operator=(const ParticleSystem& system)
|
||||
ParticleGroup& ParticleGroup::operator=(const ParticleGroup& system)
|
||||
{
|
||||
ErrorFlags flags(ErrorFlag_ThrowException, true);
|
||||
|
||||
@@ -468,7 +468,7 @@ namespace Nz
|
||||
* \brief Makes the bounding volume of this text
|
||||
*/
|
||||
|
||||
void ParticleSystem::MakeBoundingVolume() const
|
||||
void ParticleGroup::MakeBoundingVolume() const
|
||||
{
|
||||
///TODO: Compute the AABB (taking into account the size of particles)
|
||||
m_boundingVolume.MakeInfinite();
|
||||
@@ -480,7 +480,7 @@ namespace Nz
|
||||
* \remark Produces a NazaraError if resize did not work
|
||||
*/
|
||||
|
||||
void ParticleSystem::ResizeBuffer()
|
||||
void ParticleGroup::ResizeBuffer()
|
||||
{
|
||||
// Just to have a better description of our problem in case of error
|
||||
try
|
||||
Reference in New Issue
Block a user