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
 
struct  Aggregate
 
class  AggregateContext
 
struct  AggregateId
 
struct  AggregateInfo
 
struct  AggregateResourceId
 
class  Allocator
 
struct  BodyInfo
 
struct  Constraint
 
struct  ConstraintId
 
struct  ConstraintInfo
 
struct  ConstraintResourceId
 
struct  ContactEvent
 
class  ErrorCallback
 
struct  Material
 
struct  PhysicsResourceId
 
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...
 
struct  ShapeHandle
 
class  StreamActorPool
 
class  VisualDebugger
 Class that communicates with the physics visual debugger program. More...
 

Typedefs

using UpdateFunctionType = void (*) (const Actor&)
 
using EventCallbackType = void (*) (const Util::Array<ContactEvent>&)
 

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)
 
static void PreSceneUpdates (Physics::Scene &scene)
 
static void PostSceneUpdates (Physics::Scene &scene)
 
static PxShape * GetShapeCopy (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::transform &trans, const char *name, const Util::String &colliderName, BodyInfo &bodyInfo, const Util::StringAtom &tag, Ids::Id32 entry)
 
static void AddMeshColliders (PhysicsResource::MeshColliderT *colliderNode, Math::transform const &nodeTransform, Util::String nodeName, IndexT materialIdx, const Util::StringAtom &tag, Ids::Id32 entry, BodyInfo &targetBody)
 
static void AddHeightField (PhysicsResource::HeightFieldColliderT *colliderNode, Math::transform const &nodeTransform, Util::String nodeName, IndexT materialIdx, const Util::StringAtom &tag, Ids::Id32 entry, BodyInfo &targetBody)
 
 __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 SetEventCallback (EventCallbackType callback, IndexT sceneId)
 
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::transform const &trans, Physics::ActorType type, uint64_t userData, IndexT scene)
 
void DestroyActorInstance (Physics::ActorId id)
 

Variables

PhysxState state
 
StreamActorPoolactorPool = nullptr
 

Typedef Documentation

◆ EventCallbackType

◆ 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::transform & trans,
const char * name,
const Util::String & colliderName,
BodyInfo & bodyInfo,
const Util::StringAtom & tag,
Ids::Id32 entry )
static

◆ AddHeightField()

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

◆ AddMeshColliders()

static void Physics::AddMeshColliders ( PhysicsResource::MeshColliderT * colliderNode,
Math::transform const & nodeTransform,
Util::String nodeName,
IndexT materialIdx,
const Util::StringAtom & tag,
Ids::Id32 entry,
BodyInfo & targetBody )
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)
static

◆ CreateActorInstance()

ActorId Physics::CreateActorInstance ( Physics::ActorResourceId id,
Math::transform const & trans,
Physics::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 ( )

◆ GetScene()

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

◆ GetShapeCopy()

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

◆ LoadMaterialTable()

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

◆ LookupMaterial()

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

◆ PostSceneUpdates()

static void Physics::PostSceneUpdates ( Physics::Scene & scene)
static

◆ PreSceneUpdates()

static void Physics::PreSceneUpdates ( Physics::Scene & scene)
static

◆ 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 )

◆ SetEventCallback()

void Physics::SetEventCallback ( EventCallbackType 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