Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
PhysicsContext.hpp File Reference
#include <box2d/box2d.h>
#include <unordered_map>
#include <vector>
#include <cstdint>
#include <cstring>
Include dependency graph for PhysicsContext.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PhysicsContext
struct  PhysicsContext::PausedMotion
struct  PhysicsContext::OneWayNormal

Macros

#define EMSCRIPTEN_KEEPALIVE

Functions

b2BodyId findValidBody (uint32_t entityId)
b2JointId findValidJoint (uint32_t entityId)
uint32_t entityFromBody (b2BodyId bodyId)
uint32_t entityFromShape (b2ShapeId shapeId)
void pushEntityBits (std::vector< float > &buf, uint32_t entityId)

Variables

static constexpr int MAX_PHYSICS_STEPS_PER_FRAME = 8
static constexpr int RAYCAST_STRIDE = 6
static constexpr int MAX_RAYCAST_HITS = 64
static constexpr int MAX_OVERLAP_HITS = 64
static constexpr int SHAPECAST_STRIDE = 6
PhysicsContext g_ctx
std::vector< float > g_raycastBuffer
std::vector< float > g_overlapBuffer
std::vector< float > g_shapeCastBuffer
float g_massDataBuffer [2]

Macro Definition Documentation

◆ EMSCRIPTEN_KEEPALIVE

#define EMSCRIPTEN_KEEPALIVE

Definition at line 11 of file PhysicsContext.hpp.

Function Documentation

◆ entityFromBody()

uint32_t entityFromBody ( b2BodyId bodyId)

Definition at line 26 of file PhysicsContext.cpp.

Referenced by entityFromShape().

◆ entityFromShape()

◆ findValidBody()

b2BodyId findValidBody ( uint32_t entityId)

◆ findValidJoint()

◆ pushEntityBits()

void pushEntityBits ( std::vector< float > & buf,
uint32_t entityId )

Variable Documentation

◆ g_ctx

PhysicsContext g_ctx
extern

Definition at line 5 of file PhysicsContext.cpp.

