summaryrefslogtreecommitdiffstats
path: root/core/math/camera_matrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/camera_matrix.h')
-rw-r--r--core/math/camera_matrix.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index 952f1e8fb2..c96f8259b5 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -48,32 +48,32 @@ struct CameraMatrix {
PLANE_BOTTOM
};
- float matrix[4][4];
+ real_t matrix[4][4];
void set_identity();
void set_zero();
void set_light_bias();
void set_light_atlas_rect(const Rect2& p_rect);
- void set_perspective(float p_fovy_degrees, float p_aspect, float p_z_near, float p_z_far,bool p_flip_fov=false);
- void set_orthogonal(float p_left, float p_right, float p_bottom, float p_top, float p_znear, float p_zfar);
- void set_orthogonal(float p_size, float p_aspect, float p_znear, float p_zfar,bool p_flip_fov=false);
- void set_frustum(float p_left, float p_right, float p_bottom, float p_top, float p_near, float p_far);
+ void set_perspective(real_t p_fovy_degrees, real_t p_aspect, real_t p_z_near, real_t p_z_far,bool p_flip_fov=false);
+ void set_orthogonal(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_znear, real_t p_zfar);
+ void set_orthogonal(real_t p_size, real_t p_aspect, real_t p_znear, real_t p_zfar,bool p_flip_fov=false);
+ void set_frustum(real_t p_left, real_t p_right, real_t p_bottom, real_t p_top, real_t p_near, real_t p_far);
- static float get_fovy(float p_fovx,float p_aspect) {
+ static real_t get_fovy(real_t p_fovx,real_t p_aspect) {
return Math::rad2deg(Math::atan(p_aspect * Math::tan(Math::deg2rad(p_fovx) * 0.5))*2.0);
}
- float get_z_far() const;
- float get_z_near() const;
- float get_aspect() const;
- float get_fov() const;
+ real_t get_z_far() const;
+ real_t get_z_near() const;
+ real_t get_aspect() const;
+ real_t get_fov() const;
Vector<Plane> get_projection_planes(const Transform& p_transform) const;
bool get_endpoints(const Transform& p_transform,Vector3 *p_8points) const;
- void get_viewport_size(float& r_width, float& r_height) const;
+ void get_viewport_size(real_t& r_width, real_t& r_height) const;
void invert();
CameraMatrix inverse() const;
@@ -102,7 +102,7 @@ Vector3 CameraMatrix::xform(const Vector3& p_vec3) const {
ret.x = matrix[0][0] * p_vec3.x + matrix[1][0] * p_vec3.y + matrix[2][0] * p_vec3.z + matrix[3][0];
ret.y = matrix[0][1] * p_vec3.x + matrix[1][1] * p_vec3.y + matrix[2][1] * p_vec3.z + matrix[3][1];
ret.z = matrix[0][2] * p_vec3.x + matrix[1][2] * p_vec3.y + matrix[2][2] * p_vec3.z + matrix[3][2];
- float w = matrix[0][3] * p_vec3.x + matrix[1][3] * p_vec3.y + matrix[2][3] * p_vec3.z + matrix[3][3];
+ real_t w = matrix[0][3] * p_vec3.x + matrix[1][3] * p_vec3.y + matrix[2][3] * p_vec3.z + matrix[3][3];
return ret/w;
}