Remove default zoom level from camera constructor
Initial distance should be sufficient to determine default zoom.
This commit is contained in:
parent
5475303ec2
commit
afccea34a5
|
@ -86,7 +86,7 @@ EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER( wxWindow* aParent, const int* aAttribL
|
||||||
S3D_CACHE* aCacheManager ) :
|
S3D_CACHE* aCacheManager ) :
|
||||||
HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
|
HIDPI_GL_CANVAS( aParent, wxID_ANY, aAttribList, wxDefaultPosition, wxDefaultSize,
|
||||||
wxFULL_REPAINT_ON_RESIZE ),
|
wxFULL_REPAINT_ON_RESIZE ),
|
||||||
m_trackBallCamera( RANGE_SCALE_3D * 2.0f, 0.38f ),
|
m_trackBallCamera( RANGE_SCALE_3D * 4.0f ),
|
||||||
m_cacheManager( aCacheManager )
|
m_cacheManager( aCacheManager )
|
||||||
{
|
{
|
||||||
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER" ) );
|
wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::EDA_3D_MODEL_VIEWER" ) );
|
||||||
|
|
|
@ -48,16 +48,14 @@ const wxChar *CAMERA::m_logTrace = wxT( "KI_TRACE_CAMERA" );
|
||||||
|
|
||||||
|
|
||||||
#define MIN_ZOOM 0.10f
|
#define MIN_ZOOM 0.10f
|
||||||
#define MAX_ZOOM 1.25f
|
#define MAX_ZOOM 2.00f
|
||||||
|
|
||||||
|
|
||||||
CAMERA::CAMERA( float aRangeScale, float aDefaultZoom )
|
CAMERA::CAMERA( float aInitialDistance )
|
||||||
{
|
{
|
||||||
wxLogTrace( m_logTrace, wxT( "CAMERA::CAMERA" ) );
|
wxLogTrace( m_logTrace, wxT( "CAMERA::CAMERA" ) );
|
||||||
|
|
||||||
m_range_scale = aRangeScale;
|
m_camera_pos_init = SFVEC3F( 0.0f, 0.0f, -aInitialDistance );
|
||||||
m_default_zoom = aDefaultZoom;
|
|
||||||
m_camera_pos_init = SFVEC3F( 0.0f, 0.0f, -(aRangeScale * 2.0f ) );
|
|
||||||
m_board_lookat_pos_init = SFVEC3F( 0.0f );
|
m_board_lookat_pos_init = SFVEC3F( 0.0f );
|
||||||
m_windowSize = SFVEC2I( 0, 0 );
|
m_windowSize = SFVEC2I( 0, 0 );
|
||||||
m_projectionType = PROJECTION_TYPE::PERSPECTIVE;
|
m_projectionType = PROJECTION_TYPE::PERSPECTIVE;
|
||||||
|
@ -76,9 +74,9 @@ void CAMERA::Reset()
|
||||||
m_rotationMatrixAux = glm::mat4( 1.0f );
|
m_rotationMatrixAux = glm::mat4( 1.0f );
|
||||||
m_lastPosition = wxPoint( 0, 0 );
|
m_lastPosition = wxPoint( 0, 0 );
|
||||||
|
|
||||||
m_zoom = m_default_zoom;
|
m_zoom = 1.0f;
|
||||||
m_zoom_t0 = m_default_zoom;
|
m_zoom_t0 = 1.0f;
|
||||||
m_zoom_t1 = m_default_zoom;
|
m_zoom_t1 = 1.0f;
|
||||||
m_camera_pos = m_camera_pos_init;
|
m_camera_pos = m_camera_pos_init;
|
||||||
m_camera_pos_t0 = m_camera_pos_init;
|
m_camera_pos_t0 = m_camera_pos_init;
|
||||||
m_camera_pos_t1 = m_camera_pos_init;
|
m_camera_pos_t1 = m_camera_pos_init;
|
||||||
|
@ -102,7 +100,7 @@ void CAMERA::Reset()
|
||||||
void CAMERA::Reset_T1()
|
void CAMERA::Reset_T1()
|
||||||
{
|
{
|
||||||
m_camera_pos_t1 = m_camera_pos_init;
|
m_camera_pos_t1 = m_camera_pos_init;
|
||||||
m_zoom_t1 = m_default_zoom;
|
m_zoom_t1 = 1.0f;
|
||||||
m_rotate_aux_t1 = SFVEC3F( 0.0f );
|
m_rotate_aux_t1 = SFVEC3F( 0.0f );
|
||||||
m_lookat_pos_t1 = m_board_lookat_pos_init;
|
m_lookat_pos_t1 = m_board_lookat_pos_init;
|
||||||
|
|
||||||
|
|
|
@ -80,11 +80,9 @@ public:
|
||||||
/**
|
/**
|
||||||
* Initialize a camera.
|
* Initialize a camera.
|
||||||
*
|
*
|
||||||
* @param aRangeScale it will be expected that the board will have a
|
* @param aInitialDistance Initial Z-distance to the board
|
||||||
* -aRangeScale/2 to +aRangeScale/2. It will initialize the
|
|
||||||
* Z position with aRangeScale.
|
|
||||||
*/
|
*/
|
||||||
explicit CAMERA( float aRangeScale, float aDefaultZoom );
|
explicit CAMERA( float aInitialDistance );
|
||||||
|
|
||||||
virtual ~CAMERA()
|
virtual ~CAMERA()
|
||||||
{
|
{
|
||||||
|
@ -245,17 +243,8 @@ protected:
|
||||||
void updateRotationMatrix();
|
void updateRotationMatrix();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The nominal range expected to be used in the camera.
|
* 3D zoom value -- Z-distance is scaled by it
|
||||||
*
|
|
||||||
* It will be used to initialize the Z position
|
|
||||||
*/
|
*/
|
||||||
float m_range_scale;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 3D zoom value (Min 0.0 ... Max 1.0)
|
|
||||||
*/
|
|
||||||
float m_default_zoom;
|
|
||||||
float m_zoom;
|
float m_zoom;
|
||||||
float m_zoom_t0;
|
float m_zoom_t0;
|
||||||
float m_zoom_t1;
|
float m_zoom_t1;
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
|
|
||||||
|
|
||||||
TRACK_BALL::TRACK_BALL( float aRangeScale, float aDefaultZoom ) :
|
TRACK_BALL::TRACK_BALL( float aInitialDistance ) :
|
||||||
CAMERA( aRangeScale, aDefaultZoom )
|
CAMERA( aInitialDistance )
|
||||||
{
|
{
|
||||||
wxLogTrace( m_logTrace, wxT( "TRACK_BALL::TRACK_BALL" ) );
|
wxLogTrace( m_logTrace, wxT( "TRACK_BALL::TRACK_BALL" ) );
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
class TRACK_BALL : public CAMERA
|
class TRACK_BALL : public CAMERA
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit TRACK_BALL( float aRangeScale, float aDefaultZoom );
|
explicit TRACK_BALL( float aInitialDistance );
|
||||||
|
|
||||||
virtual ~TRACK_BALL()
|
virtual ~TRACK_BALL()
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,7 +90,7 @@ EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME( KIWAY *aKiway, PCB_BASE_FRAME *aParent
|
||||||
m_mainToolBar( nullptr ),
|
m_mainToolBar( nullptr ),
|
||||||
m_canvas( nullptr ),
|
m_canvas( nullptr ),
|
||||||
m_currentCamera( m_trackBallCamera ),
|
m_currentCamera( m_trackBallCamera ),
|
||||||
m_trackBallCamera( RANGE_SCALE_3D, 0.66f )
|
m_trackBallCamera( 2 * RANGE_SCALE_3D )
|
||||||
{
|
{
|
||||||
wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME %s", aTitle );
|
wxLogTrace( m_logTrace, "EDA_3D_VIEWER_FRAME::EDA_3D_VIEWER_FRAME %s", aTitle );
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL( wxWindow* aParent, PCB_BASE_FRAM
|
||||||
m_infobar( nullptr ),
|
m_infobar( nullptr ),
|
||||||
m_boardAdapter(),
|
m_boardAdapter(),
|
||||||
m_currentCamera( m_trackBallCamera ),
|
m_currentCamera( m_trackBallCamera ),
|
||||||
m_trackBallCamera( RANGE_SCALE_3D, 0.85f )
|
m_trackBallCamera( 2 * RANGE_SCALE_3D )
|
||||||
{
|
{
|
||||||
m_userUnits = aFrame->GetUserUnits();
|
m_userUnits = aFrame->GetUserUnits();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue