50 void setSnap(
bool enabled) { _snap = enabled; }
51 bool snap()
const {
return _snap; }
57 bool handleEvent(
const SDL_Event& event,
int windowWidth,
int windowHeight);
67 Color baseColor =
Color(1.0f, 1.0f, 1.0f, 1.0f);
71 Entity* createHandleEntity(
const char* primitiveType,
const Color& color);
72 void updateHandleTransforms();
73 void updateHandleColors();
75 Axis pickAxis(
float mouseX,
float mouseY)
const;
76 bool worldToScreen(
const Vector3& world,
float& outX,
float& outY)
const;
77 Vector3 axisDirection(
Axis axis)
const;
78 Vector3 cameraRight()
const;
79 Vector3 cameraUp()
const;
80 Vector3 cameraForward()
const;
82 void beginDrag(
Axis axis,
float mouseX,
float mouseY);
83 void applyDrag(
float mouseX,
float mouseY);
86 float unitsPerPixelAtTarget()
const;
88 Engine* _engine =
nullptr;
89 CameraComponent* _camera =
nullptr;
90 Entity* _target =
nullptr;
92 Entity* _root =
nullptr;
101 std::vector<std::shared_ptr<StandardMaterial>> _materials;
106 bool _dragging =
false;
108 float _windowWidth = 1.0f;
109 float _windowHeight = 1.0f;
111 float _dragStartMouseX = 0.0f;
112 float _dragStartMouseY = 0.0f;
114 Vector3 _targetStartPosition = Vector3(0.0f, 0.0f, 0.0f);
115 Quaternion _targetStartRotation;
116 Vector3 _targetStartScale = Vector3(1.0f, 1.0f, 1.0f);
118 float _gizmoSize = 1.8f;
121 float _translateSnapIncrement = 0.5f;
122 float _rotateSnapIncrement = 15.0f;
123 float _scaleSnapIncrement = 0.1f;