Set of functions regarding stepping the simulation and getting the body transforms back.
More...
Set of functions regarding stepping the simulation and getting the body transforms back.
◆ pre_simulation_step()
unsigned nudge::pre_simulation_step |
( |
context_t * |
c, |
|
|
double |
elapsedSecondsFromLastCall |
|
) |
| |
Mandatory function that must be called once per frame.
- Parameters
-
c | the nudge context |
elapsedSecondsFromLastCall | time tn seconds elapsed from last call |
- Returns
- the number of simulation substeps (i.e. physic frame substeps) that will be executed in the next simulation_step(...) call
◆ simulation_step()
Mandatory function that must be called once per frame.
- Parameters
-
- Note
- It's the main function of the whole library
◆ calculate_graphic_transform_for_body()
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.
- Parameters
-
c | the nudge context |
body | the input body index |
pModelMatrix16Out | the output smoothed 16-float column-major model matrix |
- Returns
- the same as pModelMatrix16Out (for chaining the call only)
- Note
- This function must be used after calling simulation_step(...), and the returned matrix inglobes the center of mass offset if present (so that no offset operation is required on the user-side in most cases)
◆ calculate_graphic_transforms()
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.
- Parameters
-
c | the nudge context |
pModelMatricesOut | a pointer to the output c->bodies.count*modelMatrixStrideInFloatUnits floats that represent the returned smoothed 16-float column-major model matrices of this function |
modelMatrixStrideInFloatUnits | stride (in number of floats) between two 16-float matrices inside the pModelMatricesOut array (it must be at least 16) |
loopActiveBodiesOnly | (experimental) if not zero, it only updates bodies present in the c->active_bodies list, i.e. not all the output matrices are updated (not recommended) |
- Note
- This function must be used after calling simulation_step(...), and the returned matrices inglobe the center of mass offsets if present (so that no offset operation is required on the user-side in most cases)