text stringlengths 0 234 |
|---|
U8'Write (s, Positive'Pos (face.repeat_U)); |
U8'Write (s, Positive'Pos (face.repeat_V)); |
if not face.whole_texture then |
Write_Map_idx_pair_array (face.texture_edge_map); |
end if; |
end Write_face; |
begin |
String'Write (s, signature_obj); |
Write_String (s, o.ID); |
Write_Intel (U32 (o.Max_points)); |
Write_Intel (U32 (o.Max_faces)); |
for p in o.Point'Range loop |
Write_Point_3D (o.Point (p)); |
end loop; |
for f in o.face'Range loop |
Write_face (o.face (f), o.face_invariant (f)); |
end loop; |
Write_Point_3D (o.Centre); |
for i in Matrix_33'Range (1) loop |
for j in Matrix_33'Range (2) loop |
Write_Double (s, o.rotation (i, j)); |
end loop; |
end loop; |
-- !! sub - objects : skipped !! |
-- Main operation done! |
end Write; |
generic |
type Anything is private; |
extension : String; |
animal : String; |
with procedure Read ( |
s : in Ada.Streams.Stream_IO.Stream_Access; |
a : out Anything |
); |
procedure Load_generic (name_in_resource : String; a : out Anything); |
procedure Load_generic (name_in_resource : String; a : out Anything) is |
name_ext : constant String := name_in_resource & extension; |
procedure Try (zif : in out Zip.Zip_info; name : String) is |
use UnZip.Streams; |
fobj : Zipped_File_Type; |
begin -- Try |
Load_if_needed (zif, name); |
Open (fobj, zif, name_ext); |
Read (Stream (fobj), a); |
Close (fobj); |
exception |
when Zip.File_name_not_found => |
raise; |
when e:others => |
Raise_Exception ( |
Exception_Identity (e), |
Exception_Message (e) & " on " & animal & " : " & name_ext |
); |
end Try; |
begin |
begin |
Try (zif_level, To_String (level_data_name)); |
exception |
when Zip.File_name_not_found | |
Zip.Zip_file_open_Error => |
-- Not found in level - specific pack |
Try (zif_global, To_String (global_data_name)); |
Function Definition: procedure Load_Internal is |
Function Body: new Load_generic ( |
Anything => p_Object_3D, |
extension => object_extension, |
animal => "object", |
Read => Read |
); |
procedure Load (name_in_resource : String; o : out p_Object_3D) |
renames Load_Internal; |
procedure Load_file (file_name : String; o : out p_Object_3D) is |
use Ada.Streams.Stream_IO; |
f : File_Type; |
begin |
Open (f, in_file, file_name); |
Read (Stream (f), o); |
Close (f); |
end Load_file; |
procedure Save_file (file_name : String; o : in Object_3D'Class) is |
use Ada.Streams.Stream_IO; |
f : File_Type; |
begin |
Create (f, out_file, file_name); |
Write (Stream (f), Object_3D (o)); |
-- ^ endian - proof and floating - point hardware neutral; |
-- using stream attribute would be machine - specific. |
Close (f); |
end Save_file; |
procedure Save_file (o : in Object_3D'Class) is |
begin |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.