Nebula
Loading...
Searching...
No Matches
Physics Namespace Reference

Detailed Description

Diverse functions for manipulating physics actors.

Implements a resource loader for physics actors.

Physics shape enums.

Physics::DebugUI.

callback interfaces for PhysX

Classes

struct  Actor
 
class  ActorContext
 
struct  ActorId
 
struct  ActorInfo
 
struct  ActorResourceId
 
class  Allocator
 
struct  ColliderId
 
class  ErrorCallback
 
struct  Material
 
class  PhysxState
 
struct  Scene
 physx scene classes, foundation and physics are duplicated here for convenience instead of static getters, might be removed later on More...
 
class  StreamActorPool
 
class  VisualDebugger
 Class that communicates with the physics visual debugger program. More...
 

Typedefs

using UpdateFunctionType = void (*) (const Actor&)
 

Enumerations

enum  CollsionGroups {
  Default = 0 , Static = 1 , Kinematic = 3 , Debris = 4 ,
  SensorTrigger = 5 , Characters = 6
}
 
enum  MeshTopologyType { Convex = 0 , ConvexHull = 1 , Triangles = 2 , HeightField = 3 }
 
enum  ColliderType {
  ColliderSphere = 0 , ColliderCube = 1 , ColliderCapsule = 2 , ColliderPlane = 3 ,
  ColliderMesh = 4
}
 
enum  PhysicsIdType { ActorIdType , MeshIdType }
 
enum  ActorType { Static = 1 , Kinematic = 3 , Dynamic }
 

Functions

void RenderUI (Graphics::GraphicsEntityId camera)
 
void RenderMaterialsUI ()
 
static void CollectModified (Physics::Scene &scene, Util::Set< Ids::Id32 > &modifiedActors)
 
static PxShape * GetScaledShape (PxShape *shape, Math::vec3 const &scale)
 
static physx::PxGeometryHolder CreateMeshFromResource (MeshTopology type, Util::StringAtom resource, int primGroup)
 
static PxShape * CreateColliderShape (physx::PxGeometryHolder geometry, physx::PxMaterial *material, physx::PxTransform const &trans, const Util::String &colliderName, bool exclusive)
 
static void AddCollider (physx::PxGeometryHolder geometry, IndexT material, const Math::mat4 &trans, const char *name, const Util::String &colliderName, ActorInfo &actorInfo, const Util::StringAtom &tag, Ids::Id32 entry)
 
static void AddMeshColliders (PhysicsResource::MeshColliderT *colliderNode, Math::mat4 const &nodeTransform, Util::String nodeName, IndexT materialIdx, const Util::StringAtom &tag, Ids::Id32 entry, ActorInfo &targetActor)
 
static void AddHeightField (PhysicsResource::HeightFieldColliderT *colliderNode, Math::mat4 const &nodeTransform, Util::String nodeName, IndexT materialIdx, const Util::StringAtom &tag, Ids::Id32 entry, ActorInfo &targetActor)
 
 __ImplementInterfaceSingleton (Physics::VisualDebugger)
 
void LoadMaterialTable (const IO::URI &materialTable)
 
void Setup ()
 initialize the physics subsystem and create a default scene
 
void ShutDown ()
 close the physics subsystem
 
IndexT CreateScene ()
 
void DestroyScene (IndexT sceneId)
 
Physics::SceneGetScene (IndexT idx)
 
void SetActiveActorCallback (UpdateFunctionType callback, IndexT sceneId)
 
void RenderDebug ()
 render a debug visualization of the level
 
Physics::MaterialGetMaterial (IndexT idx)
 
void SetOnSleepCallback (Util::Delegate< void(ActorId *id, SizeT num)> const &callback)
 
void SetOnWakeCallback (Util::Delegate< void(ActorId *id, SizeT num)> const &callback)
 
IndexT SetPhysicsMaterial (Util::StringAtom name, float staticFriction, float dynamicFriction, float restitution, float density)
 
IndexT LookupMaterial (Util::StringAtom name)
 
SizeT GetNrMaterials ()
 
void Update (Timing::Time delta)
 perform sync simulation step(s)
 
void BeginSimulating (Timing::Time delta, IndexT scene)
 explicit calls to simulate and fetch results. Do not mix with Update!
 
void EndSimulating (IndexT scene)
 
void FlushSimulation (IndexT scene)
 this will block until simulation has ended for cleanups e.g.
 
ActorId CreateActorInstance (Physics::ActorResourceId id, Math::mat4 const &trans, ActorType type, uint64_t userData, IndexT scene)
 
void DestroyActorInstance (Physics::ActorId id)
 
void HandleCollisions ()
 

Variables

PhysxState state
 
StreamActorPoolactorPool = nullptr
 

Typedef Documentation

◆ UpdateFunctionType

using Physics::UpdateFunctionType = void (*) (const Actor&)

Enumeration Type Documentation

◆ ActorType

Enumerator
Static 
Kinematic 
Dynamic 

◆ ColliderType

