Blender V2.61 - r43446

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