Added a very simple light source so the 3D models now have simple shading applied to them.

This commit is contained in:
2020-07-15 04:12:39 -05:00
parent 05d2beb8ac
commit 34f5917359
4 changed files with 98 additions and 32 deletions
+2 -3
View File
@@ -1,5 +1,6 @@
from vectors import Vector2d, Vector3d, Vector4d
from matrix import Matrix3x3
from triangle import Triangle
class Engine:
def __init__(self, width, height):
@@ -40,7 +41,5 @@ class Mesh:
row0 = self.vertices[int(tmp[1]) - 1]
row1 = self.vertices[int(tmp[2]) - 1]
row2 = self.vertices[int(tmp[3]) - 1]
tri = Matrix3x3(row0, row1, row2)
self.triangles.append(tri)#Vector3d(x - 1, y - 1, z - 1))
self.triangles.append(Triangle(Matrix3x3(row0, row1, row2)))