Referenced by db_createInstance(), db_destroyInstance(), db_fadeInAnimation(), db_getAnimations(), db_getArmatures(), db_getAtlasImageName(), db_getBonePoses(), db_getBones(), db_getBounds(), db_getLastError(), db_getMeshBatchCount(), db_getMeshBatchData(), db_getMeshBatchIndexCount(), db_getMeshBatchVertexCount(), db_loadSkeleton(), db_playAnimation(), db_setAtlasTexture(), db_setColor(), db_setTimeScale(), db_stopAnimation(), db_unloadSkeleton(), db_update(), findValidBody(), findValidJoint(), headroomCastCallback(), oneWayAdmits(), physics_addBoxShape(), physics_addCapsuleShape(), physics_addChainShape(), physics_addCircleShape(), physics_addPolygonShape(), physics_addSegmentShape(), physics_applyAngularImpulse(), physics_applyForce(), physics_applyImpulse(), physics_applyTorque(), physics_capturePoses(), physics_clearShapes(), physics_collectEvents(), physics_collisionEnterBytes(), physics_collisionExitBytes(), physics_createBody(), physics_createDistanceJoint(), physics_createMotorJoint(), physics_createMouseJoint(), physics_createPrismaticJoint(), physics_createRevoluteJoint(), physics_createWeldJoint(), physics_createWheelJoint(), physics_destroyBody(), physics_destroyJoint(), physics_destroyMouseJoint(), physics_dynamicBodyTransformsBytes(), physics_enableRevoluteLimit(), physics_enableRevoluteMotor(), physics_getAngularVelocity(), physics_getBodyCount(), physics_getCollisionEnterBuffer(), physics_getCollisionEnterCount(), physics_getCollisionExitBuffer(), physics_getCollisionExitCount(), physics_getDynamicBodyCount(), physics_getDynamicBodyTransforms(), physics_getGravity(), physics_getHitEventBuffer(), physics_getHitEventCount(), physics_getInterpolatedCount(), physics_getInterpolatedTransforms(), physics_getJointCount(), physics_getLinearVelocity(), physics_getRevoluteAngle(), physics_getRevoluteMotorTorque(), physics_getSensorEnterBuffer(), physics_getSensorEnterCount(), physics_getSensorExitBuffer(), physics_getSensorExitCount(), physics_getShapeCount(), physics_getTrackingRows(), physics_hasBody(), physics_hasJoint(), physics_hasMouseJoint(), physics_hitEventBytes(), physics_init(), physics_interpolatedTransformsBytes(), physics_isAwake(), physics_moveCharacter(), physics_overlapAABB(), physics_overlapCircle(), physics_raycast(), physics_sensorEnterBytes(), physics_sensorExitBytes(), physics_setAngularVelocity(), physics_setAwake(), physics_setBodyEnabled(), physics_setBodyTargetTransform(), physics_setBodyTransform(), physics_setBodyTransforms(), physics_setGravity(), physics_setLinearVelocity(), physics_setMouseTarget(), physics_setOneWayPlatform(), physics_setOneWayPlatformLocal(), physics_setRevoluteLimits(), physics_setRevoluteMaxMotorTorque(), physics_setRevoluteMotorSpeed(), physics_setWorldConfig(), physics_shapeCastBox(), physics_shapeCastCapsule(), physics_shapeCastCircle(), physics_shutdown(), physics_step(), physics_updateBodyProperties(), preSolveOneWayPlatform(), spine_addAnimation(), spine_advanceAndApply(), spine_clearEvents(), spine_clipBudget(), spine_createInstance(), spine_destroyInstance(), spine_enableEvents(), spine_eventBufferBytes(), spine_getAnimationDuration(), spine_getAnimations(), spine_getAtlasPageCount(), spine_getAtlasPageTextureName(), spine_getBonePoses(), spine_getBonePosition(), spine_getBoneRotation(), spine_getBones(), spine_getBounds(), spine_getEventAnimationName(), spine_getEventBuffer(), spine_getEventCount(), spine_getEventName(), spine_getEventStringValue(), spine_getLastError(), spine_getMeshBatchColorPremultiplied(), spine_getMeshBatchCount(), spine_getMeshBatchData(), spine_getMeshBatchIndexCount(), spine_getMeshBatchVertexCount(), spine_getPathConstraintMix(), spine_getSkeletonBounds(), spine_getSkins(), spine_getTransformConstraintMix(), spine_listConstraints(), spine_loadSkeleton(), spine_materializeWorldPose(), spine_playAnimation(), spine_probe_clip_start(), spine_probe_extract(), spine_probe_pose(), spine_probe_storage(), spine_requiresContinuousWorldPose(), spine_setAtlasPageTexture(), spine_setAttachment(), spine_setClippingEnabled(), spine_setDefaultMix(), spine_setIKTarget(), spine_setMixDuration(), spine_setPathConstraintMix(), spine_setSkeletonColor(), spine_setSkin(), spine_setSlotColor(), spine_setToSetupPose(), spine_setTrackAlpha(), spine_setTransformConstraintMix(), spine_unloadSkeleton(), and spine_update().

◆ g_massDataBuffer

float g_massDataBuffer[2]
extern

Definition at line 10 of file PhysicsContext.cpp.

Referenced by physics_getBodyCenterOfMass().

◆ g_overlapBuffer

std::vector<float> g_overlapBuffer
extern

◆ g_raycastBuffer

std::vector<float> g_raycastBuffer
extern

◆ g_shapeCastBuffer

◆ MAX_OVERLAP_HITS

int MAX_OVERLAP_HITS = 64
staticconstexpr

Definition at line 24 of file PhysicsContext.hpp.

Referenced by overlapCallback().

◆ MAX_PHYSICS_STEPS_PER_FRAME

int MAX_PHYSICS_STEPS_PER_FRAME = 8
staticconstexpr

Definition at line 21 of file PhysicsContext.hpp.

Referenced by physics_step().

◆ MAX_RAYCAST_HITS

int MAX_RAYCAST_HITS = 64
staticconstexpr

Definition at line 23 of file PhysicsContext.hpp.

Referenced by raycastCallback(), and shapeCastCallback().

◆ RAYCAST_STRIDE

int RAYCAST_STRIDE = 6
staticconstexpr

Definition at line 22 of file PhysicsContext.hpp.

Referenced by physics_raycast(), and raycastCallback().

◆ SHAPECAST_STRIDE

int SHAPECAST_STRIDE = 6
staticconstexpr