|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
#include "./PhysicsBindings.hpp"#include "./PhysicsContext.hpp"#include <cfloat>#include <cstring>
Go to the source code of this file.
Functions | |
| static float | raycastCallback (b2ShapeId shapeId, b2Vec2 point, b2Vec2 normal, float fraction, void *context) |
| static bool | overlapCallback (b2ShapeId shapeId, void *context) |
| static float | shapeCastCallback (b2ShapeId shapeId, b2Vec2 point, b2Vec2 normal, float fraction, void *context) |
| static bool | oneWayAdmits (b2ShapeId shapeId, uint32_t entity, b2Vec2 normal, float depth) |
| static bool | normalIsSurface (b2ShapeId shapeId, const b2PlaneResult *pr) |
| static bool | moverPlaneCallback (b2ShapeId shapeId, const b2PlaneResult *pr, void *context) |
| static float | snapCastCallback (b2ShapeId shapeId, b2Vec2 point, b2Vec2 normal, float fraction, void *context) |
| static float | headroomCastCallback (b2ShapeId shapeId, b2Vec2 point, b2Vec2 normal, float fraction, void *context) |
| int | physics_raycast (float originX, float originY, float dirX, float dirY, float maxDistance, uint32_t maskBits) |
| uintptr_t | physics_getRaycastBuffer () |
| int | physics_overlapCircle (float centerX, float centerY, float radius, uint32_t maskBits) |
| uintptr_t | physics_getOverlapBuffer () |
| int | physics_shapeCastCircle (float centerX, float centerY, float radius, float translationX, float translationY, uint32_t maskBits) |
| int | physics_shapeCastBox (float centerX, float centerY, float halfW, float halfH, float angle, float translationX, float translationY, uint32_t maskBits) |
| int | physics_shapeCastCapsule (float center1X, float center1Y, float center2X, float center2Y, float radius, float translationX, float translationY, uint32_t maskBits) |
| uintptr_t | physics_getShapeCastBuffer () |
| int | physics_overlapAABB (float minX, float minY, float maxX, float maxY, uint32_t maskBits) |
| int | physics_moveCharacter (float px, float py, float c1x, float c1y, float c2x, float c2y, float radius, float velX, float velY, float dt, float upX, float upY, float floorCos, uint32_t maskBits, uint32_t selfEntity, float skinWidth, int maxSlides, float snapLength, int slideOnCeiling, float carryX, float carryY, uint32_t flags, float stepHeight) |
| uintptr_t | physics_getMoveCharacterBuffer () |
Variables | |
| static constexpr int | MAX_MOVER_PLANES = 32 |
| static constexpr int | MAX_MOVER_HITS = 4 |
| static constexpr float | MOVER_ONE_WAY_ALIGN = 0.5f |
| static constexpr float | MOVER_ONE_WAY_SLOP = 0.02f |
| static constexpr uint32_t | MOVER_DROP_THROUGH = 1u |
| static constexpr uint32_t | MOVER_IGNORE_DYNAMIC = 2u |
| static constexpr uint32_t | MOVER_BLOCK_STEEP = 4u |
| static constexpr uint32_t | MOVER_WAS_ON_FLOOR = 8u |
| static b2CollisionPlane | g_moverPlanes [MAX_MOVER_PLANES] |
| static uint32_t | g_moverPlaneEntity [MAX_MOVER_PLANES] |
| static bool | g_moverPlaneSurface [MAX_MOVER_PLANES] |
| static int | g_moverPlaneCount = 0 |
| static uint32_t | g_moverSelfEntity = 0xFFFFFFFF |
| static uint32_t | g_moverFlags = 0 |
| static b2Vec2 | g_moverVelocity = {0.0f, 0.0f} |
| static float | g_moverDt = 0.0f |
| static float | g_moverBuffer [11+MAX_MOVER_HITS *3] = {} |
| static uint32_t | g_moverHitEntity [MAX_MOVER_HITS] |
| static b2Vec2 | g_moverHitNormal [MAX_MOVER_HITS] |
| static int | g_moverHitCount = 0 |
| static float | g_snapClosest = 1.0f |
| static b2Vec2 | g_snapNormal = {0.0f, 0.0f} |
| static uint32_t | g_snapEntity = 0xFFFFFFFF |
| static bool | g_snapHit = false |
| static b2Vec2 | g_snapUp = {0.0f, 1.0f} |
| static float | g_snapFloorCos = 0.0f |
| static float | g_headroom = 1.0f |
|
static |
Definition at line 173 of file PhysicsQueries.cpp.
References entityFromShape(), g_ctx, g_headroom, g_moverFlags, g_moverSelfEntity, g_snapUp, and MOVER_IGNORE_DYNAMIC.
|
static |
Definition at line 111 of file PhysicsQueries.cpp.
References entityFromShape(), g_moverFlags, g_moverHitCount, g_moverHitEntity, g_moverHitNormal, g_moverPlaneCount, g_moverPlaneEntity, g_moverPlanes, g_moverPlaneSurface, g_moverSelfEntity, MAX_MOVER_HITS, MAX_MOVER_PLANES, MOVER_BLOCK_STEEP, MOVER_IGNORE_DYNAMIC, normalIsSurface(), and oneWayAdmits().
|
static |
Whether a contact's normal is the surface's own. A rounded foot on the corner of a ledge gets a leaning normal off no slope at all, and a ray along it tells them apart: it lands on a face, and only a real slope's face leans.
Definition at line 102 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback().
|
static |
A one-way surface answers only from its solid side, while what meets it is not rising, and not once it is already inside it.
Definition at line 85 of file PhysicsQueries.cpp.
References g_ctx, g_moverDt, g_moverFlags, g_moverVelocity, MOVER_DROP_THROUGH, MOVER_ONE_WAY_ALIGN, and MOVER_ONE_WAY_SLOP.
Referenced by moverPlaneCallback(), and snapCastCallback().
|
static |
Definition at line 25 of file PhysicsQueries.cpp.
References entityFromShape(), g_overlapBuffer, MAX_OVERLAP_HITS, and pushEntityBits().
Referenced by physics_overlapAABB(), and physics_overlapCircle().
| uintptr_t physics_getMoveCharacterBuffer | ( | ) |
Definition at line 524 of file PhysicsQueries.cpp.
References g_moverBuffer.
| uintptr_t physics_getOverlapBuffer | ( | ) |
Definition at line 316 of file PhysicsQueries.cpp.
References g_overlapBuffer.
| uintptr_t physics_getRaycastBuffer | ( | ) |
Definition at line 294 of file PhysicsQueries.cpp.
References g_raycastBuffer.
| uintptr_t physics_getShapeCastBuffer | ( | ) |
Definition at line 378 of file PhysicsQueries.cpp.
References g_shapeCastBuffer.
| int physics_moveCharacter | ( | float | px, |
| float | py, | ||
| float | c1x, | ||
| float | c1y, | ||
| float | c2x, | ||
| float | c2y, | ||
| float | radius, | ||
| float | velX, | ||
| float | velY, | ||
| float | dt, | ||
| float | upX, | ||
| float | upY, | ||
| float | floorCos, | ||
| uint32_t | maskBits, | ||
| uint32_t | selfEntity, | ||
| float | skinWidth, | ||
| int | maxSlides, | ||
| float | snapLength, | ||
| int | slideOnCeiling, | ||
| float | carryX, | ||
| float | carryY, | ||
| uint32_t | flags, | ||
| float | stepHeight ) |
Definition at line 401 of file PhysicsQueries.cpp.
References g_ctx, g_moverBuffer, g_moverDt, g_moverFlags, g_moverHitCount, g_moverHitEntity, g_moverHitNormal, g_moverPlaneCount, g_moverPlaneEntity, g_moverPlanes, g_moverSelfEntity, g_moverVelocity, g_snapClosest, g_snapEntity, g_snapFloorCos, g_snapHit, g_snapNormal, g_snapUp, MOVER_BLOCK_STEEP, MOVER_WAS_ON_FLOOR, and snapCastCallback().
| int physics_overlapAABB | ( | float | minX, |
| float | minY, | ||
| float | maxX, | ||
| float | maxY, | ||
| uint32_t | maskBits ) |
Definition at line 383 of file PhysicsQueries.cpp.
References g_ctx, g_overlapBuffer, and overlapCallback().
| int physics_overlapCircle | ( | float | centerX, |
| float | centerY, | ||
| float | radius, | ||
| uint32_t | maskBits ) |
Definition at line 299 of file PhysicsQueries.cpp.
References g_ctx, g_overlapBuffer, and overlapCallback().
| int physics_raycast | ( | float | originX, |
| float | originY, | ||
| float | dirX, | ||
| float | dirY, | ||
| float | maxDistance, | ||
| uint32_t | maskBits ) |
Definition at line 276 of file PhysicsQueries.cpp.
References g_ctx, g_raycastBuffer, RAYCAST_STRIDE, and raycastCallback().
| int physics_shapeCastBox | ( | float | centerX, |
| float | centerY, | ||
| float | halfW, | ||
| float | halfH, | ||
| float | angle, | ||
| float | translationX, | ||
| float | translationY, | ||
| uint32_t | maskBits ) |
Definition at line 340 of file PhysicsQueries.cpp.
References g_ctx, g_shapeCastBuffer, SHAPECAST_STRIDE, and shapeCastCallback().
| int physics_shapeCastCapsule | ( | float | center1X, |
| float | center1Y, | ||
| float | center2X, | ||
| float | center2Y, | ||
| float | radius, | ||
| float | translationX, | ||
| float | translationY, | ||
| uint32_t | maskBits ) |
Definition at line 359 of file PhysicsQueries.cpp.
References g_ctx, g_shapeCastBuffer, SHAPECAST_STRIDE, and shapeCastCallback().
| int physics_shapeCastCircle | ( | float | centerX, |
| float | centerY, | ||
| float | radius, | ||
| float | translationX, | ||
| float | translationY, | ||
| uint32_t | maskBits ) |
Definition at line 321 of file PhysicsQueries.cpp.
References g_ctx, g_shapeCastBuffer, SHAPECAST_STRIDE, and shapeCastCallback().
|
static |
Definition at line 9 of file PhysicsQueries.cpp.
References entityFromShape(), g_raycastBuffer, MAX_RAYCAST_HITS, pushEntityBits(), and RAYCAST_STRIDE.
Referenced by physics_raycast().
|
static |
Definition at line 35 of file PhysicsQueries.cpp.
References entityFromShape(), g_shapeCastBuffer, MAX_RAYCAST_HITS, pushEntityBits(), and SHAPECAST_STRIDE.
Referenced by physics_shapeCastBox(), physics_shapeCastCapsule(), and physics_shapeCastCircle().
|
static |
Definition at line 153 of file PhysicsQueries.cpp.
References entityFromShape(), g_moverFlags, g_moverSelfEntity, g_snapClosest, g_snapEntity, g_snapFloorCos, g_snapHit, g_snapNormal, g_snapUp, MOVER_IGNORE_DYNAMIC, and oneWayAdmits().
Referenced by physics_moveCharacter().
|
static |
Definition at line 171 of file PhysicsQueries.cpp.
Referenced by headroomCastCallback().
|
static |
Definition at line 79 of file PhysicsQueries.cpp.
Referenced by physics_getMoveCharacterBuffer(), and physics_moveCharacter().
|
static |
Definition at line 77 of file PhysicsQueries.cpp.
Referenced by oneWayAdmits(), and physics_moveCharacter().
|
static |
Definition at line 74 of file PhysicsQueries.cpp.
Referenced by headroomCastCallback(), moverPlaneCallback(), oneWayAdmits(), physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 82 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
static |
Definition at line 80 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
static |
Definition at line 81 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
static |
Definition at line 72 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
static |
Definition at line 70 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
static |
Definition at line 69 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
static |
Definition at line 71 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback().
|
static |
Definition at line 73 of file PhysicsQueries.cpp.
Referenced by headroomCastCallback(), moverPlaneCallback(), physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 76 of file PhysicsQueries.cpp.
Referenced by oneWayAdmits(), and physics_moveCharacter().
|
static |
Definition at line 146 of file PhysicsQueries.cpp.
Referenced by physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 148 of file PhysicsQueries.cpp.
Referenced by physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 151 of file PhysicsQueries.cpp.
Referenced by physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 149 of file PhysicsQueries.cpp.
Referenced by physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 147 of file PhysicsQueries.cpp.
Referenced by physics_moveCharacter(), and snapCastCallback().
|
static |
Definition at line 150 of file PhysicsQueries.cpp.
Referenced by headroomCastCallback(), physics_moveCharacter(), and snapCastCallback().
|
staticconstexpr |
Definition at line 57 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback().
|
staticconstexpr |
Definition at line 56 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback().
|
staticconstexpr |
Definition at line 66 of file PhysicsQueries.cpp.
Referenced by moverPlaneCallback(), and physics_moveCharacter().
|
staticconstexpr |
Definition at line 64 of file PhysicsQueries.cpp.
Referenced by oneWayAdmits().
|
staticconstexpr |
Definition at line 65 of file PhysicsQueries.cpp.
Referenced by headroomCastCallback(), moverPlaneCallback(), and snapCastCallback().
|
staticconstexpr |
Definition at line 60 of file PhysicsQueries.cpp.
Referenced by oneWayAdmits().
|
staticconstexpr |
Definition at line 62 of file PhysicsQueries.cpp.
Referenced by oneWayAdmits().
|
staticconstexpr |
Definition at line 67 of file PhysicsQueries.cpp.
Referenced by physics_moveCharacter().