Box3D
Safe HaskellNone
LanguageGHC2021

Box3D.Types

Description

Low-level bindings to the enums and configuration structs of box3d/types.h needed to create and configure worlds, bodies and shapes.

The *Def structs carry an internalValue magic that Box3D uses to detect an initialised definition, so always start from the matching default* constructor and tweak the fields you need before use. Every C bool maps to CBool (one byte), and opaque callback / userData pointers are kept as Ptr () until the callback layer lands.

Synopsis

Enums

newtype BodyType Source #

The body simulation type.

Constructors

BodyType CInt 

Instances

Instances details
Storable BodyType Source # 
Instance details

Defined in Box3D.Types

Show BodyType Source # 
Instance details

Defined in Box3D.Types

Eq BodyType Source # 
Instance details

Defined in Box3D.Types

newtype ShapeType Source #

Shape geometry type.

Constructors

ShapeType CInt 

Instances

Instances details
Storable ShapeType Source # 
Instance details

Defined in Box3D.Types

Show ShapeType Source # 
Instance details

Defined in Box3D.Types

Eq ShapeType Source # 
Instance details

Defined in Box3D.Types

newtype JointType Source #

Joint type.

Constructors

JointType CInt 

Instances

Instances details
Storable JointType Source # 
Instance details

Defined in Box3D.Types

Show JointType Source # 
Instance details

Defined in Box3D.Types

Eq JointType Source # 
Instance details

Defined in Box3D.Types

Small structs

data Capacity Source #

Optional world capacities used to avoid run-time allocations.

Instances

Instances details
Storable Capacity Source # 
Instance details

Defined in Box3D.Types

Show Capacity Source # 
Instance details

Defined in Box3D.Types

Eq Capacity Source # 
Instance details

Defined in Box3D.Types

data Filter Source #

Collision filtering data.

Instances

Instances details
Storable Filter Source # 
Instance details

Defined in Box3D.Types

Show Filter Source # 
Instance details

Defined in Box3D.Types

Eq Filter Source # 
Instance details

Defined in Box3D.Types

Methods

(==) :: Filter -> Filter -> Bool #

(/=) :: Filter -> Filter -> Bool #

data Sphere Source #

A sphere with a local center offset.

Constructors

Sphere 

Instances

Instances details
Storable Sphere Source # 
Instance details

Defined in Box3D.Types

Show Sphere Source # 
Instance details

Defined in Box3D.Types

Eq Sphere Source # 
Instance details

Defined in Box3D.Types

Methods

(==) :: Sphere -> Sphere -> Bool #

(/=) :: Sphere -> Sphere -> Bool #

data Capsule Source #

A capsule: an extruded sphere between two hemisphere centers.

Instances

Instances details
Storable Capsule Source # 
Instance details

Defined in Box3D.Types

Show Capsule Source # 
Instance details

Defined in Box3D.Types

Eq Capsule Source # 
Instance details

Defined in Box3D.Types

Methods

(==) :: Capsule -> Capsule -> Bool #

(/=) :: Capsule -> Capsule -> Bool #

Definitions

data WorldDef Source #

World creation definition. Initialise with defaultWorldDef.

Instances

Instances details
Storable WorldDef Source # 
Instance details

Defined in Box3D.Types

Show WorldDef Source # 
Instance details

Defined in Box3D.Types

Eq WorldDef Source # 
Instance details

Defined in Box3D.Types

data EnqueueTaskCallback Source #

Phantom tags for the task-system callbacks stored on WorldDef. These typedefs never appear in API signatures, so Box3D.Tags carries no tag for them; produce values with withThreadPoolTaskSystem.

data ShapeDef Source #

Shape creation definition. Initialise with defaultShapeDef.

Constructors

ShapeDef 

Fields

Instances

Instances details
Storable ShapeDef Source # 
Instance details

Defined in Box3D.Types

Show ShapeDef Source # 
Instance details

Defined in Box3D.Types

Eq ShapeDef Source # 
Instance details

Defined in Box3D.Types

defaultExplosionDef :: IO ExplosionDef Source #

A fully-initialised explosion definition.

Queries and casts

data QueryFilter Source #

Filter for world queries: which shape categories to accept. The optional id / name pair tags the query in a recording; a nullPtr name means untagged.

defaultQueryFilter :: IO QueryFilter Source #

A fully-initialised query filter (accept everything, untagged).

data MassData Source #

The mass, centroid and inertia tensor of a shape or body.

Instances

Instances details
Storable MassData Source # 
Instance details

Defined in Box3D.Types

Show MassData Source # 
Instance details

Defined in Box3D.Types

Eq MassData Source # 
Instance details

Defined in Box3D.Types

data RayCastInput Source #

Low-level ray-cast input in the local frame of the target shape.

data CastOutput Source #

Low-level ray or shape-cast output, in the frame of the input. A zero fraction and normal signal initial overlap. The triangle/child/material indices are -1 when not applicable.

Instances

Instances details
Storable CastOutput Source # 
Instance details

