From 5d441583f2db300ea3e04beda3fa58bf784987b5 Mon Sep 17 00:00:00 2001 From: Lynix Date: Wed, 23 Nov 2016 14:06:47 +0100 Subject: [PATCH] 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