doxygen: blender/blenkernel tagged.
[blender.git] / source / blender / blenkernel / intern / bullet.c
1 /*  
2  * 
3  * $Id$
4  *
5  * ***** BEGIN GPL LICENSE BLOCK *****
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * The Original Code is Copyright (C) Blender Foundation
22  * All rights reserved.
23  *
24  * The Original Code is: all of this file.
25  *
26  * Contributor(s): none yet.
27  *
28  * ***** END GPL LICENSE BLOCK *****
29  */
30
31 /** \file blender/blenkernel/intern/bullet.c
32  *  \ingroup bke
33  */
34
35
36 #include "MEM_guardedalloc.h"
37
38 /* types */
39 #include "DNA_object_force.h"   /* here is the softbody struct */
40
41 #include "BKE_bullet.h"
42
43
44 /* ************ Object level, exported functions *************** */
45
46 /* allocates and initializes general main data */
47 BulletSoftBody *bsbNew(void)
48 {
49         BulletSoftBody *bsb;
50         
51         bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody");
52                 
53         bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
54         bsb->linStiff = 0.5f;
55         bsb->angStiff = 1.0f;
56         bsb->volume = 1.0f;
57
58         
59         bsb->viterations        =       0;
60         bsb->piterations        =       2;      
61         bsb->diterations        =       0;
62         bsb->citerations        =       4;
63         
64         bsb->kSRHR_CL           =       0.1f;
65         bsb->kSKHR_CL           =       1.f;
66         bsb->kSSHR_CL           =       0.5f;
67         bsb->kSR_SPLT_CL        =       0.5f;
68         
69         bsb->kSK_SPLT_CL        =       0.5f;
70         bsb->kSS_SPLT_CL        =       0.5f;
71         bsb->kVCF                       =       1;
72         bsb->kDP                        =       0;
73
74         bsb->kDG                        =       0;
75         bsb->kLF                        =       0;
76         bsb->kPR                        =       0;
77         bsb->kVC                        =       0;
78
79         bsb->kDF                        =       0.2f;
80         bsb->kMT                        =       0.05;
81         bsb->kCHR                       =       1.0f;
82         bsb->kKHR                       =       0.1f;
83
84         bsb->kSHR                       =       1.0f;
85         bsb->kAHR                       =       0.7f;
86         
87         bsb->collisionflags = 0;
88         //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
89         bsb->numclusteriterations = 64;
90         bsb->welding = 0.f;
91
92         return bsb;
93 }
94
95 /* frees all */
96 void bsbFree(BulletSoftBody *bsb)
97 {
98         /* no internal data yet */
99         MEM_freeN(bsb);
100 }
101
102