opengl: Revamp multi-texturing.

This commit is contained in:
Rod Kay
2025-10-05 16:22:49 +11:00
parent 8a2a562a8b
commit 3e11a52f5d
48 changed files with 226 additions and 188 deletions

View File

@@ -31,7 +31,7 @@ begin
--
the_Ball_1_Model : constant Model.Sphere.lit_colored_textured.view
:= openGL.Model.Sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
Image => the_Texture);
the_Ball_2_Model : constant Model.Sphere.lit_colored.view
:= openGL.Model.Sphere.lit_colored.new_Sphere (Radius => 1.0,

View File

@@ -29,14 +29,14 @@ begin
:= Model.Billboard.textured.forge.new_Billboard (--Scale => (1.0, 1.0, 1.0),
Plane => Billboard.xy,
Texture => the_Texture,
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]));
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]));
the_colored_Billboard_Model : constant Model.Billboard.colored_textured.view
:= Model.Billboard.colored_textured.new_Billboard (--Scale => (1.0, 1.0, 1.0),
Plane => Billboard.xy,
Color => (Palette.Green, Opaque),
Texture => the_Texture,
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]));
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]));
-- The Sprites.
--
use openGL.Visual.Forge;

View File

@@ -61,7 +61,7 @@ begin
Lower => (texture_Name => the_Texture),
Left => (texture_Name => the_Texture),
Right => (texture_Name => the_Texture)],
texture_Details => texture_Set.to_Details ([1 => the_Texture]));
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
-- The Visuals.
--

View File

@@ -37,7 +37,7 @@ begin
:= Model.Text.lit_colored.new_Text (Text => "Howdy",
Font => the_font_Id,
Color => (Red, Opaque),
texture_Details => openGL.texture_Set.to_Details ([1 => openGL.to_Asset ("assets/texture/Face1.bmp")]),
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("assets/texture/Face1.bmp")]),
Centered => False);
-- The sprites.

View File

@@ -56,7 +56,7 @@ begin
the_ball_Model : constant Model.Sphere.lit_colored_textured.view
:= Model.Sphere.lit_colored_textured.new_Sphere (radius => 0.5,
texture_Details => texture_Set.to_Details ([1 => the_Face]));
texture_Details => texture_Set.to_Set ([1 => the_Face]));
-- The Sprites.
--

View File

@@ -152,25 +152,25 @@ is
the_ball_3_Model : constant Model.sphere.lit_textured.view
:= Model.sphere.lit_textured.new_Sphere (Radius => 1.0,
texture_Details => texture_Set.to_Details ([1 => the_Texture]),
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
Image => the_Texture);
the_ball_4_Model : constant Model.sphere.lit_colored_textured.view
:= Model.sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
texture_Details => texture_Set.to_Details ([1 => the_Texture]),
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
Image => the_Texture);
the_billboard_Model : constant Model.billboard.textured.view
:= Model.billboard.textured.forge.new_Billboard (Size => (1.0, 1.0),
Plane => Billboard.xy,
texture_Details => texture_Set.to_Details ([1 => the_Texture]),
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
Texture => the_Texture);
the_colored_billboard_Model : constant Model.billboard.textured.view -- TODO: Add color.
:= Model.billboard.textured.forge.new_Billboard (Size => (1.0, 1.0),
Plane => Billboard.xy,
Texture => the_Texture,
texture_Details => texture_Set.to_Details ([1 => the_Texture]));
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
use Model.box;
the_box_1_Model : constant Model.box.colored.view
@@ -187,24 +187,24 @@ is
:= Model.box.lit_textured.new_Box
(Size => [1.0, 2.0, 1.0],
Faces => [others => (texture_Name => the_Texture)],
texture_Details => texture_Set.to_Details ([1 => the_Texture]));
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
the_box_3_Model : constant Model.box.textured.view
:= Model.box.textured.new_Box
(Size => [1.0, 2.0, 3.0],
Faces => [others => (texture_Name => the_Texture)],
texture_Details => texture_Set.to_Details ([1 => the_Texture]));
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
the_capsule_Model : constant Model.capsule.lit_textured.view
:= Model.capsule.lit_textured.new_Capsule (Radius => 0.5,
Height => 2.0,
texture_Details => texture_Set.to_Details ([1 => the_Texture]),
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
Image => the_Texture);
the_lit_textured_circle_Model : constant Model.circle.lit_textured.view
:= Model.circle.lit_textured.new_Circle (Radius => 1.5,
Texture_Details => (openGL.texture_Set.to_Details ([1 => the_Texture])),
Texture_Details => (openGL.texture_Set.to_Set ([1 => the_Texture])),
Sides => 24);
the_grid_Model : constant Model.grid.view
@@ -219,7 +219,7 @@ is
the_textured_hexagon_Model : constant Model.hexagon.lit_textured.view
:= Model.hexagon.lit_textured.new_Hexagon (Radius => 0.5,
texture_Details => texture_Set.to_Details ([1 => the_Texture]));
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
the_faceted_hexagon_column_Model : constant Model.hexagon_Column.lit_colored_faceted.view
:= Model.hexagon_Column.lit_colored_faceted.new_hexagon_Column
@@ -254,7 +254,7 @@ is
:= Model.any.new_Model (--Scale => (1.0, 1.0, 1.0),
Model => to_Asset ("assets/opengl/model/human.obj"),
Texture => the_Texture,
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
Texture_is_lucid => False);
the_lit_colored_polygon_Model : constant Model.polygon.lit_colored.view
@@ -263,13 +263,13 @@ is
the_lit_textured_polygon_Model : constant Model.polygon.lit_textured.view
:= Model.polygon.lit_textured.new_Polygon (vertex_Sites => [Origin_2D, [1.0, 0.0], [1.0, 1.0], [-1.0, 0.5]],
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]));
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]));
the_text_Model : constant Model.Text.lit_colored.view
:= Model.Text.lit_colored.new_Text (Text => "Once upon a midnight dreary ...",
Font => the_font_Id,
Color => (Green, Opaque),
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
Centered => True);
the_segment_line_Model : constant Model.segment_line.view
@@ -290,7 +290,7 @@ is
Col => 1,
Heights => the_Region.all'Access,
Color_Map => texture_File,
texture_Details => openGL.texture_Set.to_Details ([1 => texture_File]),
texture_Details => openGL.texture_Set.to_Set ([1 => texture_File]),
Tiling => Tiling);
begin
Demo.Renderer.add_Font (the_font_Id);

View File

@@ -31,7 +31,7 @@ is
function to_Model (Model : in asset_Name;
Texture : in asset_Name;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Texture_is_lucid : in Boolean) return openGL.Model.any.item
is
begin
@@ -50,7 +50,7 @@ is
function new_Model (Model : in asset_Name;
Texture : in asset_Name;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Texture_is_lucid : in Boolean) return openGL.Model.any.view
is
begin

View File

@@ -24,7 +24,7 @@ is
function new_Model (Model : in asset_Name;
Texture : in asset_Name;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Texture_is_lucid : in Boolean) return openGL.Model.any.view;
--------------

View File

@@ -15,7 +15,7 @@ is
Plane : in billboard.Plane;
Color : in lucid_Color;
Texture : in asset_Name;
texture_Details : in texture_Set.Details) return View
texture_Details : in texture_Set.item) return View
is
Self : constant View := new Item;
begin

View File

@@ -25,7 +25,7 @@ is
Plane : in billboard.Plane;
Color : in lucid_Color;
Texture : in asset_Name;
texture_Details : in texture_Set.Details) return View;
texture_Details : in texture_Set.item) return View;
--------------
--- Attributes

View File

@@ -17,7 +17,7 @@ is
function new_Billboard (Size : in Size_t := default_Size;
Plane : in billboard.Plane;
Texture : in asset_Name;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Lucid : in Boolean := False) return View
is
Self : constant View := new Item (Lucid);

View File

@@ -27,7 +27,7 @@ is
function new_Billboard (Size : in Size_t := default_Size;
Plane : in billboard.Plane;
Texture : in asset_Name;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Lucid : in Boolean := False) return View;
end Forge;

View File

@@ -11,7 +11,7 @@ is
function new_Box (Size : in Vector_3;
Faces : in lit_textured.Faces;
texture_Details : in texture_Set.Details := texture_Set.no_Details) return View
texture_Details : in texture_Set.item := texture_Set.null_Set) return View
is
Self : constant View := new Item;

View File

@@ -32,7 +32,7 @@ is
function new_Box (Size : in Vector_3;
Faces : in lit_textured.Faces;
texture_Details : in texture_Set.Details := texture_Set.no_Details) return View;
texture_Details : in texture_Set.item := texture_Set.null_Set) return View;
--------------

View File

@@ -11,7 +11,7 @@ is
function new_Box (Size : in Vector_3;
Faces : in textured.Faces;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
is_Skybox : in Boolean := False) return View
is
Self : constant View := new Item;

View File

@@ -32,7 +32,7 @@ is
function new_Box (Size : in Vector_3;
Faces : in textured.Faces;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
is_Skybox : in Boolean := False) return View;

View File

