X-Git-Url: https://git.ao2.it/vrm.git/blobdiff_plain/dafb24918e83227315727f0e3255823fcd7c5304..08e34a873729c718a510ec642d36eebaef6f4ee7:/vrm.py
diff --git a/vrm.py b/vrm.py
index 871131e..d85b085 100755
--- a/vrm.py
+++ b/vrm.py
@@ -34,7 +34,7 @@ Tooltip: 'Vector Rendering Method Export Script 0.3'
#
# Additional credits:
# Thanks to Emilio Aguirre for S2flender from which I took inspirations :)
-# Thanks to Anthony C. D'Agostino for the backface.py script
+# Thanks to Anthony C. D'Agostino for the original backface.py script
#
# ---------------------------------------------------------------------
@@ -84,14 +84,12 @@ class Projector:
else:
m2 = self._calcPerspectiveMatrix(fovy, aspect, near, far)
- m1 = Matrix()
- mP = Matrix()
# View transformation
- cam = cameraObj.getInverseMatrix()
+ cam = Matrix(cameraObj.getInverseMatrix())
cam.transpose()
- m1 = obMesh.getMatrix()
+ m1 = Matrix(obMesh.getMatrix())
m1.transpose()
mP = cam * m1
@@ -117,11 +115,11 @@ class Projector:
mH = self.size[1]/2
if p[3]<=0:
- p[0] = int(p[0]*mW)+mW
- p[1] = int(p[1]*mH)+mH
+ p[0] = round(p[0]*mW)+mW
+ p[1] = round(p[1]*mH)+mH
else:
- p[0] = int((p[0]/p[3])*mW)+mW
- p[1] = int((p[1]/p[3])*mH)+mH
+ p[0] = round((p[0]/p[3])*mW)+mW
+ p[1] = round((p[1]/p[3])*mH)+mH
# For now we want (0,0) in the top-left corner of the canvas
# Mirror and translate along y
@@ -181,7 +179,7 @@ class Projector:
# ---------------------------------------------------------------------
#
-## Mesh representation class
+## Object representation class
#
# ---------------------------------------------------------------------
@@ -259,12 +257,15 @@ class SVGVectorWriter(VectorWriter):
self._printHeader()
- for obj in scene:
+ Objects = scene.getChildren()
+ for obj in Objects:
self.file.write("\n")
- for face in obj.faces:
+ for face in obj.getData().faces:
self._printPolygon(face)
+ self._printWireframe(obj.getData())
+
self.file.write("\n")
self._printFooter()
@@ -277,7 +278,9 @@ class SVGVectorWriter(VectorWriter):
"""Print SVG header."""
self.file.write("\n")
- self.file.write("