3d-viewer: prevent max zoom+frustum from growing infinitely at reload.
Fixes https://gitlab.com/kicad/code/kicad/issues/13381
This commit is contained in:
parent
33249d37b0
commit
1dd25dd196
|
@ -46,9 +46,8 @@ inline void normalise2PI( float& aAngle )
|
||||||
*/
|
*/
|
||||||
const wxChar *CAMERA::m_logTrace = wxT( "KI_TRACE_CAMERA" );
|
const wxChar *CAMERA::m_logTrace = wxT( "KI_TRACE_CAMERA" );
|
||||||
|
|
||||||
|
const float CAMERA::DEFAULT_MIN_ZOOM = 0.020f;
|
||||||
#define DEFAULT_MIN_ZOOM 0.020f
|
const float CAMERA::DEFAULT_MAX_ZOOM = 2.0f;
|
||||||
#define DEFAULT_MAX_ZOOM 2.0f
|
|
||||||
|
|
||||||
|
|
||||||
CAMERA::CAMERA( float aInitialDistance )
|
CAMERA::CAMERA( float aInitialDistance )
|
||||||
|
|
|
@ -77,6 +77,9 @@ enum class CAMERA_INTERPOLATION
|
||||||
class CAMERA
|
class CAMERA
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static const float DEFAULT_MIN_ZOOM;
|
||||||
|
static const float DEFAULT_MAX_ZOOM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize a camera.
|
* Initialize a camera.
|
||||||
*
|
*
|
||||||
|
|
|
@ -931,7 +931,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
||||||
{
|
{
|
||||||
float ratio =
|
float ratio =
|
||||||
std::max( 1.0f, m_objectContainer.GetBBox().GetMaxDimension() / RANGE_SCALE_3D );
|
std::max( 1.0f, m_objectContainer.GetBBox().GetMaxDimension() / RANGE_SCALE_3D );
|
||||||
m_camera.SetMaxZoom( m_camera.GetMaxZoom() * ratio );
|
m_camera.SetMaxZoom( CAMERA::DEFAULT_MAX_ZOOM * ratio );
|
||||||
|
|
||||||
m_camera.SetMinZoom( static_cast<float>( MIN_DISTANCE_IU * m_boardAdapter.BiuTo3dUnits()
|
m_camera.SetMinZoom( static_cast<float>( MIN_DISTANCE_IU * m_boardAdapter.BiuTo3dUnits()
|
||||||
/ -m_camera.GetCameraInitPos().z ) );
|
/ -m_camera.GetCameraInitPos().z ) );
|
||||||
|
|
Loading…
Reference in New Issue