2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
28 /** \file BL_MeshDeformer.h
32 #ifndef __BL_MESHDEFORMER_H__
33 #define __BL_MESHDEFORMER_H__
35 #include "RAS_Deformer.h"
36 #include "DNA_object_types.h"
37 #include "DNA_key_types.h"
38 #include "MT_Point3.h"
41 #if defined(WIN32) && !defined(FREE_WINDOWS)
42 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
45 class BL_DeformableGameObject;
47 class BL_MeshDeformer : public RAS_Deformer
52 virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map);
53 BL_MeshDeformer(BL_DeformableGameObject *gameobj,
55 class RAS_MeshObject *meshobj ):
56 m_pMeshObject(meshobj),
57 m_bmesh((struct Mesh*)(obj->data)),
63 m_lastDeformUpdate(-1)
65 virtual ~BL_MeshDeformer();
66 virtual void SetSimulatedTime(double time){}
67 virtual bool Apply(class RAS_IPolyMaterial *mat);
68 virtual bool Update(void){ return false; }
69 virtual bool UpdateBuckets(void){ return false; }
70 virtual RAS_Deformer* GetReplica(){return NULL;}
71 virtual void ProcessReplica();
72 struct Mesh* GetMesh() { return m_bmesh; }
73 virtual class RAS_MeshObject* GetRasMesh() { return (RAS_MeshObject*)m_pMeshObject; }
74 virtual float (* GetTransVerts(int *tot))[3] { *tot= m_tvtot; return m_transverts; }
75 // virtual void InitDeform(double time){}
78 class RAS_MeshObject* m_pMeshObject;
81 // this is so m_transverts doesn't need to be converted
83 float (*m_transverts)[3];
84 float (*m_transnors)[3];
85 struct Object* m_objMesh;
88 BL_DeformableGameObject* m_gameobj;
89 double m_lastDeformUpdate;
92 #ifdef WITH_CXX_GUARDEDALLOC
94 void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_MeshDeformer"); }
95 void operator delete( void *mem ) { MEM_freeN(mem); }