Wenn du es so machst, wie ich gemeint hab, sieht es noch besser aus:
Delphi-Quellcode:
const
NEAR_PLANE = 1;
ZOOM = 80;
DISTANCE = 30;
procedure TForm1.DrawCube(M: TCube);
var
i: integer;
Pixel: T3DVektor;
Mitte: TPoint;
begin
Image1.Canvas.Rectangle(0,0, image1.Width, image1.Height);
Mitte.x := Image1.Width div 2;
Mitte.y := Image1.Height div 2;
for i := 1 to 8 do begin
Pixel := M[i];
if (pixel.z + distance > NEAR_PLANE) then begin
Pixel.x := ZOOM*Pixel.x / (Pixel.z + DISTANCE) + Mitte.x;
Pixel.y := ZOOM*Pixel.y / (Pixel.z + DISTANCE) + Mitte.y;
Image1.Canvas.Pixels[round(Pixel.X), round(Pixel.y)] := clblack;
end;
end;
end;
probiers mal