Blender V2.61 - r43446

KX_SG_NodeRelationships.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  */
00028  
00042 #ifndef __KX_SG_NODERELATIONS_H__
00043 #define __KX_SG_NODERELATIONS_H__
00044 
00045 #include "SG_Spatial.h"
00046 #include "SG_ParentRelation.h"
00047 
00048 class KX_NormalParentRelation : public SG_ParentRelation
00049 {
00050 
00051 public :
00057     static 
00058         KX_NormalParentRelation *
00059     New(
00060     );      
00061 
00066         bool
00067     UpdateChildCoordinates(
00068         SG_Spatial * child,
00069         const SG_Spatial * parent,
00070         bool& parentUpdated 
00071     );
00072 
00077         SG_ParentRelation *
00078     NewCopy(
00079     );
00080 
00081     ~KX_NormalParentRelation(
00082     );
00083 
00084 private :
00085 
00086     KX_NormalParentRelation(
00087     );
00088 
00089 
00090 #ifdef WITH_CXX_GUARDEDALLOC
00091 public:
00092     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_NormalParentRelation"); }
00093     void operator delete( void *mem ) { MEM_freeN(mem); }
00094 #endif
00095 };
00096 
00097 
00098 class KX_VertexParentRelation : public SG_ParentRelation
00099 {
00100 
00101 public :
00102 
00108     static 
00109         KX_VertexParentRelation *
00110     New(
00111     );      
00112 
00117         bool
00118     UpdateChildCoordinates(
00119         SG_Spatial * child,
00120         const SG_Spatial * parent,
00121         bool& parentUpdated 
00122     );
00123 
00128         SG_ParentRelation *
00129     NewCopy(
00130     );
00131 
00132     ~KX_VertexParentRelation(
00133     );
00134 
00135         bool
00136     IsVertexRelation(
00137     ) { 
00138         return true;
00139     }
00140 
00141 private :
00142 
00143     KX_VertexParentRelation(
00144     );
00145 
00146 
00147 #ifdef WITH_CXX_GUARDEDALLOC
00148 public:
00149     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_VertexParentRelation"); }
00150     void operator delete( void *mem ) { MEM_freeN(mem); }
00151 #endif
00152 };
00153 
00154 
00155 class KX_SlowParentRelation : public SG_ParentRelation
00156 {
00157 
00158 public :
00159 
00165     static 
00166         KX_SlowParentRelation *
00167     New(
00168         MT_Scalar relaxation
00169     );      
00170 
00175         bool
00176     UpdateChildCoordinates(
00177         SG_Spatial * child,
00178         const SG_Spatial * parent,
00179         bool& parentUpdated 
00180     );
00181 
00186         SG_ParentRelation *
00187     NewCopy(
00188     );
00189 
00190         MT_Scalar
00191     GetTimeOffset(
00192     ) { return m_relax; }
00193     
00194         void
00195     SetTimeOffset(
00196         MT_Scalar relaxation
00197     ) { m_relax = relaxation; }
00198 
00199     ~KX_SlowParentRelation(
00200     );
00201     
00202         bool
00203     IsSlowRelation(
00204     ) { 
00205         return true;
00206     }
00207 
00208 private :
00209 
00210     KX_SlowParentRelation(
00211         MT_Scalar relaxation
00212     );
00213 
00214     // the relaxation coefficient.
00215 
00216     MT_Scalar m_relax;
00217 
00227     bool m_initialized;
00228 
00229 
00230 #ifdef WITH_CXX_GUARDEDALLOC
00231 public:
00232     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_SlowParentRelation"); }
00233     void operator delete( void *mem ) { MEM_freeN(mem); }
00234 #endif
00235 };
00236 
00237 #endif