Blender  V2.59
KX_IPO_SGController.h
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_IPO_SGController.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 
00034 #ifndef __IPO_SGCONTROLLER_H
00035 #define __IPO_SGCONTROLLER_H
00036 
00037 #include "SG_Controller.h"
00038 #include "SG_Spatial.h"
00039 
00040 #include "KX_IPOTransform.h"
00041 #include "KX_IInterpolator.h"
00042 
00043 #define KX_MAX_IPO_CHANNELS 19  //note- [0] is not used
00044 
00045 class KX_IpoSGController : public SG_Controller
00046 {
00047         KX_IPOTransform     m_ipo_xform;
00048         T_InterpolatorList  m_interpolators;
00049 
00051         bool                            m_ipo_channels_active[KX_MAX_IPO_CHANNELS];
00052 
00054         bool                m_ipo_as_force;
00055 
00057         bool                m_ipo_add;
00058 
00060         bool                m_ipo_local;
00061         
00063         bool                            m_modified;
00064 
00066         double                  m_ipotime;
00067 
00069         class MT_Point3         m_ipo_start_point;
00070 
00072         class MT_Matrix3x3      m_ipo_start_orient;
00073 
00075         class MT_Vector3        m_ipo_start_scale;
00076 
00078         bool                            m_ipo_start_initialized;
00079 
00081         class MT_Vector3        m_ipo_start_euler;
00082 
00084         bool                            m_ipo_euler_initialized;
00085 
00087         class KX_GameObject* m_game_object;
00088 
00089 public:
00090         KX_IpoSGController();
00091 
00092         virtual ~KX_IpoSGController();
00093 
00094         virtual SG_Controller*  GetReplica(class SG_Node* destnode);
00095 
00096                 void
00097         SetOption(
00098                 int option,
00099                 int value
00100         );
00101 
00103         void UpdateSumoReference();
00105         void SetGameObject(class KX_GameObject*);
00106 
00107         void SetIPOChannelActive(int index, bool value) {
00108                 //indexes found in makesdna\DNA_ipo_types.h
00109                 m_ipo_channels_active[index] = value;
00110         }
00111         
00112         
00113         KX_IPOTransform& GetIPOTransform()
00114         {
00115                 return m_ipo_xform;
00116         }
00117         void    AddInterpolator(KX_IInterpolator* interp);
00118         virtual bool Update(double time);
00119         virtual void    SetSimulatedTime(double time)
00120         {
00121                 m_ipotime = time;
00122                 m_modified = true;
00123         }
00124         
00125 #ifdef WITH_CXX_GUARDEDALLOC
00126 public:
00127         void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IpoSGController"); }
00128         void operator delete( void *mem ) { MEM_freeN(mem); }
00129 #endif
00130 };
00131 
00132 #endif //__IPO_SGCONTROLLER_H
00133 
00134