Blender  V2.93
BKE_softbody.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) Blender Foundation.
17  * All rights reserved.
18  */
19 #pragma once
20 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 struct Depsgraph;
30 struct Object;
31 struct Scene;
32 struct SoftBody;
33 
34 typedef struct BodyPoint {
35  float origS[3], origE[3], origT[3], pos[3], vec[3], force[3];
36  float goal;
37  float prevpos[3], prevvec[3], prevdx[3], prevdv[3]; /* used for Heun integration */
38  float impdv[3], impdx[3];
40  int *springs;
41  float choke, choke2, frozen;
42  float colball;
43  short loc_flag; /* reserved by locale module specific states */
44  // char octantflag;
45  float mass;
46  float springweight;
48 
49 /* allocates and initializes general main data */
50 extern struct SoftBody *sbNew(struct Scene *scene);
51 
52 /* frees internal data and soft-body itself */
53 extern void sbFree(struct Object *ob);
54 
55 /* frees simulation data to reset simulation */
56 extern void sbFreeSimulation(struct SoftBody *sb);
57 
58 /* do one simul step, reading and writing vertex locs from given array */
59 extern void sbObjectStep(struct Depsgraph *depsgraph,
60  struct Scene *scene,
61  struct Object *ob,
62  float cfra,
63  float (*vertexCos)[3],
64  int numVerts);
65 
66 /* makes totally fresh start situation, resets time */
67 extern void sbObjectToSoftbody(struct Object *ob);
68 
69 /* links the soft-body module to a 'test for Interrupt' function */
70 /* pass NULL to unlink again */
71 extern void sbSetInterruptCallBack(int (*f)(void));
72 
73 extern void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float lscale[3][3]);
74 
75 #ifdef __cplusplus
76 }
77 #endif
struct SoftBody * sbNew(struct Scene *scene)
Definition: softbody.c:3121
void sbObjectStep(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float cfra, float(*vertexCos)[3], int numVerts)
Definition: softbody.c:3538
void sbObjectToSoftbody(struct Object *ob)
Definition: softbody.c:3208
struct BodyPoint BodyPoint
void sbFreeSimulation(struct SoftBody *sb)
Definition: softbody.c:3202
void SB_estimate_transform(Object *ob, float lloc[3], float lrot[3][3], float lscale[3][3])
Definition: softbody.c:3272
void sbSetInterruptCallBack(int(*f)(void))
Definition: softbody.c:3228
void sbFree(struct Object *ob)
Definition: softbody.c:3177
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:51
Scene scene
const Depsgraph * depsgraph
float pos[3]
Definition: BKE_softbody.h:35
float force[3]
Definition: BKE_softbody.h:35
float origE[3]
Definition: BKE_softbody.h:35
float vec[3]
Definition: BKE_softbody.h:35
float prevdv[3]
Definition: BKE_softbody.h:37
float choke2
Definition: BKE_softbody.h:41
float goal
Definition: BKE_softbody.h:36
float prevdx[3]
Definition: BKE_softbody.h:37
int nofsprings
Definition: BKE_softbody.h:39
float mass
Definition: BKE_softbody.h:45
float prevvec[3]
Definition: BKE_softbody.h:37
float choke
Definition: BKE_softbody.h:41
float colball
Definition: BKE_softbody.h:42
float impdv[3]
Definition: BKE_softbody.h:38
short loc_flag
Definition: BKE_softbody.h:43
float prevpos[3]
Definition: BKE_softbody.h:37
int * springs
Definition: BKE_softbody.h:40
float origT[3]
Definition: BKE_softbody.h:35
float origS[3]
Definition: BKE_softbody.h:35
float frozen
Definition: BKE_softbody.h:41
float impdx[3]
Definition: BKE_softbody.h:38
float springweight
Definition: BKE_softbody.h:46
float lscale[3][3]
float lrot[3][3]