Blender  V2.59
KX_SG_NodeRelationships.h
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_SG_NodeRelationships.h 35063 2011-02-22 10:33:14Z jesterking $
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  */
00030  
00044 #ifndef __KX_SG_NODERELATIONS_H__
00045 #define __KX_SG_NODERELATIONS_H__
00046 
00047 #include "SG_Spatial.h"
00048 #include "SG_ParentRelation.h"
00049 
00050 class KX_NormalParentRelation : public SG_ParentRelation
00051 {
00052 
00053 public :
00059         static 
00060                 KX_NormalParentRelation *
00061         New(
00062         );              
00063 
00068                 bool
00069         UpdateChildCoordinates(
00070                 SG_Spatial * child,
00071                 const SG_Spatial * parent,
00072                 bool& parentUpdated     
00073         );
00074 
00079                 SG_ParentRelation *
00080         NewCopy(
00081         );
00082 
00083         ~KX_NormalParentRelation(
00084         );
00085 
00086 private :
00087 
00088         KX_NormalParentRelation(
00089         );
00090 
00091 
00092 #ifdef WITH_CXX_GUARDEDALLOC
00093 public:
00094         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_NormalParentRelation"); }
00095         void operator delete( void *mem ) { MEM_freeN(mem); }
00096 #endif
00097 };
00098 
00099 
00100 class KX_VertexParentRelation : public SG_ParentRelation
00101 {
00102 
00103 public :
00104 
00110         static 
00111                 KX_VertexParentRelation *
00112         New(
00113         );              
00114 
00119                 bool
00120         UpdateChildCoordinates(
00121                 SG_Spatial * child,
00122                 const SG_Spatial * parent,
00123                 bool& parentUpdated     
00124         );
00125 
00130                 SG_ParentRelation *
00131         NewCopy(
00132         );
00133 
00134         ~KX_VertexParentRelation(
00135         );
00136 
00137                 bool
00138         IsVertexRelation(
00139         ) { 
00140                 return true;
00141         }
00142 
00143 private :
00144 
00145         KX_VertexParentRelation(
00146         );
00147 
00148 
00149 #ifdef WITH_CXX_GUARDEDALLOC
00150 public:
00151         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_VertexParentRelation"); }
00152         void operator delete( void *mem ) { MEM_freeN(mem); }
00153 #endif
00154 };
00155 
00156 
00157 class KX_SlowParentRelation : public SG_ParentRelation
00158 {
00159 
00160 public :
00161 
00167         static 
00168                 KX_SlowParentRelation *
00169         New(
00170                 MT_Scalar relaxation
00171         );              
00172 
00177                 bool
00178         UpdateChildCoordinates(
00179                 SG_Spatial * child,
00180                 const SG_Spatial * parent,
00181                 bool& parentUpdated     
00182         );
00183 
00188                 SG_ParentRelation *
00189         NewCopy(
00190         );
00191 
00192                 MT_Scalar
00193         GetTimeOffset(
00194         ) { return m_relax; }
00195         
00196                 void
00197         SetTimeOffset(
00198                 MT_Scalar relaxation
00199         ) { m_relax = relaxation; }
00200 
00201         ~KX_SlowParentRelation(
00202         );
00203         
00204                 bool
00205         IsSlowRelation(
00206         ) { 
00207                 return true;
00208         }
00209 
00210 private :
00211 
00212         KX_SlowParentRelation(
00213                 MT_Scalar relaxation
00214         );
00215 
00216         // the relaxation coefficient.
00217 
00218         MT_Scalar m_relax;
00219 
00229         bool m_initialized;
00230 
00231 
00232 #ifdef WITH_CXX_GUARDEDALLOC
00233 public:
00234         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_SlowParentRelation"); }
00235         void operator delete( void *mem ) { MEM_freeN(mem); }
00236 #endif
00237 };
00238 
00239 #endif