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 VECTOR_INTERPOLATOR_H_ 00026 #define VECTOR_INTERPOLATOR_H_ 00027 00028 namespace Lamp{ 00029 00030 class VectorConstantInterpolator; 00031 class VectorArrayInterpolator; 00032 class VectorLinearInterpolator; 00033 00034 //------------------------------------------------------------------------------ 00035 /** 00036 * ベクトル補間 00037 * 00038 * サブクラスでコピーコンストラクタと代入演算子を実装する 00039 */ 00040 class VectorInterpolator{ 00041 public: 00042 //-------------------------------------------------------------------------- 00043 /** 00044 * デストラクタ 00045 */ 00046 virtual ~VectorInterpolator(){} 00047 00048 //-------------------------------------------------------------------------- 00049 /** 00050 * 複製 00051 * @return 複製されたベクトル補間。呼び出し元でdeleteする必要がある 00052 */ 00053 virtual VectorInterpolator* duplicate() const = 0; 00054 00055 /** 00056 * 同じ値かどうか 00057 * @param target 比較対象 00058 * @return 同じ値ならtrueをかえす 00059 */ 00060 virtual bool equals(const VectorInterpolator& target) const = 0; 00061 00062 //-------------------------------------------------------------------------- 00063 // 長さ 00064 //-------------------------------------------------------------------------- 00065 /** 00066 * 長さの取得 00067 * @return 長さ 00068 */ 00069 virtual float getLength() const = 0; 00070 00071 //-------------------------------------------------------------------------- 00072 // バウンディング 00073 //-------------------------------------------------------------------------- 00074 /** 00075 * バウンディングボックスの取得 00076 * @return バウンディングボックス 00077 */ 00078 virtual AxisAlignedBox getBoundingBox() const = 0; 00079 00080 //-------------------------------------------------------------------------- 00081 // 補間 00082 //-------------------------------------------------------------------------- 00083 /** 00084 * 補間 00085 * @param time 時間 00086 * @return 補間されたベクトル 00087 */ 00088 virtual Vector3 interpolate(float time) = 0; 00089 00090 //-------------------------------------------------------------------------- 00091 // RTTI 00092 //-------------------------------------------------------------------------- 00093 /** 00094 * ベクトル定数補間かどうか 00095 * @return ベクトル定数補間ならtrue 00096 */ 00097 virtual bool isVectorConstantInterpolator() const{ return false; } 00098 00099 /** 00100 * ベクトル定数補間へのキャスト 00101 * @return ベクトル定数補間。型が違えばNULLを返す。 00102 */ 00103 virtual VectorConstantInterpolator* castVectorConstantInterpolator() const{ 00104 if(isVectorConstantInterpolator()){ 00105 return (VectorConstantInterpolator*)this; 00106 } 00107 return NULL; 00108 } 00109 00110 //-------------------------------------------------------------------------- 00111 /** 00112 * ベクトル配列補間かどうか 00113 * @return ベクトル配列補間ならtrue 00114 */ 00115 virtual bool isVectorArrayInterpolator() const{ return false; } 00116 00117 /** 00118 * ベクトル配列補間へのキャスト 00119 * @return ベクトル配列補間。型が違えばNULLを返す。 00120 */ 00121 virtual VectorArrayInterpolator* castVectorArrayInterpolator() const{ 00122 if(isVectorArrayInterpolator()){ 00123 return (VectorArrayInterpolator*)this; 00124 } 00125 return NULL; 00126 } 00127 00128 //-------------------------------------------------------------------------- 00129 /** 00130 * ベクトル線形補間かどうか 00131 * @return ベクトル線形補間ならtrue 00132 */ 00133 virtual bool isVectorLinearInterpolator() const{ return false; } 00134 00135 /** 00136 * ベクトル線形補間へのキャスト 00137 * @return ベクトル線形補間。型が違えばNULLを返す。 00138 */ 00139 virtual VectorLinearInterpolator* castVectorLinearInterpolator() const{ 00140 if(isVectorLinearInterpolator()){ 00141 return (VectorLinearInterpolator*)this; 00142 } 00143 return NULL; 00144 } 00145 00146 //-------------------------------------------------------------------------- 00147 00148 }; 00149 00150 //------------------------------------------------------------------------------ 00151 } // End of namespace Lamp 00152 #endif // End of VECTOR_INTERPOLATOR_H_ 00153 //------------------------------------------------------------------------------ 00154