KiCad PCB EDA Suite
camera.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2016 Mario Luzeiro <[email protected]>
5 * Copyright (C) 2015-2020 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
29#include "camera.h"
30#include <wx/log.h>
31#include <algorithm>
32
33// A helper function to normalize aAngle between -2PI and +2PI
34inline void normalise2PI( float& aAngle )
35{
36 while( aAngle > 0.0 )
37 aAngle -= static_cast<float>( M_PI * 2.0f );
38
39 while( aAngle < 0.0 )
40 aAngle += static_cast<float>( M_PI * 2.0f );
41}
42
43
47const wxChar *CAMERA::m_logTrace = wxT( "KI_TRACE_CAMERA" );
48
49const float CAMERA::DEFAULT_MIN_ZOOM = 0.020f;
50const float CAMERA::DEFAULT_MAX_ZOOM = 2.0f;
51
52
53CAMERA::CAMERA( float aInitialDistance )
54{
55 wxLogTrace( m_logTrace, wxT( "CAMERA::CAMERA" ) );
56
57 m_camera_pos_init = SFVEC3F( 0.0f, 0.0f, -aInitialDistance );
59 m_windowSize = SFVEC2I( 0, 0 );
62
65
66 Reset();
67}
68
69
71{
73 m_projectionMatrix = glm::mat4( 1.0f );
74 m_projectionMatrixInv = glm::mat4( 1.0f );
75 m_rotationMatrix = glm::mat4( 1.0f );
76 m_rotationMatrixAux = glm::mat4( 1.0f );
77 m_lastPosition = wxPoint( 0, 0 );
78
79 m_zoom = 1.0f;
80 m_zoom_t0 = 1.0f;
81 m_zoom_t1 = 1.0f;
88
89 m_rotate_aux = SFVEC3F( 0.0f );
90 m_rotate_aux_t0 = SFVEC3F( 0.0f );
91 m_rotate_aux_t1 = SFVEC3F( 0.0f );
92
95 m_viewMatrixInverse = glm::inverse( m_viewMatrix );
96 m_scr_nX.clear();
97 m_scr_nY.clear();
99}
100
101
103{
105 m_zoom_t1 = 1.0f;
106 m_rotate_aux_t1 = SFVEC3F( 0.0f );
108
109 // Since 0 = 2pi, we want to reset the angle to be the closest
110 // one to where we currently are. That ensures that we rotate
111 // the board around the smallest distance getting there.
112 if( m_rotate_aux_t0.x > M_PI )
113 m_rotate_aux_t1.x = static_cast<float>( 2.0f * M_PI );
114
115 if( m_rotate_aux_t0.y > M_PI )
116 m_rotate_aux_t1.y = static_cast<float>( 2.0f * M_PI );
117
118 if( m_rotate_aux_t0.z > M_PI )
119 m_rotate_aux_t1.z = static_cast<float>( 2.0f * M_PI );
120}
121
122
123void CAMERA::SetBoardLookAtPos( const SFVEC3F& aBoardPos )
124{
125 if( m_board_lookat_pos_init != aBoardPos )
126 {
127 m_board_lookat_pos_init = aBoardPos;
128 m_lookat_pos = aBoardPos;
129
130 m_parametersChanged = true;
131
134 }
135}
136
137
139{
140 if( m_zoom < m_minZoom )
142
143 if( m_zoom > m_maxZoom )
145
147
150}
151
152
154{
155 m_viewMatrix = glm::translate( glm::mat4( 1.0f ), m_camera_pos ) *
157 glm::translate( glm::mat4( 1.0f ), -m_lookat_pos );
158}
159
160
162{
163 m_rotationMatrixAux = glm::rotate( glm::mat4( 1.0f ), m_rotate_aux.x,
164 SFVEC3F( 1.0f, 0.0f, 0.0f ) );
166
168 SFVEC3F( 0.0f, 1.0f, 0.0f ) );
170
172 SFVEC3F( 0.0f, 0.0f, 1.0f ) );
174
175 m_parametersChanged = true;
176
179}
180
181
183{
185}
186
187
188void CAMERA::SetRotationMatrix( const glm::mat4& aRotation )
189{
190 m_parametersChanged = true;
191 std::copy_n( glm::value_ptr( aRotation * glm::inverse( m_rotationMatrixAux ) ), 12,
192 glm::value_ptr( m_rotationMatrix ) );
193}
194
195
197{
198 if( ( m_windowSize.x == 0 ) || ( m_windowSize.y == 0 ) )
199 return;
200
201 m_frustum.ratio = (float) m_windowSize.x / (float)m_windowSize.y;
202 m_frustum.farD = glm::length( m_camera_pos_init ) * m_maxZoom * 2.0f;
203
204 switch( m_projectionType )
205 {
206 default:
208
209 m_frustum.nearD = 0.10f;
210
211 m_frustum.angle = 45.0f;
212
213 m_projectionMatrix = glm::perspective( glm::radians( m_frustum.angle ), m_frustum.ratio,
215
217
218 m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
219
220 m_focalLen.x = ( (float)m_windowSize.y / (float)m_windowSize.x ) / m_frustum.tang;
221 m_focalLen.y = 1.0f / m_frustum.tang;
222
227 break;
228
230
231 // Keep the viewed plane at (m_camera_pos_init * m_zoom) the same dimensions in both projections.
232 m_frustum.angle = 45.0f;
233 m_frustum.tang = glm::tan( glm::radians( m_frustum.angle ) * 0.5f );
234
235 m_frustum.nearD = -m_frustum.farD; // Use a symmetrical clip plane for ortho projection
236
237 const float orthoReductionFactor =
238 glm::length( m_camera_pos_init ) * m_zoom * m_frustum.tang;
239
240 // Initialize Projection Matrix for Orthographic View
241 m_projectionMatrix = glm::ortho( -m_frustum.ratio * orthoReductionFactor,
242 m_frustum.ratio * orthoReductionFactor,
243 -orthoReductionFactor,
244 orthoReductionFactor,
246
248
249 m_frustum.nw = orthoReductionFactor * 2.0f * m_frustum.ratio;
250 m_frustum.nh = orthoReductionFactor * 2.0f;
253
254 break;
255 }
256
257 if( ( m_windowSize.x > 0 ) && ( m_windowSize.y > 0 ) )
258 {
259 m_scr_nX.resize( m_windowSize.x + 1 );
260 m_scr_nY.resize( m_windowSize.y + 1 );
261
262 // Precalc X values for camera -> ray generation
263 for( unsigned int x = 0; x < (unsigned int)m_windowSize.x + 1; ++x )
264 {
265 // Converts 0.0 .. 1.0
266 const float xNormalizedDeviceCoordinates = ( ( (float)x + 0.5f ) /
267 (m_windowSize.x - 0.0f) );
268
269 // Converts -1.0 .. 1.0
270 m_scr_nX[x] = 2.0f * xNormalizedDeviceCoordinates - 1.0f;
271 }
272
273 // Precalc Y values for camera -> ray generation
274 for( unsigned int y = 0; y < (unsigned int)m_windowSize.y + 1 ; ++y )
275 {
276 // Converts 0.0 .. 1.0
277 const float yNormalizedDeviceCoordinates = ( ( (float)y + 0.5f ) /
278 (m_windowSize.y - 0.0f) );
279
280 // Converts -1.0 .. 1.0
281 m_scr_nY[y] = 2.0f * yNormalizedDeviceCoordinates - 1.0f;
282 }
283
285 }
286}
287
288
290{
291 // Update matrix and vectors
292 m_viewMatrixInverse = glm::inverse( m_viewMatrix );
293
294 m_right = glm::normalize( SFVEC3F( m_viewMatrixInverse *
295 glm::vec4( SFVEC3F( 1.0, 0.0, 0.0 ), 0.0 ) ) );
296
297 m_up = glm::normalize( SFVEC3F( m_viewMatrixInverse *
298 glm::vec4( SFVEC3F( 0.0, 1.0, 0.0 ), 0.0 ) ) );
299
300 m_dir = glm::normalize( SFVEC3F( m_viewMatrixInverse *
301 glm::vec4( SFVEC3F( 0.0, 0.0, 1.0 ), 0.0 ) ) );
302
303 m_pos = SFVEC3F( m_viewMatrixInverse * glm::vec4( SFVEC3F( 0.0, 0.0, 0.0 ), 1.0 ) );
304
305 /*
306 * Frustum is a implementation based on a tutorial by
307 * http://www.lighthouse3d.com/tutorials/view-frustum-culling/
308 */
309
310 const SFVEC3F half_right_nw = m_right * m_frustum.nw * 0.5f;
311 const SFVEC3F half_right_fw = m_right * m_frustum.fw * 0.5f;
312 const SFVEC3F half_up_nh = m_up * m_frustum.nh * 0.5f;
313 const SFVEC3F half_up_fh = m_up * m_frustum.fh * 0.5f;
314
315 // compute the centers of the near and far planes
318
319 // compute the 4 corners of the frustum on the near plane
320 m_frustum.ntl = m_frustum.nc + half_up_nh - half_right_nw;
321 m_frustum.ntr = m_frustum.nc + half_up_nh + half_right_nw;
322 m_frustum.nbl = m_frustum.nc - half_up_nh - half_right_nw;
323 m_frustum.nbr = m_frustum.nc - half_up_nh + half_right_nw;
324
325 // compute the 4 corners of the frustum on the far plane
326 m_frustum.ftl = m_frustum.fc + half_up_fh - half_right_fw;
327 m_frustum.ftr = m_frustum.fc + half_up_fh + half_right_fw;
328 m_frustum.fbl = m_frustum.fc - half_up_fh - half_right_fw;
329 m_frustum.fbr = m_frustum.fc - half_up_fh + half_right_fw;
330
331 if( ( m_windowSize.x > 0 ) && ( m_windowSize.y > 0 ) )
332 {
333 // Reserve size for precalc values
334 m_right_nX.resize( m_windowSize.x + 1 );
335 m_up_nY.resize( m_windowSize.y + 1 );
336
337 // Precalc X values for camera -> ray generation
338 for( unsigned int x = 0; x < ( (unsigned int) m_windowSize.x + 1 ); ++x )
339 m_right_nX[x] = half_right_nw * m_scr_nX[x];
340
341 // Precalc Y values for camera -> ray generation
342 for( unsigned int y = 0; y < ( (unsigned int) m_windowSize.y + 1 ); ++y )
343 m_up_nY[y] = half_up_nh * m_scr_nY[y];
344 }
345}
346
347
348void CAMERA::MakeRay( const SFVEC2I& aWindowPos, SFVEC3F& aOutOrigin,
349 SFVEC3F& aOutDirection ) const
350{
351 wxASSERT( aWindowPos.x < m_windowSize.x );
352 wxASSERT( aWindowPos.y < m_windowSize.y );
353
354 aOutOrigin = m_frustum.nc + m_up_nY[aWindowPos.y] + m_right_nX[aWindowPos.x];
355
356 switch( m_projectionType )
357 {
358 default:
360 aOutDirection = glm::normalize( aOutOrigin - m_pos );
361 break;
362
364 aOutDirection = -m_dir + SFVEC3F( FLT_EPSILON );
365 break;
366 }
367}
368
369
370void CAMERA::MakeRay( const SFVEC2F& aWindowPos, SFVEC3F& aOutOrigin,
371 SFVEC3F& aOutDirection ) const
372{
373 wxASSERT( aWindowPos.x < (float)m_windowSize.x );
374 wxASSERT( aWindowPos.y < (float)m_windowSize.y );
375
376 const SFVEC2F floorWinPos_f = glm::floor( aWindowPos );
377 const SFVEC2I floorWinPos_i = (SFVEC2I)floorWinPos_f;
378 const SFVEC2F relativeWinPos = aWindowPos - floorWinPos_f;
379
380 // Note: size of vectors m_up and m_right are m_windowSize + 1
381 const SFVEC3F up_plus_right = m_up_nY[floorWinPos_i.y] * (1.0f - relativeWinPos.y) +
382 m_up_nY[floorWinPos_i.y + 1] * relativeWinPos.y +
383 m_right_nX[floorWinPos_i.x] * (1.0f - relativeWinPos.x) +
384 m_right_nX[floorWinPos_i.x + 1] * relativeWinPos.x;
385
386 aOutOrigin = up_plus_right + m_frustum.nc;
387
388 switch( m_projectionType )
389 {
390 default:
392 aOutDirection = glm::normalize( aOutOrigin - m_pos );
393 break;
394
396 aOutDirection = -m_dir + SFVEC3F( FLT_EPSILON );
397 break;
398 }
399}
400
401
402void CAMERA::MakeRayAtCurrentMousePosition( SFVEC3F& aOutOrigin, SFVEC3F& aOutDirection ) const
403{
404 const SFVEC2I windowPos = SFVEC2I( m_lastPosition.x, m_windowSize.y - m_lastPosition.y );
405
406 if( ( 0 < windowPos.x ) && ( windowPos.x < m_windowSize.x ) &&
407 ( 0 < windowPos.y ) && ( windowPos.y < m_windowSize.y ) )
408 {
409 MakeRay( windowPos, aOutOrigin, aOutDirection );
410 }
411}
412
413
414const glm::mat4& CAMERA::GetProjectionMatrix() const
415{
416 return m_projectionMatrix;
417}
418
419
420const glm::mat4& CAMERA::GetProjectionMatrixInv() const
421{
423}
424
425
427{
428 return -m_camera_pos_init.z * m_frustum.tang;
429}
430
431
433{
434 m_parametersChanged = true;
435 m_camera_pos.x = 0.0f;
436 m_camera_pos.y = 0.0f;
437
440}
441
442
444{
445 m_camera_pos_t1.x = 0.0f;
446 m_camera_pos_t1.y = 0.0f;
447}
448
449
450const glm::mat4& CAMERA::GetViewMatrix() const
451{
452 return m_viewMatrix;
453}
454
455
456void CAMERA::SetViewMatrix( glm::mat4 aViewMatrix )
457{
458 SetRotationMatrix( aViewMatrix );
459
460 // The look at position in the view frame.
461 glm::vec4 lookat = aViewMatrix * glm::vec4( m_lookat_pos, 1.0f );
462
463 wxLogTrace( m_logTrace,
464 wxT( "CAMERA::SetViewMatrix aViewMatrix[3].z =%f, old_zoom=%f, new_zoom=%f, "
465 "m[3].z=%f" ),
466 aViewMatrix[3].z, m_zoom, lookat.z / m_camera_pos_init.z, lookat.z );
467
468 m_zoom = lookat.z / m_camera_pos_init.z;
469
470 if( m_zoom > m_maxZoom )
471 {
473 aViewMatrix[3].z += -lookat.z + m_maxZoom * m_camera_pos_init.z;
474 }
475 else if( m_zoom < m_minZoom )
476 {
478 aViewMatrix[3].z += -lookat.z + m_minZoom * m_camera_pos_init.z;
479 }
480
481 m_viewMatrix = std::move( aViewMatrix );
483 * glm::inverse( m_rotationMatrix * m_rotationMatrixAux
484 * glm::translate( glm::mat4( 1.0f ), -m_lookat_pos ) )[3];
485}
486
487
488const glm::mat4& CAMERA::GetViewMatrix_Inv() const
489{
490 return m_viewMatrixInverse;
491}
492
493
494void CAMERA::SetCurMousePosition( const wxPoint& aNewMousePosition )
495{
496 m_lastPosition = aNewMousePosition;
497}
498
499
501{
504 else
506
508}
509
510
511bool CAMERA::SetCurWindowSize( const wxSize& aSize )
512{
513 const SFVEC2I newSize = SFVEC2I( aSize.x, aSize.y );
514
515 if( m_windowSize != newSize )
516 {
517 m_windowSize = newSize;
519
520 return true;
521 }
522
523 return false;
524}
525
526
528{
529 m_zoom = 1.0f;
530
532
535}
536
537
538bool CAMERA::Zoom( float aFactor )
539{
540 if( ( m_zoom <= m_minZoom && aFactor > 1 ) || ( m_zoom >= m_maxZoom && aFactor < 1 )
541 || aFactor == 1 )
542 {
543 return false;
544 }
545
546 float zoom = m_zoom;
547 m_zoom /= aFactor;
548
549 if( m_zoom <= m_minZoom && aFactor > 1 )
550 {
551 aFactor = zoom / m_minZoom;
553 }
554 else if( m_zoom >= m_maxZoom && aFactor < 1 )
555 {
556 aFactor = zoom / m_maxZoom;
558 }
559
560 m_camera_pos.z /= aFactor;
561
564
565 return true;
566}
567
568
569bool CAMERA::Zoom_T1( float aFactor )
570{
571 if( ( m_zoom <= m_minZoom && aFactor > 1 ) || ( m_zoom >= m_maxZoom && aFactor < 1 )
572 || aFactor == 1 )
573 {
574 return false;
575 }
576
577 m_zoom_t1 = m_zoom / aFactor;
578
579 if( m_zoom_t1 < m_minZoom )
581
582 if( m_zoom_t1 > m_maxZoom )
584
586
587 return true;
588}
589
590
591void CAMERA::RotateX( float aAngleInRadians )
592{
593 m_rotate_aux.x += aAngleInRadians;
595}
596
597
598void CAMERA::RotateY( float aAngleInRadians )
599{
600 m_rotate_aux.y += aAngleInRadians;
602}
603
604
605void CAMERA::RotateZ( float aAngleInRadians )
606{
607 m_rotate_aux.z += aAngleInRadians;
609}
610
611
612void CAMERA::RotateX_T1( float aAngleInRadians )
613{
614 m_rotate_aux_t1.x += aAngleInRadians;
615}
616
617
618void CAMERA::RotateY_T1( float aAngleInRadians )
619{
620 m_rotate_aux_t1.y += aAngleInRadians;
621}
622
623
624void CAMERA::RotateZ_T1( float aAngleInRadians )
625{
626 m_rotate_aux_t1.z += aAngleInRadians;
627}
628
629
631{
636
641}
642
643
644void CAMERA::Interpolate( float t )
645{
646 wxASSERT( t >= 0.0f );
647
648 const float t0 = 1.0f - t;
649
653 m_zoom = m_zoom_t0 * t0 + m_zoom_t1 * t;
654
655 m_parametersChanged = true;
656
659}
660
661
663{
664 const bool parametersChanged = m_parametersChanged;
665
666 m_parametersChanged = false;
667
668 return parametersChanged;
669}
void normalise2PI(float &aAngle)
Definition: camera.cpp:34
Define an abstract camera.
glm::mat4 GetRotationMatrix() const
Get the rotation matrix to be applied in a transformation camera.
Definition: camera.cpp:182
float m_zoom_t0
Definition: camera.h:290
bool m_parametersChanged
Set to true if any of the parameters in the camera was changed.
Definition: camera.h:358
void RotateY(float aAngleInRadians)
Definition: camera.cpp:598
glm::mat4 m_projectionMatrixInv
Definition: camera.h:314
void RotateX(float aAngleInRadians)
Definition: camera.cpp:591
SFVEC3F m_lookat_pos
Definition: camera.h:331
const glm::mat4 & GetProjectionMatrix() const
Definition: camera.cpp:414
void SetBoardLookAtPos(const SFVEC3F &aBoardPos)
Definition: camera.cpp:123
bool Zoom(float aFactor)
Definition: camera.cpp:538
SFVEC3F m_camera_pos_t0
Definition: camera.h:328
void RotateY_T1(float aAngleInRadians)
Definition: camera.cpp:618
virtual void Reset()
Reset the camera to initial state.
Definition: camera.cpp:70
SFVEC3F m_right
Definition: camera.h:319
glm::mat4 m_projectionMatrix
Definition: camera.h:313
CAMERA_INTERPOLATION m_interpolation_mode
Definition: camera.h:340
SFVEC3F m_rotate_aux_t1
Definition: camera.h:338
wxPoint m_lastPosition
The last mouse position in the screen.
Definition: camera.h:307
void ZoomReset()
Definition: camera.cpp:527
void ResetXYpos()
Definition: camera.cpp:432
const glm::mat4 & GetViewMatrix_Inv() const
Definition: camera.cpp:488
bool Zoom_T1(float aFactor)
Definition: camera.cpp:569
static const float DEFAULT_MIN_ZOOM
Definition: camera.h:80
void updateRotationMatrix()
Definition: camera.cpp:161
SFVEC3F m_rotate_aux_t0
Definition: camera.h:337
virtual void Reset_T1()
Definition: camera.cpp:102
void MakeRay(const SFVEC2I &aWindowPos, SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on a windows screen position.
Definition: camera.cpp:348
static const float DEFAULT_MAX_ZOOM
Definition: camera.h:81
virtual void Interpolate(float t)
It will update the matrix to interpolate between T0 and T1 values.
Definition: camera.cpp:644
SFVEC3F m_dir
Definition: camera.h:321
bool SetCurWindowSize(const wxSize &aSize)
Update the windows size of the camera.
Definition: camera.cpp:511
SFVEC3F m_camera_pos_init
Definition: camera.h:326
CAMERA(float aInitialDistance)
Initialize a camera.
Definition: camera.cpp:53
const glm::mat4 & GetProjectionMatrixInv() const
Definition: camera.cpp:420
void ResetXYpos_T1()
Definition: camera.cpp:443
float m_minZoom
Possible 3D zoom range.
Definition: camera.h:296
float GetCameraMinDimension() const
Definition: camera.cpp:426
float m_maxZoom
Definition: camera.h:297
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:352
void rebuildProjection()
Definition: camera.cpp:196
float m_zoom_t1
Definition: camera.h:291
SFVEC3F m_lookat_pos_t1
Definition: camera.h:333
CAMERA_FRUSTUM m_frustum
Definition: camera.h:317
void updateFrustum()
Definition: camera.cpp:289
SFVEC3F m_lookat_pos_t0
Definition: camera.h:332
void RotateZ(float aAngleInRadians)
Definition: camera.cpp:605
virtual void SetT0_and_T1_current_T()
This will set T0 and T1 with the current values.
Definition: camera.cpp:630
SFVEC3F m_camera_pos
Definition: camera.h:327
PROJECTION_TYPE m_projectionType
Definition: camera.h:315
SFVEC3F m_pos
Definition: camera.h:322
void ToggleProjection()
Definition: camera.cpp:500
SFVEC2I m_windowSize
The window size that this camera is working.
Definition: camera.h:302
void MakeRayAtCurrentMousePosition(SFVEC3F &aOutOrigin, SFVEC3F &aOutDirection) const
Make a ray based on the latest mouse position.
Definition: camera.cpp:402
SFVEC2F m_focalLen
Definition: camera.h:324
void updateViewMatrix()
Definition: camera.cpp:153
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:345
void RotateX_T1(float aAngleInRadians)
Definition: camera.cpp:612
const glm::mat4 & GetViewMatrix() const
Definition: camera.cpp:450
glm::mat4 m_viewMatrixInverse
Definition: camera.h:312
SFVEC3F m_up
Definition: camera.h:320
SFVEC3F m_rotate_aux
Stores the rotation angle auxiliary.
Definition: camera.h:336
glm::mat4 m_rotationMatrixAux
Definition: camera.h:310
glm::mat4 m_rotationMatrix
Definition: camera.h:309
std::vector< float > m_scr_nY
Definition: camera.h:346
void SetViewMatrix(glm::mat4 aViewMatrix)
Set the affine matrix to be applied to a transformation camera.
Definition: camera.cpp:456
void RotateZ_T1(float aAngleInRadians)
Definition: camera.cpp:624
glm::mat4 m_viewMatrix
Definition: camera.h:311
SFVEC3F m_board_lookat_pos_init
Default boardlookat position (the board center).
Definition: camera.h:334
std::vector< SFVEC3F > m_up_nY
Definition: camera.h:353
bool ParametersChanged()
Definition: camera.cpp:662
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:188
SFVEC3F m_camera_pos_t1
Definition: camera.h:329
float m_zoom
3D zoom value – Z-distance is scaled by it
Definition: camera.h:289
void zoomChanged()
Definition: camera.cpp:138
void SetCurMousePosition(const wxPoint &aPosition)
Update the current mouse position without make any new calculations on camera.
Definition: camera.cpp:494
static const wxChar * m_logTrace
Trace mask used to enable or disable the trace output of this class.
Definition: camera.h:367
SFVEC3F ntr
Near Top Right.
Definition: camera.h:52
SFVEC3F ntl
Near Top Left.
Definition: camera.h:51
SFVEC3F fc
Definition: camera.h:50
float angle
Definition: camera.h:59
float ratio
Definition: camera.h:59
float fh
Definition: camera.h:60
float nh
Definition: camera.h:60
SFVEC3F ftl
Far Top Left.
Definition: camera.h:55
SFVEC3F fbr
Far Bottom Right.
Definition: camera.h:58
float fw
Definition: camera.h:60
float farD
Definition: camera.h:59
SFVEC3F nbl
Near Bottom Left.
Definition: camera.h:53
SFVEC3F nc
Definition: camera.h:49
SFVEC3F nbr
Near Bottom Right.
Definition: camera.h:54
float nw
Definition: camera.h:60
SFVEC3F fbl
Far Bottom Left.
Definition: camera.h:57
float tang
Definition: camera.h:59
float nearD
Definition: camera.h:59
SFVEC3F ftr
Far Top Right.
Definition: camera.h:56
glm::ivec2 SFVEC2I
Definition: xv3d_types.h:39
glm::vec2 SFVEC2F
Definition: xv3d_types.h:42
glm::vec3 SFVEC3F
Definition: xv3d_types.h:44