Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

EulerArrayInterpolator.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------------
00002 // Lamp : Open source game middleware
00003 // Copyright (C) 2004  Junpei Ohtani ( Email : junpee@users.sourceforge.jp )
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //------------------------------------------------------------------------------
00019 
00020 /** @file
00021  * オイラー回転配列補間ヘッダ
00022  * @author Junpee
00023  */
00024 
00025 #ifndef EULER_ARRAY_INTERPOLATOR_H_
00026 #define EULER_ARRAY_INTERPOLATOR_H_
00027 
00028 #include <Animation/RotationInterpolator/RotationInterpolator.h>
00029 
00030 namespace Lamp{
00031 
00032 //------------------------------------------------------------------------------
00033 /**
00034  * オイラー回転配列補間
00035  */
00036 class EulerArrayInterpolator : public RotationInterpolator{
00037 public:
00038     //--------------------------------------------------------------------------
00039     /**
00040      * コンストラクタ
00041      */
00042     EulerArrayInterpolator();
00043 
00044     /**
00045      * デストラクタ
00046      */
00047     virtual ~EulerArrayInterpolator();
00048 
00049     /**
00050      * コピーコンストラクタ
00051      * @param copy コピー元
00052      */
00053     explicit EulerArrayInterpolator(
00054         const EulerArrayInterpolator& copy);
00055 
00056     /**
00057      * 代入演算子
00058      * @param copy 代入元
00059      */
00060     virtual EulerArrayInterpolator& operator =(
00061         const EulerArrayInterpolator& copy);
00062 
00063     //--------------------------------------------------------------------------
00064     /**
00065      * 複製
00066      * @return 複製されたオイラー回転補間。呼び出し元でdeleteする必要がある
00067      */
00068     virtual RotationInterpolator* duplicate() const{
00069         RotationInterpolator* result =
00070             new EulerArrayInterpolator(*this);
00071         return result;
00072     }
00073 
00074     //--------------------------------------------------------------------------
00075     /**
00076      * 同じ値かどうか
00077      * @param target 比較対象
00078      * @return 同じ値ならtrueをかえす
00079      */
00080     virtual bool equals(const RotationInterpolator& target) const{
00081         EulerArrayInterpolator* interpolator =
00082             target.castEulerArrayInterpolator();
00083         if(interpolator == NULL){ return false; }
00084         if(size_ != interpolator->size_){ return false; }
00085         for(int i = 0; i < size_; i++){
00086             if(array_[i] != interpolator->array_[i]){ return false; }
00087         }
00088         return true;
00089     }
00090 
00091     //--------------------------------------------------------------------------
00092     /**
00093      * 長さの取得
00094      * @return 長さ
00095      */
00096     virtual float getLength() const{ return length_; }
00097 
00098     //--------------------------------------------------------------------------
00099     // オイラー補間
00100     //--------------------------------------------------------------------------
00101     /**
00102      * オイラー補間かどうか
00103      * @return オイラー補間ならtrue
00104      */
00105     virtual bool isEulerInterpolator() const{ return true; }
00106 
00107     /**
00108      * オイラー補間
00109      * @param time 時間
00110      * @return 補間された回転
00111      */
00112     virtual Vector3 eulerInterpolate(float time);
00113 
00114     //--------------------------------------------------------------------------
00115     // 四元数補間
00116     //--------------------------------------------------------------------------
00117     /**
00118      * 四元数補間かどうか
00119      * @return 四元数補間ならtrue
00120      */
00121     virtual bool isQuaternionInterpolator() const{ return true; }
00122 
00123     /**
00124      * 四元数補間
00125      * @param time 時間
00126      * @return 補間された回転
00127      */
00128     virtual Quaternion quaternionInterpolate(float time);
00129 
00130     //--------------------------------------------------------------------------
00131     // 値
00132     //--------------------------------------------------------------------------
00133     /**
00134      * サイズ設定
00135      * @param size 設定するサイズ。サイズ - 1がLengthになる。
00136      */
00137     virtual void setSize(int size);
00138 
00139     /**
00140      * サイズ取得
00141      * @return サイズ
00142      */
00143     virtual int getSize() const{ return size_; }
00144 
00145     //--------------------------------------------------------------------------
00146     /**
00147      * 値の設定
00148      * @param index 設定する値のインデックス
00149      * @param value 設定する値
00150      */
00151     virtual void setValue(int index, const Vector3& value);
00152 
00153     /**
00154      * 値の取得
00155      * @param index 取得する値のインデックス
00156      * @return 値
00157      */
00158     virtual const Vector3& getValue(int index) const{
00159         Assert(array_ != NULL);
00160         Assert(index >= 0);
00161         Assert(index < size_);
00162         return array_[index];
00163     }
00164 
00165     //--------------------------------------------------------------------------
00166     // 変換
00167     //--------------------------------------------------------------------------
00168     /**
00169      * 四元数回転配列補間への変換
00170      * @return 四元数回転配列補間、呼び出し元で破棄する必要がある
00171      */
00172     QuaternionArrayInterpolator* convertQuaternionArrayInterpolator() const;
00173 
00174     //--------------------------------------------------------------------------
00175     // RTTI
00176     //--------------------------------------------------------------------------
00177     /**
00178      * オイラー回転配列補間かどうか
00179      * @return オイラー回転配列補間ならtrue
00180      */
00181     virtual bool isEulerArrayInterpolator() const{ return true; }
00182 
00183     //--------------------------------------------------------------------------
00184 private:
00185     // 配列
00186     Vector3* array_;
00187     // サイズ
00188     int size_;
00189     // 長さ
00190     float length_;
00191 
00192 };
00193 
00194 //------------------------------------------------------------------------------
00195 } // End of namespace Lamp
00196 #endif // End of EULER_ARRAY_INTERPOLATOR_H_
00197 //------------------------------------------------------------------------------
00198 

Generated on Wed Mar 16 10:29:30 2005 for Lamp by doxygen 1.3.2