mirror of https://github.com/axmolengine/axmol.git
[IMPROVEMENT] Remove camera unnecessary perspective option. (#993)
* Fix camera applyZoom when window size changes
* Revert "Fix camera applyZoom when window size changes"
This reverts commit 26154b5ff7
.
* Fix pr
* remove camera perspective option
* fix merge conflict
* Update CCCamera.cpp
* Update CCCamera.h
This commit is contained in:
parent
d7a6a64517
commit
4ceadb9740
|
@ -223,15 +223,15 @@ void Camera::updateTransform()
|
|||
{
|
||||
auto& size = _director->getWinSize();
|
||||
// create default camera
|
||||
switch (_type)
|
||||
switch (_director->getProjection())
|
||||
{
|
||||
case Type::ORTHOGRAPHIC:
|
||||
case Director::Projection::_2D:
|
||||
{
|
||||
initOrthographic(size.width, size.height, _nearPlane, _farPlane);
|
||||
break;
|
||||
}
|
||||
|
||||
case Type::PERSPECTIVE:
|
||||
case Director::Projection::_3D:
|
||||
{
|
||||
float zeye = _director->getZEye();
|
||||
initPerspective(_fieldOfView, (float)size.width / size.height, _nearPlane, _farPlane);
|
||||
|
@ -257,7 +257,6 @@ bool Camera::initPerspective(float fieldOfView, float aspectRatio, float nearPla
|
|||
Mat4::createPerspective(_fieldOfView, aspectRatio, _nearPlane, _farPlane, &_projection);
|
||||
_viewProjectionDirty = true;
|
||||
_frustumDirty = true;
|
||||
_type = Type::PERSPECTIVE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -271,7 +270,6 @@ bool Camera::initOrthographic(float zoomX, float zoomY, float nearPlane, float f
|
|||
Mat4::createOrthographic(_zoom[0] * _zoomFactor, _zoom[1] * _zoomFactor, _nearPlane, _farPlane, &_projection);
|
||||
_viewProjectionDirty = true;
|
||||
_frustumDirty = true;
|
||||
_type = Type::ORTHOGRAPHIC;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -69,16 +69,6 @@ class AX_DLL Camera : public Node
|
|||
friend class Director;
|
||||
friend class EventDispatcher;
|
||||
|
||||
public:
|
||||
/**
|
||||
* The type of camera.
|
||||
*/
|
||||
enum class Type
|
||||
{
|
||||
PERSPECTIVE = 1,
|
||||
ORTHOGRAPHIC = 2
|
||||
};
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a perspective camera.
|
||||
|
@ -118,13 +108,6 @@ public:
|
|||
*/
|
||||
static Camera* getDefaultCamera();
|
||||
|
||||
/**
|
||||
* Gets the type of camera.
|
||||
*
|
||||
* @return The camera type.
|
||||
*/
|
||||
Camera::Type getType() const { return _type; }
|
||||
|
||||
/**get & set Camera flag*/
|
||||
CameraFlag getCameraFlag() const { return _cameraFlag; }
|
||||
void setCameraFlag(CameraFlag flag) { _cameraFlag = flag; }
|
||||
|
@ -367,7 +350,6 @@ protected:
|
|||
mutable Mat4 _viewProjection;
|
||||
|
||||
Vec3 _up;
|
||||
Camera::Type _type;
|
||||
float _fieldOfView = 0.f;
|
||||
float _zoom[2] = {0.f};
|
||||
float _nearPlane = 0.f;
|
||||
|
|
Loading…
Reference in New Issue