text stringlengths 0 234 |
|---|
Read_face (o.face (f), o.face_invariant (f)); |
end loop; |
Read_Point_3D (o.Centre); |
for i in Matrix_33'Range (1) loop |
for j in Matrix_33'Range (2) loop |
Read_Double (buf, o.rotation (i, j)); |
end loop; |
end loop; |
-- !! sub - objects : skipped !! |
-- Main operation done! |
end Read; |
procedure Write ( |
s : in Ada.Streams.Stream_IO.Stream_Access; |
o : in Object_3D |
) |
is |
procedure Write_Intel is new Write_Intel_x86_number (s, U16); |
procedure Write_Intel is new Write_Intel_x86_number (s, U32); |
procedure Write_Float (n : in GL.C_Float) is |
m : I32; e : I16; |
begin |
Split (n, m, e); |
Write_Intel (Cvt (m)); |
Write_Intel (Cvt (e)); |
end Write_Float; |
procedure Write_Material_Float_vector (mfv : in GL.Material_Float_vector) is |
begin |
for i in mfv'Range loop |
Write_Float (mfv (i)); |
end loop; |
end Write_Material_Float_vector; |
procedure Write_Point_3D (p : in Point_3D) is |
begin |
for i in p'Range loop |
Write_Double (s, p (i)); |
end loop; |
end Write_Point_3D; |
procedure Write_Map_idx_pair_array (m : in Map_idx_pair_array) is |
begin |
for i in m'Range loop |
Write_Double (s, m (i).U); |
Write_Double (s, m (i).V); |
end loop; |
end Write_Map_idx_pair_array; |
procedure Write_face (face : Face_type; face_invar : Face_invariant_type) is |
begin |
-- 1/ Points |
for i in face.p'Range loop |
Write_Intel (U32 (face.p (i))); |
end loop; |
-- 2/ Portal connection : object name is stored |
if face.connecting = null then |
Write_String (s, empty); |
else |
Write_String (s, face.connecting.ID); |
end if; |
-- 3/ Skin |
U8'Write (s, Skin_Type'Pos (face.skin)); |
-- 4/ Mirror |
U8'Write (s, Boolean'Pos (face.mirror)); |
-- 5/ Alpha |
Write_Double (s, face.alpha); |
-- 6/ Colour |
case face.skin is |
when colour_only | coloured_texture => |
Write_Double (s, face.colour.red); |
Write_Double (s, face.colour.green); |
Write_Double (s, face.colour.blue); |
when others => |
null; |
end case; |
-- 7/ Material |
case face.skin is |
when material_only | material_texture => |
Write_Material_Float_vector (face.material.ambient); |
Write_Material_Float_vector (face.material.diffuse); |
Write_Material_Float_vector (face.material.specular); |
Write_Material_Float_vector (face.material.emission); |
Write_Float (face.material.shininess); |
when others => |
null; |
end case; |
-- 8/ Texture : texture name is stored |
if face.texture = null_image then |
-- Maybe a texture name has been given with Texture_name_hint, |
-- but was not yet attached to a GL ID number through Rebuild_Links |
Write_String (s, face_invar.texture_name); |
else |
-- Usual way : We can get the texture name associated to the |
-- GL ID number; name is stored by GLOBE_3D.Textures. |
Write_String (s, Textures.Texture_name (face.texture, False)); |
end if; |
U8'Write (s, Boolean'Pos (face.whole_texture)); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.