Defined in Box3D.Types

Show CastOutput Source # 
Instance details

Defined in Box3D.Types

Eq CastOutput Source # 
Instance details

Defined in Box3D.Types

type WorldCastOutput = CastOutput Source #

World-space cast output. In single-precision builds (the default) this is the same struct as CastOutput.

data TreeStats Source #

Broad-phase traversal counters for a query. Diagnostic.

Instances

Instances details
Storable TreeStats Source # 
Instance details

Defined in Box3D.Types

Show TreeStats Source # 
Instance details

Defined in Box3D.Types

Eq TreeStats Source # 
Instance details

Defined in Box3D.Types

data Sweep Source #

The motion of a body between two configurations, for TOI computation.

Constructors

Sweep 

Instances

Instances details
Storable Sweep Source # 
Instance details

Defined in Box3D.Types

Methods

sizeOf :: Sweep -> Int #

alignment :: Sweep -> Int #

peekElemOff :: Ptr Sweep -> Int -> IO Sweep #

pokeElemOff :: Ptr Sweep -> Int -> Sweep -> IO () #

peekByteOff :: Ptr b -> Int -> IO Sweep #

pokeByteOff :: Ptr b -> Int -> Sweep -> IO () #

peek :: Ptr Sweep -> IO Sweep #

poke :: Ptr Sweep -> Sweep -> IO () #

Show Sweep Source # 
Instance details

Defined in Box3D.Types

Methods

showsPrec :: Int -> Sweep -> ShowS #

show :: Sweep -> String #

showList :: [Sweep] -> ShowS #

Eq Sweep Source # 
Instance details

Defined in Box3D.Types

Methods

(==) :: Sweep -> Sweep -> Bool #

(/=) :: Sweep -> Sweep -> Bool #

data PlaneResult Source #

One collision plane from collideMover, relative to the query origin.

dynamicTreeByteCount :: Int Source #

The size of the (opaque) b3DynamicTree struct, for allocating one to initialise with create.

Events

data BodyEvents Source #

Body events buffer: a C-owned array of BodyMoveEvent valid until the next step. Marshalled to a list by Box3D.Events.

Instances

Instances details
Storable BodyEvents Source # 
Instance details

Defined in Box3D.Types

Show BodyEvents Source # 
Instance details

Defined in Box3D.Types

Eq BodyEvents Source # 
Instance details

Defined in Box3D.Types

data BodyMoveEvent Source #

A body move event: the new transform of a body that moved this step. Read after step and before the next step (see Box3D.Events).

data SensorEvents Source #

Sensor events buffer: C-owned begin/end arrays valid until the next step. Marshalled to lists by Box3D.Events.

data JointEvents Source #

Joint events buffer: a C-owned array of JointEvent valid until the next step. Marshalled to a list by Box3D.Events.

data JointEvent Source #

A joint exceeded its force/torque event threshold this step.

Instances

Instances details
Storable JointEvent Source # 
Instance details

Defined in Box3D.Types

Show JointEvent Source # 
Instance details

Defined in Box3D.Types

Eq JointEvent Source # 
Instance details

Defined in Box3D.Types

Default definitions

defaultWorldDef :: IO WorldDef Source #

A fully-initialised world definition.

defaultBodyDef :: IO BodyDef Source #

A fully-initialised body definition.

defaultShapeDef :: IO ShapeDef Source #

A fully-initialised shape definition.

defaultFilter :: IO Filter Source #

A fully-initialised collision filter.

defaultSurfaceMaterial :: IO SurfaceMaterial Source #

A fully-initialised surface material.

Joint definitions

data DistanceJointDef Source #

Distance joint definition. Initialise with defaultDistanceJointDef.

defaultDistanceJointDef :: IO DistanceJointDef Source #

A fully-initialised DistanceJointDef.

defaultMotorJointDef :: IO MotorJointDef Source #

A fully-initialised MotorJointDef.

defaultParallelJointDef :: IO ParallelJointDef Source #

A fully-initialised ParallelJointDef.

data PrismaticJointDef Source #

Prismatic joint definition. Initialise with defaultPrismaticJointDef.

defaultPrismaticJointDef :: IO PrismaticJointDef Source #

A fully-initialised PrismaticJointDef.

defaultRevoluteJointDef :: IO RevoluteJointDef Source #

A fully-initialised RevoluteJointDef.

data SphericalJointDef Source #

Spherical joint definition. Initialise with defaultSphericalJointDef.

defaultSphericalJointDef :: IO SphericalJointDef Source #

A fully-initialised SphericalJointDef.

defaultWeldJointDef :: IO WeldJointDef Source #

A fully-initialised WeldJointDef.

data WheelJointDef Source #

Wheel joint definition. Initialise with defaultWheelJointDef.

defaultWheelJointDef :: IO WheelJointDef Source #

A fully-initialised WheelJointDef.

defaultFilterJointDef :: IO FilterJointDef Source #

A fully-initialised FilterJointDef.