<commit_before>#include <Internal/FluidManagerImpl.hpp>
#include <Internal/PhysicsModuleImplementation.hpp>
namespace DoremiEngine
{
    namespace Physics
    {
        FluidManagerImpl::FluidManagerImpl(InternalPhysicsUtils& p_utils) : m_utils(p_utils) {}
        FluidManagerImpl::~FluidManagerImpl() {}

        void FluidManagerImpl::CreateFluid(int p_id)
        {
            float maxParticles = 100;
            bool perParticleRestOffset = false;

            // Create the particle systen
            PxParticleSystem* particleSystem = m_utils.m_physics->createParticleSystem(maxParticles, perParticleRestOffset);

            // Add particle system to the world
            if(particleSystem)
            {
                m_utils.m_worldScene->addActor(*particleSystem);
            }
        }
        void FluidManagerImpl::CreateFluidParticles(int p_id, vector<XMFLOAT3>& p_positions, vector<XMFLOAT3>& p_velocities, vector<int32_t>& p_indices)
        {
            // Cast XMFLOAT3s into something that PhysX likes. Possible since the data of the types are identical. Thanks, Bolt!
            PxVec3* positions = reinterpret_cast<PxVec3*>(&p_positions[0]);
            PxVec3* velocities = reinterpret_cast<PxVec3*>(&p_velocities[0]);
            PxU32* indices = reinterpret_cast<PxU32*>(&p_indices[0]);
            // Create the data for the particles
            PxParticleCreationData particleData;
            particleData.positionBuffer = PxStrideIterator<const PxVec3>(positions);
            particleData.velocityBuffer = PxStrideIterator<const PxVec3>(velocities);
            particleData.indexBuffer = PxStrideIterator<const PxU32>(indices);
            // Check that the data is valid
            if(particleData.isValid())
            {
                // Create the particles
                m_fluids[p_id]->createParticles(particleData);
            }
            else
            {
                // Shit went wrong! Handle somehow?
            }
        }

        vector<XMFLOAT3> FluidManagerImpl::GetParticlePositions(int p_id)
        {
            PxParticleFluidReadData* readData = m_fluids[p_id]->lockParticleFluidReadData();
            return vector<XMFLOAT3>();
        }
    }
}<commit_msg>FluidManager: implementet method to get positions<commit_after>#include <Internal/FluidManagerImpl.hpp>
#include <Internal/PhysicsModuleImplementation.hpp>
namespace DoremiEngine
{
    namespace Physics
    {
        FluidManagerImpl::FluidManagerImpl(InternalPhysicsUtils& p_utils) : m_utils(p_utils) {}
        FluidManagerImpl::~FluidManagerImpl() {}

        void FluidManagerImpl::CreateFluid(int p_id)
        {
            float maxParticles = 100;
            bool perParticleRestOffset = false;

            // Create the particle systen
            PxParticleSystem* particleSystem = m_utils.m_physics->createParticleSystem(maxParticles, perParticleRestOffset);

            // Add particle system to the world
            if(particleSystem)
            {
                m_utils.m_worldScene->addActor(*particleSystem);
            }
        }
        void FluidManagerImpl::CreateFluidParticles(int p_id, vector<XMFLOAT3>& p_positions, vector<XMFLOAT3>& p_velocities, vector<int32_t>& p_indices)
        {
            // Cast XMFLOAT3s into something that PhysX likes. Possible since the data of the types are identical. Thanks, Bolt!
            PxVec3* positions = reinterpret_cast<PxVec3*>(&p_positions[0]);
            PxVec3* velocities = reinterpret_cast<PxVec3*>(&p_velocities[0]);
            PxU32* indices = reinterpret_cast<PxU32*>(&p_indices[0]);
            // Create the data for the particles
            PxParticleCreationData particleData;
            particleData.positionBuffer = PxStrideIterator<const PxVec3>(positions);
            particleData.velocityBuffer = PxStrideIterator<const PxVec3>(velocities);
            particleData.indexBuffer = PxStrideIterator<const PxU32>(indices);
            // Check that the data is valid
            if(particleData.isValid())
            {
                // Create the particles
                m_fluids[p_id]->createParticles(particleData);
            }
            else
            {
                // Shit went wrong! Handle somehow?
            }
        }

        vector<XMFLOAT3> FluidManagerImpl::GetParticlePositions(int p_id)
        {
            PxParticleFluidReadData* readData = m_fluids[p_id]->lockParticleFluidReadData();
            PxStrideIterator<const PxVec3> positions = readData->positionBuffer;
            const XMFLOAT3* positionsXM = reinterpret_cast<const XMFLOAT3*>(positions.ptr());
            int numParticles = readData->nbValidParticles;
            vector<const XMFLOAT3> positionsXMVector;
            positionsXMVector.reserve(numParticles);
            positionsXMVector.data = positionsXMVector;
        }
    }
}
{'fraction_non_alphanumeric': 0.08562628336755647, 'fraction_numerical': 0.010882956878850103, 'mean_word_length': 2.452161587526577, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6639378', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1341, 'n_words': 251}