mirror of https://github.com/axmolengine/axmol.git
[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:
parent
2dcf76a88a
commit
d7a6a64517
|
@ -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()
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue