Skip to content

Commit e12bd23

Browse files
committed
Visually separate scene and child bbox
1 parent afe4936 commit e12bd23

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

demosys/scene/mesh.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def draw_bbox(self, proj_matrix, view_matrix, shader, vao):
3838
shader.uniform_mat4("m_mv", view_matrix)
3939
shader.uniform_3fv("bb_min", self.bbox_min)
4040
shader.uniform_3fv("bb_max", self.bbox_max)
41+
shader.uniform_3fv("color", [0.75, 0.75, 0.75])
4142
vao.draw()
4243

4344
def calc_global_bbox(self, view_matrix, bbox_min, bbox_max):

demosys/scene/scene.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@ def draw(self, m_proj, m_mv):
3838

3939
def draw_bbox(self, m_proj, m_mv, all=True):
4040
"""Draw scene and mesh bounding boxes"""
41+
# Scene bounding box
4142
self.bbox_vao.bind(self.bbox_shader)
4243
self.bbox_shader.uniform_mat4("m_proj", m_proj)
4344
self.bbox_shader.uniform_mat4("m_mv", m_mv)
4445
self.bbox_shader.uniform_3fv("bb_min", self.bbox_min)
4546
self.bbox_shader.uniform_3fv("bb_max", self.bbox_max)
47+
self.bbox_shader.uniform_3fv("color", [1.0, 0.0, 0.0])
4648
self.bbox_vao.draw()
4749

4850
if not all:
4951
return
5052

53+
# Draw bounding box for children
5154
for node in self.root_nodes:
5255
node.draw_bbox(m_proj, m_mv, self.bbox_shader, self.bbox_vao)
5356

demosys/scene/shaders/scene_default/bbox.glsl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ void main() {
1717
#elif defined FRAGMENT_SHADER
1818

1919
out vec4 fragColor;
20+
uniform vec3 color;
2021

2122
void main()
2223
{
23-
fragColor = vec4(1.0);
24+
fragColor = vec4(color, 1.0);
2425
}
2526

2627
#endif

0 commit comments

Comments
 (0)