|
Blender
V2.59
|
00001 /* 00002 * $Id: BL_SkinDeformer.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 BL_SKINDEFORMER 00035 #define BL_SKINDEFORMER 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 "CTR_HashedPtr.h" 00042 #include "BL_MeshDeformer.h" 00043 #include "BL_ArmatureObject.h" 00044 00045 #include "DNA_mesh_types.h" 00046 #include "DNA_meshdata_types.h" 00047 #include "DNA_object_types.h" 00048 #include "BKE_armature.h" 00049 00050 #include "RAS_Deformer.h" 00051 00052 00053 class BL_SkinDeformer : public BL_MeshDeformer 00054 { 00055 public: 00056 // void SetArmatureController (BL_ArmatureController *cont); 00057 virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map); 00058 void SetArmature (class BL_ArmatureObject *armobj); 00059 00060 BL_SkinDeformer(BL_DeformableGameObject *gameobj, 00061 struct Object *bmeshobj, 00062 class RAS_MeshObject *mesh, 00063 BL_ArmatureObject* arma = NULL); 00064 00065 /* this second constructor is needed for making a mesh deformable on the fly. */ 00066 BL_SkinDeformer(BL_DeformableGameObject *gameobj, 00067 struct Object *bmeshobj_old, 00068 struct Object *bmeshobj_new, 00069 class RAS_MeshObject *mesh, 00070 bool release_object, 00071 bool recalc_normal, 00072 BL_ArmatureObject* arma = NULL); 00073 00074 virtual RAS_Deformer *GetReplica(); 00075 virtual void ProcessReplica(); 00076 00077 virtual ~BL_SkinDeformer(); 00078 bool Update (void); 00079 bool UpdateInternal (bool shape_applied); 00080 bool Apply (class RAS_IPolyMaterial *polymat); 00081 bool UpdateBuckets(void) 00082 { 00083 // update the deformer and all the mesh slots; Apply() does it well, so just call it. 00084 return Apply(NULL); 00085 } 00086 bool PoseUpdated(void) 00087 { 00088 if (m_armobj && m_lastArmaUpdate!=m_armobj->GetLastFrame()) { 00089 return true; 00090 } 00091 return false; 00092 } 00093 00094 void ForceUpdate() 00095 { 00096 m_lastArmaUpdate = -1.0; 00097 }; 00098 virtual bool ShareVertexArray() 00099 { 00100 return false; 00101 } 00102 00103 protected: 00104 BL_ArmatureObject* m_armobj; // Our parent object 00105 float m_time; 00106 double m_lastArmaUpdate; 00107 //ListBase* m_defbase; 00108 float m_obmat[4][4]; // the reference matrix for skeleton deform 00109 bool m_releaseobject; 00110 bool m_poseApplied; 00111 bool m_recalcNormal; 00112 00113 00114 #ifdef WITH_CXX_GUARDEDALLOC 00115 public: 00116 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_SkinDeformer"); } 00117 void operator delete( void *mem ) { MEM_freeN(mem); } 00118 #endif 00119 }; 00120 00121 #endif 00122