Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2014-05-01 00:42:58 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-05-01 00:43:19 +0400
commitd2a326076342845fc5e0bcfc4ea10b09ce86242e (patch)
tree70aee396d03fe39c8fc60fc79cdf5246981d5ade /source/blender/gpu/intern
parentd50f8832e39f79a9a2477ddb2e26dd2c801dbc8f (diff)
Add PBVH debug display, where we can see the PBVH node bounding boxes.
To enable enter debug value 14. Leaf nodes are green while container nodes are red.
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index df6aa4d868d..9bf63d2fe29 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -2657,3 +2657,65 @@ void GPU_free_pbvh_buffers(GPU_PBVH_Buffers *buffers)
MEM_freeN(buffers);
}
}
+
+
+/* debug function, draws the pbvh BB */
+void GPU_draw_pbvh_BB(float min[3], float max[3], bool leaf)
+{
+ float quads[4][4][3] = {
+ {
+ {min[0], min[1], min[2]},
+ {max[0], min[1], min[2]},
+ {max[0], min[1], max[2]},
+ {min[0], min[1], max[2]}
+ },
+
+ {
+ {min[0], min[1], min[2]},
+ {min[0], max[1], min[2]},
+ {min[0], max[1], max[2]},
+ {min[0], min[1], max[2]}
+ },
+
+ {
+ {max[0], max[1], min[2]},
+ {max[0], min[1], min[2]},
+ {max[0], min[1], max[2]},
+ {max[0], max[1], max[2]}
+ },
+
+ {
+ {max[0], max[1], min[2]},
+ {min[0], max[1], min[2]},
+ {min[0], max[1], max[2]},
+ {max[0], max[1], max[2]}
+ },
+ };
+
+ if (leaf)
+ glColor4f(0.0, 1.0, 0.0, 0.5);
+ else
+ glColor4f(1.0, 0.0, 0.0, 0.5);
+
+ glVertexPointer(3, GL_FLOAT, 0, &quads[0][0][0]);
+ glDrawArrays(GL_QUADS, 0, 16);
+}
+
+void GPU_init_draw_pbvh_BB(void)
+{
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_CULL_FACE);
+ glEnableClientState(GL_VERTEX_ARRAY);
+ glDisableClientState(GL_COLOR_ARRAY);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ glDisable(GL_LIGHTING);
+ glDisable(GL_COLOR_MATERIAL);
+ glEnable(GL_BLEND);
+ glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
+}
+
+void GPU_end_draw_pbvh_BB(void)
+{
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ glPopAttrib();
+}