Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
threevis
threevis
Commits
e5bf8a4b
Commit
e5bf8a4b
authored
Apr 03, 2018
by
Isaak Lim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add line_width option for wireframe rendering with faces
parent
82cba126
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
threevis/context.py
threevis/context.py
+3
-2
threevis/immediate.py
threevis/immediate.py
+3
-3
No files found.
threevis/context.py
View file @
e5bf8a4b
...
...
@@ -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
:
...
...
threevis/immediate.py
View file @
e5bf8a4b
...
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment