33#include "../3d_math.h"
36#include <glm/gtc/quaternion.hpp>
44 wxLogTrace(
m_logTrace, wxT(
"TRACK_BALL::TRACK_BALL" ) );
50 CAMERA( aInitPos, aLookat, aProjectionType )
52 wxLogTrace(
m_logTrace, wxT(
"TRACK_BALL::TRACK_BALL" ) );
75 const float zoom = 1.0f;
82 float spin_matrix[4][4];
145 std::copy_n( glm::value_ptr( glm::conjugate( glm::quat_cast(
m_rotationMatrix ) ) ),
146 sizeof( quat ) /
sizeof( quat[0] ), quat );
148 memcpy(
m_quat_t0, quat,
sizeof( quat ) );
149 memcpy(
m_quat_t1, quat,
sizeof( quat ) );
154 wxASSERT( t >= 0.0f );
157 t = ( t > 1.0f ) ? 1.0f : t;
161 case CAMERA_INTERPOLATION::BEZIER:
165 case CAMERA_INTERPOLATION::EASING_IN_OUT:
169 case CAMERA_INTERPOLATION::LINEAR:
174 const float t0 = 1.0f - t;
181 float rotationMatrix[4][4];
float BezierBlend(float t)
float QuadricEasingInOut(float t)
A class used to derive camera objects from.
bool m_parametersChanged
Set to true if any of the parameters in the camera was changed.
CAMERA_INTERPOLATION m_interpolation_mode
wxPoint m_lastPosition
The last mouse position in the screen.
virtual void Interpolate(float t)
It will update the matrix to interpolate between T0 and T1 values.
virtual void SetT0_and_T1_current_T()
This will set T0 and T1 with the current values.
PROJECTION_TYPE m_projectionType
SFVEC2I m_windowSize
The window size that this camera is working.
glm::mat4 m_rotationMatrix
void Pan_T1(const SFVEC3F &aDeltaOffsetInc) override
void SetT0_and_T1_current_T() override
This will set T0 and T1 with the current values.
void Interpolate(float t) override
It will update the matrix to interpolate between T0 and T1 values.
TRACK_BALL(float aInitialDistance)
void Pan(const wxPoint &aNewMousePosition) override
double m_quat_t0[4]
interpolate quaternions of the trackball
void Drag(const wxPoint &aNewMousePosition) override
Calculate a new mouse drag position.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Declaration for a track ball camera.
void build_rotmatrix(float m[4][4], double q[4])
void trackball(double q[4], double p1x, double p1y, double p2x, double p2y)