10#include <magic_enum.hpp>
23 const std::shared_ptr<DxlibCamera> camera_ptr) :
27 camera_ptr_(camera_ptr)
29 const int close_button_size = 28;
31 const int close_button_y =
gui_top_pos_y_ + close_button_size / 2 + 2;
33 button_.push_back(std::make_unique<SimpleButton>(
"×", close_button_x, close_button_y, close_button_size, close_button_size));
62 DrawCameraParameter();
65void DxlibGuiCameraParameterDisplayer::DrawCameraParameter()
const
67 const unsigned int text_color = GetColor(10, 10, 10);
72 const int text_interval_y = kFontSize + 4;
76 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
"カメラの向き(正規化クォータニオン)");
77 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
" (w:%5.3f,x:%5.3f,y:%5.3f,z:%5.3f)",
78 camera_ptr_->GetNowCameraQuat().w, camera_ptr_->GetNowCameraQuat().v.x, camera_ptr_->GetNowCameraQuat().v.y, camera_ptr_->GetNowCameraQuat().v.z);
81 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
"カメラの向き(オイラー角)");
82 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
" (roll:%5.3f[deg],pitch:%5.3f[deg],yaw:%5.3f[deg])",
86 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
"カメラの表示モード");
87 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
" %s",
88 static_cast<std::string
>(magic_enum::enum_name(camera_ptr_->GetCameraViewMode())).c_str());
90 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
"カメラの注視点の座標");
91 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
" (x:%5.3f [mm],y:%5.3f [mm],z:%5.3f [mm])",
92 camera_ptr_->GetNowTargetPos().x, camera_ptr_->GetNowTargetPos().y, camera_ptr_->GetNowTargetPos().z);
94 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
"カメラと対象との距離");
95 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
" %5.3f [mm]", camera_ptr_->GetNowCameraToTargetLength());
98 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
"カメラの位置");
99 DrawFormatStringToHandle(text_pos_x, text_pos_y_min + text_interval_y * (text_line++), text_color, font_handle,
" (x:%5.3f [mm],y:%5.3f [mm],z:%5.3f [mm])",
100 camera_ptr_->GetNowCameraPos().x, camera_ptr_->GetNowCameraPos().y, camera_ptr_->GetNowCameraPos().z);
103bool DxlibGuiCameraParameterDisplayer::IsInWindow()
const
void DrawBackground(const std::string &str) const
int gui_left_pos_x_
GUIの左端の位置.
static constexpr int kTitleBarHeight
タイトルバーの高さ.
int gui_top_pos_y_
GUIの上端の位置.
void SetVisible(bool visible) override
GUIの表示を行うかどうかを設定する.
virtual void Update()=0
GUIの更新,毎フレーム実行すること.
std::vector< std::unique_ptr< SimpleButton > > button_
ボタンのリスト.
DxlibGuiCameraParameterDisplayer()=delete
< デフォルトコンストラクタは生成できない.
void Draw() const override
GUIの描画.
void Update() override
GUIの更新,毎フレーム実行すること.
int GetFontHandle(const std::string &file_path)
Dxlibでは特定のフォントで描画する際に,フォントのハンドルを指定する. この関数では,フォントのファイルパスを指定すると, フォントのハンドル番号を返す. フォントがまだ読み込まれていない場...
static FontLoader * GetIns()
インスタンスを取得する. このクラスを継承したクラスは クラス名::getIns()-> の形式でメンバ関数を呼び出す.
constexpr T ConvertRadToDeg(const T rad) noexcept
角度を [rad]から [deg] に変換する関数.
EulerXYZ ToEulerXYZ(const RotationMatrix3x3 &rot)
回転角行列からXYZオイラー角への変換.
float x_angle
X 軸周りの回転 [rad]
float y_angle
Y 軸周りの回転 [rad]
float z_angle
Z 軸周りの回転 [rad]