CameraWidget.ixx File
ImGui widget for controlling and configuring camera parameters. More...
Included Headers
#include <memory>
#include <string>
#include <vector>
#include "imgui.h"
#include <helios.math.utils>
#include <helios.core.spatial.Transform>
#include <helios.math.types>
#include <helios.scene.CameraSceneNode>
#include <helios.scene.Camera>
#include <helios.ext.imgui.ImGuiWidget>
Namespaces Index
| namespace | helios |
| namespace | ext |
|
Platform-specific extensions and backend implementations. More... | |
| namespace | imgui |
| namespace | widgets |
|
Debug and developer widgets for ImGui overlays. More... | |
Classes Index
| class | CameraWidget |
|
Debug widget for real-time camera parameter control and visualization. More... | |
| struct | CameraEntry |
Description
ImGui widget for controlling and configuring camera parameters.
File Listing
The file content with the documentation metadata removed is:
21export namespace helios::ext::imgui::widgets {
27 class CameraWidget : public ImGuiWidget {
32 helios::scene::CameraSceneNode* node = nullptr;
34 helios::math::vec3f initialTranslation{0.0f, 0.0f, 5.0f};
35 helios::math::vec3f initialScale{1.0f, 1.0f, 1.0f};
36 helios::math::mat4f initialRotation = helios::math::mat4f::identity();
43 helios::math::vec3f initialLookAtTarget{0.0f, 0.0f, 0.0f};
44 helios::math::vec3f initialUp{0.0f, 1.0f, 0.0f};
53 helios::math::vec3f tempTranslation_{0.0f, 0.0f, 5.0f};
54 helios::math::vec3f tempLookAtTarget_{0.0f, 0.0f, 0.0f};
55 helios::math::vec3f tempUp_{0.0f, 1.0f, 0.0f};
70 [[nodiscard]] helios::scene::CameraSceneNode* getCurrentCameraNode() noexcept {
80 [[nodiscard]] helios::scene::Camera* getActiveCamera() noexcept {
91 void applyTransformToNode(helios::scene::CameraSceneNode* node,
107 node->setTranslation(tempTranslation_);
115 node->lookAtLocal(tempLookAtTarget_, tempUp_);
117 node->lookAt(tempLookAtTarget_, tempUp_);
127 const auto& transform = node->localTransform();
128 tempTranslation_ = transform.translation();
130 const auto& cam = node->camera();
131 tempFovDegrees_ = helios::math::degrees(cam.fovY());
142 const auto& transform = entry.node->localTransform();
147 const auto& cam = entry.node->camera();
148 entry.initialFovDegrees = helios::math::degrees(cam.fovY());
169 node->setTranslation(entry.initialTranslation);
170 node->setRotation(entry.initialRotation);
171 node->setScale(entry.initialScale);
173 auto& cam = node->camera();
174 cam.setPerspective(helios::math::radians(entry.initialFovDegrees),
182 node->lookAtLocal(tempLookAtTarget_, tempUp_);
184 node->lookAt(tempLookAtTarget_, tempUp_);
191 CameraWidget() = default;
193 void addCameraSceneNode(const std::string& name, helios::scene::CameraSceneNode* node) {
208 void clearCameras() noexcept {
265 translationChanged |= ImGui::DragFloat("X##Pos", &tempTranslation_[0], 0.1f, -100.0f, 100.0f, "%.2f");
266 translationChanged |= ImGui::DragFloat("Y##Pos", &tempTranslation_[1], 0.1f, -100.0f, 100.0f, "%.2f");
267 translationChanged |= ImGui::DragFloat("Z##Pos", &tempTranslation_[2], 0.1f, -100.0f, 100.0f, "%.2f");
304 lookAtChanged |= ImGui::DragFloat("X##Target", &tempLookAtTarget_[0], 0.1f, -100.0f, 100.0f, "%.2f");
305 lookAtChanged |= ImGui::DragFloat("Y##Target", &tempLookAtTarget_[1], 0.1f, -100.0f, 100.0f, "%.2f");
306 lookAtChanged |= ImGui::DragFloat("Z##Target", &tempLookAtTarget_[2], 0.1f, -100.0f, 100.0f, "%.2f");
340 projectionChanged |= ImGui::DragFloat("Near Plane", &tempZNear_, 0.01f, 0.001f, tempZFar_ - 0.01f, "%.3f");
341 projectionChanged |= ImGui::DragFloat("Far Plane", &tempZFar_, 1.0f, tempZNear_ + 0.01f, 100000.0f, "%.1f");
344 camera.setPerspective(helios::math::radians(tempFovDegrees_), tempAspectRatio_, tempZNear_, tempZFar_);
414 helios::math::vec3f diff = tempTranslation_ - tempLookAtTarget_;
415 float distance = diff.length();
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.