Blender V2.61 - r43446

BL_ShapeDeformer.h

Go to the documentation of this file.
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_SHAPEDEFORMER
00033 #define BL_SHAPEDEFORMER
00034 
00035 #if defined(WIN32) && !defined(FREE_WINDOWS)
00036 #pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
00037 #endif //WIN32
00038 
00039 #include "BL_SkinDeformer.h"
00040 #include "BL_DeformableGameObject.h"
00041 #include <vector>
00042 
00043 class BL_ShapeDeformer : public BL_SkinDeformer  
00044 {
00045 public:
00046     BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
00047                      Object *bmeshobj,
00048                      RAS_MeshObject *mesh);
00049 
00050     /* this second constructor is needed for making a mesh deformable on the fly. */
00051     BL_ShapeDeformer(BL_DeformableGameObject *gameobj,
00052                     struct Object *bmeshobj_old,
00053                     struct Object *bmeshobj_new,
00054                     class RAS_MeshObject *mesh,
00055                     bool release_object,
00056                     bool recalc_normal,
00057                     BL_ArmatureObject* arma = NULL);
00058 
00059     virtual RAS_Deformer *GetReplica();
00060     virtual void ProcessReplica();
00061     virtual ~BL_ShapeDeformer();
00062 
00063     bool Update (void);
00064     bool LoadShapeDrivers(Object* arma);
00065     bool ExecuteShapeDrivers(void);
00066 
00067     struct Key *GetKey();
00068     void SetKey(struct Key *key);
00069 
00070     void ForceUpdate()
00071     {
00072         m_lastShapeUpdate = -1.0;
00073     };
00074 
00075 protected:
00076     bool            m_useShapeDrivers;  
00077     double          m_lastShapeUpdate;
00078     struct Key*     m_key;
00079 
00080 
00081 #ifdef WITH_CXX_GUARDEDALLOC
00082 public:
00083     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:BL_ShapeDeformer"); }
00084     void operator delete( void *mem ) { MEM_freeN(mem); }
00085 #endif
00086 };
00087 
00088 #endif
00089