Skip to content

Instantly share code, notes, and snippets.

@pr8x
Created September 7, 2016 14:28
Show Gist options
  • Save pr8x/ef1fb26076f9d4f8e27e334f6f48cd40 to your computer and use it in GitHub Desktop.
Save pr8x/ef1fb26076f9d4f8e27e334f6f48cd40 to your computer and use it in GitHub Desktop.
mat4 view;
view[0] = vec4(1,0,0,0);
view[1] = vec4(0,1,0,0);
view[2] = vec4(0,0,1,0);
view[3] = vec4(0,0,0,1);
mat4 projection;
vec2 fov = vec2(45.,45.);
float far = 1000.;
float near = .5;
projection[0] = vec4(atan(fov.x/2.),0,0,0);
projection[1] = vec4(0,atan(fov.y/2.),0,0);
projection[2] = vec4(0,0,-((far+near)/(far-near)),-((2*(near*far))/(far-near)));
projection[3] = vec4(0,0,-1,0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment