Commit e5bf8a4b authored by Isaak Lim's avatar Isaak Lim

add line_width option for wireframe rendering with faces

parent 82cba126
......@@ -52,7 +52,7 @@ class Context(object):
obj.prepare_render()
if isinstance(obj, Mesh):
return self.draw_faces(obj.vertices, obj.tri_face_indices, obj.normals, obj.colors, obj.uvs, shading, z_offset, texture, clipping_planes)
return self.draw_faces(obj.vertices, obj.tri_face_indices, obj.normals, obj.colors, obj.uvs, shading, z_offset, texture, line_width, clipping_planes)
elif isinstance(obj, EdgeList):
return self.draw_edges(obj.vertices, obj.edge_indices, obj.colors, obj.uvs, z_offset, texture, line_width, clipping_planes)
elif isinstance(obj, PointList):
......@@ -63,7 +63,7 @@ class Context(object):
def draw_faces(self, vertices, face_indices, normals=None, colors=None, uvs=None,
shading='flat', z_offset=0.5, texture=None, clipping_planes = []):
shading='flat', z_offset=0.5, texture=None, line_width=1., clipping_planes = []):
"""
Draw a triangle mesh described by a list of vertex positions and face indices.
face_indices is expected to be a n x 3 matrix.
......@@ -89,6 +89,7 @@ class Context(object):
mat.clippingPlanes = tuple(clipping_planes)
mat.wireframe = shading is 'wireframe'
mat.wireframeLinewidth = line_width
mat.map = texture
if z_offset is not 0:
......
......@@ -5,9 +5,9 @@ Immediate drawing without explicitely creating a context.
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,
shading='flat', z_offset=0.5, texture=None, line_width=1, width=600, height=400,
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).set_bounds(show_bounds).display()
Context(width, height, background_color).draw_faces(vertices, face_indices, normals, colors, uvs, shading, z_offset, texture, line_width, clipping_planes).set_bounds(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,
......@@ -22,4 +22,4 @@ def display_vertices(vertices, colors=None, uvs=None, point_size=1, z_offset=0,
def display(obj, shading='flat', point_size=1, z_offset=0, texture=None,
perspective=False, width=600, height=400,
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).set_bounds(show_bounds).display()
\ No newline at end of file
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).set_bounds(show_bounds).display()
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