doxygen: prevent GPL license block from being parsed as doxygen comment.
[blender.git] / source / gameengine / Converter / BL_DeformableGameObject.h
1 /*
2  * $Id$
3  *
4  * ***** BEGIN GPL LICENSE BLOCK *****
5  *
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.
10  *
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.
15  *
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.
19  *
20  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
21  * All rights reserved.
22  *
23  * The Original Code is: all of this file.
24  *
25  * Contributor(s): none yet.
26  *
27  * ***** END GPL LICENSE BLOCK *****
28  */
29
30 /** \file BL_DeformableGameObject.h
31  *  \ingroup bgeconv
32  */
33
34 #ifndef BL_DEFORMABLEGAMEOBJECT
35 #define BL_DEFORMABLEGAMEOBJECT
36
37 #if defined(WIN32) && !defined(FREE_WINDOWS)
38 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
39 #endif //WIN32
40
41 #include "DNA_mesh_types.h"
42 #include "KX_GameObject.h"
43 #include "BL_MeshDeformer.h"
44 #include "KX_SoftBodyDeformer.h"
45 #include <vector>
46
47 class BL_ShapeActionActuator;
48 struct Key;
49
50 class BL_DeformableGameObject : public KX_GameObject  
51 {
52 public:
53         CValue*         GetReplica();
54
55         double GetLastFrame ()
56         {
57                 return m_lastframe;
58         }
59         Object* GetBlendObject()
60         {
61                 return m_blendobj;
62         }
63         virtual void Relink(GEN_Map<GEN_HashedPtr, void*>*map)
64         {
65                 if (m_pDeformer)
66                         m_pDeformer->Relink (map);
67                 KX_GameObject::Relink(map);
68         };
69         void ProcessReplica();
70
71         BL_DeformableGameObject(Object* blendobj, void* sgReplicationInfo, SG_Callbacks callbacks) :
72                 KX_GameObject(sgReplicationInfo,callbacks),
73                 m_pDeformer(NULL),
74                 m_activeAct(NULL),
75                 m_lastframe(0.),
76                 m_blendobj(blendobj),
77                 m_activePriority(9999)
78         {
79                 m_isDeformable = true;
80         };
81         virtual ~BL_DeformableGameObject();
82         bool SetActiveAction(class BL_ShapeActionActuator *act, short priority, double curtime);
83
84         bool GetShape(vector<float> &shape);
85         Key* GetKey()
86         {
87                 if(m_pDeformer) {
88                         BL_MeshDeformer *deformer= dynamic_cast<BL_MeshDeformer *>(m_pDeformer); // incase its not a MeshDeformer
89                         if(deformer) {
90                                 return deformer->GetMesh()->key;
91                         }
92
93 #if 0           // TODO. shape keys for softbody, currently they dont store a mesh.
94                         KX_SoftBodyDeformer *deformer_soft= dynamic_cast<KX_SoftBodyDeformer *>(m_pDeformer);   
95                         if(deformer) {
96                                 return deformer->GetMesh()->key;
97                         }
98 #endif
99                 }
100                 return NULL;
101         }
102         
103         virtual void    SetDeformer(class RAS_Deformer* deformer);
104         virtual class RAS_Deformer* GetDeformer()
105         {
106                 return m_pDeformer;
107         }
108
109 public:
110         
111 protected:      
112         
113         RAS_Deformer            *m_pDeformer;
114
115         class BL_ShapeActionActuator *m_activeAct;
116         double          m_lastframe;
117         Object*         m_blendobj;
118         short           m_activePriority;
119
120
121 #ifdef WITH_CXX_GUARDEDALLOC
122 public:
123         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_DeformableGameObject"); }
124         void operator delete( void *mem ) { MEM_freeN(mem); }
125 #endif
126 };
127
128 #endif
129