Fix constant typeid comparisons. Allow methods to use & and * and constants. Improved error messages. Updated String type with generic append.

This commit is contained in:
Christoffer Lerno
2022-07-23 23:08:27 +02:00
committed by Christoffer Lerno
parent c1de3f059e
commit 7e0a29ef40
11 changed files with 117 additions and 50 deletions

View File

@@ -1,4 +1,4 @@
module std::math;
module std::math::matrix;
fault MatrixError {
MATRIX_INVERSE_DOESNT_EXIST,
@@ -360,7 +360,7 @@ fn Matrix4x4 Matrix4x4.scale(Matrix4x4* m, float[<3>] v) {
}
fn Matrix4x4 Matrix4x4.ortho(float left, float right, float top, float bottom, float near, float far) {
fn Matrix4x4 ortho(float left, float right, float top, float bottom, float near, float far) {
float width = right - left;
float height = top - bottom;
float depth = far - near;
@@ -375,7 +375,7 @@ fn Matrix4x4 Matrix4x4.ortho(float left, float right, float top, float bottom, f
}
// fov in radians
fn Matrix4x4 Matrix4x4.perspective(float fov, float aspect_ratio, float near, float far) {
fn Matrix4x4 perspective(float fov, float aspect_ratio, float near, float far) {
float top = ((float)math::sin(fov / 2) / (float)math::cos(fov / 2)) * near;
float right = top * aspect_ratio;
float depth = far - near;