54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
// Copyright (c) 2024 Dominic Masters
|
|
//
|
|
// This software is released under the MIT License.
|
|
// https://opensource.org/licenses/MIT
|
|
|
|
#pragma once
|
|
#include "dawn.hpp"
|
|
|
|
namespace Dawn {
|
|
class Game;
|
|
|
|
class PhysicsManager final {
|
|
private:
|
|
std::weak_ptr<Game> game;
|
|
|
|
protected:
|
|
JPH::PhysicsSystem physicsSystem;
|
|
std::shared_ptr<JPH::TempAllocatorImpl> tempAllocator;
|
|
std::shared_ptr<JPH::JobSystemThreadPool> jobSystem;
|
|
|
|
public:
|
|
|
|
/**
|
|
* Gets the game associated with the PhysicsManager.
|
|
*
|
|
* @return The game associated with the PhysicsManager.
|
|
*/
|
|
std::shared_ptr<Game> getGame();
|
|
|
|
/**
|
|
* Gets the JoltPhysics body interface system.
|
|
*
|
|
* @return The JoltPhysics body interface system.
|
|
*/
|
|
JPH::BodyInterface & getBodyInterface();
|
|
|
|
/**
|
|
* Initializes the PhysicsManager.
|
|
*
|
|
* @param game The game to initialize the PhysicsManager with.
|
|
*/
|
|
void init(const std::shared_ptr<Game> &game);
|
|
|
|
/**
|
|
* Updates the PhysicsManager.
|
|
*/
|
|
void update();
|
|
|
|
/**
|
|
* Deconstructs the PhysicsManager.
|
|
*/
|
|
~PhysicsManager();
|
|
};
|
|
} |