载入中...
搜索中...
未找到
GizmoManager.h
浏览该文件的文档.
1#pragma once
2
4
5#include <string>
6
7namespace eve::editor {
8
14public:
16
17 TransformGizmo *getGizmo() { return &gizmo_; }
18
19 void setPositionEnabled(bool enabled) { positionEnabled_ = enabled; }
20 void setRotationEnabled(bool enabled) { rotationEnabled_ = enabled; }
21 void setScaleEnabled(bool enabled) { scaleEnabled_ = enabled; }
22 void setBoundEnabled(bool enabled) { boundEnabled_ = enabled; }
23
24 bool getPositionEnabled() const { return positionEnabled_; }
25 bool getRotationEnabled() const { return rotationEnabled_; }
26 bool getScaleEnabled() const { return scaleEnabled_; }
27 bool getBoundEnabled() const { return boundEnabled_; }
28
29 void attach();
30 void detach();
31 bool isAttached() const { return attached_; }
32
34 std::string pick(float ox, float oy, float oz, float dx, float dy, float dz);
35
36 bool beginDrag(const std::string &axis, float ox, float oy, float oz, float dx, float dy,
37 float dz);
38 bool updateDrag(float ox, float oy, float oz, float dx, float dy, float dz);
39 void endDrag();
40
41 bool isDragging() const { return gizmo_.isDragging(); }
42 bool isHovered() const { return gizmo_.isHovered(); }
43
44private:
45 struct Hit {
46 std::string mode;
47 std::string axis;
48 float t = 1e30f;
49 };
50
51 Hit pickMode(const std::string &mode, float ox, float oy, float oz, float dx, float dy,
52 float dz);
53
54 TransformGizmo gizmo_;
55 bool attached_ = false;
56 bool positionEnabled_ = true;
57 bool rotationEnabled_ = false;
58 bool scaleEnabled_ = false;
59 bool boundEnabled_ = false;
60};
61
62} // namespace eve::editor
bool enabled
Babylon.js-style manager: toggles which transform modes are enabled and routes pick/drag to the owned...
void setPositionEnabled(bool enabled)
void setScaleEnabled(bool enabled)
void setBoundEnabled(bool enabled)
bool getPositionEnabled() const
void setRotationEnabled(bool enabled)
TransformGizmo * getGizmo()
std::string pick(float ox, float oy, float oz, float dx, float dy, float dz)
Pick across enabled modes; sets gizmo mode to the winning tool.
bool getRotationEnabled() const
bool beginDrag(const std::string &axis, float ox, float oy, float oz, float dx, float dy, float dz)
bool updateDrag(float ox, float oy, float oz, float dx, float dy, float dz)
3D transform gizmo (Three.js TransformControls + ImGuizmo style). Owns TRS + optional local bounds; i...