Archived

This topic is now archived and is closed to further replies.

NBarrett

perspective projection matrix

Recommended Posts

void MATRIX4::SetProjection(float fov,float aspect,float nearplane,float farplane)
{
float h = cosf(fov / 2) / sinf(fov / 2);
float w = h / aspect;

memset(this,0,sizeof(MATRIX4));

m[0][0] = w;
m[1][1] = h;
m[2][2] = farplane / (farplane - nearplane);
m[2][3] = 1;
m[3][2] = nearplane * farplane / (nearplane - farplane);
}

Share this post


Link to post
Share on other sites