Skip to content

Instantly share code, notes, and snippets.

@sherief
Created May 9, 2013 00:43
Show Gist options
  • Save sherief/5544762 to your computer and use it in GitHub Desktop.
Save sherief/5544762 to your computer and use it in GitHub Desktop.
//Projection Matrix
mat4x4 mP = perspective_matrix(45.0, 1, 0.1, 100);
mP = transpose(mP);
//Translation
mat4x4 mT = mat4x4::translation(float3(0, 0, -14));
//Rotation
mat4x4 mR = rotation_matrix_degrees(Rotation, float3(0, 1, 0));
//View matrix
mat4x4 mV = lookat_matrix(float3(0.0, 0.0, -3.0), float3(0, 0, -3), float3(0, 1, 0));
mV = transpose(mV);
//WorldViewProjection
mat4x4 mWVP;
//World Matrix - object to world space.
mat4x4 mW = mT * mR;
//WVP construction
mWVP = mP * mW;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment