Blender V2.61 - r43446

KX_IPO_SGController.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 __IPO_SGCONTROLLER_H
00033 #define __IPO_SGCONTROLLER_H
00034 
00035 #include "SG_Controller.h"
00036 #include "SG_Spatial.h"
00037 
00038 #include "KX_IPOTransform.h"
00039 #include "KX_IInterpolator.h"
00040 
00041 #define KX_MAX_IPO_CHANNELS 19  //note- [0] is not used
00042 
00043 class KX_IpoSGController : public SG_Controller
00044 {
00045     KX_IPOTransform     m_ipo_xform;
00046     T_InterpolatorList  m_interpolators;
00047 
00049     bool                m_ipo_channels_active[KX_MAX_IPO_CHANNELS];
00050 
00052     bool                m_ipo_as_force;
00053 
00055     bool                m_ipo_add;
00056 
00058     bool                m_ipo_local;
00059     
00061     bool                m_modified;
00062 
00064     double              m_ipotime;
00065 
00067     class MT_Point3     m_ipo_start_point;
00068 
00070     class MT_Matrix3x3  m_ipo_start_orient;
00071 
00073     class MT_Vector3    m_ipo_start_scale;
00074 
00076     bool                m_ipo_start_initialized;
00077 
00079     class MT_Vector3    m_ipo_start_euler;
00080 
00082     bool                m_ipo_euler_initialized;
00083 
00085     class KX_GameObject* m_game_object;
00086 
00087 public:
00088     KX_IpoSGController();
00089 
00090     virtual ~KX_IpoSGController();
00091 
00092     virtual SG_Controller*  GetReplica(class SG_Node* destnode);
00093 
00094         void
00095     SetOption(
00096         int option,
00097         int value
00098     );
00099 
00101     void UpdateSumoReference();
00103     void SetGameObject(class KX_GameObject*);
00104 
00105     void SetIPOChannelActive(int index, bool value) {
00106         //indexes found in makesdna\DNA_ipo_types.h
00107         m_ipo_channels_active[index] = value;
00108     }
00109     
00110     
00111     KX_IPOTransform& GetIPOTransform()
00112     {
00113         return m_ipo_xform;
00114     }
00115     void    AddInterpolator(KX_IInterpolator* interp);
00116     virtual bool Update(double time);
00117     virtual void    SetSimulatedTime(double time)
00118     {
00119         m_ipotime = time;
00120         m_modified = true;
00121     }
00122     
00123 #ifdef WITH_CXX_GUARDEDALLOC
00124 public:
00125     void *operator new(size_t num_bytes) { return MEM_mallocN(num_bytes, "GE:KX_IpoSGController"); }
00126     void operator delete( void *mem ) { MEM_freeN(mem); }
00127 #endif
00128 };
00129 
00130 #endif //__IPO_SGCONTROLLER_H
00131 
00132