- function SetPerspektivMatrix(fovy, Width, Heigth, NPlane, FPlane: glFloat;
- Perspektivmatrix: tMat44): tMat44;
- var
- aspect : glFloat;
- f : glFloat;
- begin
- aspect:=Heigth/Width;
- f:=cot(0.5*DegToRad(fovy));
- PerspektivMatrix[0,0]:=f/aspect;PerspektivMatrix[1,0]:=0; PerspektivMatrix[2,0]:=0; PerspektivMatrix[3,0]:=0;
- PerspektivMatrix[0,1]:=0; PerspektivMatrix[1,1]:=f; PerspektivMatrix[2,1]:=0; PerspektivMatrix[3,1]:=0;
- PerspektivMatrix[0,2]:=0; PerspektivMatrix[1,2]:=0; PerspektivMatrix[2,2]:=((FPlane+NPlane)/(NPlane-FPlane)); PerspektivMatrix[3,2]:=((2*FPlane*NPlane)/(NPlane-FPlane));
- PerspektivMatrix[0,3]:=0; PerspektivMatrix[1,3]:=0; PerspektivMatrix[2,3]:=-1; PerspektivMatrix[3,3]:=0;
- result:=PerspektivMatrix;
- end;