mirror of https://github.com/axmolengine/axmol.git
change function to const
This commit is contained in:
parent
579ae882e3
commit
34f6368ff7
|
@ -134,7 +134,7 @@ const Mat4& Camera::getProjectionMatrix() const
|
|||
{
|
||||
return _projection;
|
||||
}
|
||||
const Mat4& Camera::getViewMatrix()
|
||||
const Mat4& Camera::getViewMatrix() const
|
||||
{
|
||||
Mat4 viewInv(getNodeToWorldTransform());
|
||||
static int count = sizeof(float) * 16;
|
||||
|
@ -183,7 +183,7 @@ void Camera::lookAt(const Vec3& lookAtPos, const Vec3& up)
|
|||
setRotation3D(Vec3(CC_RADIANS_TO_DEGREES(fPitch),CC_RADIANS_TO_DEGREES(fYaw),CC_RADIANS_TO_DEGREES(fRoll)));
|
||||
}
|
||||
|
||||
const Mat4& Camera::getViewProjectionMatrix()
|
||||
const Mat4& Camera::getViewProjectionMatrix() const
|
||||
{
|
||||
getViewMatrix();
|
||||
if (_viewProjectionDirty)
|
||||
|
@ -201,7 +201,7 @@ void Camera::setAdditionalProjection(const Mat4& mat)
|
|||
getViewProjectionMatrix();
|
||||
}
|
||||
|
||||
void Camera::unproject(const Size& viewport, Vec3* src, Vec3* dst)
|
||||
void Camera::unproject(const Size& viewport, Vec3* src, Vec3* dst) const
|
||||
{
|
||||
assert(dst);
|
||||
Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f);
|
||||
|
|
|
@ -118,15 +118,15 @@ public:
|
|||
*
|
||||
* @return The camera view matrix.
|
||||
*/
|
||||
const Mat4& getViewMatrix();
|
||||
const Mat4& getViewMatrix() const;
|
||||
|
||||
/**get view projection matrix*/
|
||||
const Mat4& getViewProjectionMatrix();
|
||||
const Mat4& getViewProjectionMatrix() const;
|
||||
|
||||
/**
|
||||
* Convert the specified point of viewport from screenspace coordinate into the worldspace coordinate.
|
||||
*/
|
||||
void unproject(const Size& viewport, Vec3* src, Vec3* dst);
|
||||
void unproject(const Size& viewport, Vec3* src, Vec3* dst) const;
|
||||
|
||||
//override
|
||||
virtual void onEnter() override;
|
||||
|
@ -145,9 +145,9 @@ protected:
|
|||
|
||||
Scene* _scene; //Scene camera belongs to
|
||||
Mat4 _projection;
|
||||
Mat4 _view;
|
||||
Mat4 _viewInv;
|
||||
Mat4 _viewProjection;
|
||||
mutable Mat4 _view;
|
||||
mutable Mat4 _viewInv;
|
||||
mutable Mat4 _viewProjection;
|
||||
Vec3 _up;
|
||||
Camera::Type _type;
|
||||
float _fieldOfView;
|
||||
|
@ -155,7 +155,7 @@ protected:
|
|||
float _aspectRatio;
|
||||
float _nearPlane;
|
||||
float _farPlane;
|
||||
bool _viewProjectionDirty;
|
||||
mutable bool _viewProjectionDirty;
|
||||
unsigned short _cameraFlag; // camera flag
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue