Physics Simulation & Visualization Tool 0.1
A C++ physics simulation engine with real-time 3D visualization
Loading...
Searching...
No Matches
TranslateHandle.h
Go to the documentation of this file.
1#pragma once
2#include <glm/glm.hpp>
3#include "IHandle.h"
4
5class SceneObject;
6
7class TranslateHandle : public IHandle{
8public:
10
11 void onDrag(const Math::Ray& ray) override;
12 void setDragState(glm::vec3 initHitPos) override;
13 glm::vec3 getAxisDir() const override { return axisDir(axis); }
14 glm::mat4 getModelMatrix() const override;
15private:
16 SceneObject* target;
17 Axis axis;
18
19 constexpr static float length = 1.0f;
20 constexpr static float thickness = 0.5f;
21
22 glm::vec3 initialHitPoint;
23 glm::vec3 originalPosition;
24};
Axis
Cardinal axes for handle orientation.
Definition Axis.h:7
Interface for interactive manipulation handles on gizmos.
constexpr glm::vec3 axisDir(Axis a)
Converts an axis enum to its corresponding unit vector.
Definition IHandle.h:17
Abstract interface for gizmo manipulation handles.
Definition IHandle.h:47
glm::vec3 getAxisDir() const override
Gets the axis direction this handle operates along/around.
void setDragState(glm::vec3 initHitPos) override
Initializes the drag operation state.
void onDrag(const Math::Ray &ray) override
Handles continuous dragging motion.
glm::mat4 getModelMatrix() const override
Gets the model transformation matrix for rendering this handle.
Represents a ray in 3D space.
Definition Ray.h:11