-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwireMesh.py
27 lines (25 loc) · 1.47 KB
/
wireMesh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class wireMesh:
def __init__(self, objectList, camera):
self.__faceList = [] # List of faces with normals
EPSILON = 0.001
facePoints = [] # List of points for a face
for object in objectList:
c = object.getColor() # Obtain object color
u = object.getURange()[0]
while u + object.getUVDelta()[0] < object.getURange()[1] + EPSILON:
v = object.getVRange()[0]
while v + object.getUVDelta()[1] < object.getVRange()[1] + EPSILON:
# Collect surface points transformed into viewing coordinates
facePoints.append(camera.worldToPixelCoordinates(object.getT() * object.getPoint(u, v)))
facePoints.append(
camera.worldToPixelCoordinates(object.getT() * object.getPoint(u, v + object.getUVDelta()[1])))
facePoints.append(camera.worldToPixelCoordinates(
object.getT() * object.getPoint(u + object.getUVDelta()[0], v + object.getUVDelta()[1])))
facePoints.append(
camera.worldToPixelCoordinates(object.getT() * object.getPoint(u + object.getUVDelta()[0], v)))
self.__faceList.append((0.0, facePoints, c))
facePoints = []
v += object.getUVDelta()[1]
u += object.getUVDelta()[0]
def getFaceList(self):
return self.__faceList