Merge remote-tracking branch 'origin/Scene-Update'

Former-commit-id: 4185e7a826476d3d5b4275b3900fe695bd791f3a
This commit is contained in:
Lynix
2015-01-25 16:35:18 +01:00
26 changed files with 620 additions and 354 deletions

View File

@@ -7,6 +7,7 @@
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Core/StringStream.hpp>
#include <Nazara/Graphics/ParticleMapper.hpp>
#include <Nazara/Graphics/Scene.hpp>
#include <cstdlib>
#include <memory>
#include <Nazara/Graphics/Debug.hpp>
@@ -18,7 +19,6 @@ NzParticleSystem(maxParticleCount, NzParticleDeclaration::Get(layout))
NzParticleSystem::NzParticleSystem(unsigned int maxParticleCount, const NzParticleDeclaration* declaration) :
m_declaration(declaration),
m_boundingVolumeUpdated(false),
m_fixedStepEnabled(false),
m_processing(false),
m_stepAccumulator(0.f),
@@ -38,10 +38,8 @@ NzParticleSystem::NzParticleSystem(const NzParticleSystem& system) :
NzSceneNode(system),
m_controllers(system.m_controllers),
m_generators(system.m_generators),
m_boundingVolume(system.m_boundingVolume),
m_declaration(system.m_declaration),
m_renderer(system.m_renderer),
m_boundingVolumeUpdated(system.m_boundingVolumeUpdated),
m_fixedStepEnabled(system.m_fixedStepEnabled),
m_processing(false),
m_stepAccumulator(0.f),
@@ -132,14 +130,6 @@ void* NzParticleSystem::GenerateParticles(unsigned int count)
return ptr;
}
const NzBoundingVolumef& NzParticleSystem::GetBoundingVolume() const
{
if (!m_boundingVolumeUpdated)
UpdateBoundingVolume();
return m_boundingVolume;
}
const NzParticleDeclaration* NzParticleSystem::GetDeclaration() const
{
return m_declaration;
@@ -238,8 +228,6 @@ NzParticleSystem& NzParticleSystem::operator=(const NzParticleSystem& system)
NzSceneNode::operator=(system);
m_boundingVolume = system.m_boundingVolume;
m_boundingVolumeUpdated = system.m_boundingVolumeUpdated;
m_controllers = system.m_controllers;
m_declaration = system.m_declaration;
m_fixedStepEnabled = system.m_fixedStepEnabled;
@@ -308,7 +296,7 @@ void NzParticleSystem::ApplyControllers(NzParticleMapper& mapper, unsigned int p
m_dyingParticles.clear();
}
void NzParticleSystem::GenerateAABB() const
void NzParticleSystem::MakeBoundingVolume() const
{
///TODO: Calculer l'AABB (prendre la taille des particules en compte s'il y a)
m_boundingVolume.MakeInfinite();
@@ -356,16 +344,3 @@ void NzParticleSystem::Update()
ApplyControllers(mapper, m_particleCount, elapsedTime, m_stepAccumulator);
}
}
void NzParticleSystem::UpdateBoundingVolume() const
{
if (m_boundingVolume.IsNull())
GenerateAABB();
if (!m_transformMatrixUpdated)
UpdateTransformMatrix();
///FIXME: Pourquoi est-ce que le particle system est un node ? Il serait trop coûteux de calculer les particules relativement
m_boundingVolume.Update(m_transformMatrix);
m_boundingVolumeUpdated = true;
}