37 aAngle -= static_cast<float>( M_PI * 2.0f );
40 aAngle += static_cast<float>( M_PI * 2.0f );
50 #define DEFAULT_MIN_ZOOM 0.10f 51 #define DEFAULT_MAX_ZOOM 1.20f 56 wxLogTrace(
m_logTrace, wxT(
"CAMERA::CAMERA" ) );
219 -orthoReductionFactor,
220 orthoReductionFactor,
239 for(
unsigned int x = 0; x < (
unsigned int)
m_windowSize.x + 1; ++x )
242 const float xNormalizedDeviceCoordinates = ( ( (float)x + 0.5f ) /
246 m_scr_nX[x] = 2.0f * xNormalizedDeviceCoordinates - 1.0f;
250 for(
unsigned int y = 0; y < (
unsigned int)
m_windowSize.y + 1 ; ++y )
253 const float yNormalizedDeviceCoordinates = ( ( (float)y + 0.5f ) /
257 m_scr_nY[y] = 2.0f * yNormalizedDeviceCoordinates - 1.0f;
271 glm::vec4(
SFVEC3F( 1.0, 0.0, 0.0 ), 0.0 ) ) );
274 glm::vec4(
SFVEC3F( 0.0, 1.0, 0.0 ), 0.0 ) ) );
277 glm::vec4(
SFVEC3F( 0.0, 0.0, 1.0 ), 0.0 ) ) );
311 for(
unsigned int x = 0; x < ( (
unsigned int)
m_windowSize.x + 1 ); ++x )
317 for(
unsigned int y = 0; y < ( (
unsigned int)
m_windowSize.y + 1 ); ++y )
336 aOutDirection = glm::normalize( aOutOrigin -
m_pos );
353 const SFVEC2F floorWinPos_f = glm::floor( aWindowPos );
355 const SFVEC2F relativeWinPos = aWindowPos - floorWinPos_f;
358 const SFVEC3F up_plus_right =
m_up_nY[floorWinPos_i.y] * (1.0f - relativeWinPos.y) +
359 m_up_nY[floorWinPos_i.y + 1] * relativeWinPos.y +
360 m_right_nX[floorWinPos_i.x] * (1.0f - relativeWinPos.x) +
361 m_right_nX[floorWinPos_i.x + 1] * relativeWinPos.x;
368 aOutDirection = glm::normalize( aOutOrigin -
m_pos );
383 if( ( 0 < windowPos.x ) && ( windowPos.x <
m_windowSize.x ) &&
384 ( 0 < windowPos.y ) && ( windowPos.y <
m_windowSize.y ) )
386 MakeRay( windowPos, aOutOrigin, aOutDirection );
574 wxASSERT( t >= 0.0f );
576 const float t0 = 1.0f - t;
596 return parametersChanged;
SFVEC3F fbl
Far Bottom Left.
void RotateX(float aAngleInRadians)
glm::mat4 m_viewMatrixInverse
SFVEC3F m_rotate_aux
Stores the rotation angle auxiliary.
void RotateZ_T1(float aAngleInRadians)
float m_zoom
3D zoom value – Z-distance is scaled by it
bool Zoom_T1(float aFactor)
const glm::mat4 & GetViewMatrix_Inv() const
bool m_parametersChanged
Set to true if any of the parameters in the camera was changed.
CAMERA(float aInitialDistance)
Initialize a camera.
const glm::mat4 & GetProjectionMatrix() const
Define an abstract camera.
void RotateY_T1(float aAngleInRadians)
virtual void Reset()
Reset the camera to initial state.
SFVEC3F nbr
Near Bottom Right.
const glm::mat4 GetRotationMatrix() const
Get the rotation matrix to be applied in a transformation camera.
std::vector< SFVEC3F > m_right_nX
Precalc values array used to calc ray for each pixel, for X and Y axis of each new camera position.
SFVEC3F fbr
Far Bottom Right.
SFVEC3F m_camera_pos_init
float GetCameraMinDimension() const
PROJECTION_TYPE m_projectionType
SFVEC3F nbl
Near Bottom Left.
wxPoint m_lastPosition
The last mouse position in the screen.
void updateRotationMatrix()
const glm::mat4 & GetViewMatrix() const
void RotateY(float aAngleInRadians)
void normalise2PI(float &aAngle)
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on a windows screen position.
void SetCurMousePosition(const wxPoint &aPosition)
Update the current mouse position without make any new calculations on camera.
const glm::mat4 & GetProjectionMatrixInv() const
glm::mat4 m_rotationMatrix
void MakeRayAtCurrrentMousePosition(SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on the latest mouse position.
SFVEC2I m_windowSize
The window size that this camera is working.
glm::mat4 m_projectionMatrix
CAMERA_INTERPOLATION m_interpolation_mode
SFVEC3F m_board_lookat_pos_init
Default boardlookat position (the board center).
bool SetCurWindowSize(const wxSize &aSize)
Update the windows size of the camera.
float m_minZoom
Possible 3D zoom range.
std::vector< SFVEC3F > m_up_nY
virtual void SetT0_and_T1_current_T()
This will set T0 and T1 with the current values.
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
virtual void Interpolate(float t)
It will update the matrix to interpolate between T0 and T1 values.
SFVEC3F ntl
Near Top Left.
void RotateZ(float aAngleInRadians)
SFVEC3F ntr
Near Top Right.
glm::mat4 m_rotationMatrixAux
std::vector< float > m_scr_nY
std::vector< float > m_scr_nX
Precalc values array used to calc ray for each pixel (constant for the same window size).
glm::mat4 m_projectionMatrixInv
SFVEC3F ftr
Far Top Right.
void RotateX_T1(float aAngleInRadians)