Blender V2.61 - r43446
|
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) 2001-2002 by NaN Holding BV. 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 00032 #ifndef BL_MESHDEFORMER 00033 #define BL_MESHDEFORMER 00034 00035 #include "RAS_Deformer.h" 00036 #include "DNA_object_types.h" 00037 #include "DNA_key_types.h" 00038 #include "MT_Point3.h" 00039 #include <stdlib.h> 00040 00041 #if defined(WIN32) && !defined(FREE_WINDOWS) 00042 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning 00043 #endif //WIN32 00044 00045 class BL_DeformableGameObject; 00046 00047 class BL_MeshDeformer : public RAS_Deformer 00048 { 00049 public: 00050 void VerifyStorage(); 00051 void RecalcNormals(); 00052 virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map); 00053 BL_MeshDeformer(BL_DeformableGameObject *gameobj, 00054 struct Object* obj, 00055 class RAS_MeshObject *meshobj ): 00056 m_pMeshObject(meshobj), 00057 m_bmesh((struct Mesh*)(obj->data)), 00058 m_transverts(0), 00059 m_transnors(0), 00060 m_objMesh(obj), 00061 m_tvtot(0), 00062 m_gameobj(gameobj), 00063 m_lastDeformUpdate(-1) 00064 {}; 00065 virtual ~BL_MeshDeformer(); 00066 virtual void SetSimulatedTime(double time){}; 00067 virtual bool Apply(class RAS_IPolyMaterial *mat); 00068 virtual bool Update(void){ return false; }; 00069 virtual bool UpdateBuckets(void){ return false; }; 00070 virtual RAS_Deformer* GetReplica(){return NULL;}; 00071 virtual void ProcessReplica(); 00072 struct Mesh* GetMesh() { return m_bmesh; }; 00073 virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }; 00074 virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; } 00075 // virtual void InitDeform(double time){}; 00076 00077 protected: 00078 class RAS_MeshObject* m_pMeshObject; 00079 struct Mesh* m_bmesh; 00080 00081 // this is so m_transverts doesn't need to be converted 00082 // before deformation 00083 float (*m_transverts)[3]; 00084 float (*m_transnors)[3]; 00085 struct Object* m_objMesh; 00086 // -- 00087 int m_tvtot; 00088 BL_DeformableGameObject* m_gameobj; 00089 double m_lastDeformUpdate; 00090 00091 00092 #ifdef WITH_CXX_GUARDEDALLOC 00093 public: 00094 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_MeshDeformer"); } 00095 void operator delete( void *mem ) { MEM_freeN(mem); } 00096 #endif 00097 }; 00098 00099 #endif 00100