summaryrefslogtreecommitdiff
path: root/drivers/gles1
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles1')
-rw-r--r--drivers/gles1/rasterizer_gles1.cpp21
-rw-r--r--drivers/gles1/rasterizer_gles1.h4
2 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gles1/rasterizer_gles1.cpp b/drivers/gles1/rasterizer_gles1.cpp
index 3ffebd4703..60c88af508 100644
--- a/drivers/gles1/rasterizer_gles1.cpp
+++ b/drivers/gles1/rasterizer_gles1.cpp
@@ -1982,6 +1982,9 @@ AABB RasterizerGLES1::mesh_get_aabb(RID p_mesh) const {
Mesh *mesh = mesh_owner.get( p_mesh );
ERR_FAIL_COND_V(!mesh,AABB());
+ if (mesh->custom_aabb!=AABB())
+ return mesh->custom_aabb;
+
AABB aabb;
for (int i=0;i<mesh->surfaces.size();i++) {
@@ -1995,6 +1998,24 @@ AABB RasterizerGLES1::mesh_get_aabb(RID p_mesh) const {
return aabb;
}
+void RasterizerGLES1::mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb) {
+
+ Mesh *mesh = mesh_owner.get( p_mesh );
+ ERR_FAIL_COND(!mesh);
+
+ mesh->custom_aabb=p_aabb;
+
+}
+
+AABB RasterizerGLES1::mesh_get_custom_aabb(RID p_mesh) const {
+
+ const Mesh *mesh = mesh_owner.get( p_mesh );
+ ERR_FAIL_COND_V(!mesh,AABB());
+
+ return mesh->custom_aabb;
+}
+
+
/* MULTIMESH API */
RID RasterizerGLES1::multimesh_create() {
diff --git a/drivers/gles1/rasterizer_gles1.h b/drivers/gles1/rasterizer_gles1.h
index e7e3200bbc..dbb411c8a3 100644
--- a/drivers/gles1/rasterizer_gles1.h
+++ b/drivers/gles1/rasterizer_gles1.h
@@ -323,6 +323,7 @@ class RasterizerGLES1 : public Rasterizer {
Vector<Surface*> surfaces;
int morph_target_count;
VS::MorphTargetMode morph_target_mode;
+ AABB custom_aabb;
mutable uint64_t last_pass;
Mesh() {
@@ -938,6 +939,9 @@ public:
virtual AABB mesh_get_aabb(RID p_mesh) const;
+ virtual void mesh_set_custom_aabb(RID p_mesh,const AABB& p_aabb);
+ virtual AABB mesh_get_custom_aabb(RID p_mesh) const;
+
/* MULTIMESH API */
virtual RID multimesh_create();