98a9339d060e — Laurens Holst 6 years ago
Application: Use proper projection matrix.
2 files changed, 16 insertions(+), 5 deletions(-)

M src/Application.asm
M src/Matrix4x4.asm
M src/Application.asm +2 -5
@@ 360,14 360,11 @@ Application_model:
 Application_view:
 	Matrix4x4  100H,    0H,    0H,    0H,
 	             0H,  100H,    0H,    0H,
-	             0H,    0H,  100H,  200H,
+	             0H,    0H,  100H,  300H,
 	             0H,    0H,    0H,  100H
 
 Application_projection:
-	Matrix4x4  100H,    0H,    0H,    0H,
-	             0H,  100H,    0H,    0H,
-	             0H,    0H,  100H,    0H,
-	             0H,    0H,  100H,  100H
+	PerspectiveMatrix4x4 100H, 100H, 100H, 500H
 
 Application_mvp:
 	IdentityMatrix4x4

          
M src/Matrix4x4.asm +14 -0
@@ 28,6 28,20 @@ ScaleMatrix4x4: MACRO ?x = 0, ?y = 0, ?z
 	Matrix4x4 ?x, 0, 0, 0, 0, ?y, 0, 0, 0, 0, ?z, 0, 0, 0, 0, 100H
 	ENDM
 
+OrthographicMatrix4x4: MACRO ?aspect = 100H, ?fovtan = 100H, ?near = 100H, ?far = 500H
+	Matrix4x4 100H * ?aspect / ?fovtan, 0, 0, 0,
+	          0, 10000H / ?fovtan, 0, 0,
+	          0, 0, 10000H / (?far - ?near), -100H * ?near / (?far - ?near),
+	          0, 0, 0, 100H
+	ENDM
+
+PerspectiveMatrix4x4: MACRO ?aspect = 100H, ?fovtan = 100H, ?near = 100H, ?far = 500H
+	Matrix4x4 100H * ?aspect / ?fovtan, 0, 0, 0,
+	          0, 10000H / ?fovtan, 0, 0,
+	          0, 0, 100H * ?far / (?far - ?near), -?far * ?near / (?far - ?near),
+	          0, 0, 100H, 0
+	ENDM
+
 ; iy = matrix
 ; ix = this
 Matrix4x4_Multiply: