# HG changeset patch # User Laurens Holst # Date 1497466131 -7200 # Wed Jun 14 20:48:51 2017 +0200 # Node ID 98a9339d060eed05b6e797f60c0cb8a464bff670 # Parent 06dfe38df30e9c83cb1dbcb2e1b6a94ce85c99b1 Application: Use proper projection matrix. diff --git a/src/Application.asm b/src/Application.asm --- a/src/Application.asm +++ b/src/Application.asm @@ -360,14 +360,11 @@ 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 diff --git a/src/Matrix4x4.asm b/src/Matrix4x4.asm --- a/src/Matrix4x4.asm +++ b/src/Matrix4x4.asm @@ -28,6 +28,20 @@ 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: