[BUG] Fix camera `applyZoom()` when window size changes and remove unnecessary projection code (#992)

* Fix camera applyZoom when window size changes

* Revert "Fix camera applyZoom when window size changes"

This reverts commit 26154b5ff7.

* Fix pr
This commit is contained in:
Turky Mohammed 2022-12-29 11:54:01 +03:00 committed by GitHub
parent 2dcf76a88a
commit d7a6a64517
2 changed files with 4 additions and 3 deletions

View File

@ -188,7 +188,6 @@ void Camera::initDefault()
{ {
case Director::Projection::_2D: case Director::Projection::_2D:
{ {
_zoomFactor = 1.0F;
_fieldOfView = 60.0F; _fieldOfView = 60.0F;
_nearPlane = -1024.0F; _nearPlane = -1024.0F;
_farPlane = 1024.0F; _farPlane = 1024.0F;
@ -201,7 +200,6 @@ void Camera::initDefault()
case Director::Projection::_3D: case Director::Projection::_3D:
{ {
float zeye = _director->getZEye(); float zeye = _director->getZEye();
_zoomFactor = 1.0F;
_fieldOfView = 60.0F; _fieldOfView = 60.0F;
_nearPlane = 0.5F; _nearPlane = 0.5F;
_farPlane = zeye + size.height / 2.0f; _farPlane = zeye + size.height / 2.0f;
@ -216,6 +214,9 @@ void Camera::initDefault()
} }
setDepth(0); setDepth(0);
if (_zoomFactor != 1.0F)
applyZoom();
} }
void Camera::updateTransform() void Camera::updateTransform()

View File

@ -381,7 +381,7 @@ protected:
// with larger depth is drawn on top of camera with smaller depth // with larger depth is drawn on top of camera with smaller depth
float _eyeZdistance; // Z eye projection distance for 2D in 3D projection. float _eyeZdistance; // Z eye projection distance for 2D in 3D projection.
float _zoomFactor; // The zoom factor of the camera. 3D = (cameraZDistance * _zoomFactor), 2D = (cameraScale * _zoomFactor) float _zoomFactor = 1.0F; // The zoom factor of the camera. 3D = (cameraZDistance * _zoomFactor), 2D = (cameraScale * _zoomFactor)
float _zoomFactorFarPlane; float _zoomFactorFarPlane;
float _zoomFactorNearPlane; float _zoomFactorNearPlane;