Commit 1030fd79 authored by Martok's avatar Martok

[glcCamera] Frustum Vert list, fix point order in TglcFrustum.Render

parent dc5cc222
......@@ -62,6 +62,7 @@ type
procedure Perspective(const aFOVAngle, aAspectRatio, aNear, aFar: Single);
procedure Ortho(const aLeft, aRight, aBottom, aTop, aNear, aFar: Single);
procedure Activate;
procedure GetPoints(const aPoints: PgluVector3f);
{$IFNDEF OPENGL_ES}
procedure Render;
{$ENDIF}
......@@ -229,8 +230,7 @@ begin
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{$IFNDEF OPENGL_ES}
procedure TglcFrustum.Render;
procedure TglcFrustum.GetPoints(const aPoints: PgluVector3f);
var
min, max: TgluVector2f;
begin
......@@ -239,25 +239,45 @@ begin
max[0] := fRight / fNear * fFar;
max[1] := fTop / fNear * fFar;
// near plane
aPoints[0]:= gluVector3f(fLeft, fTop, -fNear);
aPoints[1]:= gluVector3f(fLeft, fBottom, -fNear);
aPoints[2]:= gluVector3f(fRight, fBottom, -fNear);
aPoints[3]:= gluVector3f(fRight, fTop, -fNear);
// far plane
aPoints[4]:= gluVector3f(min[0], max[1], -fFar);
aPoints[5]:= gluVector3f(min[0], min[1], -fFar);
aPoints[6]:= gluVector3f(max[0], min[1], -fFar);
aPoints[7]:= gluVector3f(max[0], max[1], -fFar);
end;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
{$IFNDEF OPENGL_ES}
procedure TglcFrustum.Render;
var
pt: array[0..7] of TgluVector3f;
begin
GetPoints(@pt[0]);
glBegin(GL_LINE_LOOP);
glVertex3f(fLeft, fTop, -fNear);
glVertex3f(fLeft, fBottom, -fNear);
glVertex3f(fRight, fBottom, -fNear);
glVertex3f(fRight, fTop, -fNear);
glVertex3fv(@pt[0]);
glVertex3fv(@pt[1]);
glVertex3fv(@pt[2]);
glVertex3fv(@pt[3]);
glEnd;
glBegin(GL_LINE_LOOP);
glVertex3f(min[0], min[0], -fFar);
glVertex3f(min[0], max[0], -fFar);
glVertex3f(max[0], max[0], -fFar);
glVertex3f(max[0], min[0], -fFar);
glVertex3fv(@pt[4]);
glVertex3fv(@pt[5]);
glVertex3fv(@pt[6]);
glVertex3fv(@pt[7]);
glEnd;
glBegin(GL_LINES);
glVertex3f(0, 0, 0); glVertex3f(min[0], min[0], -fFar);
glVertex3f(0, 0, 0); glVertex3f(min[0], max[0], -fFar);
glVertex3f(0, 0, 0); glVertex3f(max[0], max[0], -fFar);
glVertex3f(0, 0, 0); glVertex3f(max[0], min[0], -fFar);
glVertex3f(0, 0, 0); glVertex3fv(@pt[4]);
glVertex3f(0, 0, 0); glVertex3fv(@pt[5]);
glVertex3f(0, 0, 0); glVertex3fv(@pt[6]);
glVertex3f(0, 0, 0); glVertex3fv(@pt[7]);
glEnd;
end;
{$ENDIF}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment