Set of functions regarding the nudge context, and in general the program startup and shutdown functions.
More...
Set of functions regarding the nudge context, and in general the program startup and shutdown functions.
◆ show_info()
void nudge::show_info |
( |
| ) |
|
Displays basic info at program startup; very important call to detect the SIMD configuration of the program.
◆ init_context_with()
void nudge::init_context_with |
( |
context_t * |
c, |
|
|
unsigned |
MAX_NUM_BOXES, |
|
|
unsigned |
MAX_NUM_SPHERES |
|
) |
| |
Mandatory function to be called at program startup.
- Parameters
-
c | the nudge context; best practice is to clear its memory before calling this function |
MAX_NUM_BOXES | the max number of box colliders (i.e. box collision shapes) that can be used in the library (each physic body can contain one or more colliders and each collider is owned by a single physic body) |
MAX_NUM_SPHERES | the max number of sphere colliders (i.e. sphere collision shapes) that can be used in the library (each physic body can contain one or more colliders and each collider is owned by a single physic body) |
- Note
- It must be MAX_NUM_BOXES+MAX_NUM_SPHERES<=8192
◆ init_context()
Mandatory function to be called at program startup.
- Parameters
-
c | the nudge context; best practice is to clear its memory before calling this function |
- Note
- It sets MAX_NUM_BOXES and MAX_NUM_SPHERES to some default value (see init_context_with(...))
◆ destroy_context()
◆ restart_context()
Optional function that restarts a valid context, preserving the simulation settings and the allocated memory.
- Parameters
-
- Note
- This function is faster than calling in sequence destroy_context(...) and init_context(...) (no deallocations/allocations)
-
If you want to restart the simulation frame/substep counters, please manually set: c->simulation_params.num_frames=0;c->simulation_params.num_total_substeps=0;
◆ save_context()
void nudge::save_context |
( |
FILE * |
f, |
|
|
const context_t * |
c |
|
) |
| |
Saves the nudge context.
- Parameters
-
f | the output file |
c | the input context |
- Note
- Experimental feature
-
Available only when NUDGE_NO_STDIO is not defined
◆ load_context()
void nudge::load_context |
( |
FILE * |
f, |
|
|
context_t * |
c |
|
) |
| |
Loads a saved nudge context.
- Parameters
-
f | the input file |
c | the output (inited) context |
- Note
- Experimental feature, currently c must have a compatible c->MAX_NUM_BOXES and c->MAX_NUM_SPHERES to work (and user pointers must of course be handled by the user)
-
Currently it just asserts on failing
-
Available only when NUDGE_NO_STDIO is not defined