4 * ***** BEGIN GPL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21 * All rights reserved.
23 * The Original Code is: all of this file.
25 * Contributor(s): none yet.
27 * ***** END GPL LICENSE BLOCK *****
30 #ifndef BL_SKINDEFORMER
31 #define BL_SKINDEFORMER
33 #if defined(WIN32) && !defined(FREE_WINDOWS)
34 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
37 #include "GEN_HashedPtr.h"
38 #include "BL_MeshDeformer.h"
39 #include "BL_ArmatureObject.h"
41 #include "DNA_mesh_types.h"
42 #include "DNA_meshdata_types.h"
43 #include "DNA_object_types.h"
44 #include "BKE_armature.h"
46 #include "RAS_Deformer.h"
49 class BL_SkinDeformer : public BL_MeshDeformer
52 // void SetArmatureController (BL_ArmatureController *cont);
53 virtual void Relink(GEN_Map<class GEN_HashedPtr, void*>*map);
54 void SetArmature (class BL_ArmatureObject *armobj);
56 BL_SkinDeformer(BL_DeformableGameObject *gameobj,
57 struct Object *bmeshobj,
58 class RAS_MeshObject *mesh,
59 BL_ArmatureObject* arma = NULL);
61 /* this second constructor is needed for making a mesh deformable on the fly. */
62 BL_SkinDeformer(BL_DeformableGameObject *gameobj,
63 struct Object *bmeshobj_old,
64 struct Object *bmeshobj_new,
65 class RAS_MeshObject *mesh,
68 BL_ArmatureObject* arma = NULL);
70 virtual RAS_Deformer *GetReplica();
71 virtual void ProcessReplica();
73 virtual ~BL_SkinDeformer();
75 bool UpdateInternal (bool shape_applied);
76 bool Apply (class RAS_IPolyMaterial *polymat);
77 bool UpdateBuckets(void)
79 // update the deformer and all the mesh slots; Apply() does it well, so just call it.
82 bool PoseUpdated(void)
84 if (m_armobj && m_lastArmaUpdate!=m_armobj->GetLastFrame()) {
92 m_lastArmaUpdate = -1.0;
94 virtual bool ShareVertexArray()
100 BL_ArmatureObject* m_armobj; // Our parent object
102 double m_lastArmaUpdate;
103 //ListBase* m_defbase;
104 float m_obmat[4][4]; // the reference matrix for skeleton deform
105 bool m_releaseobject;
110 #ifdef WITH_CXX_GUARDEDALLOC
112 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_SkinDeformer"); }
113 void operator delete( void *mem ) { MEM_freeN(mem); }