Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f82c475
commit 1f4e84a
Showing
140 changed files
with
66,650 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
//------------------------------------------------------------------------------------------- | ||
// File : asdxAxisRenderer.h | ||
// Desc : Axis Renderer Module. | ||
// Copyright(c) Project Asura. All right reserved. | ||
//-------------------------------------------------------------------------------------------- | ||
|
||
#ifndef __ASDX_AXIS_RENDERER_H__ | ||
#define __ASDX_AXIS_RENDERER_H__ | ||
|
||
//-------------------------------------------------------------------------------------------- | ||
// Includes | ||
//-------------------------------------------------------------------------------------------- | ||
#include <asdxMath.h> | ||
#include <d3d11.h> | ||
|
||
|
||
namespace asdx { | ||
|
||
////////////////////////////////////////////////////////////////////////////////////////////// | ||
// AxisRenderer class | ||
////////////////////////////////////////////////////////////////////////////////////////////// | ||
class AxisRenderer | ||
{ | ||
//======================================================================================== | ||
// list of friend classes and methods. | ||
//======================================================================================== | ||
/* NOTHING */ | ||
|
||
public: | ||
//======================================================================================== | ||
// public variables. | ||
//======================================================================================== | ||
/* NOTHING */ | ||
|
||
//======================================================================================== | ||
// public methods. | ||
//======================================================================================== | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief コンストラクタです. | ||
//---------------------------------------------------------------------------------------- | ||
AxisRenderer(); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief デストラクタです. | ||
//---------------------------------------------------------------------------------------- | ||
virtual ~AxisRenderer(); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief 初期化処理を行います. | ||
//---------------------------------------------------------------------------------------- | ||
bool Init( ID3D11Device* pDevice ); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief 終了処理を行います. | ||
//---------------------------------------------------------------------------------------- | ||
void Term(); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief 描画開始処理です. | ||
//---------------------------------------------------------------------------------------- | ||
void Begin( | ||
ID3D11DeviceContext* pDeviceContext, | ||
const asdx::Matrix& view, | ||
const asdx::Matrix& proj ); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief 軸を描画します. | ||
//---------------------------------------------------------------------------------------- | ||
void Render( | ||
ID3D11DeviceContext* pDeviceContext, | ||
const asdx::Vector3 position, | ||
const f32 scale = 1.0f ); | ||
|
||
//---------------------------------------------------------------------------------------- | ||
//! @brief 描画終了処理です. | ||
//---------------------------------------------------------------------------------------- | ||
void End( ID3D11DeviceContext* pDeviceContext ); | ||
|
||
protected: | ||
//======================================================================================== | ||
// protected variables. | ||
//======================================================================================== | ||
ID3D11Buffer* m_pVB; //!< 頂点バッファです. | ||
ID3D11Buffer* m_pCB0; //!< 定数バッファ(スロット0)です. | ||
ID3D11Buffer* m_pCB1; //!< 定数バッファ(スロット1)です. | ||
ID3D11VertexShader* m_pVS; //!< 頂点シェーダです. | ||
ID3D11PixelShader* m_pPS; //!< ピクセルシェーダです. | ||
ID3D11InputLayout* m_pIL; //!< 入力レイアウトです. | ||
ID3D11DepthStencilState* m_pDSS; //!< 深度ステンシルステートです. | ||
|
||
//======================================================================================== | ||
// protected methods. | ||
//======================================================================================== | ||
/* NOTHING */ | ||
|
||
private: | ||
//======================================================================================== | ||
// private variables. | ||
//======================================================================================== | ||
/* NOTHING */ | ||
|
||
//======================================================================================== | ||
// private methods. | ||
//======================================================================================== | ||
AxisRenderer ( const AxisRenderer& renderer ); // アクセス禁止. | ||
void operator = ( const AxisRenderer& renderer ); // アクセス禁止. | ||
}; | ||
|
||
} // namespace asdx | ||
|
||
#endif//__ASDX_CAMERA_RENDERER_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,255 @@ | ||
//------------------------------------------------------------------------------------------- | ||
// File : asdxCamera.h | ||
// Desc : Camera Module. | ||
// Copyright(c) Project Asura. All right reserved. | ||
//------------------------------------------------------------------------------------------- | ||
|
||
#ifndef __ASDX_CAMERA_H__ | ||
#define __ASDX_CAMERA_H__ | ||
|
||
//------------------------------------------------------------------------------------------- | ||
// Includes | ||
//------------------------------------------------------------------------------------------- | ||
#include <asdxMath.h> | ||
|
||
|
||
namespace asdx { | ||
|
||
///////////////////////////////////////////////////////////////////////////////////////////// | ||
// CameraEvent struct | ||
///////////////////////////////////////////////////////////////////////////////////////////// | ||
struct CameraEvent | ||
{ | ||
///////////////////////////////////////////////////////////////////////////////////////// | ||
// EVENT_TYPE enum | ||
///////////////////////////////////////////////////////////////////////////////////////// | ||
enum EVENT_TYPE | ||
{ | ||
EVENT_ROTATE = 0x000001 << 0, //!< ターゲットを中心に回転. | ||
EVENT_DOLLY = 0x000001 << 1, //!< ドリー. | ||
EVENT_TRUCK = 0x000001 << 2, //!< 平行移動. | ||
EVENT_TWIST = 0x000001 << 3, //!< ツイスト. | ||
EVENT_PANTILT = 0x000001 << 4, //!< パン・チルト. | ||
EVENT_RESET = 0x000001 << 5, //!< リセット. | ||
}; | ||
|
||
asdx::Vector2 Rotate; //!< 回転角です. | ||
asdx::Vector2 PanTilt; //!< パン・チルト角. | ||
asdx::Vector3 Truck; //!< トラック量です. | ||
f32 Twist; //!< ツイスト角です. | ||
f32 Dolly; //!< ドリー量です. | ||
u32 Flags; //!< フラグです. | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief コンストラクタです. | ||
//--------------------------------------------------------------------------------------- | ||
CameraEvent() | ||
: Rotate ( 0.0f, 0.0f ) | ||
, PanTilt ( 0.0f, 0.0f ) | ||
, Truck ( 0.0f, 0.0f, 0.0f ) | ||
, Twist ( 0.0f ) | ||
, Dolly ( 0.0f ) | ||
, Flags ( 0 ) | ||
{ /* DO_NOTHING */ } | ||
}; | ||
|
||
|
||
///////////////////////////////////////////////////////////////////////////////////////////// | ||
// Camera class | ||
///////////////////////////////////////////////////////////////////////////////////////////// | ||
class Camera | ||
{ | ||
//======================================================================================= | ||
// list of friend classes and methods. | ||
//======================================================================================= | ||
/* NOTHING */ | ||
|
||
public: | ||
//======================================================================================= | ||
// public variables | ||
//======================================================================================= | ||
struct Param | ||
{ | ||
asdx::Vector3 Position; //!< カメラの位置です. | ||
asdx::Vector3 Target; //!< カメラの注視点です. | ||
asdx::Vector3 Upward; //!< カメラの上向きベクトルです. | ||
asdx::Vector2 Rotate; //!< 回転角です. | ||
asdx::Vector2 PanTilt; //!< パン・チルト角です. | ||
f32 Twist; //!< ツイスト角です. | ||
f32 MinDist; //!< ターゲットとの最小距離です. | ||
f32 MaxDist; //!< ターゲットとの最大距離です. | ||
|
||
//----------------------------------------------------------------------------------- | ||
//! @brief コンストラクタです. | ||
//----------------------------------------------------------------------------------- | ||
Param() | ||
: Position ( 0.0f, 0.0f, 5.0f ) | ||
, Target ( 0.0f, 0.0f, 0.0f ) | ||
, Upward ( 0.0f, 1.0f, 0.0f ) | ||
, Rotate ( 0.0f, 0.0f ) | ||
, PanTilt ( 0.0f, 0.0f ) | ||
, Twist ( 0.0f ) | ||
, MinDist ( 0.01f ) | ||
, MaxDist ( 1000.0f ) | ||
{ /* DO_NOTHING */ } | ||
}; | ||
|
||
//======================================================================================= | ||
// public methods. | ||
//======================================================================================= | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief コンストラクタです. | ||
//--------------------------------------------------------------------------------------- | ||
Camera(); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief デストラクタです. | ||
//--------------------------------------------------------------------------------------- | ||
~Camera(); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラ位置を設定します. | ||
//! | ||
//! @param [in] position 設定するカメラ位置です. | ||
//--------------------------------------------------------------------------------------- | ||
void SetPosition( const asdx::Vector3& position ); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラ注視点を設定します. | ||
//! | ||
//! @param [in] target 設定するカメラ注視点です. | ||
//--------------------------------------------------------------------------------------- | ||
void SetTarget( const asdx::Vector3& target ); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラ上向きベクトルを設定します. | ||
//! | ||
//! @param [in] upward 設定するカメラ上向きベクトルです. | ||
//--------------------------------------------------------------------------------------- | ||
void SetUpward( const asdx::Vector3& upward ); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief ツイスト角を設定します. | ||
//! | ||
//! @param [in] twist 設定するツイスト角です. | ||
//--------------------------------------------------------------------------------------- | ||
void SetTwist( const f32 twist ); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief 可動距離範囲を設定します. | ||
//! | ||
//! @param [in] minDist 設定するカメラ注視点との最小距離. | ||
//! @param [in] maxDist 設定するカメラ注視点との最大距離. | ||
//--------------------------------------------------------------------------------------- | ||
void SetRange( const f32 minDist, const f32 maxDist ); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラパラメータを記憶します. | ||
//--------------------------------------------------------------------------------------- | ||
void Preset(); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラパラメータをリセットします. | ||
//--------------------------------------------------------------------------------------- | ||
void Reset(); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief ビュー行列を更新します. | ||
//--------------------------------------------------------------------------------------- | ||
void Update(); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメライベントを基にビュー行列を更新します. | ||
//--------------------------------------------------------------------------------------- | ||
void UpdateByEvent( const CameraEvent& camEvent ); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief ビュー行列を取得します. | ||
//! | ||
//! @return ビュー行列を返却します. | ||
//--------------------------------------------------------------------------------------- | ||
asdx::Matrix GetView() const; | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラ位置を取得します. | ||
//! | ||
//! @return カメラ位置を返却します. | ||
//--------------------------------------------------------------------------------------- | ||
asdx::Vector3 GetPosition() const; | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラ注視点を取得します. | ||
//! | ||
//! @return カメラ注視点を返却します. | ||
//--------------------------------------------------------------------------------------- | ||
asdx::Vector3 GetTarget() const; | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief カメラ上向きベクトルを取得します. | ||
//! | ||
//! @return カメラ上向きベクトルを返却します. | ||
//--------------------------------------------------------------------------------------- | ||
asdx::Vector3 GetUpward() const; | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief ツイスト角を取得します. | ||
//! | ||
//! @return ツイスト角を返却します. | ||
//--------------------------------------------------------------------------------------- | ||
f32 GetTwist() const; | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief 可動最小距離(カメラ注視点との最小距離)を取得します. | ||
//! | ||
//! @return 可動最小距離を返却します. | ||
//--------------------------------------------------------------------------------------- | ||
f32 GetMinDist() const; | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief 可動最大距離(カメラ注視点との最大距離)を取得します. | ||
//! | ||
//! @return 可動最大距離を返却します. | ||
//--------------------------------------------------------------------------------------- | ||
f32 GetMaxDist() const; | ||
|
||
|
||
protected: | ||
//======================================================================================= | ||
// protected variables. | ||
//======================================================================================= | ||
/* NOTHING */ | ||
|
||
//======================================================================================= | ||
// protected methods. | ||
//======================================================================================= | ||
/* NOTHING */ | ||
|
||
|
||
private: | ||
//======================================================================================= | ||
// private variables | ||
//======================================================================================= | ||
Param m_Param; //!< 計算用カメラパラメータです. | ||
Param m_Preset; //!< リセット用カメラパラメータです. | ||
asdx::Matrix m_View; //!< ビュー行列です. | ||
|
||
//======================================================================================= | ||
// praviate methods. | ||
//======================================================================================= | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief 角度を計算します. | ||
//--------------------------------------------------------------------------------------- | ||
void ComputeAngle(); | ||
|
||
//--------------------------------------------------------------------------------------- | ||
//! @brief 可動距離範囲内に制限します. | ||
//--------------------------------------------------------------------------------------- | ||
void ClampDist(); | ||
}; | ||
|
||
|
||
} // namespace asdx | ||
|
||
#endif//__ASDX_CAMERA_H__ |
Oops, something went wrong.