Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
Divide::PXDevice Class Referencefinal

#include <PXDevice.h>

+ Inheritance diagram for Divide::PXDevice:

Public Types

enum class  PhysicsAPI : U8 { PhysX = 0 , ODE , Bullet , COUNT }
 

Public Member Functions

 PXDevice (PlatformContext &context) noexcept
 
 ~PXDevice () override
 
ErrorCode initPhysicsAPI (U8 targetFrameRate, F32 simSpeed) override
 
bool closePhysicsAPI () override
 
void updateTimeStep (U8 timeStepFactor, F32 simSpeed) override
 
void idle () override
 
bool convertActor (PhysicsAsset *actor, PhysicsGroup newGroup) override
 
bool initPhysicsScene (Scene &scene) override
 
bool destroyPhysicsScene (const Scene &scene) override
 
PhysicsAssetcreateRigidActor (SceneGraphNode *node, RigidBodyComponent &parentComp) override
 
PhysicsAPIWrappergetImpl ()
 
const PhysicsAPIWrappergetImpl () const
 
bool intersect (const Ray &intersectionRay, vec2< F32 > range, vector< SGNRayResult > &intersectionsOut) const override
 
bool frameStarted (const FrameEvent &evt) override
 
bool frameEnded (const FrameEvent &evt) noexcept override
 frameEnded is called after the buffers have been swapped
 
 PROPERTY_RW (PhysicsAPI, apiID, PhysicsAPI::COUNT)
 
- Public Member Functions inherited from Divide::PhysicsAPIWrapper
 PhysicsAPIWrapper (PlatformContext &context)
 
virtual bool convertActor (PhysicsAsset *actor, PhysicsGroup newGroup)=0
 
- Public Member Functions inherited from Divide::PlatformContextComponent
 PlatformContextComponent (PlatformContext &context) noexcept
 
virtual ~PlatformContextComponent ()=default
 
PlatformContextcontext () noexcept
 
const PlatformContextcontext () const noexcept
 
- Public Member Functions inherited from Divide::NonCopyable
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
 NonCopyable (NonCopyable &&)=default
 
NonCopyableoperator= (NonCopyable &&)=default
 
- Public Member Functions inherited from Divide::FrameListener
 FrameListener (const Str< 64 > &name, FrameListenerManager &parent, U32 callOrder)
 Either give it a name.
 
virtual ~FrameListener () override
 
bool operator< (FrameListener &that) const noexcept
 
- Public Member Functions inherited from Divide::GUIDWrapper
 GUIDWrapper () noexcept
 
 GUIDWrapper (const GUIDWrapper &old) noexcept
 
 GUIDWrapper (GUIDWrapper &&old) noexcept
 
virtual ~GUIDWrapper ()=default
 
FORCE_INLINE I64 getGUID () const noexcept
 
GUIDWrapperoperator= (const GUIDWrapper &old)=delete
 
GUIDWrapperoperator= (GUIDWrapper &&other)=delete
 

Protected Member Functions

void frameStarted (U64 deltaTimeGameUS) override
 
void frameEnded (U64 deltaTimeGameUS) noexcept override
 
virtual ErrorCode initPhysicsAPI (U8 targetFrameRate, F32 simSpeed)=0
 
virtual bool closePhysicsAPI ()=0
 
virtual void updateTimeStep (U8 timeStepFactor, F32 simSpeed)=0
 
virtual void idle ()=0
 
virtual bool initPhysicsScene (Scene &scene)=0
 
virtual bool destroyPhysicsScene (const Scene &scene)=0
 
virtual void frameStarted (const U64 deltaTimeGameUS)=0
 
virtual void frameEnded (const U64 deltaTimeGameUS)=0
 
virtual PhysicsAssetcreateRigidActor (SceneGraphNode *node, RigidBodyComponent &parentComp)=0
 
virtual bool intersect (const Ray &intersectionRay, vec2< F32 > range, vector< SGNRayResult > &intersectionsOut) const =0
 
- Protected Member Functions inherited from Divide::NonCopyable
 NonCopyable ()=default
 
 ~NonCopyable ()=default
 
- Protected Member Functions inherited from Divide::FrameListener
void setCallOrder (const U32 order) noexcept
 
virtual bool frameStarted (const FrameEvent &evt)
 
virtual bool framePreRender (const FrameEvent &evt)
 framePreRenderStarted is called when we need to start processing the visual aspect of a scene
 
virtual bool frameSceneRenderStarted (const FrameEvent &evt)
 frameSceneRenderStarted is called right before rendering the scene for the current player starts
 
virtual bool frameSceneRenderEnded (const FrameEvent &evt)
 frameSceneRenderEnded is called immediately after scene rendering for the current player has ended but before any blitting operations
 
virtual bool frameRenderingQueued (const FrameEvent &evt)
 
virtual bool framePostRender (const FrameEvent &evt)
 
