Blender V2.61 - r43446

bullet.c

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