PDA

View Full Version : View frustum plane equations..... and culling



frogger
10-26-2000, 11:12 AM
I have this code that will give me the equations of the planes that define the view frustum


viewPlanes[0].normal.coords[0]=ocCcMat[3]-ocCcMat[0];
viewPlanes[0].normal.coords[1]=ocCcMat[7]-ocCcMat[4];
viewPlanes[0].normal.coords[2]=ocCcMat[11]-ocCcMat[8];
viewPlanes[0].distance=ocCcMat[15]-ocCcMat[12];

viewPlanes[1].normal.coords[0] = ocCcMat[3] + ocCcMat[0];
viewPlanes[1].normal.coords[1] = ocCcMat[7] + ocCcMat[4];
viewPlanes[1].normal.coords[2] = ocCcMat[11] + ocCcMat[8];
viewPlanes[1].distance = ocCcMat[15] + ocCcMat[12];

viewPlanes[2].normal.coords[0] = ocCcMat[3] + ocCcMat[1];
viewPlanes[2].normal.coords[1] = ocCcMat[7] + ocCcMat[5];
viewPlanes[2].normal.coords[2] = ocCcMat[11] + ocCcMat[9];
viewPlanes[2].distance = ocCcMat[15] + ocCcMat[13];

viewPlanes[3].normal.coords[0] = ocCcMat[3] - ocCcMat[1];
viewPlanes[3].normal.coords[1] = ocCcMat[7] - ocCcMat[5];
viewPlanes[3].normal.coords[2] = ocCcMat[11] - ocCcMat[9];
viewPlanes[3].distance = ocCcMat[15] - ocCcMat[13];

viewPlanes[4].normal.coords[0] = ocCcMat[3] + ocCcMat[2];
viewPlanes[4].normal.coords[1] = ocCcMat[7] + ocCcMat[6];
viewPlanes[4].normal.coords[2] = ocCcMat[11] + ocCcMat[10];
viewPlanes[4].distance = ocCcMat[15] + ocCcMat[14];

viewPlanes[5].normal.coords[0] = ocCcMat[3] - ocCcMat[2];
viewPlanes[5].normal.coords[1] = ocCcMat[7] - ocCcMat[6];
viewPlanes[5].normal.coords[2] = ocCcMat[11] - ocCcMat[10];
viewPlanes[5].distance = ocCcMat[15] - ocCcMat[14];


What I need to know is which plane is which '
i.e. which is the top, left, bottom, right, etc

Thanks

zed
10-26-2000, 11:47 AM
left right top bot near far
(after writing this im not to sure now maybe reverse the last two?) sorry

[This message has been edited by zed (edited 10-26-2000).]