bad char
[vg.git] / vg_rigidbody_constraints.h
1 #pragma once
2
3 typedef struct rb_constr_pos rb_constr_pos;
4 typedef struct rb_constr_swingtwist rb_constr_swingtwist;
5
6 struct rb_constr_pos
7 {
8 rigidbody *rba, *rbb;
9 v3f lca, lcb;
10 };
11
12 struct rb_constr_swingtwist
13 {
14 rigidbody *rba, *rbb;
15
16 v4f conevx, conevy; /* relative to rba */
17 v3f view_offset, /* relative to rba */
18 coneva, conevxb;/* relative to rbb */
19
20 int tangent_violation, axis_violation;
21 v3f axis, tangent_axis, tangent_target, axis_target;
22
23 float conet;
24 float tangent_mass, axis_mass;
25
26 f32 conv_tangent, conv_axis;
27 };
28
29 void rb_debug_position_constraints( rb_constr_pos *buffer, int len );
30 void rb_presolve_swingtwist_constraints( rb_constr_swingtwist *buf, int len );
31 void rb_debug_swingtwist_constraints( rb_constr_swingtwist *buf, int len );
32
33 /*
34 * Solve a list of positional constraints
35 */
36 void rb_solve_position_constraints( rb_constr_pos *buf, int len );
37 void rb_solve_swingtwist_constraints( rb_constr_swingtwist *buf, int len );
38 void rb_postsolve_swingtwist_constraints( rb_constr_swingtwist *buf, u32 len );
39 void rb_solve_constr_angle( rigidbody *rba, rigidbody *rbb, v3f ra, v3f rb );
40
41 /*
42 * Correct position constraint drift errors
43 * [ 0.0 <= amt <= 1.0 ]: the correction amount
44 */
45 void rb_correct_position_constraints( rb_constr_pos *buf, int len, f32 amt );
46 void rb_correct_swingtwist_constraints( rb_constr_swingtwist *buf,
47 int len, float amt );