Enumerator
ColliderSphere 
ColliderCube 
ColliderCapsule 
ColliderPlane 
ColliderMesh 

◆ CollsionGroups

Enumerator
Default 
Static 
Kinematic 
Debris 
SensorTrigger 
Characters 

◆ MeshTopologyType

Enumerator
Convex 
ConvexHull 
Triangles 
HeightField 

◆ PhysicsIdType

Enumerator
ActorIdType 
MeshIdType 

Function Documentation

◆ __ImplementInterfaceSingleton()

Physics::__ImplementInterfaceSingleton ( Physics::VisualDebugger )

◆ AddCollider()

static void Physics::AddCollider ( physx::PxGeometryHolder geometry,
IndexT material,
const Math::mat4 & trans,
const char * name,
const Util::String & colliderName,
ActorInfo & actorInfo,
const Util::StringAtom & tag,
Ids::Id32 entry )
static

◆ AddHeightField()

static void Physics::AddHeightField ( PhysicsResource::HeightFieldColliderT * colliderNode,
Math::mat4 const & nodeTransform,
Util::String nodeName,
IndexT materialIdx,
const Util::StringAtom & tag,
Ids::Id32 entry,
ActorInfo & targetActor )
static

◆ AddMeshColliders()

static void Physics::AddMeshColliders ( PhysicsResource::MeshColliderT * colliderNode,
Math::mat4 const & nodeTransform,
Util::String nodeName,
IndexT materialIdx,
const Util::StringAtom & tag,
Ids::Id32 entry,
ActorInfo & targetActor )
static

◆ BeginSimulating()

void Physics::BeginSimulating ( Timing::Time delta,
IndexT scene )

explicit calls to simulate and fetch results. Do not mix with Update!

◆ CollectModified()

static void Physics::CollectModified ( Physics::Scene & scene,
Util::Set< Ids::Id32 > & modifiedActors )
static

◆ CreateActorInstance()

ActorId Physics::CreateActorInstance ( Physics::ActorResourceId id,
Math::mat4 const & trans,
ActorType type,
uint64_t userData,
IndexT scene )

◆ CreateColliderShape()

static PxShape * Physics::CreateColliderShape ( physx::PxGeometryHolder geometry,
physx::PxMaterial * material,
physx::PxTransform const & trans,
const Util::String & colliderName,
bool exclusive )
static

◆ CreateMeshFromResource()

static physx::PxGeometryHolder Physics::CreateMeshFromResource ( MeshTopology type,
Util::StringAtom resource,
int primGroup )
static

◆ CreateScene()

IndexT Physics::CreateScene ( )

◆ DestroyActorInstance()

void Physics::DestroyActorInstance ( Physics::ActorId id)

◆ DestroyScene()

void Physics::DestroyScene ( IndexT sceneId)

◆ EndSimulating()

void Physics::EndSimulating ( IndexT scene)

◆ FlushSimulation()

void Physics::FlushSimulation ( IndexT scene)

this will block until simulation has ended for cleanups e.g.

◆ GetMaterial()

Material & Physics::GetMaterial ( IndexT idx)

◆ GetNrMaterials()

SizeT Physics::GetNrMaterials ( )

◆ GetScaledShape()

static PxShape * Physics::GetScaledShape ( PxShape * shape,
Math::vec3 const & scale )
static

◆ GetScene()

Physics::Scene & Physics::GetScene ( IndexT idx)

◆ HandleCollisions()

void Physics::HandleCollisions ( )

◆ LoadMaterialTable()

void Physics::LoadMaterialTable ( const IO::URI & materialTable)

◆ LookupMaterial()

IndexT Physics::LookupMaterial ( Util::StringAtom name)

◆ RenderDebug()

void Physics::RenderDebug ( )

render a debug visualization of the level

◆ RenderMaterialsUI()

void Physics::RenderMaterialsUI ( )

◆ RenderUI()

void Physics::RenderUI ( Graphics::GraphicsEntityId camera)

◆ SetActiveActorCallback()

void Physics::SetActiveActorCallback ( UpdateFunctionType callback,
IndexT sceneId )

◆ SetOnSleepCallback()

void Physics::SetOnSleepCallback ( Util::Delegate< void(ActorId *id, SizeT num)> const & callback)

◆ SetOnWakeCallback()

void Physics::SetOnWakeCallback ( Util::Delegate< void(ActorId *id, SizeT num)> const & callback)

◆ SetPhysicsMaterial()

IndexT Physics::SetPhysicsMaterial ( Util::StringAtom name,
float staticFriction,
float dynamicFriction,
float restitution,
float density )

◆ Setup()

void Physics::Setup ( )

initialize the physics subsystem and create a default scene

◆ ShutDown()

void Physics::ShutDown ( )

close the physics subsystem

◆ Update()

void Physics::Update ( Timing::Time delta)

perform sync simulation step(s)

Variable Documentation

◆ actorPool

StreamActorPool * Physics::actorPool = nullptr

◆ state

PhysxState Physics::state