Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
threevis
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
11
Issues
11
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
threevis
threevis
Commits
bc0580d9
Commit
bc0580d9
authored
Feb 02, 2018
by
Dario Seyb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added uvs+texture to edges/vertices api
parent
5c9cc9f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
meshvis/context.py
meshvis/context.py
+8
-3
meshvis/immediate.py
meshvis/immediate.py
+4
-4
No files found.
meshvis/context.py
View file @
bc0580d9
...
...
@@ -102,10 +102,11 @@ class Context(object):
self
.
scene
.
add
(
mesh_obj
)
return
self
def
draw_edges
(
self
,
vertices
,
edge_indices
=
None
,
colors
=
None
,
uvs
=
None
,
z_offset
=
0
,
linewidth
=
1
):
def
draw_edges
(
self
,
vertices
,
edge_indices
=
None
,
colors
=
None
,
uvs
=
None
,
z_offset
=
0
,
texture
=
None
,
linewidth
=
1
):
mat
=
three
.
LineBasicMaterial
(
color
=
'#000000'
)
mat
.
linewidth
=
linewidth
mat
.
map
=
texture
if
z_offset
is
not
0
:
mat
.
polygonOffset
=
True
...
...
@@ -149,7 +150,7 @@ class Context(object):
self
.
scene
.
add
(
mesh_obj
)
return
self
def
draw_vertices
(
self
,
vertices
,
colors
=
None
,
point_size
=
1
,
z_offset
=
0
,
perspective
=
False
):
def
draw_vertices
(
self
,
vertices
,
colors
=
None
,
uvs
=
None
,
point_size
=
1
,
z_offset
=
0
,
texture
=
None
,
perspective
=
False
):
vertices
=
np
.
array
(
vertices
)
matColor
=
colors
...
...
@@ -157,7 +158,7 @@ class Context(object):
if
colors
is
None
:
matColor
=
'black'
elif
hasattr
(
colors
,
'__len__'
)
and
(
not
isinstance
(
colors
,
str
)):
matColor
=
'#
dddddd
'
matColor
=
'#
ffffff
'
else
:
colors
=
None
...
...
@@ -166,6 +167,7 @@ class Context(object):
)
mat
=
three
.
PointsMaterial
(
color
=
matColor
,
sizeAttenuation
=
perspective
,
size
=
point_size
)
mat
.
map
=
texture
if
z_offset
is
not
0
:
mat
.
polygonOffset
=
True
...
...
@@ -175,6 +177,9 @@ class Context(object):
if
colors
is
not
None
:
attributes
[
'color'
]
=
three
.
BufferAttribute
(
np
.
asarray
(
colors
,
dtype
=
np
.
float32
))
mat
.
vertexColors
=
'VertexColors'
if
uvs
is
not
None
:
attributes
[
'uv'
]
=
three
.
BufferAttribute
(
np
.
asarray
(
uvs
,
dtype
=
np
.
float32
))
geom
=
three
.
BufferGeometry
(
attributes
=
attributes
)
mesh_obj
=
three
.
Points
(
geometry
=
geom
,
material
=
mat
)
...
...
meshvis/immediate.py
View file @
bc0580d9
...
...
@@ -6,11 +6,11 @@ def display_faces(vertices, face_indices, normals=None, colors=None, uvs=None,
Context
(
width
,
height
,
background_color
).
draw_faces
(
vertices
,
face_indices
,
normals
,
colors
,
uvs
,
shading
,
z_offset
,
texture
).
display
()
def
display_edges
(
vertices
,
edge_indices
=
None
,
colors
=
None
,
uvs
=
None
,
z_offset
=
0
,
linewidth
=
1
,
width
=
600
,
height
=
400
,
z_offset
=
0
,
texture
=
None
,
linewidth
=
1
,
width
=
600
,
height
=
400
,
background_color
=
'#dddddd'
):
Context
(
width
,
height
,
background_color
).
draw_edges
(
vertices
,
edge_indices
,
colors
,
uvs
,
z_offset
,
linewidth
).
display
()
Context
(
width
,
height
,
background_color
).
draw_edges
(
vertices
,
edge_indices
,
colors
,
uvs
,
z_offset
,
texture
,
linewidth
).
display
()
def
display_vertices
(
vertices
,
colors
=
None
,
point_size
=
1
,
z_offset
=
0
,
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'
):
Context
(
width
,
height
,
background_color
).
draw_vertices
(
vertices
,
colors
,
point_size
,
z_offset
,
perspective
).
display
()
Context
(
width
,
height
,
background_color
).
draw_vertices
(
vertices
,
colors
,
uvs
,
point_size
,
z_offset
,
texture
,
perspective
).
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