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

FirstPersonCameraController.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 FIRST_PERSON_CAMERA_CONTROLLER_H_
00026 #define FIRST_PERSON_CAMERA_CONTROLLER_H_
00027 
00028 namespace Lamp{
00029 
00030 class Camera;
00031 
00032 //------------------------------------------------------------------------------
00033 /**
00034  * 一人称カメラコントローラ
00035  */
00036 class FirstPersonCameraController{
00037 public:
00038     /**
00039      * コンストラクタ
00040      */
00041     FirstPersonCameraController();
00042 
00043     /**
00044      * デストラクタ
00045      */
00046     virtual ~FirstPersonCameraController();
00047 
00048     /**
00049      * カメラの設定
00050      * @param camera カメラ
00051      */
00052     virtual void setCamera(Camera* camera){ camera_ = camera; }
00053 
00054     /**
00055      * セットアップ
00056      * @param nearClip ニアクリップ
00057      * @param farClip ファークリップ
00058      * @param aspect アスペクト比
00059      */
00060     virtual void setup(float nearClip, float farClip, float aspect);
00061 
00062     /**
00063      * ウィンドウプロシージャ
00064      * @param windowHandle ウィンドウハンドル
00065      * @param message メッセージ
00066      * @param wParam wメッセージパラメータ
00067      * @param lParam lメッセージパラメータ
00068      */
00069     virtual LRESULT windowProcedure(
00070         HWND windowHandle, u_int message, WPARAM wParam, LPARAM lParam);
00071 
00072     //--------------------------------------------------------------------------
00073     /**
00074      * カメラ位置の設定
00075      * @param position カメラ位置
00076      */
00077     virtual void setCameraPosition(const Vector3& position){
00078         cameraPosition_ = position;
00079     }
00080 
00081     /**
00082      * カメラ位置の取得
00083      * @return カメラ位置
00084      */
00085     virtual const Vector3& getCameraPosition() const{ return cameraPosition_; }
00086 
00087     //--------------------------------------------------------------------------
00088     /**
00089      * カメラ回転値の設定
00090      * @param rotation カメラ回転値
00091      */
00092     virtual void setCameraRotation(const Vector3& rotation){
00093         cameraRotation_ = rotation;
00094     }
00095 
00096     /**
00097      * カメラ回転値の取得
00098      * @return カメラ回転値
00099      */
00100     virtual const Vector3& getCameraRotation() const{ return cameraRotation_; }
00101 
00102     //--------------------------------------------------------------------------
00103     /**
00104      * 操作方法文字列の取得
00105      * @return 操作方法文字列
00106      */
00107     virtual String getOperationString() const{
00108         return String(
00109             "左ドラッグ カメラの向き変更\n"
00110             "右ドラッグ 上下左右にカメラを移動\n"
00111             "Shift+右ドラッグ 前後左右にカメラを移動\n"
00112             "[ e ] カメラ前移動\n[ d ] カメラ後移動\n"
00113             "[ f ] カメラ右移動\n[ s ] カメラ左移動\n"
00114             "[ r ] カメラ上移動\n[ v ] カメラ下移動\n"
00115             "マウスホイールでズームイン、ズームアウト\n"
00116             "Shiftを押しながらキー入力すると1/10の速度でカメラが移動します\n"
00117         );
00118     }
00119 
00120     /**
00121      * インフォメーション文字列の取得
00122      * @return インフォメーション文字列
00123      */
00124     const String& getInformationString() const{ return informationString_; }
00125 
00126 private:
00127     // コピーコンストラクタの隠蔽
00128     FirstPersonCameraController(const FirstPersonCameraController& copy);
00129 
00130     // 代入コピーの隠蔽
00131     void operator =(const FirstPersonCameraController& copy);
00132 
00133     // カメラ
00134     Camera* camera_;
00135     // カメラ移動値
00136     Vector3 cameraPosition_;
00137     // カメラ回転値
00138     Vector3 cameraRotation_;
00139     // 画角
00140     float fovY_;
00141     // インフォメーション文字列
00142     String informationString_;
00143 
00144     // 移動に関するマウス感度
00145     float cameraPositionSensibility_;
00146     // 回転に関するマウス感度
00147     float cameraRotationSensibility_;
00148     // キーボード感度
00149     float keyboardSensibility_;
00150     // マウスX位置
00151     int mouseXPosition_;
00152     // マウスY位置
00153     int mouseYPosition_;
00154 
00155 };
00156 
00157 //------------------------------------------------------------------------------
00158 } // End of namespace Lamp
00159 #endif // End of FIRST_PERSON_CAMERA_CONTROLLER_H_
00160 //------------------------------------------------------------------------------

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