From 5d441583f2db300ea3e04beda3fa58bf784987b5 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 23 Nov 2016 14:06:47 +0100 Subject: [PATCH 1/4] Graphics/Particlegroup: Add GetBuffer method --- include/Nazara/Graphics/ParticleGroup.hpp | 4 +++ include/Nazara/Graphics/ParticleGroup.inl | 40 +++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 include/Nazara/Graphics/ParticleGroup.inl diff --git a/include/Nazara/Graphics/ParticleGroup.hpp b/include/Nazara/Graphics/ParticleGroup.hpp index 35feaa674..460694160 100644 --- a/include/Nazara/Graphics/ParticleGroup.hpp +++ b/include/Nazara/Graphics/ParticleGroup.hpp @@ -44,6 +44,8 @@ namespace Nz void* GenerateParticle(); void* GenerateParticles(unsigned int count); + inline void* GetBuffer(); + inline const void* GetBuffer() const; const ParticleDeclarationConstRef& GetDeclaration() const; std::size_t GetMaxParticleCount() const; std::size_t GetParticleCount() const; @@ -94,4 +96,6 @@ namespace Nz }; } +#include + #endif // NAZARA_PARTICLEGROUP_HPP diff --git a/include/Nazara/Graphics/ParticleGroup.inl b/include/Nazara/Graphics/ParticleGroup.inl new file mode 100644 index 000000000..f0e205346 --- /dev/null +++ b/include/Nazara/Graphics/ParticleGroup.inl @@ -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 +#include +#include + +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 From 24e0163a8a6578f41d9de85de927c9bb8de4f134 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 23 Nov 2016 14:07:01 +0100 Subject: [PATCH 2/4] Graphics/ParticleMapper: Add GetPointer method --- include/Nazara/Graphics/ParticleMapper.hpp | 1 + include/Nazara/Graphics/ParticleMapper.inl | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/include/Nazara/Graphics/ParticleMapper.hpp b/include/Nazara/Graphics/ParticleMapper.hpp index e66b519a7..ffbe2a5ad 100644 --- a/include/Nazara/Graphics/ParticleMapper.hpp +++ b/include/Nazara/Graphics/ParticleMapper.hpp @@ -22,6 +22,7 @@ namespace Nz template SparsePtr GetComponentPtr(ParticleComponent component); template SparsePtr GetComponentPtr(ParticleComponent component) const; + inline void* GetPointer(); private: const ParticleDeclaration* m_declaration; diff --git a/include/Nazara/Graphics/ParticleMapper.inl b/include/Nazara/Graphics/ParticleMapper.inl index 7d33bb655..1a4566c33 100644 --- a/include/Nazara/Graphics/ParticleMapper.inl +++ b/include/Nazara/Graphics/ParticleMapper.inl @@ -68,6 +68,18 @@ namespace Nz return SparsePtr(); } } + + /*! + * \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 From 88895df1d0d3201b841e666006edbf0c144a2e40 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 23 Nov 2016 14:07:20 +0100 Subject: [PATCH 3/4] SDK/Systems: Disable VelocitySystem if PhysicsComponent2D is present --- SDK/src/NDK/Systems/VelocitySystem.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SDK/src/NDK/Systems/VelocitySystem.cpp b/SDK/src/NDK/Systems/VelocitySystem.cpp index 4bc3b3a68..bc8042cd7 100644 --- a/SDK/src/NDK/Systems/VelocitySystem.cpp +++ b/SDK/src/NDK/Systems/VelocitySystem.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -14,8 +15,8 @@ namespace Ndk * \class Ndk::VelocitySystem * \brief NDK class that represents the velocity system * - * \remark This system is enabled if the entity owns the trait: NodeComponent and VelocityComponent - * but it's disabled with the trait: PhysicsComponent3D + * \remark This system is enabled if the entity owns the traits NodeComponent and VelocityComponent + * but it's disabled with the traits: PhysicsComponent2D, PhysicsComponent3D */ /*! @@ -24,7 +25,7 @@ namespace Ndk VelocitySystem::VelocitySystem() { - Excludes(); + Excludes(); Requires(); SetUpdateOrder(10); //< Since some systems may want to stop us } From c4e837b14f582a173e9a47492d4a4ec1caff511b Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 23 Nov 2016 14:07:38 +0100 Subject: [PATCH 4/4] Graphics/ParticleStruct: Replace life type from UInt32 to float --- include/Nazara/Graphics/ParticleStruct.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Nazara/Graphics/ParticleStruct.hpp b/include/Nazara/Graphics/ParticleStruct.hpp index 895e8fca2..b4f55a3a1 100644 --- a/include/Nazara/Graphics/ParticleStruct.hpp +++ b/include/Nazara/Graphics/ParticleStruct.hpp @@ -21,16 +21,16 @@ namespace Nz Vector3f normal; Vector3f position; Vector3f velocity; - UInt32 life; + float life; float rotation; }; struct ParticleStruct_Model { + Quaternionf rotation; Vector3f position; Vector3f velocity; - UInt32 life; - Quaternionf rotation; + float life; }; struct ParticleStruct_Sprite @@ -38,7 +38,7 @@ namespace Nz Color color; Vector3f position; Vector3f velocity; - UInt32 life; + float life; float rotation; }; }