@@ -13,7 +13,7 @@ is
function new_Capsule (Radius : in Real;
Height : in Real;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View
is
Self : constant View := new Item;

View File

@@ -20,7 +20,7 @@ is
function new_Capsule (Radius : in Real;
Height : in Real;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View;
--------------

View File

@@ -13,7 +13,7 @@ is
function new_Capsule (Radius : in Real;
Height : in Real;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View
is
Self : constant View := new Item;

View File

@@ -19,7 +19,7 @@ is
function new_Capsule (Radius : in Real;
Height : in Real;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View;
--------------

View File

@@ -13,7 +13,7 @@ is
--
function new_circle (Radius : in Real;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Sides : in Positive := 24) return View
is
Self : constant View := new Item;
@@ -84,7 +84,7 @@ is
the_Geometry.Vertices_are (Vertices);
the_Geometry.add (Primitive.view (the_Primitive));
for i in 1 .. Self.texture_Details.texture_Count
for i in 1 .. Self.texture_Details.Count
loop
put_Line ("KKK" & Self.texture_Details'Image);
@@ -94,9 +94,9 @@ is
-- the_Geometry.Fade_is (which => Id,
-- now => Self.texture_Details.Fades (Id));
the_Geometry.Texture_is (which => Id,
now => Textures.fetch (Self.texture_Details.Textures (i)));
the_Geometry.is_Transparent (now => the_Geometry.Texture.is_Transparent);
the_Geometry.Texture_is (Which => Id,
Now => Textures.fetch (Self.texture_Details.Details (i).Texture));
the_Geometry.is_Transparent (Now => the_Geometry.Texture.is_Transparent);
end loop;
the_Geometry.is_Transparent (True); -- TODO: Do transparency properly.

View File

@@ -20,7 +20,7 @@ is
--
function new_circle (Radius : in Real;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Sides : in Positive := 24) return View;

View File

@@ -10,7 +10,7 @@ is
--
function new_Hexagon (Radius : in Real;
texture_Details : in texture_Set.Details) return View
texture_Details : in texture_Set.item) return View
is
Self : constant View := new Item;
begin
@@ -64,7 +64,7 @@ is
the_Geometry.Vertices_are (Vertices);
the_Geometry.add (Primitive.view (the_Primitive));
for i in 1 .. Self.texture_Details.texture_Count
for i in 1 .. Self.texture_Details.Count
loop
Id := texture_Id (i);
@@ -72,7 +72,7 @@ is
-- Now => Self.texture_Details.Fades (Id));
the_Geometry.Texture_is (Which => Id,
Now => Textures.fetch (Self.texture_Details.Textures (i)));
Now => Textures.fetch (Self.texture_Details.Details (i).Texture));
the_Geometry.is_Transparent (Now => the_Geometry.Texture.is_Transparent);
end loop;

View File

@@ -20,7 +20,7 @@ is
--
function new_Hexagon (Radius : in Real;
texture_Details : in texture_Set.Details) return View;
texture_Details : in texture_Set.item) return View;
--------------

View File

@@ -11,7 +11,7 @@ is
--
function new_polygon (vertex_Sites : in Vector_2_array;
texture_Details : in texture_Set.Details) return View
texture_Details : in texture_Set.item) return View
is
Self : constant View := new Item;
begin
@@ -74,7 +74,7 @@ is
the_Geometry.Vertices_are (Vertices);
the_Geometry.add (Primitive.view (the_Primitive));
for i in 1 .. Self.texture_Details.texture_Count
for i in 1 .. Self.texture_Details.Count
loop
Id := texture_Id (i);
@@ -82,7 +82,7 @@ is
-- Now => Self.texture_Details.Fades (Id));
the_Geometry.Texture_is (Which => Id,
Now => Textures.fetch (Self.texture_Details.Textures (i)));
Now => Textures.fetch (Self.texture_Details.Details (i).Texture));
the_Geometry.is_Transparent (Now => the_Geometry.Texture.is_Transparent);
end loop;

View File

@@ -20,7 +20,7 @@ is
--
function new_Polygon (vertex_Sites : in Vector_2_array;
texture_Details : in texture_Set.Details) return View;
texture_Details : in texture_Set.item) return View;
--------------
--- Attributes

View File

@@ -15,7 +15,7 @@ is
long_Count : in Positive := default_longitude_Count;
Color : in openGL.lucid_Color := (openGL.Palette.Grey,
Opacity => 1.0);
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View
is
Self : constant View := new Item;

View File

@@ -21,7 +21,7 @@ is
long_Count : in Positive := default_longitude_Count;
Color : in openGL.lucid_Color := (openGL.Palette.Grey,
Opacity => 1.0);
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View;

View File

@@ -12,7 +12,7 @@ is
function new_Sphere (Radius : in Real;
lat_Count : in Positive := default_latitude_Count;
long_Count : in Positive := default_longitude_Count;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View
is
Self : constant View := new Item;

View File

@@ -20,7 +20,7 @@ is
function new_Sphere (Radius : in Real;
lat_Count : in Positive := default_latitude_Count;
long_Count : in Positive := default_longitude_Count;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Image : in asset_Name := null_Asset) return View;

View File

@@ -15,7 +15,7 @@ is
lat_Count : in Positive := 26;
long_Count : in Positive := 52;
Image : in asset_Name := null_Asset;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
is_Skysphere : in Boolean := False) return View
is
Self : constant View := new Item;

View File

