Blender  V2.59
RAS_Deformer.h
Go to the documentation of this file.
00001 /*
00002  * $Id: RAS_Deformer.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 RAS_DEFORMER
00035 #define RAS_DEFORMER
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 <stdlib.h>
00042 #include "CTR_Map.h"
00043 
00044 #ifdef WITH_CXX_GUARDEDALLOC
00045 #include "MEM_guardedalloc.h"
00046 #endif
00047 
00048 struct DerivedMesh;
00049 class RAS_MeshObject;
00050 
00051 class RAS_Deformer
00052 {
00053 public:
00054         RAS_Deformer() : m_pMesh(NULL), m_bDynamic(false) {};
00055         virtual ~RAS_Deformer(){};
00056         virtual void Relink(CTR_Map<class CTR_HashedPtr, void*>*map)=0;
00057         virtual bool Apply(class RAS_IPolyMaterial *polymat)=0;
00058         virtual bool Update(void)=0;
00059         virtual bool UpdateBuckets(void)=0;
00060         virtual RAS_Deformer *GetReplica()=0;
00061         virtual void ProcessReplica()=0;
00062         virtual bool SkipVertexTransform()
00063         {
00064                 return false;
00065         }
00066         virtual bool ShareVertexArray()
00067         {
00068                 return true;
00069         }
00070         virtual bool UseVertexArray()
00071         {
00072                 return true;
00073         }
00074         // true when deformer produces varying vertex (shape or armature)
00075         bool IsDynamic()
00076         {
00077                 return m_bDynamic;
00078         }
00079         virtual struct DerivedMesh* GetFinalMesh()
00080         {
00081                 return NULL;
00082         }
00083         virtual struct DerivedMesh* GetPhysicsMesh()
00084         {
00085                 return NULL;
00086         }
00087         virtual class RAS_MeshObject* GetRasMesh()
00088         {
00089                 /* m_pMesh does not seem to be being used?? */
00090                 return NULL;
00091         }
00092         virtual float (* GetTransVerts(int *tot))[3]    {       *tot= 0; return NULL; }
00093 
00094 protected:
00095         class RAS_MeshObject    *m_pMesh;
00096         bool  m_bDynamic;       
00097 
00098 #ifdef WITH_CXX_GUARDEDALLOC
00099 public:
00100         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:RAS_Deformer"); }
00101         void operator delete( void *mem ) { MEM_freeN(mem); }
00102 #endif
00103 };
00104 
00105 #endif
00106