summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-07-15 01:23:10 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-07-15 08:32:34 -0300
commit2e73be99d8d86d9dad7bcb99518a4d3cbb5c373c (patch)
treed863db50852afe5d4b0bc15b8452054498004cb1 /drivers
parente64b82ebfcc3475c7a7d2a9196bfe20d6c9e3614 (diff)
Lots of work on Audio & Physics engine:
-Added new 3D stream player node -Added ability for Area to capture sound from streams -Added small features in physics to be able to properly guess distance to areas for sound -Fixed 3D CollisionObject so shapes are added the same as in 2D, directly from children -Fixed KinematicBody API to make it the same as 2D.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp2
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h33
2 files changed, 26 insertions, 9 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index e8c6502bf4..89c4c909ee 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -4199,7 +4199,7 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
glEnable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
- render_list.sort_by_depth(true);
+ render_list.sort_by_reverse_depth(true);
if (state.directional_light_count == 0) {
directional_light = NULL;
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 37bbd60797..a03e3dbe3d 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -666,7 +666,7 @@ public:
uint64_t sort_key;
};
- Element *_elements;
+ Element *base_elements;
Element **elements;
int element_count;
@@ -700,11 +700,11 @@ public:
struct SortByDepth {
_FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
- return A->instance->depth > B->instance->depth;
+ return A->instance->depth < B->instance->depth;
}
};
- void sort_by_depth(bool p_alpha) {
+ void sort_by_depth(bool p_alpha) { //used for shadows
SortArray<Element *, SortByDepth> sorter;
if (p_alpha) {
@@ -714,11 +714,28 @@ public:
}
}
+ struct SortByReverseDepth {
+
+ _FORCE_INLINE_ bool operator()(const Element *A, const Element *B) const {
+ return A->instance->depth > B->instance->depth;
+ }
+ };
+
+ void sort_by_reverse_depth(bool p_alpha) { //used for alpha
+
+ SortArray<Element *, SortByReverseDepth> sorter;
+ if (p_alpha) {
+ sorter.sort(&elements[max_elements - alpha_element_count], alpha_element_count);
+ } else {
+ sorter.sort(elements, element_count);
+ }
+ }
+
_FORCE_INLINE_ Element *add_element() {
if (element_count + alpha_element_count >= max_elements)
return NULL;
- elements[element_count] = &_elements[element_count];
+ elements[element_count] = &base_elements[element_count];
return elements[element_count++];
}
@@ -727,7 +744,7 @@ public:
if (element_count + alpha_element_count >= max_elements)
return NULL;
int idx = max_elements - alpha_element_count - 1;
- elements[idx] = &_elements[idx];
+ elements[idx] = &base_elements[idx];
alpha_element_count++;
return elements[idx];
}
@@ -737,9 +754,9 @@ public:
element_count = 0;
alpha_element_count = 0;
elements = memnew_arr(Element *, max_elements);
- _elements = memnew_arr(Element, max_elements);
+ base_elements = memnew_arr(Element, max_elements);
for (int i = 0; i < max_elements; i++)
- elements[i] = &_elements[i]; // assign elements
+ elements[i] = &base_elements[i]; // assign elements
}
RenderList() {
@@ -749,7 +766,7 @@ public:
~RenderList() {
memdelete_arr(elements);
- memdelete_arr(_elements);
+ memdelete_arr(base_elements);
}
};