Merge remote-tracking branch 'refs/remotes/origin/master' into culling

This commit is contained in:
Lynix 2016-11-23 14:12:46 +01:00
commit 7e7549b182
6 changed files with 65 additions and 7 deletions

View File

@ -4,6 +4,7 @@
#include <NDK/Systems/VelocitySystem.hpp> #include <NDK/Systems/VelocitySystem.hpp>
#include <NDK/Components/NodeComponent.hpp> #include <NDK/Components/NodeComponent.hpp>
#include <NDK/Components/PhysicsComponent2D.hpp>
#include <NDK/Components/PhysicsComponent3D.hpp> #include <NDK/Components/PhysicsComponent3D.hpp>
#include <NDK/Components/VelocityComponent.hpp> #include <NDK/Components/VelocityComponent.hpp>
@ -14,8 +15,8 @@ namespace Ndk
* \class Ndk::VelocitySystem * \class Ndk::VelocitySystem
* \brief NDK class that represents the velocity system * \brief NDK class that represents the velocity system
* *
* \remark This system is enabled if the entity owns the trait: NodeComponent and VelocityComponent * \remark This system is enabled if the entity owns the traits NodeComponent and VelocityComponent
* but it's disabled with the trait: PhysicsComponent3D * but it's disabled with the traits: PhysicsComponent2D, PhysicsComponent3D
*/ */
/*! /*!
@ -24,7 +25,7 @@ namespace Ndk
VelocitySystem::VelocitySystem() VelocitySystem::VelocitySystem()
{ {
Excludes<PhysicsComponent3D>(); Excludes<PhysicsComponent2D, PhysicsComponent3D>();
Requires<NodeComponent, VelocityComponent>(); Requires<NodeComponent, VelocityComponent>();
SetUpdateOrder(10); //< Since some systems may want to stop us SetUpdateOrder(10); //< Since some systems may want to stop us
} }

View File

@ -44,6 +44,8 @@ namespace Nz
void* GenerateParticle(); void* GenerateParticle();
void* GenerateParticles(unsigned int count); void* GenerateParticles(unsigned int count);
inline void* GetBuffer();
inline const void* GetBuffer() const;
const ParticleDeclarationConstRef& GetDeclaration() const; const ParticleDeclarationConstRef& GetDeclaration() const;
std::size_t GetMaxParticleCount() const; std::size_t GetMaxParticleCount() const;
std::size_t GetParticleCount() const; std::size_t GetParticleCount() const;
@ -94,4 +96,6 @@ namespace Nz
}; };
} }
#include <Nazara/Graphics/ParticleGroup.inl>
#endif // NAZARA_PARTICLEGROUP_HPP #endif // NAZARA_PARTICLEGROUP_HPP

View File

@ -0,0 +1,40 @@
// Copyright (C) 2016 Jérôme Leclercq
// 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/ParticleGroup.hpp>
#include <Nazara/Core/Error.hpp>
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
{
/*!
* \brief Gets a raw pointer to the particle buffer
*
* This can be useful when working directly with a struct, or needing to iterate over all particles.
*
* \return Pointer to the buffer
*
* \see GetParticleCount
*/
inline void* ParticleGroup::GetBuffer()
{
return m_buffer.data();
}
/*!
* \brief Gets a raw pointer to the particle buffer
*
* This can be useful when working directly with a struct, or needing to iterate over all particles.
*
* \return Pointer to the buffer
*
* \see GetParticleCount
*/
inline const void* ParticleGroup::GetBuffer() const
{
return m_buffer.data();
}
}
#include <Nazara/Graphics/DebugOff.hpp>

View File

@ -22,6 +22,7 @@ namespace Nz
template<typename T> SparsePtr<T> GetComponentPtr(ParticleComponent component); template<typename T> SparsePtr<T> GetComponentPtr(ParticleComponent component);
template<typename T> SparsePtr<const T> GetComponentPtr(ParticleComponent component) const; template<typename T> SparsePtr<const T> GetComponentPtr(ParticleComponent component) const;
inline void* GetPointer();
private: private:
const ParticleDeclaration* m_declaration; const ParticleDeclaration* m_declaration;

View File

@ -68,6 +68,18 @@ namespace Nz
return SparsePtr<const T>(); return SparsePtr<const T>();
} }
} }
/*!
* \brief Gets a raw pointer to the particle buffer
*
* This can be useful when working directly with a struct
*
* \return Pointer to the buffer
*/
inline void* ParticleMapper::GetPointer()
{
return m_ptr;
}
} }
#include <Nazara/Graphics/DebugOff.hpp> #include <Nazara/Graphics/DebugOff.hpp>

View File

@ -21,16 +21,16 @@ namespace Nz
Vector3f normal; Vector3f normal;
Vector3f position; Vector3f position;
Vector3f velocity; Vector3f velocity;
UInt32 life; float life;
float rotation; float rotation;
}; };
struct ParticleStruct_Model struct ParticleStruct_Model
{ {
Quaternionf rotation;
Vector3f position; Vector3f position;
Vector3f velocity; Vector3f velocity;
UInt32 life; float life;
Quaternionf rotation;
}; };
struct ParticleStruct_Sprite struct ParticleStruct_Sprite
@ -38,7 +38,7 @@ namespace Nz
Color color; Color color;
Vector3f position; Vector3f position;
Vector3f velocity; Vector3f velocity;
UInt32 life; float life;
float rotation; float rotation;
}; };
} }