Blender  V2.59
KX_IPOTransform.h
Go to the documentation of this file.
00001 /*
00002  * $Id: KX_IPOTransform.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 
00035 #ifndef KX_IPOTRANSFORM_H
00036 #define KX_IPOTRANSFORM_H
00037 
00038 #include "MT_Transform.h"
00039 
00040 class KX_IPOTransform {
00041 public:
00042         KX_IPOTransform() :
00043                 m_position(0.0, 0.0, 0.0),
00044                 m_eulerAngles(0.0, 0.0, 0.0),
00045                 m_scaling(1.0, 1.0, 1.0),
00046                 m_deltaPosition(0.0, 0.0, 0.0),
00047                 m_deltaEulerAngles(0.0, 0.0, 0.0),
00048                 m_deltaScaling(0.0, 0.0, 0.0)
00049                 {}
00050 
00051         MT_Transform         GetTransform() const {
00052                 return MT_Transform(m_position + m_deltaPosition,
00053                                                         MT_Matrix3x3(m_eulerAngles + m_deltaEulerAngles,
00054                                                                                  m_scaling + m_deltaScaling));
00055         }
00056 
00057         MT_Point3&               GetPosition()          { return m_position;    }
00058         MT_Vector3&          GetEulerAngles()       { return m_eulerAngles;     }
00059         MT_Vector3&          GetScaling()           { return m_scaling; }
00060 
00061         const MT_Point3&         GetPosition()    const { return m_position;    }
00062         const MT_Vector3&    GetEulerAngles() const { return m_eulerAngles;     }
00063         const MT_Vector3&    GetScaling()     const { return m_scaling; }
00064         
00065         MT_Vector3&          GetDeltaPosition()     { return m_deltaPosition; }
00066         MT_Vector3&          GetDeltaEulerAngles()  { return m_deltaEulerAngles; }
00067         MT_Vector3&          GetDeltaScaling()      { return m_deltaScaling; }
00068         
00069         void SetPosition(const MT_Point3& pos)      { m_position = pos;         }
00070         void SetEulerAngles(const MT_Vector3& eul)  { m_eulerAngles = eul;      }
00071         void SetScaling(const MT_Vector3& scaling)  { m_scaling = scaling;      }
00072         
00073         void ClearDeltaStuff() { 
00074                 m_deltaPosition.setValue(0.0, 0.0, 0.0);
00075                 m_deltaEulerAngles.setValue(0.0, 0.0, 0.0);
00076                 m_deltaScaling.setValue(0.0, 0.0, 0.0);
00077         }
00078 
00079 protected:
00080         MT_Point3              m_position;
00081         MT_Vector3             m_eulerAngles;
00082         MT_Vector3             m_scaling;
00083         MT_Vector3             m_deltaPosition;
00084         MT_Vector3             m_deltaEulerAngles;
00085         MT_Vector3             m_deltaScaling;
00086 };
00087 
00088 #endif
00089