summaryrefslogtreecommitdiff
path: root/core/math
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-11-09 23:55:06 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-11-09 23:55:06 -0300
commitcacf9ebb7fd8df8845daca9da2fe55456cc179aa (patch)
tree5881cb42ace5001916e9d1843f5a7acbc35332a6 /core/math
parent6b2a27bbe5fa112365fc88b9b4678a61293bcb53 (diff)
all light types and shadows are working, pending a lot of clean-up
Diffstat (limited to 'core/math')
-rw-r--r--core/math/camera_matrix.cpp22
-rw-r--r--core/math/camera_matrix.h2
-rw-r--r--core/math/math_funcs.h2
3 files changed, 25 insertions, 1 deletions
diff --git a/core/math/camera_matrix.cpp b/core/math/camera_matrix.cpp
index f7dd8839b8..3e3cd1af4f 100644
--- a/core/math/camera_matrix.cpp
+++ b/core/math/camera_matrix.cpp
@@ -495,6 +495,28 @@ void CameraMatrix::set_light_bias() {
}
+void CameraMatrix::set_light_atlas_rect(const Rect2& p_rect) {
+
+ float *m=&matrix[0][0];
+
+ m[0]=p_rect.size.width,
+ m[1]=0.0,
+ m[2]=0.0,
+ m[3]=0.0,
+ m[4]=0.0,
+ m[5]=p_rect.size.height,
+ m[6]=0.0,
+ m[7]=0.0,
+ m[8]=0.0,
+ m[9]=0.0,
+ m[10]=1.0,
+ m[11]=0.0,
+ m[12]=p_rect.pos.x,
+ m[13]=p_rect.pos.y,
+ m[14]=0.0,
+ m[15]=1.0;
+}
+
CameraMatrix::operator String() const {
String str;
diff --git a/core/math/camera_matrix.h b/core/math/camera_matrix.h
index d192b1fef1..bf8cf3592e 100644
--- a/core/math/camera_matrix.h
+++ b/core/math/camera_matrix.h
@@ -30,6 +30,7 @@
#define CAMERA_MATRIX_H
#include "transform.h"
+#include "math_2d.h"
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
@@ -53,6 +54,7 @@ struct CameraMatrix {
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);
diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h
index c8ced0b306..9d7e881c65 100644
--- a/core/math/math_funcs.h
+++ b/core/math/math_funcs.h
@@ -208,7 +208,7 @@ public:
}
}
- static _FORCE_INLINE_ float halfptr_to_float(uint16_t *h) {
+ static _FORCE_INLINE_ float halfptr_to_float(const uint16_t *h) {
union {
uint32_t u32;