@@ -23,7 +23,7 @@ is
lat_Count : in Positive := 26;
long_Count : in Positive := 52;
Image : in asset_Name := null_Asset;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
is_Skysphere : in Boolean := False) return View;
--------------

View File

@@ -19,7 +19,7 @@ is
Row, Col : in Integer;
Heights : in height_Map_view;
color_Map : in asset_Name;
texture_Details : in texture_Set.Details := texture_Set.no_Details;
texture_Details : in texture_Set.item := texture_Set.null_Set;
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
T => (0.0, 1.0))) return View
is

View File

@@ -26,7 +26,7 @@ is
Row, Col : in Integer;
Heights : in height_Map_view;
color_Map : in asset_Name;
texture_Details : in texture_Set.Details := texture_Set.no_Details;
texture_Details : in texture_Set.item := texture_Set.null_Set;
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
T => (0.0, 1.0))) return View;
overriding

View File

@@ -16,7 +16,7 @@ is
function new_Text (Text : in String;
Font : in openGL.Font.font_Id;
Color : in lucid_Color;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Centered : in Boolean := True) return View
is
Font_Name : constant String := to_String (Font.Name);

View File

@@ -23,7 +23,7 @@ is
function new_Text (Text : in String;
Font : in openGL.Font.font_Id;
Color : in lucid_Color;
texture_Details : in texture_Set.Details;
texture_Details : in texture_Set.item;
Centered : in Boolean := True) return View;

View File

@@ -7,13 +7,15 @@ is
package body Mixin
is
use openGL.texture_Set;
overriding
procedure texture_Object_is (Self : in out textured_Item; Which : in texture_Set.texture_Id;
Now : in openGL.texture.Object)
is
begin
Self.texture_Details.Objects (Integer (Which)) := Now;
Self.texture_Set.Details (detail_Count (Which)).Object := Now;
end texture_Object_is;
@@ -22,7 +24,7 @@ is
function texture_Object (Self : in textured_Item; Which : in texture_Set.texture_Id) return openGL.texture.Object
is
begin
return Self.texture_Details.Objects (Integer (Which));
return Self.texture_Set.Details (detail_Count (Which)).Object;
end texture_Object;
@@ -33,7 +35,7 @@ is
Now : in texture_Set.fade_Level)
is
begin
Self.texture_Details.Fades (Which) := Now;
Self.texture_Set.Details (detail_Count (Which)).Fade := Now;
end Fade_is;
@@ -42,7 +44,7 @@ is
function Fade (Self : in textured_Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
is
begin
return Self.texture_Details.Fades (Which);
return Self.texture_Set.Details (detail_Count (Which)).Fade;
end Fade;
@@ -52,7 +54,7 @@ is
Now : in texture_Set.Tiling)
is
begin
Self.texture_Details.texture_Tilings (Which) := Now;
Self.texture_Set.Details (detail_Count (Which)).texture_Tiling := Now;
end Tiling_is;
@@ -61,7 +63,7 @@ is
function Tiling (Self : in textured_Item; Which : in texture_Set.texture_Id) return texture_Set.Tiling
is
begin
return Self.texture_Details.texture_Tilings (Which);
return Self.texture_Set.Details (detail_Count (Which)).texture_Tiling;
end Tiling;
@@ -71,7 +73,7 @@ is
Now : in openGL.asset_Name)
is
begin
Self.texture_Details.Textures (Positive (Which)) := Now;
Self.texture_Set.Details (detail_Count (Which)).Texture := Now;
end Texture_is;
@@ -81,7 +83,7 @@ is
function texture_Count (Self : in textured_Item) return Natural
is
begin
return Self.texture_Details.texture_Count;
return Natural (Self.texture_Set.Count);
end texture_Count;
@@ -90,7 +92,7 @@ is
function texture_Applied (Self : in textured_Item; Which : in texture_Set.texture_Id) return Boolean
is
begin
return Self.texture_Details.texture_Applies (Which);
return Self.texture_Set.Details (detail_Count (Which)).texture_Apply;
end texture_Applied;
@@ -100,7 +102,7 @@ is
Now : in Boolean)
is
begin
Self.texture_Details.texture_Applies (Which) := Now;
Self.texture_Set.Details (detail_Count (Which)).texture_Apply := Now;
end texture_Applied_is;
@@ -109,30 +111,32 @@ is
overriding
procedure animate (Self : in out textured_Item)
is
use type texture_Set.Animation_view;
-- use type texture_Set.Animation_view;
begin
if Self.texture_Details.Animation = null
then
return;
end if;
texture_Set.animate (Self.texture_Details.Animation.all,
Self.texture_Details.texture_Applies);
-- texture_Set.animate (Self.texture_Set.Animation.all,
-- Self.texture_Set.texture_Applies);
texture_Set.animate (Self.texture_Set);
end animate;
function texture_Details (Self : in textured_Item) return openGL.texture_Set.Details
function texture_Details (Self : in textured_Item) return openGL.texture_Set.item
is
begin
return Self.texture_Details;
return Self.texture_Set;
end texture_Details;
procedure texture_Details_is (Self : in out textured_Item; Now : in openGL.texture_Set.Details)
procedure texture_Details_is (Self : in out textured_Item; Now : in openGL.texture_Set.item)
is
begin
Self.texture_Details := Now;
Self.texture_Set := Now;
end texture_Details_is;

View File

@@ -58,9 +58,9 @@ is
procedure animate (Self : in out textured_Item);
function texture_Details (Self : in textured_Item) return openGL.texture_Set.Details;
function texture_Details (Self : in textured_Item) return openGL.texture_Set.item;
procedure texture_Details_is (Self : in out textured_Item; Now : in openGL.texture_Set.Details);
procedure texture_Details_is (Self : in out textured_Item; Now : in openGL.texture_Set.item);
@@ -68,7 +68,7 @@ is
type textured_Item is abstract new Item with
record
texture_Details : openGL.texture_Set.Details;
texture_Set : openGL.texture_Set.item;
end record;
end Mixin;

View File

@@ -122,7 +122,7 @@ is
Col => Col,
Heights => the_Region.all'Access,
color_Map => texture_File,
texture_Details => texture_Set.to_Details ([1 => texture_File]),
texture_Details => texture_Set.to_Set ([1 => texture_File]),
Tiling => Tiling);
the_height_Extents : constant Vector_2 := height_Extent (the_Region.all);

View File

@@ -19,82 +19,110 @@ is
procedure animate (the_Animation : in out Animation;
texture_Applies : in out texture_Apply_array)
-- procedure animate (the_Animation : in out Animation;
-- texture_Applies : in out texture_Apply_array)
-- is
-- use ada.Calendar;
--
-- Now : constant ada.Calendar.Time := Clock;
--
-- begin
-- if Now >= the_Animation.next_frame_Time
-- then
-- declare
-- next_frame_Id : constant frame_Id := (if the_Animation.Current < the_Animation.frame_Count then the_Animation.Current + 1
-- else 1);
-- old_Frame : Frame renames the_Animation.Frames (the_Animation.Current);
-- new_Frame : Frame renames the_Animation.Frames (next_frame_Id);
-- begin
-- texture_Applies (old_Frame.texture_Id) := False;
-- texture_Applies (new_Frame.texture_Id) := True;
--
-- the_Animation.Current := next_frame_Id;
-- the_Animation.next_frame_Time := Now + the_Animation.frame_Duration;
-- end;
-- end if;
-- end animate;
procedure animate (Self : in out Item)
is
use ada.Calendar;
Now : constant ada.Calendar.Time := Clock;
begin
if Now >= the_Animation.next_frame_Time
if Now >= Self.Animation.next_frame_Time
then
declare
next_frame_Id : constant frame_Id := (if the_Animation.Current < the_Animation.frame_Count then the_Animation.Current + 1
else 1);
old_Frame : Frame renames the_Animation.Frames (the_Animation.Current);
new_Frame : Frame renames the_Animation.Frames (next_frame_Id);
next_frame_Id : constant frame_Id := (if Self.Animation.Current < Self.Animation.frame_Count then Self.Animation.Current + 1
else 1);
old_Frame : Frame renames Self.Animation.Frames (Self.Animation.Current);
new_Frame : Frame renames Self.Animation.Frames (next_frame_Id);
begin
texture_Applies (old_Frame.texture_Id) := False;
texture_Applies (new_Frame.texture_Id) := True;
Self.Details (detail_Count (old_Frame.texture_Id)).texture_Apply := False;
Self.Details (detail_Count (new_Frame.texture_Id)).texture_Apply := True;
the_Animation.Current := next_frame_Id;
the_Animation.next_frame_Time := Now + the_Animation.frame_Duration;
Self.Animation.Current := next_frame_Id;
Self.Animation.next_frame_Time := Now + Self.Animation.frame_Duration;
end;
end if;
end animate;
-----------
--- Details
--
function to_Details (texture_Assets : in asset_Names;
Animation : in Animation_view := null) return Details
is
Result : Details;
begin
Result.texture_Count := texture_Assets'Length;
for i in 1 .. texture_Assets'Length
loop
Result.Textures (i) := texture_Assets (i);
end loop;
Result.Animation := Animation;
return Result;
end to_Details;
-- function to_Set (texture_Assets : in asset_Names;
-- Animation : in Animation_view := null) return Item
-- function to_Details (texture_Assets : in asset_Names;
-- Animation : in Animation_view := null) return Details
-- is
-- Result : Item (Count => texture_Assets'Length);
--
-- Result : Details;
-- begin
-- for i in 1 .. Result.Count
-- loop
-- Result.Details (i).Object := texture.null_Object;
-- Result.Details (i).Texture := texture_Assets (Integer (i));
-- Result.Details (i).Fade := 0.0;
-- Result.Details (i).texture_Tiling := (S => 1.0, T => 1.0);
-- Result.texture_Count := texture_Assets'Length;
--
-- if i = 1
-- then
-- Result.Details (i).texture_Apply := True;
-- else
-- Result.Details (i).texture_Apply := False;
-- end if;
-- for i in 1 .. texture_Assets'Length
-- loop
-- Result.Textures (i) := texture_Assets (i);
-- end loop;
--
-- Result.Animation := Animation;
--
-- return Result;
-- end to_Set;
-- end to_Details;
function to_Set (texture_Assets : in asset_Names;
texture_Tilings : in Tilings := [others => (S => 1.0,
T => 1.0)];
Animation : in Animation_view := null) return Item
is
Result : Item (Count => texture_Assets'Length);
begin
for i in 1 .. Result.Count
loop
Result.Details (i).Object := texture.null_Object;
Result.Details (i).Texture := texture_Assets (Integer (i));
Result.Details (i).Fade := 0.0;
Result.Details (i).texture_Tiling := texture_Tilings (texture_Id (i));
if i = 1
then
Result.Details (i).texture_Apply := True;
else
Result.Details (i).texture_Apply := False;
end if;
end loop;
Result.Animation := Animation;
return Result;
end to_Set;

View File

@@ -64,7 +64,7 @@ is
--- Apply
--
type texture_Apply_array is array (texture_Set.texture_Id) of Boolean;
-- type texture_Apply_array is array (texture_Set.texture_Id) of Boolean;
-------------
@@ -96,8 +96,8 @@ is
type Animation_view is access all Animation;
procedure animate (the_Animation : in out Animation;
texture_Applies : in out texture_Apply_array);
-- procedure animate (the_Animation : in out Animation;
-- texture_Applies : in out texture_Apply_array);
@@ -118,38 +118,54 @@ is
--- Details
--
type Details is
-- type Details is
-- record
-- texture_Count : Natural := 0;
-- Fades : fade_Levels (texture_Id) := [others => 0.0];
-- Textures : asset_Names (1 .. Positive (texture_Id'Last)) := [others => null_Asset];
-- Objects : texture.Objects (1 .. Positive (texture_Id'Last)) := [others => texture.null_Object];
-- texture_Tilings : Tilings := [others => (S => 1.0,
-- T => 1.0)];
-- texture_Applies : texture_Apply_array := [1 => True, others => False]; -- The textures to be applied to the visual.
-- Animation : Animation_view;
-- end record;
type Item (Count : detail_Count := 1) is
record
texture_Count : Natural := 0;
Fades : fade_Levels (texture_Id) := [others => 0.0];
Textures : asset_Names (1 .. Positive (texture_Id'Last)) := [others => null_Asset];
Objects : texture.Objects (1 .. Positive (texture_Id'Last)) := [others => texture.null_Object];
texture_Tilings : Tilings := [others => (S => 1.0,
T => 1.0)];
texture_Applies : texture_Apply_array := [1 => True, others => False]; -- The textures to be applied to the visual.
Animation : Animation_view;
Details : Detail_array (1 .. Count);
Animation : Animation_view;
end record;
null_Set : constant Item;
---------
--- Forge
--
function to_Details (texture_Assets : in asset_Names;
Animation : in Animation_view := null) return Details;
no_Details : constant Details;
-- function to_Details (texture_Assets : in asset_Names;
-- Animation : in Animation_view := null) return Details;
--
-- no_Details : constant Details;
-- function to_Set (texture_Assets : in asset_Names;
-- Animation : in Animation_view := null) return Item;
function to_Set (texture_Assets : in asset_Names;
texture_Tilings : in Tilings := [others => (S => 1.0,
T => 1.0)];
Animation : in Animation_view := null) return Item;
--------------
--- Attributes
--
procedure animate (Self : in out Item);
-- function get_Details (Self : in Item) return Detail_array;
-- procedure Details_are (Self : in out Item; Now : in Detail_array);
--
@@ -160,13 +176,6 @@ is
private
-- type Item (Count : detail_Count := 1) is
-- record
-- Details : Detail_array (1 .. Count);
-- Animation : Animation_view;
-- end record;
-----------
--- Streams
@@ -182,8 +191,8 @@ private
for Animation_view'read use read;
no_Details : constant Details := (others => <>);
-- null_Set : constant Item := (Count => 0,
-- others => <>);
-- no_Details : constant Details := (others => <>);
null_Set : constant Item := (Count => 0,
others => <>);
end openGL.texture_Set;

View File

@@ -84,7 +84,7 @@ is
Height => Height),
Plane => Model.billboard.xy,
Texture => null_Asset,
texture_Details => texture_Set.to_Details ([1 => null_Asset])).all'Access);
texture_Details => texture_Set.to_Set ([1 => null_Asset])).all'Access);
Self.Visual.Transform_is (Target.Transform);
-- Self.Visual.model_Transform_is (Target.model_Transform);
end set_Target;

View File

@@ -35,7 +35,7 @@ is
the_human_graphics_Model : constant openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => openGL.to_Asset ("./assets/opengl/model/human.obj"),
Texture => openGL.to_Asset ("./assets/opengl/texture/wooden-crate.jpg"),
texture_Details => openGL.texture_Set.to_Details ([1 => openGL.to_Asset ("./assets/opengl/texture/wooden-crate.jpg")]),
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("./assets/opengl/texture/wooden-crate.jpg")]),
Texture_is_lucid => False);
the_human_physics_Model : constant physics.Model.view
@@ -54,7 +54,7 @@ is
the_cobra_graphics_Model : aliased constant openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => openGL.to_Asset ("./assets/oolite_cobra3.obj"),
Texture => openGL.to_Asset ("./assets/oolite_cobra3_diffuse.png"),
texture_Details => openGL.texture_Set.to_Details ([1 => openGL.to_Asset ("./assets/oolite_cobra3_diffuse.png")]),
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("./assets/oolite_cobra3_diffuse.png")]),
Texture_is_lucid => False);
the_cobra_physics_Model : constant physics.Model.view

View File

@@ -47,7 +47,7 @@ is
Model => openGL.to_Asset ("./box_1_bone.dae"),
-- Model => openGL.to_Asset ("./box_2_bone.dae"),
Texture => openGL.null_Asset,
texture_Details => openGL.texture_Set.to_Details ([1 => openGL.to_Asset ("./assets/opengl/textures/wooden-crate.jpg")]),
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("./assets/opengl/textures/wooden-crate.jpg")]),
Texture_is_lucid => False);
the_Rig : aliased gel.Rig.item;

View File

@@ -97,7 +97,7 @@ is
Col => 1,
Heights => openGL.Model.terrain.height_Map_view (gl_Heights),
color_Map => terrain_Texture,
texture_Details => texture_Set.to_Details ([1 => terrain_Texture]),
texture_Details => texture_Set.to_Set ([1 => terrain_Texture]),
Tiling => (s => (0.0, 1.0),
t => (0.0, 1.0)));
@@ -170,7 +170,7 @@ begin
the_ball_Model : constant openGL.Model.sphere.lit_colored_textured.view
:= openGL.Model.sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
Image => openGL.to_Asset ("assets/gel/golf_green-16x16.tga"),
texture_Details => texture_Set.to_Details ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]));
texture_Details => texture_Set.to_Set ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]));
the_Ball : constant gel.Sprite.view
:= gel.Sprite.forge.new_Sprite (Name => "demo.Ball",
World => the_Applet.gui_World.all'Access,
@@ -182,7 +182,7 @@ begin
the_cone_Model : constant openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => openGL.to_Asset ("assets/gel/model/unit_cone.obj"),
Texture => openGL.to_Asset ("assets/gel/Face1.bmp"),
texture_Details => texture_Set.to_Details ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]),
texture_Details => texture_Set.to_Set ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]),
Texture_is_lucid => False);
the_cone_physics_Model : constant physics.Model.view
@@ -198,7 +198,7 @@ begin
the_cylinder_Model : constant openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => openGL.to_Asset ("assets/gel/model/unit_cylinder.obj"),
Texture => openGL.to_Asset ("assets/gel/Face1.bmp"),
texture_Details => texture_Set.to_Details ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]),
texture_Details => texture_Set.to_Set ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]),
Texture_is_lucid => False);
the_cylinder_physics_Model : constant physics.Model.view
@@ -216,7 +216,7 @@ begin
the_capsule_Model : constant openGL.Model.capsule.textured.view
:= openGL.Model.capsule.textured.new_Capsule (Radius => 0.5,
Height => 2.0,
texture_Details => texture_Set.to_Details ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]),
texture_Details => texture_Set.to_Set ([1 => openGL.to_Asset ("assets/gel/Face1.bmp")]),
Image => openGL.to_Asset ("assets/gel/Face1.bmp"));

View File

@@ -154,7 +154,7 @@ is
then
the_graphics_Model := openGL.Model.sphere.lit_colored_textured.new_Sphere (Radius,
Color => Color,
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]),
Image => Texture).all'Access;
else
the_graphics_Model := openGL.Model.circle.colored.new_circle (Radius,
@@ -164,13 +164,7 @@ is
else
the_graphics_Model := openGL.Model.circle.lit_textured.new_Circle (Radius,
texture_Details => (Fades => [1 => 0.0, others => <>],
texture_Applies => [1 => True, others => <>],
Textures => [1 => Texture, others => <>],
Objects => [others => <>],
texture_Count => 1,
texture_Tilings => [others => (S => 1.0, T => 1.0)],
Animation => null)).all'Access;
texture_Details => openGL.texture_Set.to_Set ([1 => Texture])).all'Access;
end if;
return gel.Sprite.Forge.new_Sprite (Name,
@@ -221,13 +215,16 @@ is
(Color, openGL.Opaque)).all'Access;
else
the_graphics_Model := openGL.Model.polygon.lit_textured.new_Polygon (vertex_Sites => openGL.Vector_2_array (Vertices),
texture_Details => (Fades => [1 => 0.0, others => <>],
Textures => [1 => Texture, others => <>],
Objects => [others => <>],
texture_Count => 1,
texture_Tilings => texture_Tiling,
texture_Applies => [others => True],
Animation => null)).all'Access;
texture_Details => openGL.texture_Set.to_Set (texture_Assets => [1 => Texture],
texture_Tilings => texture_Tiling,
Animation => null)).all'Access;
-- texture_Details => (Fades => [1 => 0.0, others => <>],
-- Textures => [1 => Texture, others => <>],
-- Objects => [others => <>],
-- texture_Count => 1,
-- texture_Tilings => texture_Tiling,
-- texture_Applies => [others => True],
-- Animation => null)).all'Access;
end if;
return gel.Sprite.Forge.new_Sprite (Name,
@@ -318,7 +315,7 @@ is
the_graphics_Model := openGL.Model.sphere.lit_colored_textured.new_Sphere (Radius,
lat_Count => lat_Count,
long_Count => long_Count,
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]),
Image => Texture).all'Access;
else
the_graphics_Model := openGL.Model.sphere.lit_colored.new_Sphere (Radius,
@@ -337,7 +334,7 @@ is
the_graphics_Model := openGL.Model.sphere.textured.new_Sphere (Radius,
lat_Count => lat_Count,
long_Count => long_Count,
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]),
Image => Texture).all'Access;
end if;
end if;
@@ -371,7 +368,7 @@ is
begin
the_graphics_Model := openGL.Model.sphere.textured.new_Sphere (Radius,
lat_Count => 180,
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]),
Image => Texture,
is_Skysphere => True).all'Access;
return gel.Sprite.Forge.new_Sprite ("skysphere_Sprite",
@@ -449,7 +446,7 @@ is
Lower => (texture_Name => Texture),
Left => (texture_Name => Texture),
Right => (texture_Name => Texture)],
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]));
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]));
the_box_physics_Model : constant physics.Model.view
:= physics.Model.Forge.new_physics_Model (shape_Info => (Kind => physics.Model.Cube,
half_Extents => Size / 2.0),
@@ -486,7 +483,7 @@ is
Height => Size (2)),
Plane => openGL.Model.Billboard.xy,
Texture => Texture,
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]));
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]));
the_billboard_physics_Model : constant physics.Model.view
:= physics.Model.Forge.new_physics_Model (shape_Info => (Kind => physics.Model.Cube,
@@ -527,7 +524,7 @@ is
Plane => openGL.Model.Billboard.xy,
Texture => Texture,
Color => Color,
texture_Details => openGL.texture_Set.to_Details ([1 => Texture]));
texture_Details => openGL.texture_Set.to_Set ([1 => Texture]));
the_billboard_physics_Model : constant physics.Model.view
:= physics.Model.Forge.new_physics_Model (shape_Info => (Kind => physics.Model.Cube,
half_Extents => Size / 2.0),
@@ -690,7 +687,7 @@ is
:= openGL.Model.Text.lit_colored.new_Text (Text => Text,
Font => Font,
Color => (Color, openGL.Opaque),
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]),
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
Centered => True);
the_physics_Model : physics.Model.view;

View File

@@ -479,7 +479,7 @@ is
Model => openGL.to_Asset ("assets/gel/collada/mh-human-dae.dae"),
-- model => gel.to_Asset ("assets/gel/collada/alfieri.dae"),
Texture => openGL.null_Asset, -- gel.to_Asset ("assets/collada/gel-human-texture.tga"),
texture_Details => openGL.texture_Set.to_Details ([1 => openGL.to_Asset ("./assets/gel/Face1.bmp")]),
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("./assets/gel/Face1.bmp")]),
Texture_is_lucid => False);
begin
Self.bone_Sprites (the_Bone) := gel.Sprite.forge.new_Sprite (Name => sprite_Name,

View File

@@ -705,7 +705,7 @@ is
the_human_graphics_Model : aliased openGL.Model.any.view
:= openGL.Model.any.new_Model (Model => to_Asset (model_Name.all),
Texture => openGL.null_Asset, -- gel.to_Asset ("assets/collada/gel-human-texture.tga"),
texture_Details => openGL.texture_Set.to_Details ([1 => openGL.to_Asset ("./assets/opengl/texture/wooden-crate.jpg")]),
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("./assets/opengl/texture/wooden-crate.jpg")]),
Texture_is_lucid => False);
the_physics_Model : constant standard.physics.Model.view