Commit 3aabfb0f authored by Dario Seyb's avatar Dario Seyb

added texture argument to faces API

parent 5456f285
This diff is collapsed.
# Blender MTL File: 'None'
# Material Count: 1
newmtl None
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
This diff is collapsed.
......@@ -10,3 +10,4 @@ from .context import *
from .immediate import *
from .indexed_attribute import UniformAttribute, PointAttribute, FaceAttribute, HalfEdgeAttribute
from .mesh_helper import *
from pythreejs import ImageTexture, DataTexture
......@@ -40,7 +40,7 @@ class Context(object):
self.scene.add(mesh_obj)
def draw_faces(self, vertices, face_indices, normals=None, colors=None, uvs=None,
shading='flat', z_offset=0.5):
shading='flat', z_offset=0.5, texture=None):
assert(len(face_indices) > 0 and len(vertices) > 0)
......@@ -55,6 +55,7 @@ class Context(object):
mat = three.MeshPhongMaterial(color='#dddddd')
mat.wireframe = shading is 'wireframe'
mat.map = texture
if z_offset is not 0:
mat.polygonOffset = True
......
from .context import *
def display_faces(vertices, face_indices, normals=None, colors=None, uvs=None,
shading='flat', z_offset=0.5, width=600, height=400,
shading='flat', z_offset=0.5, texture=None, width=600, height=400,
background_color = '#dddddd'):
Context(width, height, background_color).draw_faces(vertices, face_indices, normals, colors, uvs, shading, z_offset).display()
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,
......
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