KiCad PCB EDA Suite
CAMERA Class Referenceabstract

A class used to derive camera objects from. More...

#include <camera.h>

Inheritance diagram for CAMERA:
TRACK_BALL

Public Member Functions

 CAMERA (float aInitialDistance)
 Initialize a camera. More...
 
virtual ~CAMERA ()
 
glm::mat4 GetRotationMatrix () const
 Get the rotation matrix to be applied in a transformation camera. More...
 
const glm::mat4 & GetViewMatrix () const
 
const glm::mat4 & GetViewMatrix_Inv () const
 
const glm::mat4 & GetProjectionMatrix () const
 
const glm::mat4 & GetProjectionMatrixInv () const
 
const SFVEC3FGetRight () const
 
const SFVEC3FGetUp () const
 
const SFVEC3FGetDir () const
 
const SFVEC3FGetPos () const
 
const SFVEC2FGetFocalLen () const
 
float GetNear () const
 
float GetFar () const
 
const CAMERA_FRUSTUMGetFrustum () const
 
const SFVEC3FGetLookAtPos () const
 
void SetRotationMatrix (const glm::mat4 &aRotation)
 Set the rotation matrix to be applied in a transformation camera, without making any new calculations on camera. More...
 
void SetViewMatrix (glm::mat4 aViewMatrix)
 Set the affine matrix to be applied to a transformation camera. More...
 
void SetBoardLookAtPos (const SFVEC3F &aBoardPos)
 
void SetLookAtPos_T1 (const SFVEC3F &aLookAtPos)
 
const SFVEC3FGetLookAtPos_T1 () const
 
const SFVEC3FGetCameraPos () const
 
const SFVEC3FGetCameraInitPos () const
 
float GetCameraMinDimension () const
 
virtual void Drag (const wxPoint &aNewMousePosition)=0
 Calculate a new mouse drag position. More...
 
virtual void Pan (const wxPoint &aNewMousePosition)=0
 
virtual void Pan (const SFVEC3F &aDeltaOffsetInc)=0
 
virtual void Pan_T1 (const SFVEC3F &aDeltaOffsetInc)=0
 
virtual void Reset ()
 Reset the camera to initial state. More...
 
virtual void Reset_T1 ()
 
void ResetXYpos ()
 
void ResetXYpos_T1 ()
 
const wxPoint & GetCurMousePosition ()
 Get the current mouse position. More...
 
void SetCurMousePosition (const wxPoint &aPosition)
 Update the current mouse position without make any new calculations on camera. More...
 
void ToggleProjection ()
 
PROJECTION_TYPE GetProjection ()
 
void SetProjection (PROJECTION_TYPE aProjection)
 
bool SetCurWindowSize (const wxSize &aSize)
 Update the windows size of the camera. More...
 
void ZoomReset ()
 
bool Zoom (float aFactor)
 
bool Zoom_T1 (float aFactor)
 
float GetZoom () const
 
float GetMinZoom ()
 
void SetMinZoom (float minZoom)
 
float GetMaxZoom ()
 
void SetMaxZoom (float maxZoom)
 
void RotateX (float aAngleInRadians)
 
void RotateY (float aAngleInRadians)
 
void RotateZ (float aAngleInRadians)
 
void RotateX_T1 (float aAngleInRadians)
 
void RotateY_T1 (float aAngleInRadians)
 
void RotateZ_T1 (float aAngleInRadians)
 
virtual void SetT0_and_T1_current_T ()
 This will set T0 and T1 with the current values. More...
 
virtual void Interpolate (float t)
 It will update the matrix to interpolate between T0 and T1 values. More...
 
void SetInterpolateMode (CAMERA_INTERPOLATION aInterpolateMode)
 
bool ParametersChanged ()
 
bool ParametersChangedQuery () const
 
