Blender  V2.59
BKE_softbody.h
Go to the documentation of this file.
00001 /*
00002  * $Id: BKE_softbody.h 34962 2011-02-18 13:05:18Z jesterking $
00003  *
00004  * ***** BEGIN GPL LICENSE BLOCK *****
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software Foundation,
00018  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019  *
00020  * The Original Code is Copyright (C) Blender Foundation.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef BKE_SOFTBODY_H
00030 #define BKE_SOFTBODY_H
00031 
00036 struct Object;
00037 struct Scene;
00038 struct SoftBody;
00039 
00040 typedef struct BodyPoint {
00041         float origS[3], origE[3], origT[3], pos[3], vec[3], force[3];
00042         float goal;
00043         float prevpos[3], prevvec[3], prevdx[3], prevdv[3]; /* used for Heun integration */
00044         float impdv[3],impdx[3];
00045         int nofsprings; int *springs;
00046         float choke,choke2,frozen;
00047         float colball;
00048         short loc_flag; //reserved by locale module specific states
00049         //char octantflag;
00050         float mass;
00051         float springweight;
00052 } BodyPoint;
00053 
00054 /* allocates and initializes general main data */
00055 extern struct SoftBody  *sbNew(struct Scene *scene);
00056 
00057 /* frees internal data and softbody itself */
00058 extern void                             sbFree(struct SoftBody *sb);
00059 
00060 /* frees simulation data to reset simulation */
00061 extern void                             sbFreeSimulation(struct SoftBody *sb);
00062 
00063 /* do one simul step, reading and writing vertex locs from given array */
00064 extern void                             sbObjectStep(struct Scene *scene, struct Object *ob, float framnr, float (*vertexCos)[3], int numVerts);
00065 
00066 /* makes totally fresh start situation, resets time */
00067 extern void                             sbObjectToSoftbody(struct Object *ob);
00068 
00069 /* links the softbody module to a 'test for Interrupt' function */
00070 /* pass NULL to unlink again */
00071 extern void             sbSetInterruptCallBack(int (*f)(void));
00072 
00073 extern void             SB_estimate_transform(Object *ob,float lloc[3],float lrot[3][3],float lscale[3][3]);
00074 
00075 
00076 #endif
00077