Blender  V2.59
bullet.c
Go to the documentation of this file.
00001 /*  
00002  * 
00003  * $Id: bullet.c 35247 2011-02-27 20:40:57Z jesterking $
00004  *
00005  * ***** BEGIN GPL LICENSE BLOCK *****
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software Foundation,
00019  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  * The Original Code is Copyright (C) Blender Foundation
00022  * All rights reserved.
00023  *
00024  * The Original Code is: all of this file.
00025  *
00026  * Contributor(s): none yet.
00027  *
00028  * ***** END GPL LICENSE BLOCK *****
00029  */
00030 
00036 #include "MEM_guardedalloc.h"
00037 
00038 /* types */
00039 #include "DNA_object_force.h"   /* here is the softbody struct */
00040 
00041 #include "BKE_bullet.h"
00042 
00043 
00044 /* ************ Object level, exported functions *************** */
00045 
00046 /* allocates and initializes general main data */
00047 BulletSoftBody *bsbNew(void)
00048 {
00049         BulletSoftBody *bsb;
00050         
00051         bsb= MEM_callocN(sizeof(BulletSoftBody), "bulletsoftbody");
00052                 
00053         bsb->flag = OB_BSB_BENDING_CONSTRAINTS | OB_BSB_SHAPE_MATCHING | OB_BSB_AERO_VPOINT;
00054         bsb->linStiff = 0.5f;
00055         bsb->angStiff = 1.0f;
00056         bsb->volume = 1.0f;
00057 
00058         
00059         bsb->viterations        =       0;
00060         bsb->piterations        =       2;      
00061         bsb->diterations        =       0;
00062         bsb->citerations        =       4;
00063         
00064         bsb->kSRHR_CL           =       0.1f;
00065         bsb->kSKHR_CL           =       1.f;
00066         bsb->kSSHR_CL           =       0.5f;
00067         bsb->kSR_SPLT_CL        =       0.5f;
00068         
00069         bsb->kSK_SPLT_CL        =       0.5f;
00070         bsb->kSS_SPLT_CL        =       0.5f;
00071         bsb->kVCF                       =       1;
00072         bsb->kDP                        =       0;
00073 
00074         bsb->kDG                        =       0;
00075         bsb->kLF                        =       0;
00076         bsb->kPR                        =       0;
00077         bsb->kVC                        =       0;
00078 
00079         bsb->kDF                        =       0.2f;
00080         bsb->kMT                        =       0.05;
00081         bsb->kCHR                       =       1.0f;
00082         bsb->kKHR                       =       0.1f;
00083 
00084         bsb->kSHR                       =       1.0f;
00085         bsb->kAHR                       =       0.7f;
00086         
00087         bsb->collisionflags = 0;
00088         //bsb->collisionflags = OB_BSB_COL_CL_RS + OB_BSB_COL_CL_SS;
00089         bsb->numclusteriterations = 64;
00090         bsb->welding = 0.f;
00091 
00092         return bsb;
00093 }
00094 
00095 /* frees all */
00096 void bsbFree(BulletSoftBody *bsb)
00097 {
00098         /* no internal data yet */
00099         MEM_freeN(bsb);
00100 }
00101 
00102