virtual bool frameEnded (const FrameEvent &evt)
 frameEnded is called after the buffers have been swapped
 
 PROPERTY_R_IW (bool, enabled, false)
 
 PROPERTY_RW (Str< 64 >, name)
 

Private Attributes

F32 _simulationSpeed = 1.0f
 
PhysicsAPIWrapper_uptr _api = nullptr
 

Additional Inherited Members

- Static Public Member Functions inherited from Divide::GUIDWrapper
static I64 generateGUID () noexcept
 
- Protected Attributes inherited from Divide::PlatformContextComponent
PlatformContext_context
 
- Protected Attributes inherited from Divide::GUIDWrapper
const I64 _guid
 

Detailed Description

Definition at line 43 of file PXDevice.h.

Member Enumeration Documentation

◆ PhysicsAPI

enum class Divide::PXDevice::PhysicsAPI : U8
strong
Enumerator
PhysX 
ODE 
Bullet 
COUNT 

Definition at line 46 of file PXDevice.h.

Constructor & Destructor Documentation

◆ PXDevice()

Divide::PXDevice::PXDevice ( PlatformContext context)
explicitnoexcept

Definition at line 22 of file PXDevice.cpp.

◆ ~PXDevice()

Divide::PXDevice::~PXDevice ( )
override

Definition at line 28 of file PXDevice.cpp.

Member Function Documentation

◆ closePhysicsAPI()

bool Divide::PXDevice::closePhysicsAPI ( )
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 55 of file PXDevice.cpp.

◆ convertActor()

bool Divide::PXDevice::convertActor ( PhysicsAsset actor,
PhysicsGroup  newGroup 
)
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 124 of file PXDevice.cpp.

◆ createRigidActor()

PhysicsAsset * Divide::PXDevice::createRigidActor ( SceneGraphNode node,
RigidBodyComponent parentComp 
)
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 118 of file PXDevice.cpp.

◆ destroyPhysicsScene()

bool Divide::PXDevice::destroyPhysicsScene ( const Scene scene)
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 113 of file PXDevice.cpp.

◆ frameEnded() [1/2]

bool Divide::PXDevice::frameEnded ( const FrameEvent evt)
overridevirtualnoexcept

frameEnded is called after the buffers have been swapped

Reimplemented from Divide::FrameListener.

Definition at line 75 of file PXDevice.cpp.

◆ frameEnded() [2/2]

void Divide::PXDevice::frameEnded ( U64  deltaTimeGameUS)
overrideprotectedvirtualnoexcept

Implements Divide::PhysicsAPIWrapper.

Definition at line 83 of file PXDevice.cpp.

◆ frameStarted() [1/2]

bool Divide::PXDevice::frameStarted ( const FrameEvent evt)
overridevirtual

Adapter patern instead of pure interface for the same reason as the Ogre boys pointed out: Implement what you need without filling classes with dummy functions frameStarted is calld at the beggining of a new frame before processing the logic aspect of a scene

Reimplemented from Divide::FrameListener.

Definition at line 88 of file PXDevice.cpp.

◆ frameStarted() [2/2]

void Divide::PXDevice::frameStarted ( U64  deltaTimeGameUS)
overrideprotectedvirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 96 of file PXDevice.cpp.

◆ getImpl() [1/2]

PhysicsAPIWrapper & Divide::PXDevice::getImpl ( )
inline

Definition at line 68 of file PXDevice.h.

◆ getImpl() [2/2]

const PhysicsAPIWrapper & Divide::PXDevice::getImpl ( ) const
inline

Definition at line 69 of file PXDevice.h.

◆ idle()

void Divide::PXDevice::idle ( )
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 101 of file PXDevice.cpp.

◆ initPhysicsAPI()

ErrorCode Divide::PXDevice::initPhysicsAPI ( U8  targetFrameRate,
F32  simSpeed 
)
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 33 of file PXDevice.cpp.

◆ initPhysicsScene()

bool Divide::PXDevice::initPhysicsScene ( Scene scene)
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 108 of file PXDevice.cpp.

◆ intersect()

bool Divide::PXDevice::intersect ( const Ray intersectionRay,
vec2< F32 range,
vector< SGNRayResult > &  intersectionsOut 
) const
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 130 of file PXDevice.cpp.

◆ PROPERTY_RW()

Divide::PXDevice::PROPERTY_RW ( PhysicsAPI  ,
apiID  ,
PhysicsAPI::COUNT   
)

◆ updateTimeStep()

void Divide::PXDevice::updateTimeStep ( U8  timeStepFactor,
F32  simSpeed 
)
overridevirtual

Implements Divide::PhysicsAPIWrapper.

Definition at line 69 of file PXDevice.cpp.

Member Data Documentation

◆ _api

PhysicsAPIWrapper_uptr Divide::PXDevice::_api = nullptr
private

Definition at line 84 of file PXDevice.h.

◆ _simulationSpeed

F32 Divide::PXDevice::_simulationSpeed = 1.0f
private

Definition at line 83 of file PXDevice.h.


The documentation for this class was generated from the following files: