Commit ce854033 authored by Dario Seyb's avatar Dario Seyb

Add show_bounds to immediate API and update sample code

parent 4d0cd287
......@@ -21,10 +21,7 @@
"mesh = meshvis.Mesh(vertices, faces, \n",
" normals = meshvis.calculateFaceNormals(vertices, faces))\n",
"\n",
"ctx = meshvis.Context()\n",
"ctx.draw(mesh, shading='flat', clipping_planes=[meshvis.Plane((1.0, 0.0, 0.0) , 0)])\n",
"ctx.showBounds()\n",
"ctx.display()"
"meshvis.display(mesh, show_bounds=True)\n"
]
}
],
......
......@@ -241,13 +241,16 @@ class Context(object):
def showBounds(self):
self.show_bounds = True
return self
def hideBounds(self):
self.show_bounds = False
return self
def setBounds(self, val):
self.show_bounds = val
return self
def draw_text(self, text, position=(0, 0, 0), color='white', size=100, height=1):
"""
Draw a text object at the specified location with a given height
......
......@@ -6,20 +6,20 @@ from .context import Context
def display_faces(vertices, face_indices, normals=None, colors=None, uvs=None,
shading='flat', z_offset=0.5, texture=None, width=600, height=400,
background_color = '#dddddd', clipping_planes = []):
Context(width, height, background_color).draw_faces(vertices, face_indices, normals, colors, uvs, shading, z_offset, texture, clipping_planes).display()
background_color = '#dddddd', clipping_planes = [], show_bounds = False):
Context(width, height, background_color).draw_faces(vertices, face_indices, normals, colors, uvs, shading, z_offset, texture, clipping_planes).setBounds(show_bounds).display()
def display_edges(vertices, edge_indices=None, colors=None, uvs=None,
z_offset=0, texture=None, line_width=1, width=600, height=400,
background_color = '#dddddd', clipping_planes = []):
Context(width, height, background_color).draw_edges(vertices, edge_indices, colors, uvs, z_offset, texture, line_width, clipping_planes).display()
background_color = '#dddddd', clipping_planes = [], show_bounds = False):
Context(width, height, background_color).draw_edges(vertices, edge_indices, colors, uvs, z_offset, texture, line_width, clipping_planes).setBounds(show_bounds).display()
def display_vertices(vertices, colors=None, uvs=None, point_size=1, z_offset=0, texture=None,
perspective=False, width=600, height=400,
background_color = '#dddddd', clipping_planes = []):
Context(width, height, background_color).draw_vertices(vertices, colors, uvs, point_size, z_offset, texture, perspective, clipping_planes).display()
background_color = '#dddddd', clipping_planes = [], show_bounds = False):
Context(width, height, background_color).draw_vertices(vertices, colors, uvs, point_size, z_offset, texture, perspective, clipping_planes).setBounds(show_bounds).display()
def display(obj, shading='flat', point_size=1, z_offset=0, texture=None,
perspective=False, width=600, height=400,
background_color = '#dddddd', clipping_planes = []):
Context(width, height, background_color).draw(obj, shading= shading, point_size = point_size, z_offset= z_offset, texture = texture, perspective = perspective, clipping_planes = clipping_planes).display()
\ No newline at end of file
background_color = '#dddddd', clipping_planes = [], show_bounds = False):
Context(width, height, background_color).draw(obj, shading= shading, point_size = point_size, z_offset= z_offset, texture = texture, perspective = perspective, clipping_planes = clipping_planes).setBounds(show_bounds).display()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment