implement smooth camera
This commit is contained in:
@ -11,19 +11,25 @@ class OrbitCamera3D {
|
||||
|
||||
private:
|
||||
Camera camera;
|
||||
|
||||
Vector3 position;
|
||||
Vector3 target;
|
||||
Vector3 target_target;
|
||||
float distance;
|
||||
float angle_x;
|
||||
float angle_y;
|
||||
|
||||
// Input
|
||||
Vector2 last_mouse;
|
||||
bool dragging;
|
||||
bool rotating;
|
||||
bool panning;
|
||||
bool target_lock;
|
||||
|
||||
public:
|
||||
OrbitCamera3D()
|
||||
: camera({0}), target(Vector3Zero()), distance(CAMERA_DISTANCE),
|
||||
angle_x(0.0), angle_y(0.0), last_mouse(Vector2Zero()), dragging(false),
|
||||
: camera({0}), position(Vector3Zero()), target(Vector3Zero()),
|
||||
target_target(Vector3Zero()), distance(CAMERA_DISTANCE), angle_x(0.0),
|
||||
angle_y(0.0), last_mouse(Vector2Zero()), rotating(false),
|
||||
panning(false), target_lock(true) {
|
||||
camera.position = Vector3(0, 0, -1.0 * distance);
|
||||
camera.target = target;
|
||||
@ -35,6 +41,8 @@ public:
|
||||
~OrbitCamera3D() {}
|
||||
|
||||
public:
|
||||
auto HandleCameraInput() -> Vector2;
|
||||
|
||||
auto Update(const Vector3 ¤t_target) -> void;
|
||||
};
|
||||
|
||||
|
||||
@ -28,6 +28,7 @@ constexpr float ZOOM_MULTIPLIER = 4.0;
|
||||
constexpr float PAN_SPEED = 2.0;
|
||||
constexpr float PAN_MULTIPLIER = 10.0;
|
||||
constexpr float ROT_SPEED = 1.0;
|
||||
constexpr float CAMERA_SMOOTH_SPEED = 15.0;
|
||||
|
||||
// Physics Engine
|
||||
constexpr float SIM_SPEED = 4.0; // How large each update should be
|
||||
@ -38,7 +39,7 @@ constexpr float DAMPENING_CONSTANT = 1.0; // Mass spring system
|
||||
constexpr float REST_LENGTH = 2.0; // Mass spring system
|
||||
constexpr float VERLET_DAMPENING = 0.05; // [0, 1]
|
||||
constexpr float BH_FORCE = 2.0; // BH: [1.0, 3.0]
|
||||
constexpr float THETA = 1.0; // Barnes-Hut [0.5, ~]
|
||||
constexpr float THETA = 1.0; // Barnes-Hut [0.5, 1.0]
|
||||
constexpr float SOFTENING = 0.01; // Barnes-Hut [0.01, 1.0]
|
||||
constexpr float GRID_FORCE = 0.02; // Grid: [0.0, ~0.05]
|
||||
constexpr float REPULSION_RANGE = 5.0 * REST_LENGTH; // Grid
|
||||
|
||||
Reference in New Issue
Block a user