|
Blender
V2.59
|
00001 /* 00002 * $Id: KX_SoftBodyDeformer.h 36523 2011-05-06 20:18:42Z blendix $ 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) 2001-2002 by NaN Holding BV. 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 00034 #ifndef KX_SOFTBODYDEFORMER 00035 #define KX_SOFTBODYDEFORMER 00036 00037 #if defined(WIN32) && !defined(FREE_WINDOWS) 00038 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning 00039 #endif //WIN32 00040 00041 #include "RAS_Deformer.h" 00042 #include "BL_DeformableGameObject.h" 00043 #include <vector> 00044 00045 00046 class KX_SoftBodyDeformer : public RAS_Deformer 00047 { 00048 class RAS_MeshObject* m_pMeshObject; 00049 class BL_DeformableGameObject* m_gameobj; 00050 00051 public: 00052 KX_SoftBodyDeformer(RAS_MeshObject* pMeshObject,BL_DeformableGameObject* gameobj) 00053 :m_pMeshObject(pMeshObject), 00054 m_gameobj(gameobj) 00055 { 00056 //printf("KX_SoftBodyDeformer\n"); 00057 }; 00058 00059 virtual ~KX_SoftBodyDeformer() 00060 { 00061 //printf("~KX_SoftBodyDeformer\n"); 00062 }; 00063 virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map); 00064 virtual bool Apply(class RAS_IPolyMaterial *polymat); 00065 virtual bool Update(void) 00066 { 00067 //printf("update\n"); 00068 m_bDynamic = true; 00069 return true;//?? 00070 } 00071 virtual bool UpdateBuckets(void) 00072 { 00073 // this is to update the mesh slots outside the rasterizer, 00074 // no need to do it for this deformer, it's done in any case in Apply() 00075 return false; 00076 } 00077 00078 virtual RAS_Deformer *GetReplica() 00079 { 00080 KX_SoftBodyDeformer* deformer = new KX_SoftBodyDeformer(*this); 00081 deformer->ProcessReplica(); 00082 return deformer; 00083 } 00084 virtual void ProcessReplica() 00085 { 00086 // we have two pointers to deal with but we cannot do it now, will be done in Relink 00087 m_bDynamic = false; 00088 } 00089 virtual bool SkipVertexTransform() 00090 { 00091 return true; 00092 } 00093 00094 protected: 00095 //class RAS_MeshObject *m_pMesh; 00096 00097 #ifdef WITH_CXX_GUARDEDALLOC 00098 public: 00099 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ShapeDeformer"); } 00100 void operator delete( void *mem ) { MEM_freeN(mem); } 00101 #endif 00102 }; 00103 00104 00105 #endif 00106