text
stringlengths
0
234
Create (f, Out_File, Name);
declare
procedure Write_Intel is new Write_Intel_x86_number (U16, Stream (f));
procedure Write_Intel is new Write_Intel_x86_number (U32, Stream (f));
function Cvt is new Ada.Unchecked_Conversion (I32, U32);
begin
-- ** Only for Intel endianess : ** --
-- BITMAPFILEHEADER'Write (Stream (F), FileHeader);
-- BITMAPINFOHEADER'Write (Stream (F), FileInfo);
--
-- ** Endian - safe : ** --
Write_Intel (FileHeader.bfType);
Write_Intel (FileHeader.bfSize);
Write_Intel (FileHeader.bfReserved1);
Write_Intel (FileHeader.bfReserved2);
Write_Intel (FileHeader.bfOffBits);
--
Write_Intel (FileInfo.biSize);
Write_Intel (Cvt (FileInfo.biWidth));
Write_Intel (Cvt (FileInfo.biHeight));
Write_Intel (FileInfo.biPlanes);
Write_Intel (FileInfo.biBitCount);
Write_Intel (FileInfo.biCompression);
Write_Intel (FileInfo.biSizeImage);
Write_Intel (Cvt (FileInfo.biXPelsPerMeter));
Write_Intel (Cvt (FileInfo.biYPelsPerMeter));
Write_Intel (FileInfo.biClrUsed);
Write_Intel (FileInfo.biClrImportant);
--
Write_raw_BGR_frame (Stream (f), Integer (Screenshot_Viewport (2)), Integer (Screenshot_Viewport (3)));
Close (f);
exception
when others =>
Close (f);
raise;
Function Definition: procedure Normalise (the_Plane : in out Plane) is
Function Body: use GL_Double_EF;
inv_Magnitude : constant GL.Double := 1.0 / Sqrt (the_Plane (0) * the_Plane (0)
+ the_Plane (1) * the_Plane (1)
+ the_Plane (2) * the_Plane (2));
begin
the_Plane := (0 => the_Plane (0) * inv_Magnitude,
1 => the_Plane (1) * inv_Magnitude,
2 => the_Plane (2) * inv_Magnitude,
3 => the_Plane (3) * inv_Magnitude);
end Normalise;
-- Bounds
--
function Max (L, R : Extent) return Extent is
(Min => GL.Double'Max (L.Min, R.Min),
Max => GL.Double'Max (L.Max, R.Max));
function Max (L, R : Axis_Aligned_Bounding_Box) return Axis_Aligned_Bounding_Box is
(X_Extent => Max (L.X_Extent, R.X_Extent),
Y_Extent => Max (L.Y_Extent, R.Y_Extent),
Z_Extent => Max (L.Z_Extent, R.Z_Extent));
function Max (L, R : Bounds_record) return Bounds_record is
(Sphere_Radius => GL.Double'Max (L.Sphere_Radius, R.Sphere_Radius),
Box => Max (L.Box, R.Box));
-- vertex_Id's
--
procedure Increment (Self : in out vertex_Id_array) is
begin
for Each in Self'Range loop
Self (Each) := Self (Each) + 1;
end loop;
end Increment;
procedure Decrement (Self : in out vertex_Id_array) is
begin
for Each in Self'Range loop
Self (Each) := Self (Each) - 1;
end loop;
end Decrement;
-- vertices
--
function Image (Self : GL_Vertex) return String is
(" (" & Double'Image (Self (0)) & Double'Image (Self (1)) & Double'Image (Self (2)) & ")");
function Bounds (Self : GL_Vertex_array) return GL.Geometry.Bounds_record is
use GL_Double_EF;
the_Bounds : Bounds_record := null_Bounds;
max_Distance_2 : GL.Double := 0.0; -- current maximum distance squared.
begin
for p in Self'Range loop
max_Distance_2 := GL.Double'Max (Self (p) (0) * Self (p) (0)
+ Self (p) (1) * Self (p) (1)