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" );
|
||||
|
||||
|
||||
#define DEFAULT_MIN_ZOOM 0.020f
|
||||
#define DEFAULT_MAX_ZOOM 2.0f
|
||||
const float CAMERA::DEFAULT_MIN_ZOOM = 0.020f;
|
||||
const float CAMERA::DEFAULT_MAX_ZOOM = 2.0f;
|
||||
|
||||
|
||||
CAMERA::CAMERA( float aInitialDistance )
|
||||
|
|
|
@ -77,6 +77,9 @@ enum class CAMERA_INTERPOLATION
|
|||
class CAMERA
|
||||
{
|
||||
public:
|
||||
static const float DEFAULT_MIN_ZOOM;
|
||||
static const float DEFAULT_MAX_ZOOM;
|
||||
|
||||
/**
|
||||
* Initialize a camera.
|
||||
*
|
||||
|
|
|
@ -931,7 +931,7 @@ void RENDER_3D_RAYTRACE::Reload( REPORTER* aStatusReporter, REPORTER* aWarningRe
|
|||
{
|
||||
float ratio =
|
||||
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.GetCameraInitPos().z ) );
|
||||
|
|
Loading…
Reference in New Issue