Problem with gfm.math.matrix (some gamedevs out there ?)
Guillaume Piolat
first.name at gmail.com
Fri Sep 4 15:13:27 UTC 2020
On Thursday, 3 September 2020 at 12:36:35 UTC, Thomas wrote:
> ---------------------
> import std.stdio;
>
> int main()
> {
>
> import gfm.math.matrix;
>
> const int width = 800;
> const int height = 600;
>
> auto projectionMatrix = mat4!(float).identity();
Note that instead of `mat4!(float)` you can just use `mat4f`.
> auto ratio = cast(float)width / cast(float)height;
>
> projectionMatrix = mat4!(float).perspective( 45.0f, ratio,
> 0.0f, 100.0f );
As others said, zNear is zero so your matrix is not invertible.
I guess perspective should warn about that.
More information about the Digitalmars-d-learn
mailing list