载入中...
搜索中...
未找到
GizmoManager.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
6
7#include <string>
8
9namespace eve::editor {
10
16public:
19
21 TransformGizmo *getGizmo() { return &gizmo_; }
22
24 void setPositionEnabled(bool enabled) { positionEnabled_ = enabled; }
26 void setRotationEnabled(bool enabled) { rotationEnabled_ = enabled; }
28 void setScaleEnabled(bool enabled) { scaleEnabled_ = enabled; }
30 void setBoundEnabled(bool enabled) { boundEnabled_ = enabled; }
31
33 bool getPositionEnabled() const { return positionEnabled_; }
35 bool getRotationEnabled() const { return rotationEnabled_; }
37 bool getScaleEnabled() const { return scaleEnabled_; }
39 bool getBoundEnabled() const { return boundEnabled_; }
40
42 void attach();
44 void detach();
46 bool isAttached() const { return attached_; }
47
49 std::string pick(float ox, float oy, float oz, float dx, float dy, float dz);
50
52 bool beginDrag(const std::string &axis, float ox, float oy, float oz, float dx, float dy,
53 float dz);
55 bool updateDrag(float ox, float oy, float oz, float dx, float dy, float dz);
57 void endDrag();
58
60 bool isDragging() const { return gizmo_.isDragging(); }
62 bool isHovered() const { return gizmo_.isHovered(); }
63
64private:
65 struct Hit {
66 std::string mode;
67 std::string axis;
68 float t = 1e30f;
69 };
70
71 Hit pickMode(const std::string &mode, float ox, float oy, float oz, float dx, float dy,
72 float dz);
73
74 TransformGizmo gizmo_;
75 bool attached_ = false;
76 bool positionEnabled_ = true;
77 bool rotationEnabled_ = false;
78 bool scaleEnabled_ = false;
79 bool boundEnabled_ = false;
80};
81
82} // namespace eve::editor
#define EVENGINE_API_ORCHESTRATION
Definition Export.h:111
float t
float dz
float dy
float dx
double oy
double ox
Babylon.js-style manager: toggles which transform modes are enabled and routes pick/drag to the owned...
bool getScaleEnabled() const
Returns the scale enabled.
bool isDragging() const
True when dragging.
void setPositionEnabled(bool enabled)
Sets the position enabled.
void setScaleEnabled(bool enabled)
Sets the scale enabled.
void setBoundEnabled(bool enabled)
Sets the bound enabled.
bool getPositionEnabled() const
Returns the position enabled.
bool isHovered() const
True when hovered.
bool isAttached() const
True when attached.
void setRotationEnabled(bool enabled)
Sets the rotation enabled.
TransformGizmo * getGizmo()
Returns the gizmo.
bool getBoundEnabled() const
Returns the bound enabled.
bool getRotationEnabled() const
Returns the rotation enabled.
3D transform gizmo (Three.js TransformControls + ImGuizmo style). Owns TRS + optional local bounds; i...
bool enabled