mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
camera: minor constness
This commit fixes constness of camera getters, and changes a few arguments into const references.
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
#include "camera.h"
|
||||
#include "matrix.h"
|
||||
|
||||
void Camera::Arcball(float dist, Vec3f rot)
|
||||
void Camera::Arcball(float dist, const Vec3f &rot)
|
||||
{
|
||||
pos = Vec3f(0.0f, 0.0f, dist);
|
||||
|
||||
@@ -39,7 +39,7 @@ void Camera::Arcball(float dist, Vec3f rot)
|
||||
angles.y = rot.y;
|
||||
}
|
||||
|
||||
void Camera::fpsLook(Vec3f p, Vec3f rot)
|
||||
void Camera::fpsLook(const Vec3f &p, const Vec3f &rot)
|
||||
{
|
||||
pos = -p;
|
||||
|
||||
@@ -49,7 +49,7 @@ void Camera::fpsLook(Vec3f p, Vec3f rot)
|
||||
order = ORDER_TRANS_ROT;
|
||||
}
|
||||
|
||||
const Matrix4f Camera::GetMatrix()
|
||||
const Matrix4f Camera::GetMatrix() const
|
||||
{
|
||||
Matrix4f p = Matrix4f::Translation(pos);
|
||||
Matrix4f r = Matrix4f::RotationXYZ(angles);
|
||||
@@ -60,17 +60,17 @@ const Matrix4f Camera::GetMatrix()
|
||||
return p.Mul(r);
|
||||
}
|
||||
|
||||
const Vec3f Camera::GetPosition()
|
||||
const Vec3f Camera::GetPosition() const
|
||||
{
|
||||
return GetMatrix().GetPosition();
|
||||
}
|
||||
|
||||
const Vec3f Camera::GetForward()
|
||||
const Vec3f Camera::GetForward() const
|
||||
{
|
||||
return Matrix4f::RotationZYX(-angles).GetForward();
|
||||
}
|
||||
|
||||
const Vec3f Camera::GetRight()
|
||||
const Vec3f Camera::GetRight() const
|
||||
{
|
||||
return Matrix4f::RotationZYX(-angles).GetRight();
|
||||
}
|
||||
|
||||
@@ -36,17 +36,17 @@ class Camera
|
||||
: order(ORDER_TRANS_ROT), pos(), angles()
|
||||
{ }
|
||||
|
||||
void Arcball(float dist, Vec3f rot);
|
||||
void fpsLook(Vec3f pos, Vec3f rot);
|
||||
void Arcball(float dist, const Vec3f &rot);
|
||||
void fpsLook(const Vec3f &pos, const Vec3f &rot);
|
||||
|
||||
void SetPosition(const Vec3f &p) { pos = p; }
|
||||
void SetAngles(const Vec3f &r) { angles = r; }
|
||||
|
||||
const Vec3f GetPosition();
|
||||
const Vec3f GetForward();
|
||||
const Vec3f GetRight();
|
||||
const Vec3f GetUp();
|
||||
const Matrix4f GetMatrix();
|
||||
const Vec3f GetPosition() const;
|
||||
const Vec3f GetForward() const;
|
||||
const Vec3f GetRight() const;
|
||||
const Vec3f GetUp() const;
|
||||
const Matrix4f GetMatrix() const;
|
||||
|
||||
private:
|
||||
enum OperationOrder
|
||||
|
||||
Reference in New Issue
Block a user