|
void | nudge::show_info () |
| Displays basic info at program startup; very important call to detect the SIMD configuration of the program.
|
|
void | nudge::init_context_with (context_t *c, unsigned MAX_NUM_BOXES, unsigned MAX_NUM_SPHERES) |
| Mandatory function to be called at program startup.
|
|
void | nudge::init_context (context_t *c) |
| Mandatory function to be called at program startup.
|
|
void | nudge::destroy_context (context_t *c) |
| Mandatory function to be called at program exit.
|
|
void | nudge::restart_context (context_t *c) |
| Optional function that restarts a valid context, preserving the simulation settings and the allocated memory.
|
|
void | nudge::save_context (FILE *f, const context_t *c) |
| Saves the nudge context.
|
|
void | nudge::load_context (FILE *f, context_t *c) |
| Loads a saved nudge context.
|
|
unsigned | nudge::pre_simulation_step (context_t *c, double elapsedSecondsFromLastCall) |
| Mandatory function that must be called once per frame.
|
|
void | nudge::simulation_step (context_t *c) |
| Mandatory function that must be called once per frame.
|
|
float * | nudge::calculate_graphic_transform_for_body (context_t *c, unsigned body, float *pModelMatrix16Out) |
| Function that can be used to calculate the smoothed 16-float column-major model matrix of a single body.
|
|
void | nudge::calculate_graphic_transforms (context_t *c, float *pModelMatricesOut, unsigned modelMatrixStrideInFloatUnits, int loopActiveBodiesOnly=0) |
| Function that can be used to calculate the smoothed 16-float column-major model matrices of all the bodies together.
|
|
unsigned | nudge::add_box (context_t *c, float mass, float hsizex, float hsizey, float hsizez, const Transform *T=NULL, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a single box collider.
|
|
unsigned | nudge::add_box (context_t *c, float mass, float hsizex, float hsizey, float hsizez, const float *mMatrix16WithoutScaling, const float comOffset[3]=NULL) |
|
unsigned | nudge::add_sphere (context_t *c, float mass, float radius, const Transform *T=NULL, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a single sphere collider.
|
|
unsigned | nudge::add_sphere (context_t *c, float mass, float radius, const float *mMatrix16WithoutScaling, const float comOffset[3]=NULL) |
|
unsigned | nudge::add_compound (context_t *c, float mass, float inertia[3], unsigned num_boxes, const float *hsizeTriplets, const Transform *boxOffsetTransforms, unsigned num_spheres, const float *radii, const Transform *sphereOffsetTransforms, const Transform *T=NULL, const float comOffset[3]=NULL, float *centerMeshAndRetrieveOldCenter3Out=NULL) |
| Adds a new body to the simulation with a compound collider made up of num_boxes box colliders and num_spheres sphere colliders.
|
|
unsigned | nudge::add_compound (context_t *c, float mass, float inertia[3], unsigned num_boxes, const float *hsizeTriplets, const float *boxOffsetMatrices16WithoutScaling, unsigned num_spheres, const float *radii, const float *sphereOffsetMatrices16WithoutScaling, const float *mMatrix16WithoutScaling=NULL, const float comOffset[3]=NULL, float *centerMeshAndRetrieveOldCenter3Out=NULL) |
|
unsigned | nudge::add_clone (context_t *c, unsigned body_to_clone, float mass, const Transform *T=NULL, float scale_factor=1.f, const float newComOffsetInPreScaledUnits[3]=NULL) |
| [Experimental] Adds a new body to the simulation cloning an existing body
|
|
unsigned | nudge::add_clone (context_t *c, unsigned body_to_clone, float mass, const float *mMatrix16WithoutScaling, float scale_factor=1.f, const float newComOffsetInPreScaledUnits[3]=NULL) |
|
void | nudge::remove_body (context_t *c, unsigned body) |
| Removes a body from the simulation.
|
|
uint32_t | nudge::colliders_get_num_remaining_boxes (context_t *c) |
| Return the number of box colliders that can still be added to the physic world.
|
|
uint32_t | nudge::colliders_get_num_remaining_spheres (context_t *c) |
| Return the number of sphere colliders that can still be added to the physic world.
|
|
int | nudge::can_add_box (context_t *c) |
|
int | nudge::can_add_sphere (context_t *c) |
|
int | nudge::can_add_compound (context_t *c, unsigned num_boxes, unsigned num_spheres) |
|
int | nudge::can_add_clone (context_t *c, unsigned body_to_clone) |
|
unsigned | nudge::get_next_add_body_index (context_t *c) |
| Allows to peek the body index that is going to be returned in next add_xxx(...) call.
|
|
void | nudge::body_recalculate_bounding_box (context_t *c, uint32_t body) |
| Recalculates the bounding box of the body (BodyInfo::aabb_center and BodyInfo::aabb_extents)
|
|
void | nudge::body_change_motion_state (nudge::context_t *c, unsigned body, nudge::FlagMask new_motion_state, float mass_fallback=1.f) |
| [Experimental] Changes the body motion state (i.e. the BF_IS_STATIC_OR_KINEMATIC_OR_DYNAMIC group of body flags)
|
|
void | nudge::body_scale (nudge::context_t *c, unsigned body, float scale_factor, float mass_scale_factor=0.f) |
| [Experimental] Uniformly scales the specified body incrementally
|
|
float * | nudge::body_get_velocity (context_t *c, uint32_t body) |
| Gets the pointer to the body linear velocity (3-floats)
|
|
float * | nudge::body_get_angular_velocity (context_t *c, uint32_t body) |
| Gets the pointer to the body angular velocity (3-floats)
|
|
float * | nudge::body_get_position (context_t *c, uint32_t body) |
| Gets the pointer to the body position (3-floats vector)
|
|
float * | nudge::body_get_orientation (context_t *c, uint32_t body) |
| Gets the pointer to the body orientation (4-floats quaternion in {x,y,z,w} format)
|
|
unsigned | nudge::extra::add_compound_prism (context_t *c, float mass, float radius, float hheight, unsigned num_lateral_faces=0, const Transform *T=NULL, AxisEnum axis=AXIS_Y, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents a prism of 4 or more lateral faces.
|
|
unsigned | nudge::extra::add_compound_prism (context_t *c, float mass, float radius, float hheight, unsigned num_lateral_faces, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, const float comOffset[3]=NULL) |
|
unsigned | nudge::extra::add_compound_cylinder (context_t *c, float mass, float radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
| Adds a new body to the simulation with a compound collider that represents a cylinder.
|
|
unsigned | nudge::extra::add_compound_cylinder (context_t *c, float mass, float radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
|
unsigned | nudge::extra::add_compound_capsule (context_t *c, float mass, float radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=1, unsigned num_spheres=3, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
| Adds a new body to the simulation with a compound collider that represents a capsule.
|
|
unsigned | nudge::extra::add_compound_capsule (context_t *c, float mass, float radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=1, unsigned num_spheres=3, const float comOffset[3]=NULL, float box_lateral_side_shrinking=-1.f) |
|
unsigned | nudge::extra::add_compound_hollow_cylinder (context_t *c, float mass, float min_radius, float max_radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents the hollow lateral surface of a cylinder.
|
|
unsigned | nudge::extra::add_compound_hollow_cylinder (context_t *c, float mass, float min_radius, float max_radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
|
unsigned | nudge::extra::add_compound_torus (context_t *c, float mass, float radius, float inner_radius, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents a torus.
|
|
unsigned | nudge::extra::add_compound_torus (context_t *c, float mass, float radius, float inner_radius, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=8, const float comOffset[3]=NULL) |
|
unsigned | nudge::extra::add_compound_cone (context_t *c, float mass, float radius, float hheight, const Transform *T=NULL, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents an approximated cone.
|
|
unsigned | nudge::extra::add_compound_cone (context_t *c, float mass, float radius, float hheight, const float *mMatrix16WithoutScaling, AxisEnum axis=AXIS_Y, unsigned num_boxes=0, unsigned num_spheres=0, const float comOffset[3]=NULL) |
|
unsigned | nudge::extra::add_compound_staircase (context_t *c, float mass, float hdepth, float hheight, float hlength, unsigned num_steps=15, const Transform *T=NULL, int orientation_in_0_3=0, const float comOffset[3]=NULL) |
| Adds a new body to the simulation with a compound collider that represents a staircase; please note that the inertia is not calculated (or even approximated) correctly (only relevant when used as dynamic body)
|
|
unsigned | nudge::extra::add_compound_staircase (context_t *c, float mass, float hdepth, float hheight, float hlength, unsigned num_steps, const float *mMatrix16WithoutScaling, int orientation_in_0_3=0, const float comOffset[3]=NULL) |
|
void | nudge::body_set_collision_group_and_mask (context_t *c, uint32_t body, CollisionMask single_collision_group_body_belongs_to, CollisionMask collision_group_mask_body_can_collide_with=COLLISION_GROUP_ALL) |
| Sets the body collision group (a single value of COLLISION_GROUP_) and mask (a combination of COLLISION_GROUP_ values)
|
|
CollisionMask * | nudge::body_get_collision_group (context_t *c, uint32_t body) |
| Gets the body collision group (a single value of COLLISION_GROUP_)
|
|
CollisionMask * | nudge::body_get_collision_mask (context_t *c, uint32_t body) |
| Gets the body collision mask (a combination of COLLISION_GROUP_ values)
|
|
FlagMask * | nudge::body_get_flags (context_t *c, uint32_t body) |
| Shortcut that returns a pointer to the body flags (a combination of BF_ enums)
|
|
void | nudge::kinematic_data_reserve_key_frames (KinematicData *kd, size_t new_size) |
| Reserves additional space for KinematicData key frames.
|
|
void | nudge::kinematic_data_reserve_animations (KinematicData *kd, size_t new_size) |
| Reserves additional space for KinematicData animations.
|
|
int | nudge::log (const char *format,...) |
| Logging function used by the library. It defaults to printf.
|
|
int | nudge::flush (void) |
| Flushes the log. It defaults to fflush(NUDGE_LOG_FILE_PTR)
|
|
void | nudge::contact_data_find_colliders (const context_t *c, unsigned contact_data_index, int16_t *box_collider_index_for_body_a, int16_t *sphere_collider_index_for_body_a, int16_t *box_collider_index_for_body_b, int16_t *sphere_collider_index_for_body_b, int use_relative_values_for_output_indices=0) |
| Find out which collider belonging to body_a and body_b is involved in the collision determined by a ContactData index.
|
|
Transform * | nudge::Mat4WithoutScalingToTransform (Transform *Tout, const float *matrix16WithoutScaling) |
| Converts a column-major 16-floats matrix without any scaling applied to a nudge::Transform.
|
|
Transform | nudge::Mat4WithoutScalingToTransform (const float *matrix16WithoutScaling) |
| Converts a column-major 16-floats matrix without any scaling applied to a nudge::Transform.
|
|
float * | nudge::TransformToMat4 (float *matrix16Out, const Transform *T) |
| Converts a nudge::Transform to a column-major 16-floats matrix.
|
|
void | nudge::TransformAssignToBody (context_t *c, unsigned body, Transform newT, float deltaTime, int16_t aux_body=-1) |
| Assigns a new Transform to a body, and sets its linear and angular velocities based on the differences between the new transform and the old one: this is essential when manually moving bodies by changing their transform.
|
|
void | nudge::TransformAdvanceBodyFromVelocities (context_t *c, unsigned body, float deltaTime) |
| Advances the body's transform based on its linear and angular velocities.
|
|
Transform | nudge::TransformSlerp (Transform T0, Transform T1, float time) |
| Applies (spherical) lerp between T0 and T1.
|
|
Transform | nudge::TransformMul (Transform T0, Transform T1) |
| Multiplies two transforms.
|
|
void | nudge::nm_QuatAdvance (float *__restrict qOut4, const float *__restrict q4, const float *__restrict angVel3, float halfTimeStep) |
| Advances a quaternion given an angular velocity and a (small) time step.
|
|
float * | nudge::nm_QuatFromMat4 (float *__restrict result4, const float *__restrict m16) |
| Turns the 3x3 submatrix of a 16-floats column-major matrix (without scaling applied) into a quaternion.
|
|
float * | nudge::nm_Mat4SetRotationFromQuat (float *__restrict result16, const float *__restrict q4) |
| Replaces the 3x3 submatrix of a 16-floats column-major matrix with the 3x3 matrix representing the given quaternion.
|
|
float * | nudge::nm_QuatFromMat3 (float *__restrict result4, const float *__restrict m9) |
| Turns the 3x3 9-floats column-major rotation matrix (without scaling applied) into a quaternion.
|
|
float * | nudge::nm_Mat3FromQuat (float *__restrict result9, const float *__restrict q4) |
| Converts the given quaternion the a 3x3 9-floats column-major rotation matrix.
|
|
void | nudge::nm_QuatGetAngularVelocity (float *__restrict angVel3, const float *newQuat4, const float *oldQuat4, float halfTimeStep) |
| Given an old and a new quaternion and a small time step, it calculates the angular velocities.
|
|
float * | nudge::nm_QuatSlerp (float *__restrict result4, const float *__restrict a4, const float *__restrict b4, float slerpTime_In_0_1, int normalizeResult4AfterLerp) |
| Performs a spherical lerp between two quaternions (in 4-floats format)
|
|
float * | nudge::nm_QuatMul (float *qOut4, const float *a4, const float *b4) |
| Multiplies two 4-floats quaternions.
|
|
void | nudge::nm_QuatNormalize (float *__restrict q4) |
| normalizes a 4-floats quaternion in place
|
|
float * | nudge::nm_QuatFromAngleAxis (float *__restrict qOut4, float rfAngle, float rkAxisX, float rkAxisY, float rkAxisZ) |
| Generates a 4-floats quaternion based on an orientation arouns an axis.
|
|
void | nudge::nm_QuatToAngleAxis (const float *__restrict q4, float *__restrict rfAngleOut1, float *__restrict rkAxisOut3) |
| Calculates the angle-axis representation of the given 4-float quaternion.
|
|
float | nudge::nm_Vec3Normalize (float *__restrict v3) |
| Normalizes a 3-floats vector in place.
|
|
float | nudge::nm_Vec3Normalized (float *__restrict v3Out, const float *__restrict v3) |
| Get a normalizes copy of an input 3-floats vector.
|
|
float | nudge::nm_Vec3Dot (const float *__restrict a3, const float *__restrict b3) |
| Computes the dot product between two 3-floats vectors.
|
|
float * | nudge::nm_Vec3Cross (float *__restrict vOut3, const float *__restrict a3, const float *__restrict b3) |
| Computes the cross product between two 3-floats vectors.
|
|
float * | nudge::nm_QuatMulVec3 (float *__restrict vOut3, const float *__restrict q4, const float *__restrict vIn3) |
| Transforms a 3-floats vector by a 4-floats quaternion.
|
|
float * | nudge::nm_QuatGetAxis (float *__restrict vOut3, const float *__restrict q4, float axisX, float axisY, float axisZ) |
| Transforms a particular axis from the input quaternion space to word space.
|
|
float * | nudge::nm_QuatGetAxisX (float *__restrict axisOut3, const float *__restrict q4) |
|
float * | nudge::nm_QuatGetAxisY (float *__restrict axisOut3, const float *__restrict q4) |
|
float * | nudge::nm_QuatGetAxisZ (float *__restrict axisOut3, const float *__restrict q4) |
|
float * | nudge::nm_QuatRotate (float *__restrict qInOut4, float angle, float axisX, float axisY, float axisZ) |
| Rotates an input 4-floats unit quaternion by an angle in radians around a specified axis.
|
|
float * | nudge::nm_Mat4Mul (float *result16, const float *ml16, const float *mr16) |
| Multiplies two column-major 16-floats 4x4 matrices.
|
|
void | nudge::calculate_box_inertia (float result[3], float mass, float hsizex, float hsizey, float hsizez, const float comOffset[3]=NULL) |
|
void | nudge::calculate_sphere_inertia (float result[3], float mass, float radius, const float comOffset[3]=NULL, bool hollow=false) |
|
void | nudge::calculate_cylinder_inertia (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_capsule_inertia (float result[3], float mass, float radius, float halfCylinderHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_torus_inertia (float result[3], float mass, float majorRadius, float minorRadius, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_hollow_cylinder_inertia (float result[3], float mass, float R, float r, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_cone_inertia (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_box_inertia_inverse (float result[3], float mass, float hsizex, float hsizey, float hsizez, const float comOffset[3]=NULL) |
|
void | nudge::calculate_sphere_inertia_inverse (float result[3], float mass, float radius, const float comOffset[3]=NULL, bool hollow=false) |
|
void | nudge::calculate_cylinder_inertia_inverse (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_capsule_inertia_inverse (float result[3], float mass, float radius, float halfCylinderHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_torus_inertia_inverse (float result[3], float mass, float majorRadius, float minorRadius, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_hollow_cylinder_inertia_inverse (float result[3], float mass, float R, float r, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|
void | nudge::calculate_cone_inertia_inverse (float result[3], float mass, float radius, float halfHeight, AxisEnum upAxis=AXIS_Y, const float comOffset[3]=NULL) |
|