void MakeRay (const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
 Make a ray based on a windows screen position. More...
 
void MakeRay (const SFVEC2F &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
 Make a ray based on a windows screen position, it will interpolate based on the aWindowPos. More...
 
void MakeRayAtCurrentMousePosition (SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
 Make a ray based on the latest mouse position. More...
 
void Update ()
 Update the camera. More...
 

Protected Member Functions

void zoomChanged ()
 
void rebuildProjection ()
 
void updateFrustum ()
 
void updateViewMatrix ()
 
void updateRotationMatrix ()
 

Protected Attributes

float m_zoom
 3D zoom value – Z-distance is scaled by it More...
 
float m_zoom_t0
 
float m_zoom_t1
 
float m_minZoom
 Possible 3D zoom range. More...
 
float m_maxZoom
 
SFVEC2I m_windowSize
 The window size that this camera is working. More...
 
wxPoint m_lastPosition
 The last mouse position in the screen. More...
 
glm::mat4 m_rotationMatrix
 
glm::mat4 m_rotationMatrixAux
 
glm::mat4 m_viewMatrix
 
glm::mat4 m_viewMatrixInverse
 
glm::mat4 m_projectionMatrix
 
glm::mat4 m_projectionMatrixInv
 
PROJECTION_TYPE m_projectionType
 
CAMERA_FRUSTUM m_frustum
 
SFVEC3F m_right
 
SFVEC3F m_up
 
SFVEC3F m_dir
 
SFVEC3F m_pos
 
SFVEC2F m_focalLen
 
SFVEC3F m_camera_pos_init
 
SFVEC3F m_camera_pos
 
SFVEC3F m_camera_pos_t0
 
SFVEC3F m_camera_pos_t1
 
SFVEC3F m_lookat_pos
 
SFVEC3F m_lookat_pos_t0
 
SFVEC3F m_lookat_pos_t1
 
SFVEC3F m_board_lookat_pos_init
 Default boardlookat position (the board center). More...
 
SFVEC3F m_rotate_aux
 Stores the rotation angle auxiliary. More...
 
SFVEC3F m_rotate_aux_t0
 
SFVEC3F m_rotate_aux_t1
 
CAMERA_INTERPOLATION m_interpolation_mode
 
std::vector< float > m_scr_nX
 Precalc values array used to calc ray for each pixel (constant for the same window size). More...
 
std::vector< float > m_scr_nY
 
std::vector< SFVEC3Fm_right_nX
 Precalc values array used to calc ray for each pixel, for X and Y axis of each new camera position. More...
 
std::vector< SFVEC3Fm_up_nY
 
bool m_parametersChanged
 Set to true if any of the parameters in the camera was changed. More...
 

Static Protected Attributes

static const wxChar * m_logTrace = wxT( "KI_TRACE_CAMERA" )
 Trace mask used to enable or disable the trace output of this class. More...
 

Detailed Description

A class used to derive camera objects from.

It must be derived by other classes to implement a real camera object.

Definition at line 77 of file camera.h.

Constructor & Destructor Documentation

◆ CAMERA()

CAMERA::CAMERA ( float  aInitialDistance)
explicit

Initialize a camera.

Parameters
aInitialDistanceInitial Z-distance to the board

Definition at line 54 of file camera.cpp.

55{
56 wxLogTrace( m_logTrace, wxT( "CAMERA::CAMERA" ) );
57
58 m_camera_pos_init = SFVEC3F( 0.0f, 0.0f, -aInitialDistance );
60 m_windowSize = SFVEC2I( 0, 0 );
63
66
67 Reset();
68}
#define DEFAULT_MAX_ZOOM
Definition: camera.cpp:51
#define DEFAULT_MIN_ZOOM
Definition: camera.cpp:50
virtual void Reset()
Reset the camera to initial state.
Definition: camera.cpp:71
CAMERA_INTERPOLATION m_interpolation_mode
Definition: camera.h:337
SFVEC3F m_camera_pos_init
Definition: camera.h:323
float m_minZoom
Possible 3D zoom range.
Definition: camera.h:293
float m_maxZoom
Definition: camera.h:294
PROJECTION_TYPE m_projectionType
Definition: camera.h:312
SFVEC2I m_windowSize
The window size that this camera is working.
Definition: camera.h:299
SFVEC3F m_board_lookat_pos_init
Default boardlookat position (the board center).
Definition: camera.h:331
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: camera.h:364
glm::ivec2 SFVEC2I
Definition: xv3d_types.h:39
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44

References BEZIER, DEFAULT_MAX_ZOOM, DEFAULT_MIN_ZOOM, m_board_lookat_pos_init, m_camera_pos_init, m_interpolation_mode, m_logTrace, m_maxZoom, m_minZoom, m_projectionType, m_windowSize, PERSPECTIVE, and Reset().

◆ ~CAMERA()

virtual CAMERA::~CAMERA ( )
inlinevirtual

Definition at line 87 of file camera.h.

88 {
89 }

Member Function Documentation

◆ Drag()

virtual void CAMERA::Drag ( const wxPoint &  aNewMousePosition)
pure virtual

Calculate a new mouse drag position.

Implemented in TRACK_BALL.

Referenced by HIDPI_GL_3D_CANVAS::OnMouseMoveCamera().

◆ GetCameraInitPos()

const SFVEC3F & CAMERA::GetCameraInitPos ( ) const
inline

Definition at line 141 of file camera.h.

141{ return m_camera_pos_init; }

References m_camera_pos_init.

Referenced by RENDER_3D_RAYTRACE::Reload().

◆ GetCameraMinDimension()

float CAMERA::GetCameraMinDimension ( ) const

Definition at line 427 of file camera.cpp.

428{
429 return -m_camera_pos_init.z * m_frustum.tang;
430}
CAMERA_FRUSTUM m_frustum
Definition: camera.h:314
float tang
Definition: camera.h:59

References m_camera_pos_init, m_frustum, and CAMERA_FRUSTUM::tang.

◆ GetCameraPos()

const SFVEC3F & CAMERA::GetCameraPos ( ) const
inline

Definition at line 140 of file camera.h.

140{ return m_camera_pos; }
SFVEC3F m_camera_pos
Definition: camera.h:324

References m_camera_pos.

Referenced by EDA_3D_CANVAS::DisplayStatus().

◆ GetCurMousePosition()

const wxPoint & CAMERA::GetCurMousePosition ( )
inline

Get the current mouse position.

Definition at line 168 of file camera.h.

168{ return m_lastPosition; }
wxPoint m_lastPosition
The last mouse position in the screen.
Definition: camera.h:304

References m_lastPosition.

◆ GetDir()

const SFVEC3F & CAMERA::GetDir ( ) const
inline

Definition at line 106 of file camera.h.

106{ return m_dir; }
SFVEC3F m_dir
Definition: camera.h:318

References m_dir.

Referenced by RENDER_3D_RAYTRACE::Redraw(), and RENDER_3D_RAYTRACE::render().

◆ GetFar()

float CAMERA::GetFar ( ) const
inline

Definition at line 110 of file camera.h.

110{ return m_frustum.farD; }
float farD
Definition: camera.h:59

References CAMERA_FRUSTUM::farD, and m_frustum.

◆ GetFocalLen()

const SFVEC2F & CAMERA::GetFocalLen ( ) const
inline

Definition at line 108 of file camera.h.

108{ return m_focalLen; }
SFVEC2F m_focalLen
Definition: camera.h:321

References m_focalLen.

◆ GetFrustum()

◆ GetLookAtPos()

const SFVEC3F & CAMERA::GetLookAtPos ( ) const
inline

Definition at line 112 of file camera.h.

112{ return m_lookat_pos; }
SFVEC3F m_lookat_pos
Definition: camera.h:328

References m_lookat_pos.

Referenced by NL_3D_VIEWER_PLUGIN_IMPL::GetPivotPosition(), and NL_3D_VIEWER_PLUGIN_IMPL::SetCameraMatrix().

◆ GetLookAtPos_T1()

const SFVEC3F & CAMERA::GetLookAtPos_T1 ( ) const
inline

Definition at line 138 of file camera.h.

138{ return m_lookat_pos_t1; }
SFVEC3F m_lookat_pos_t1
Definition: camera.h:330

References m_lookat_pos_t1.

Referenced by EDA_3D_CANVAS::render_pivot().

◆ GetMaxZoom()

float CAMERA::GetMaxZoom ( )
inline

Definition at line 201 of file camera.h.

201{ return m_maxZoom; }

References m_maxZoom.

Referenced by RENDER_3D_RAYTRACE::Reload().

◆ GetMinZoom()

float CAMERA::GetMinZoom ( )
inline

Definition at line 194 of file camera.h.

194{ return m_minZoom; }

References m_minZoom.

◆ GetNear()

float CAMERA::GetNear ( ) const
inline

Definition at line 109 of file camera.h.

109{ return m_frustum.nearD; }
float nearD
Definition: camera.h:59

References m_frustum, and CAMERA_FRUSTUM::nearD.

◆ GetPos()

const SFVEC3F & CAMERA::GetPos ( ) const
inline

Definition at line 107 of file camera.h.

107{ return m_pos; }
SFVEC3F m_pos
Definition: camera.h:319

References m_pos.

Referenced by RENDER_3D_OPENGL::Redraw(), and RENDER_3D_OPENGL::renderSolderMaskLayer().

◆ GetProjection()

◆ GetProjectionMatrix()

const glm::mat4 & CAMERA::GetProjectionMatrix ( ) const

Definition at line 415 of file camera.cpp.

416{
417 return m_projectionMatrix;
418}
glm::mat4 m_projectionMatrix
Definition: camera.h:310

References m_projectionMatrix.

Referenced by EDA_3D_MODEL_VIEWER::OnPaint(), RENDER_3D_OPENGL::Redraw(), and EDA_3D_CANVAS::render_pivot().

◆ GetProjectionMatrixInv()

const glm::mat4 & CAMERA::GetProjectionMatrixInv ( ) const

Definition at line 421 of file camera.cpp.

422{
424}
glm::mat4 m_projectionMatrixInv
Definition: camera.h:311

References m_projectionMatrixInv.

◆ GetRight()

const SFVEC3F & CAMERA::GetRight ( ) const
inline

Definition at line 104 of file camera.h.

104{ return m_right; }
SFVEC3F m_right
Definition: camera.h:316

References m_right.

◆ GetRotationMatrix()

glm::mat4 CAMERA::GetRotationMatrix ( ) const

Get the rotation matrix to be applied in a transformation camera.

Returns
the rotation matrix of the camera

Definition at line 183 of file camera.cpp.

184{
186}
glm::mat4 m_rotationMatrixAux
Definition: camera.h:307
glm::mat4 m_rotationMatrix
Definition: camera.h:306

References m_rotationMatrix, and m_rotationMatrixAux.

Referenced by EDA_3D_MODEL_VIEWER::OnPaint(), and RENDER_3D_OPENGL::render3dArrows().

◆ GetUp()

const SFVEC3F & CAMERA::GetUp ( ) const
inline

Definition at line 105 of file camera.h.

105{ return m_up; }
SFVEC3F m_up
Definition: camera.h:317

References m_up.

◆ GetViewMatrix()

◆ GetViewMatrix_Inv()

const glm::mat4 & CAMERA::GetViewMatrix_Inv ( ) const

Definition at line 489 of file camera.cpp.

490{
491 return m_viewMatrixInverse;
492}
glm::mat4 m_viewMatrixInverse
Definition: camera.h:309

References m_viewMatrixInverse.

◆ GetZoom()

float CAMERA::GetZoom ( ) const
inline

Definition at line 192 of file camera.h.

192{ return m_zoom; }
float m_zoom
3D zoom value – Z-distance is scaled by it
Definition: camera.h:286

References m_zoom.

Referenced by EDA_3D_CANVAS::DoRePaint(), HIDPI_GL_3D_CANVAS::OnMouseWheelCamera(), EDA_3D_CANVAS::SetView3D(), and NL_3D_VIEWER_PLUGIN_IMPL::SetViewExtents().

◆ Interpolate()

void CAMERA::Interpolate ( float  t)
virtual

It will update the matrix to interpolate between T0 and T1 values.

Parameters
tthe interpolation time, between 0.0f and 1.0f (it will clamp if >1).

Reimplemented in TRACK_BALL.

Definition at line 645 of file camera.cpp.

646{
647 wxASSERT( t >= 0.0f );
648
649 const float t0 = 1.0f - t;
650
654 m_zoom = m_zoom_t0 * t0 + m_zoom_t1 * t;
655
656 m_parametersChanged = true;
657
660}
float m_zoom_t0
Definition: camera.h:287
bool m_parametersChanged
Set to true if any of the parameters in the camera was changed.
Definition: camera.h:355
SFVEC3F m_camera_pos_t0
Definition: camera.h:325
SFVEC3F m_rotate_aux_t1
Definition: camera.h:335
void updateRotationMatrix()
Definition: camera.cpp:162
SFVEC3F m_rotate_aux_t0
Definition: camera.h:334
void rebuildProjection()
Definition: camera.cpp:197
float m_zoom_t1
Definition: camera.h:288
SFVEC3F m_lookat_pos_t0
Definition: camera.h:329
SFVEC3F m_rotate_aux
Stores the rotation angle auxiliary.
Definition: camera.h:333
SFVEC3F m_camera_pos_t1
Definition: camera.h:326

References m_camera_pos, m_camera_pos_t0, m_camera_pos_t1, m_lookat_pos, m_lookat_pos_t0, m_lookat_pos_t1, m_parametersChanged, m_rotate_aux, m_rotate_aux_t0, m_rotate_aux_t1, m_zoom, m_zoom_t0, m_zoom_t1, rebuildProjection(), and updateRotationMatrix().

Referenced by EDA_3D_CANVAS::DoRePaint(), TRACK_BALL::Interpolate(), and EDA_3D_CANVAS::request_start_moving_camera().

◆ MakeRay() [1/2]

void CAMERA::MakeRay ( const SFVEC2F aWindowPos,
SFVEC3F aOutOrigin,
SFVEC3F aOutDirection 
) const

Make a ray based on a windows screen position, it will interpolate based on the aWindowPos.

Parameters
aWindowPosthe windows buffer position (float value).
aOutOriginout origin position of the ray.
aOutDirectionout direction.

Definition at line 371 of file camera.cpp.

373{
374 wxASSERT( aWindowPos.x < (float)m_windowSize.x );
375 wxASSERT( aWindowPos.y < (float)m_windowSize.y );
376
377 const SFVEC2F floorWinPos_f = glm::floor( aWindowPos );
378 const SFVEC2I floorWinPos_i = (SFVEC2I)floorWinPos_f;
379 const SFVEC2F relativeWinPos = aWindowPos - floorWinPos_f;
380
381 // Note: size of vectors m_up and m_right are m_windowSize + 1
382 const SFVEC3F up_plus_right = m_up_nY[floorWinPos_i.y] * (1.0f - relativeWinPos.y) +
383 m_up_nY[floorWinPos_i.y + 1] * relativeWinPos.y +
384 m_right_nX[floorWinPos_i.x] * (1.0f - relativeWinPos.x) +
385 m_right_nX[floorWinPos_i.x + 1] * relativeWinPos.x;
386
387 aOutOrigin = up_plus_right + m_frustum.nc;
388
389 switch( m_projectionType )
390 {
391 default:
393 aOutDirection = glm::normalize( aOutOrigin - m_pos );
394 break;
395
397 aOutDirection = -m_dir + SFVEC3F( FLT_EPSILON );
398 break;
399 }
400}
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.
Definition: camera.h:349
std::vector< SFVEC3F > m_up_nY
Definition: camera.h:350
SFVEC3F nc
Definition: camera.h:49
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42

References m_dir, m_frustum, m_pos, m_projectionType, m_right_nX, m_up_nY, m_windowSize, CAMERA_FRUSTUM::nc, ORTHO, and PERSPECTIVE.

◆ MakeRay() [2/2]

void CAMERA::MakeRay ( const SFVEC2I aWindowPos,
SFVEC3F aOutOrigin,
SFVEC3F aOutDirection 
) const

Make a ray based on a windows screen position.

Parameters
aWindowPosthe windows buffer position.
aOutOriginout origin position of the ray.
aOutDirectionout direction

Definition at line 349 of file camera.cpp.

351{
352 wxASSERT( aWindowPos.x < m_windowSize.x );
353 wxASSERT( aWindowPos.y < m_windowSize.y );
354
355 aOutOrigin = m_frustum.nc + m_up_nY[aWindowPos.y] + m_right_nX[aWindowPos.x];
356
357 switch( m_projectionType )
358 {
359 default:
361 aOutDirection = glm::normalize( aOutOrigin - m_pos );
362 break;
363
365 aOutDirection = -m_dir + SFVEC3F( FLT_EPSILON );
366 break;
367 }
368}

References m_dir, m_frustum, m_pos, m_projectionType, m_right_nX, m_up_nY, m_windowSize, CAMERA_FRUSTUM::nc, ORTHO, and PERSPECTIVE.

Referenced by MakeRayAtCurrentMousePosition(), RAYPACKET::RAYPACKET(), RAYPACKET_InitRays(), and RAYPACKET_InitRays_with2DDisplacement().

◆ MakeRayAtCurrentMousePosition()

void CAMERA::MakeRayAtCurrentMousePosition ( SFVEC3F aOutOrigin,
SFVEC3F aOutDirection 
) const

Make a ray based on the latest mouse position.

Parameters
aOutOriginout origin position of the ray.
aOutDirectionout direction.

Definition at line 403 of file camera.cpp.

404{
405 const SFVEC2I windowPos = SFVEC2I( m_lastPosition.x, m_windowSize.y - m_lastPosition.y );
406
407 if( ( 0 < windowPos.x ) && ( windowPos.x < m_windowSize.x ) &&
408 ( 0 < windowPos.y ) && ( windowPos.y < m_windowSize.y ) )
409 {
410 MakeRay( windowPos, aOutOrigin, aOutDirection );
411 }
412}
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on a windows screen position.
Definition: camera.cpp:349

References m_lastPosition, m_windowSize, and MakeRay().

Referenced by NL_3D_VIEWER_PLUGIN_IMPL::GetPointerPosition(), and EDA_3D_CANVAS::getRayAtCurrentMousePosition().

◆ Pan() [1/2]

virtual void CAMERA::Pan ( const SFVEC3F aDeltaOffsetInc)
pure virtual

Implemented in TRACK_BALL.

◆ Pan() [2/2]

virtual void CAMERA::Pan ( const wxPoint &  aNewMousePosition)
pure virtual

◆ Pan_T1()

virtual void CAMERA::Pan_T1 ( const SFVEC3F aDeltaOffsetInc)
pure virtual

Implemented in TRACK_BALL.

Referenced by EDA_3D_CANVAS::SetView3D().

◆ ParametersChanged()

bool CAMERA::ParametersChanged ( )
Returns
true if some of the parameters in camera was changed, it will reset the flag.

Definition at line 663 of file camera.cpp.

664{
665 const bool parametersChanged = m_parametersChanged;
666
667 m_parametersChanged = false;
668
669 return parametersChanged;
670}

References m_parametersChanged.

Referenced by EDA_3D_CANVAS::DoRePaint(), and RENDER_3D_RAYTRACE::Redraw().

◆ ParametersChangedQuery()

bool CAMERA::ParametersChangedQuery ( ) const
inline
Returns
true if some of the parameters in camera was changed, it will NOT reset the flag.

Definition at line 241 of file camera.h.

241{ return m_parametersChanged; }

References m_parametersChanged.

◆ rebuildProjection()

void CAMERA::rebuildProjection ( )
protected

Definition at line 197 of file camera.cpp.

198{
199 if( ( m_windowSize.x == 0 ) || ( m_windowSize.y == 0 ) )
200 return;
201
202 m_frustum.ratio = (float) m_windowSize.x / (float)m_windowSize.y;
203 m_frustum.farD = glm::length( m_camera_pos_init ) * m_maxZoom * 2.0f;
204
205 switch( m_projectionType )
206 {
207 default:
209
210 m_frustum.nearD = 0.10f;
211
212 m_frustum.angle = 45.0f;
213
214 m_projectionMatrix = glm::perspective( glm::radians( m_frustum.angle ), m_frustum.ratio,
216
218
219 m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
220
221 m_focalLen.x = ( (float)m_windowSize.y / (float)m_windowSize.x ) / m_frustum.tang;
222 m_focalLen.y = 1.0f / m_frustum.tang;
223
228 break;
229
231
232 // Keep the viewed plane at (m_camera_pos_init * m_zoom) the same dimensions in both projections.
233 m_frustum.angle = 45.0f;
234 m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
235
236 m_frustum.nearD = -m_frustum.farD; // Use a symmetrical clip plane for ortho projection
237
238 const float orthoReductionFactor =
239 glm::length( m_camera_pos_init ) * m_zoom * m_frustum.tang;
240
241 // Initialize Projection Matrix for Orthographic View
242 m_projectionMatrix = glm::ortho( -m_frustum.ratio * orthoReductionFactor,
243 m_frustum.ratio * orthoReductionFactor,
244 -orthoReductionFactor,
245 orthoReductionFactor,
247
249
250 m_frustum.nw = orthoReductionFactor * 2.0f * m_frustum.ratio;
251 m_frustum.nh = orthoReductionFactor * 2.0f;
254
255 break;
256 }
257
258 if( ( m_windowSize.x > 0 ) && ( m_windowSize.y > 0 ) )
259 {
260 m_scr_nX.resize( m_windowSize.x + 1 );
261 m_scr_nY.resize( m_windowSize.y + 1 );
262
263 // Precalc X values for camera -> ray generation
264 for( unsigned int x = 0; x < (unsigned int)m_windowSize.x + 1; ++x )
265 {
266 // Converts 0.0 .. 1.0
267 const float xNormalizedDeviceCoordinates = ( ( (float)x + 0.5f ) /
268 (m_windowSize.x - 0.0f) );
269
270 // Converts -1.0 .. 1.0
271 m_scr_nX[x] = 2.0f * xNormalizedDeviceCoordinates - 1.0f;
272 }
273
274 // Precalc Y values for camera -> ray generation
275 for( unsigned int y = 0; y < (unsigned int)m_windowSize.y + 1 ; ++y )
276 {
277 // Converts 0.0 .. 1.0
278 const float yNormalizedDeviceCoordinates = ( ( (float)y + 0.5f ) /
279 (m_windowSize.y - 0.0f) );
280
281 // Converts -1.0 .. 1.0
282 m_scr_nY[y] = 2.0f * yNormalizedDeviceCoordinates - 1.0f;
283 }
284
286 }
287}
void updateFrustum()
Definition: camera.cpp:290
std::vector< float > m_scr_nX
Precalc values array used to calc ray for each pixel (constant for the same window size).
Definition: camera.h:342
std::vector< float > m_scr_nY
Definition: camera.h:343
float angle
Definition: camera.h:59
float ratio
Definition: camera.h:59
float fh
Definition: camera.h:60
float nh
Definition: camera.h:60
float fw
Definition: camera.h:60
float nw
Definition: camera.h:60

References CAMERA_FRUSTUM::angle, CAMERA_FRUSTUM::farD, CAMERA_FRUSTUM::fh, CAMERA_FRUSTUM::fw, m_camera_pos_init, m_focalLen, m_frustum, m_maxZoom, m_projectionMatrix, m_projectionMatrixInv, m_projectionType, m_scr_nX, m_scr_nY, m_windowSize, m_zoom, CAMERA_FRUSTUM::nearD, CAMERA_FRUSTUM::nh, CAMERA_FRUSTUM::nw, ORTHO, PERSPECTIVE, CAMERA_FRUSTUM::ratio, CAMERA_FRUSTUM::tang, and updateFrustum().

Referenced by Interpolate(), Reset(), SetCurWindowSize(), ToggleProjection(), Zoom(), zoomChanged(), and ZoomReset().

◆ Reset()

void CAMERA::Reset ( )
virtual

Reset the camera to initial state.

Definition at line 71 of file camera.cpp.

72{
74 m_projectionMatrix = glm::mat4( 1.0f );
75 m_projectionMatrixInv = glm::mat4( 1.0f );
76 m_rotationMatrix = glm::mat4( 1.0f );
77 m_rotationMatrixAux = glm::mat4( 1.0f );
78 m_lastPosition = wxPoint( 0, 0 );
79
80 m_zoom = 1.0f;
81 m_zoom_t0 = 1.0f;
82 m_zoom_t1 = 1.0f;
89
90 m_rotate_aux = SFVEC3F( 0.0f );
91 m_rotate_aux_t0 = SFVEC3F( 0.0f );
92 m_rotate_aux_t1 = SFVEC3F( 0.0f );
93
96 m_viewMatrixInverse = glm::inverse( m_viewMatrix );
97 m_scr_nX.clear();
98 m_scr_nY.clear();
100}
void updateViewMatrix()
Definition: camera.cpp:154

References m_board_lookat_pos_init, m_camera_pos, m_camera_pos_init, m_camera_pos_t0, m_camera_pos_t1, m_lastPosition, m_lookat_pos, m_lookat_pos_t0, m_lookat_pos_t1, m_parametersChanged, m_projectionMatrix, m_projectionMatrixInv, m_rotate_aux, m_rotate_aux_t0, m_rotate_aux_t1, m_rotationMatrix, m_rotationMatrixAux, m_scr_nX, m_scr_nY, m_viewMatrix, m_viewMatrixInverse, m_zoom, m_zoom_t0, m_zoom_t1, rebuildProjection(), updateRotationMatrix(), and updateViewMatrix().

Referenced by CAMERA().

◆ Reset_T1()

void CAMERA::Reset_T1 ( )
virtual

Reimplemented in TRACK_BALL.

Definition at line 103 of file camera.cpp.

104{
106 m_zoom_t1 = 1.0f;
107 m_rotate_aux_t1 = SFVEC3F( 0.0f );
109
110 // Since 0 = 2pi, we want to reset the angle to be the closest
111 // one to where we currently are. That ensures that we rotate
112 // the board around the smallest distance getting there.
113 if( m_rotate_aux_t0.x > M_PI )
114 m_rotate_aux_t1.x = static_cast<float>( 2.0f * M_PI );
115
116 if( m_rotate_aux_t0.y > M_PI )
117 m_rotate_aux_t1.y = static_cast<float>( 2.0f * M_PI );
118
119 if( m_rotate_aux_t0.z > M_PI )
120 m_rotate_aux_t1.z = static_cast<float>( 2.0f * M_PI );
121}

References m_board_lookat_pos_init, m_camera_pos_init, m_camera_pos_t1, m_lookat_pos_t1, m_rotate_aux_t0, m_rotate_aux_t1, and m_zoom_t1.

Referenced by TRACK_BALL::Reset_T1(), and EDA_3D_CANVAS::SetView3D().

◆ ResetXYpos()

void CAMERA::ResetXYpos ( )

Definition at line 433 of file camera.cpp.

434{
435 m_parametersChanged = true;
436 m_camera_pos.x = 0.0f;
437 m_camera_pos.y = 0.0f;
438
441}

References m_camera_pos, m_parametersChanged, updateFrustum(), and updateViewMatrix().

◆ ResetXYpos_T1()

void CAMERA::ResetXYpos_T1 ( )

Definition at line 444 of file camera.cpp.

445{
446 m_camera_pos_t1.x = 0.0f;
447 m_camera_pos_t1.y = 0.0f;
448}

References m_camera_pos_t1.

Referenced by EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position().

◆ RotateX()

void CAMERA::RotateX ( float  aAngleInRadians)

Definition at line 592 of file camera.cpp.

593{
594 m_rotate_aux.x += aAngleInRadians;
596}

References m_rotate_aux, and updateRotationMatrix().

Referenced by EDA_3D_CONTROLLER::RotateView().

◆ RotateX_T1()

void CAMERA::RotateX_T1 ( float  aAngleInRadians)

Definition at line 613 of file camera.cpp.

614{
615 m_rotate_aux_t1.x += aAngleInRadians;
616}

References m_rotate_aux_t1.

Referenced by EDA_3D_CANVAS::SetView3D().

◆ RotateY()

void CAMERA::RotateY ( float  aAngleInRadians)

Definition at line 599 of file camera.cpp.

600{
601 m_rotate_aux.y += aAngleInRadians;
603}

References m_rotate_aux, and updateRotationMatrix().

Referenced by EDA_3D_CONTROLLER::RotateView().

◆ RotateY_T1()

void CAMERA::RotateY_T1 ( float  aAngleInRadians)

Definition at line 619 of file camera.cpp.

620{
621 m_rotate_aux_t1.y += aAngleInRadians;
622}

References m_rotate_aux_t1.

Referenced by EDA_3D_CANVAS::SetView3D().

◆ RotateZ()

void CAMERA::RotateZ ( float  aAngleInRadians)

Definition at line 606 of file camera.cpp.

607{
608 m_rotate_aux.z += aAngleInRadians;
610}

References m_rotate_aux, and updateRotationMatrix().

Referenced by EDA_3D_CONTROLLER::RotateView().

◆ RotateZ_T1()

void CAMERA::RotateZ_T1 ( float  aAngleInRadians)

Definition at line 625 of file camera.cpp.

626{
627 m_rotate_aux_t1.z += aAngleInRadians;
628}

References m_rotate_aux_t1.

Referenced by EDA_3D_CANVAS::SetView3D().

◆ SetBoardLookAtPos()

void CAMERA::SetBoardLookAtPos ( const SFVEC3F aBoardPos)

Definition at line 124 of file camera.cpp.

125{
126 if( m_board_lookat_pos_init != aBoardPos )
127 {
128 m_board_lookat_pos_init = aBoardPos;
129 m_lookat_pos = aBoardPos;
130
131 m_parametersChanged = true;
132
135 }
136}

References m_board_lookat_pos_init, m_lookat_pos, m_parametersChanged, updateFrustum(), and updateViewMatrix().

Referenced by RENDER_3D_OPENGL::reload(), and RENDER_3D_RAYTRACE::Reload().

◆ SetCurMousePosition()

void CAMERA::SetCurMousePosition ( const wxPoint &  aPosition)

Update the current mouse position without make any new calculations on camera.

Definition at line 495 of file camera.cpp.

496{
497 m_lastPosition = aNewMousePosition;
498}

References m_lastPosition.

Referenced by EDA_3D_MODEL_VIEWER::OnMouseMove(), HIDPI_GL_3D_CANVAS::OnMouseMoveCamera(), EDA_3D_MODEL_VIEWER::OnMouseWheel(), and HIDPI_GL_3D_CANVAS::OnMouseWheelCamera().

◆ SetCurWindowSize()

bool CAMERA::SetCurWindowSize ( const wxSize &  aSize)

Update the windows size of the camera.

Returns
true if the windows size changed since last time.

Definition at line 512 of file camera.cpp.

513{
514 const SFVEC2I newSize = SFVEC2I( aSize.x, aSize.y );
515
516 if( m_windowSize != newSize )
517 {
518 m_windowSize = newSize;
520
521 return true;
522 }
523
524 return false;
525}

References m_windowSize, and rebuildProjection().

Referenced by EDA_3D_CANVAS::DoRePaint(), EDA_3D_MODEL_VIEWER::OnMouseMove(), HIDPI_GL_3D_CANVAS::OnMouseMoveCamera(), and EDA_3D_MODEL_VIEWER::OnPaint().

◆ SetInterpolateMode()

void CAMERA::SetInterpolateMode ( CAMERA_INTERPOLATION  aInterpolateMode)
inline

Definition at line 228 of file camera.h.

229 {
230 m_interpolation_mode = aInterpolateMode;
231 }

References m_interpolation_mode.

Referenced by EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position(), and EDA_3D_CANVAS::SetView3D().

◆ SetLookAtPos_T1()

void CAMERA::SetLookAtPos_T1 ( const SFVEC3F aLookAtPos)
inline

Definition at line 133 of file camera.h.

134 {
135 m_lookat_pos_t1 = aLookAtPos;
136 }

References m_lookat_pos_t1.

Referenced by EDA_3D_CANVAS::move_pivot_based_on_cur_mouse_position(), and NL_3D_VIEWER_PLUGIN_IMPL::SetPivotPosition().

◆ SetMaxZoom()

void CAMERA::SetMaxZoom ( float  maxZoom)
inline

Definition at line 202 of file camera.h.

203 {
204 m_maxZoom = maxZoom;
205 zoomChanged();
206 }
void zoomChanged()
Definition: camera.cpp:139

References m_maxZoom, and zoomChanged().

Referenced by RENDER_3D_RAYTRACE::Reload().

◆ SetMinZoom()

void CAMERA::SetMinZoom ( float  minZoom)
inline

Definition at line 195 of file camera.h.

196 {
197 m_minZoom = minZoom;
198 zoomChanged();
199 }

References m_minZoom, and zoomChanged().

Referenced by RENDER_3D_RAYTRACE::Reload().

◆ SetProjection()

void CAMERA::SetProjection ( PROJECTION_TYPE  aProjection)
inline

Definition at line 177 of file camera.h.

177{ m_projectionType = aProjection; }

References m_projectionType.

Referenced by EDA_3D_CANVAS::SetProjectionMode().

◆ SetRotationMatrix()

void CAMERA::SetRotationMatrix ( const glm::mat4 &  aRotation)

Set the rotation matrix to be applied in a transformation camera, without making any new calculations on camera.

Parameters
aRotationis the total rotation matrix of the camera.

Definition at line 189 of file camera.cpp.

190{
191 m_parametersChanged = true;
192 std::copy_n( glm::value_ptr( aRotation * glm::inverse( m_rotationMatrixAux ) ), 12,
193 glm::value_ptr( m_rotationMatrix ) );
194}

References m_parametersChanged, m_rotationMatrix, and m_rotationMatrixAux.

Referenced by SetViewMatrix().

◆ SetT0_and_T1_current_T()

◆ SetViewMatrix()

void CAMERA::SetViewMatrix ( glm::mat4  aViewMatrix)

Set the affine matrix to be applied to a transformation camera.

Parameters
aViewMatrixis the affine matrix of the camera. The affine matrix maps coordinates in the world frame to those in the camera frame.

Definition at line 457 of file camera.cpp.

458{
459 SetRotationMatrix( aViewMatrix );
460
461 // The look at position in the view frame.
462 glm::vec4 lookat = aViewMatrix * glm::vec4( m_lookat_pos, 1.0f );
463
464 wxLogTrace( m_logTrace,
465 wxT( "CAMERA::SetViewMatrix aViewMatrix[3].z =%f, old_zoom=%f, new_zoom=%f, "
466 "m[3].z=%f" ),
467 aViewMatrix[3].z, m_zoom, lookat.z / m_camera_pos_init.z, lookat.z );
468
469 m_zoom = lookat.z / m_camera_pos_init.z;
470
471 if( m_zoom > m_maxZoom )
472 {
474 aViewMatrix[3].z += -lookat.z + m_maxZoom * m_camera_pos_init.z;
475 }
476 else if( m_zoom < m_minZoom )
477 {
479 aViewMatrix[3].z += -lookat.z + m_minZoom * m_camera_pos_init.z;
480 }
481
482 m_viewMatrix = std::move( aViewMatrix );
484 * glm::inverse( m_rotationMatrix * m_rotationMatrixAux
485 * glm::translate( glm::mat4( 1.0f ), -m_lookat_pos ) )[3];
486}
void SetRotationMatrix(const glm::mat4 &aRotation)
Set the rotation matrix to be applied in a transformation camera, without making any new calculations...
Definition: camera.cpp:189

References m_camera_pos, m_camera_pos_init, m_logTrace, m_lookat_pos, m_maxZoom, m_minZoom, m_rotationMatrix, m_rotationMatrixAux, m_viewMatrix, m_zoom, and SetRotationMatrix().

Referenced by EDA_3D_VIEWER_FRAME::applyViewport(), and NL_3D_VIEWER_PLUGIN_IMPL::SetCameraMatrix().

◆ ToggleProjection()

◆ Update()

void CAMERA::Update ( )
inline

Update the camera.

Definition at line 273 of file camera.h.

273{ updateFrustum(); }

References updateFrustum().

Referenced by NL_3D_VIEWER_PLUGIN_IMPL::SetCameraMatrix().

◆ updateFrustum()

void CAMERA::updateFrustum ( )
protected

Definition at line 290 of file camera.cpp.

291{
292 // Update matrix and vectors
293 m_viewMatrixInverse = glm::inverse( m_viewMatrix );
294
295 m_right = glm::normalize( SFVEC3F( m_viewMatrixInverse *
296 glm::vec4( SFVEC3F( 1.0, 0.0, 0.0 ), 0.0 ) ) );
297
298 m_up = glm::normalize( SFVEC3F( m_viewMatrixInverse *
299 glm::vec4( SFVEC3F( 0.0, 1.0, 0.0 ), 0.0 ) ) );
300
301 m_dir = glm::normalize( SFVEC3F( m_viewMatrixInverse *
302 glm::vec4( SFVEC3F( 0.0, 0.0, 1.0 ), 0.0 ) ) );
303
304 m_pos = SFVEC3F( m_viewMatrixInverse * glm::vec4( SFVEC3F( 0.0, 0.0, 0.0 ), 1.0 ) );
305
306 /*
307 * Frustum is a implementation based on a tutorial by
308 * http://www.lighthouse3d.com/tutorials/view-frustum-culling/
309 */
310
311 const SFVEC3F half_right_nw = m_right * m_frustum.nw * 0.5f;
312 const SFVEC3F half_right_fw = m_right * m_frustum.fw * 0.5f;
313 const SFVEC3F half_up_nh = m_up * m_frustum.nh * 0.5f;
314 const SFVEC3F half_up_fh = m_up * m_frustum.fh * 0.5f;
315
316 // compute the centers of the near and far planes
319
320 // compute the 4 corners of the frustum on the near plane
321 m_frustum.ntl = m_frustum.nc + half_up_nh - half_right_nw;
322 m_frustum.ntr = m_frustum.nc + half_up_nh + half_right_nw;
323 m_frustum.nbl = m_frustum.nc - half_up_nh - half_right_nw;
324 m_frustum.nbr = m_frustum.nc - half_up_nh + half_right_nw;
325
326 // compute the 4 corners of the frustum on the far plane
327 m_frustum.ftl = m_frustum.fc + half_up_fh - half_right_fw;
328 m_frustum.ftr = m_frustum.fc + half_up_fh + half_right_fw;
329 m_frustum.fbl = m_frustum.fc - half_up_fh - half_right_fw;
330 m_frustum.fbr = m_frustum.fc - half_up_fh + half_right_fw;
331
332 if( ( m_windowSize.x > 0 ) && ( m_windowSize.y > 0 ) )
333 {
334 // Reserve size for precalc values
335 m_right_nX.resize( m_windowSize.x + 1 );
336 m_up_nY.resize( m_windowSize.y + 1 );
337
338 // Precalc X values for camera -> ray generation
339 for( unsigned int x = 0; x < ( (unsigned int) m_windowSize.x + 1 ); ++x )
340 m_right_nX[x] = half_right_nw * m_scr_nX[x];
341
342 // Precalc Y values for camera -> ray generation
343 for( unsigned int y = 0; y < ( (unsigned int) m_windowSize.y + 1 ); ++y )
344 m_up_nY[y] = half_up_nh * m_scr_nY[y];
345 }
346}
SFVEC3F ntr
Near Top Right.
Definition: camera.h:52
SFVEC3F ntl
Near Top Left.
Definition: camera.h:51
SFVEC3F fc
Definition: camera.h:50
SFVEC3F ftl
Far Top Left.
Definition: camera.h:55
SFVEC3F fbr
Far Bottom Right.
Definition: camera.h:58
SFVEC3F nbl
Near Bottom Left.
Definition: camera.h:53
SFVEC3F nbr
Near Bottom Right.
Definition: camera.h:54
SFVEC3F fbl
Far Bottom Left.
Definition: camera.h:57
SFVEC3F ftr
Far Top Right.
Definition: camera.h:56

References CAMERA_FRUSTUM::farD, CAMERA_FRUSTUM::fbl, CAMERA_FRUSTUM::fbr, CAMERA_FRUSTUM::fc, CAMERA_FRUSTUM::fh, CAMERA_FRUSTUM::ftl, CAMERA_FRUSTUM::ftr, CAMERA_FRUSTUM::fw, m_dir, m_frustum, m_pos, m_right, m_right_nX, m_scr_nX, m_scr_nY, m_up, m_up_nY, m_viewMatrix, m_viewMatrixInverse, m_windowSize, CAMERA_FRUSTUM::nbl, CAMERA_FRUSTUM::nbr, CAMERA_FRUSTUM::nc, CAMERA_FRUSTUM::nearD, CAMERA_FRUSTUM::nh, CAMERA_FRUSTUM::ntl, CAMERA_FRUSTUM::ntr, and CAMERA_FRUSTUM::nw.

Referenced by TRACK_BALL::Drag(), TRACK_BALL::Pan(), rebuildProjection(), ResetXYpos(), SetBoardLookAtPos(), Update(), and updateRotationMatrix().

◆ updateRotationMatrix()

void CAMERA::updateRotationMatrix ( )
protected

Definition at line 162 of file camera.cpp.

163{
164 m_rotationMatrixAux = glm::rotate( glm::mat4( 1.0f ), m_rotate_aux.x,
165 SFVEC3F( 1.0f, 0.0f, 0.0f ) );
167
169 SFVEC3F( 0.0f, 1.0f, 0.0f ) );
171
173 SFVEC3F( 0.0f, 0.0f, 1.0f ) );
175
176 m_parametersChanged = true;
177
180}
void normalise2PI(float &aAngle)
Definition: camera.cpp:34

References m_parametersChanged, m_rotate_aux, m_rotationMatrixAux, normalise2PI(), updateFrustum(), and updateViewMatrix().

Referenced by Interpolate(), Reset(), RotateX(), RotateY(), and RotateZ().

◆ updateViewMatrix()

void CAMERA::updateViewMatrix ( )
protected

Definition at line 154 of file camera.cpp.

155{
156 m_viewMatrix = glm::translate( glm::mat4( 1.0f ), m_camera_pos ) *
158 glm::translate( glm::mat4( 1.0f ), -m_lookat_pos );
159}

References m_camera_pos, m_lookat_pos, m_rotationMatrix, m_rotationMatrixAux, and m_viewMatrix.

Referenced by TRACK_BALL::Drag(), TRACK_BALL::Pan(), Reset(), ResetXYpos(), SetBoardLookAtPos(), updateRotationMatrix(), Zoom(), zoomChanged(), and ZoomReset().

◆ Zoom()

bool CAMERA::Zoom ( float  aFactor)

Definition at line 539 of file camera.cpp.

540{
541 if( ( m_zoom <= m_minZoom && aFactor > 1 ) || ( m_zoom >= m_maxZoom && aFactor < 1 )
542 || aFactor == 1 )
543 {
544 return false;
545 }
546
547 float zoom = m_zoom;
548 m_zoom /= aFactor;
549
550 if( m_zoom <= m_minZoom && aFactor > 1 )
551 {
552 aFactor = zoom / m_minZoom;
554 }
555 else if( m_zoom >= m_maxZoom && aFactor < 1 )
556 {
557 aFactor = zoom / m_maxZoom;
559 }
560
561 m_camera_pos.z /= aFactor;
562
565
566 return true;
567}

References m_camera_pos, m_maxZoom, m_minZoom, m_zoom, rebuildProjection(), updateViewMatrix(), and zoom.

Referenced by EDA_3D_MODEL_VIEWER::OnMouseWheel(), HIDPI_GL_3D_CANVAS::OnMouseWheelCamera(), and NL_3D_VIEWER_PLUGIN_IMPL::SetViewExtents().

◆ Zoom_T1()

bool CAMERA::Zoom_T1 ( float  aFactor)

Definition at line 570 of file camera.cpp.

571{
572 if( ( m_zoom <= m_minZoom && aFactor > 1 ) || ( m_zoom >= m_maxZoom && aFactor < 1 )
573 || aFactor == 1 )
574 {
575 return false;
576 }
577
578 m_zoom_t1 = m_zoom / aFactor;
579
580 if( m_zoom_t1 < m_minZoom )
582
583 if( m_zoom_t1 > m_maxZoom )
585
587
588 return true;
589}

References m_camera_pos_init, m_camera_pos_t1, m_maxZoom, m_minZoom, m_zoom, and m_zoom_t1.

Referenced by EDA_3D_CANVAS::SetView3D().

◆ zoomChanged()

void CAMERA::zoomChanged ( )
protected

Definition at line 139 of file camera.cpp.

140{
141 if( m_zoom < m_minZoom )
143
144 if( m_zoom > m_maxZoom )
146
148
151}

References m_camera_pos, m_camera_pos_init, m_maxZoom, m_minZoom, m_zoom, rebuildProjection(), and updateViewMatrix().

Referenced by SetMaxZoom(), and SetMinZoom().

◆ ZoomReset()

void CAMERA::ZoomReset ( )

Definition at line 528 of file camera.cpp.

529{
530 m_zoom = 1.0f;
531
533
536}

References m_camera_pos, m_camera_pos_init, m_zoom, rebuildProjection(), and updateViewMatrix().

Member Data Documentation

◆ m_board_lookat_pos_init

SFVEC3F CAMERA::m_board_lookat_pos_init
protected

Default boardlookat position (the board center).

Definition at line 331 of file camera.h.

Referenced by CAMERA(), Reset(), Reset_T1(), and SetBoardLookAtPos().

◆ m_camera_pos

◆ m_camera_pos_init

SFVEC3F CAMERA::m_camera_pos_init
protected

◆ m_camera_pos_t0

SFVEC3F CAMERA::m_camera_pos_t0
protected

Definition at line 325 of file camera.h.

Referenced by Interpolate(), Reset(), and SetT0_and_T1_current_T().

◆ m_camera_pos_t1

SFVEC3F CAMERA::m_camera_pos_t1
protected

◆ m_dir

SFVEC3F CAMERA::m_dir
protected

Definition at line 318 of file camera.h.

Referenced by GetDir(), MakeRay(), and updateFrustum().

◆ m_focalLen

SFVEC2F CAMERA::m_focalLen
protected

Definition at line 321 of file camera.h.

Referenced by GetFocalLen(), and rebuildProjection().

◆ m_frustum

CAMERA_FRUSTUM CAMERA::m_frustum
protected

◆ m_interpolation_mode

CAMERA_INTERPOLATION CAMERA::m_interpolation_mode
protected

Definition at line 337 of file camera.h.

Referenced by CAMERA(), TRACK_BALL::Interpolate(), and SetInterpolateMode().

◆ m_lastPosition

wxPoint CAMERA::m_lastPosition
protected

The last mouse position in the screen.

Definition at line 304 of file camera.h.

Referenced by TRACK_BALL::Drag(), GetCurMousePosition(), MakeRayAtCurrentMousePosition(), TRACK_BALL::Pan(), Reset(), and SetCurMousePosition().

◆ m_lookat_pos

SFVEC3F CAMERA::m_lookat_pos
protected

◆ m_lookat_pos_t0

SFVEC3F CAMERA::m_lookat_pos_t0
protected

Definition at line 329 of file camera.h.

Referenced by Interpolate(), Reset(), and SetT0_and_T1_current_T().

◆ m_lookat_pos_t1

SFVEC3F CAMERA::m_lookat_pos_t1
protected

◆ m_maxZoom

float CAMERA::m_maxZoom
protected

◆ m_minZoom

float CAMERA::m_minZoom
protected

Possible 3D zoom range.

Definition at line 293 of file camera.h.

Referenced by CAMERA(), GetMinZoom(), SetMinZoom(), SetViewMatrix(), Zoom(), Zoom_T1(), and zoomChanged().

◆ m_parametersChanged

bool CAMERA::m_parametersChanged
protected

Set to true if any of the parameters in the camera was changed.

Definition at line 355 of file camera.h.

Referenced by TRACK_BALL::Drag(), Interpolate(), TRACK_BALL::Pan(), ParametersChanged(), ParametersChangedQuery(), Reset(), ResetXYpos(), SetBoardLookAtPos(), SetRotationMatrix(), and updateRotationMatrix().

◆ m_pos

SFVEC3F CAMERA::m_pos
protected

Definition at line 319 of file camera.h.

Referenced by GetPos(), MakeRay(), and updateFrustum().

◆ m_projectionMatrix

glm::mat4 CAMERA::m_projectionMatrix
protected

Definition at line 310 of file camera.h.

Referenced by GetProjectionMatrix(), rebuildProjection(), and Reset().

◆ m_projectionMatrixInv

glm::mat4 CAMERA::m_projectionMatrixInv
protected

Definition at line 311 of file camera.h.

Referenced by GetProjectionMatrixInv(), rebuildProjection(), and Reset().

◆ m_projectionType

PROJECTION_TYPE CAMERA::m_projectionType
protected

◆ m_right

SFVEC3F CAMERA::m_right
protected

Definition at line 316 of file camera.h.

Referenced by GetRight(), and updateFrustum().

◆ m_right_nX

std::vector< SFVEC3F > CAMERA::m_right_nX
protected

Precalc values array used to calc ray for each pixel, for X and Y axis of each new camera position.

Definition at line 349 of file camera.h.

Referenced by MakeRay(), and updateFrustum().

◆ m_rotate_aux

SFVEC3F CAMERA::m_rotate_aux
protected

Stores the rotation angle auxiliary.

Definition at line 333 of file camera.h.

Referenced by Interpolate(), Reset(), RotateX(), RotateY(), RotateZ(), SetT0_and_T1_current_T(), and updateRotationMatrix().

◆ m_rotate_aux_t0

SFVEC3F CAMERA::m_rotate_aux_t0
protected

Definition at line 334 of file camera.h.

Referenced by Interpolate(), Reset(), Reset_T1(), and SetT0_and_T1_current_T().

◆ m_rotate_aux_t1

SFVEC3F CAMERA::m_rotate_aux_t1
protected

◆ m_rotationMatrix

◆ m_rotationMatrixAux

glm::mat4 CAMERA::m_rotationMatrixAux
protected

◆ m_scr_nX

std::vector< float > CAMERA::m_scr_nX
protected

Precalc values array used to calc ray for each pixel (constant for the same window size).

Definition at line 342 of file camera.h.

Referenced by rebuildProjection(), Reset(), and updateFrustum().

◆ m_scr_nY

std::vector< float > CAMERA::m_scr_nY
protected

Definition at line 343 of file camera.h.

Referenced by rebuildProjection(), Reset(), and updateFrustum().

◆ m_up

SFVEC3F CAMERA::m_up
protected

Definition at line 317 of file camera.h.

Referenced by GetUp(), and updateFrustum().

◆ m_up_nY

std::vector< SFVEC3F > CAMERA::m_up_nY
protected

Definition at line 350 of file camera.h.

Referenced by MakeRay(), and updateFrustum().

◆ m_viewMatrix

glm::mat4 CAMERA::m_viewMatrix
protected

Definition at line 308 of file camera.h.

Referenced by GetViewMatrix(), Reset(), SetViewMatrix(), updateFrustum(), and updateViewMatrix().

◆ m_viewMatrixInverse

glm::mat4 CAMERA::m_viewMatrixInverse
protected

Definition at line 309 of file camera.h.

Referenced by GetViewMatrix_Inv(), Reset(), and updateFrustum().

◆ m_windowSize

SFVEC2I CAMERA::m_windowSize
protected

The window size that this camera is working.

Definition at line 299 of file camera.h.

Referenced by CAMERA(), TRACK_BALL::Drag(), MakeRay(), MakeRayAtCurrentMousePosition(), TRACK_BALL::Pan(), rebuildProjection(), SetCurWindowSize(), and updateFrustum().

◆ m_zoom

float CAMERA::m_zoom
protected

3D zoom value – Z-distance is scaled by it

Definition at line 286 of file camera.h.

Referenced by GetZoom(), Interpolate(), rebuildProjection(), Reset(), SetT0_and_T1_current_T(), SetViewMatrix(), Zoom(), Zoom_T1(), zoomChanged(), and ZoomReset().

◆ m_zoom_t0

float CAMERA::m_zoom_t0
protected

Definition at line 287 of file camera.h.

Referenced by Interpolate(), Reset(), and SetT0_and_T1_current_T().

◆ m_zoom_t1

float CAMERA::m_zoom_t1
protected

Definition at line 288 of file camera.h.

Referenced by Interpolate(), Reset(), Reset_T1(), SetT0_and_T1_current_T(), and Zoom_T1().


The documentation for this class was generated from the following files: