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 @@ 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;