opengl: Rename 'openGL.texturing' to 'openGL.texture_Set'.

This commit is contained in:
Rod Kay
2023-05-31 07:07:11 +10:00
parent a362e5aeff
commit af64e4ce3e
13 changed files with 123 additions and 90 deletions

View File

@@ -18,7 +18,7 @@ with
package body openGL.Geometry.lit_colored_textured
is
use openGL.texturing,
use openGL.texture_Set,
GL.lean,
GL.Pointers,
Interfaces,
@@ -281,14 +281,14 @@ is
--- Texturing
--
procedure Fade_is (Self : in out Item; Which : texturing.texture_ID; Now : in texturing.fade_Level)
procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level)
is
begin
Self.Textures.Textures (Which).Fade := Now;
end Fade_is;
function Fade (Self : in Item; Which : texturing.texture_ID) return texturing.fade_Level
function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level
is
begin
return Self.Textures.Textures (Which).Fade;
@@ -311,7 +311,7 @@ is
function Texture (Self : in Item; Which : texture_ID) return openGL.Texture.Object
is
begin
return openGL.texturing.Texture (in_Set => Self.Textures,
return openGL.texture_Set.Texture (in_Set => Self.Textures,
which => Which);
end Texture;
@@ -330,7 +330,7 @@ is
function Texture (Self : in Item) return openGL.Texture.Object
is
begin
return openGL.texturing.Texture (in_Set => Self.Textures,
return openGL.texture_Set.Texture (in_Set => Self.Textures,
which => 1);
end Texture;

View File

@@ -1,5 +1,5 @@
with
openGL.texturing;
openGL.texture_Set;
package openGL.Geometry.lit_colored_textured
@@ -42,12 +42,12 @@ is
--- Texturing.
--
procedure Fade_is (Self : in out Item; Which : texturing.texture_ID; Now : in texturing.fade_Level);
function Fade (Self : in Item; Which : texturing.texture_ID) return texturing.fade_Level;
procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level);
function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level;
procedure Texture_is (Self : in out Item; Which : texturing.texture_ID; Now : in openGL.Texture.Object);
function Texture (Self : in Item; Which : texturing.texture_ID) return openGL.Texture.Object;
procedure Texture_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in openGL.Texture.Object);
function Texture (Self : in Item; Which : texture_Set.texture_ID) return openGL.Texture.Object;
overriding
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object);
@@ -61,7 +61,7 @@ private
type Item is new Geometry.item with
record
Textures : texturing.texture_Set;
Textures : texture_Set.texture_Set;
end record;

View File

@@ -1,4 +1,5 @@
with
-- openGL.Geometry.texturing,
openGL.Buffer.general,
openGL.Model,
openGL.Shader,
@@ -25,7 +26,7 @@ package body openGL.Geometry.lit_textured
is
use GL.lean,
GL.Pointers,
openGL.texturing,
openGL.texture_Set,
Interfaces;
-----------
@@ -57,13 +58,15 @@ is
--- Uniforms
--
type texture_Uniforms is
type texture_fade_Uniform_pair is
record
texture_Uniform : openGL.Variable.uniform.sampler2D;
fade_Uniform : openGL.Variable.uniform.float;
end record;
the_Textures : array (texture_Id range 1 .. max_Textures) of texture_Uniforms;
type texture_fade_Uniform_pairs is array (texture_Id range 1 .. max_Textures) of texture_fade_Uniform_pair;
the_Textures : texture_fade_Uniform_pairs;
the_texture_count_Uniform : openGL.Variable.uniform.int;
@@ -305,7 +308,7 @@ is
--- Texturing
--
procedure Fade_is (Self : in out Item; Which : texture_ID; Now : in texturing.fade_Level)
procedure Fade_is (Self : in out Item; Which : texture_ID; Now : in texture_Set.fade_Level)
is
begin
Self.texture_Set.Textures (which).Fade := Now;
@@ -313,7 +316,7 @@ is
function Fade (Self : in Item; Which : texturing.texture_ID) return texturing.fade_Level
function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level
is
begin
return Self.texture_Set.Textures (which).Fade;
@@ -334,7 +337,7 @@ is
function Texture (Self : in Item; Which : texture_ID) return openGL.Texture.Object
is
begin
return openGL.texturing.Texture (in_Set => Self.texture_Set,
return openGL.texture_Set.Texture (in_Set => Self.texture_Set,
Which => Which);
end Texture;
@@ -354,7 +357,7 @@ is
function Texture (Self : in Item) return openGL.Texture.Object
is
begin
return texturing.Texture (in_Set => Self.texture_Set,
return texture_Set.Texture (in_Set => Self.texture_Set,
Which => 1);
end Texture;
@@ -402,23 +405,53 @@ is
GL_TEXTURE31);
procedure enable_Texturing (for_Model : in openGL.Model.view;
texturing_Uniforms : in texture_fade_Uniform_pairs;
texture_Set : in openGL.texture_Set.texture_Set)
is
begin
for i in 1 .. texture_Id (for_Model.texture_Count)
loop
texturing_Uniforms (i).fade_Uniform.Value_is (Real (for_Model.Fade (i)));
glUniform1i (texturing_Uniforms (i).texture_Uniform.gl_Variable,
GLint (i) - 1);
glActiveTexture (all_texture_Units (i));
glBindTexture (GL_TEXTURE_2D,
texture_Set.Textures (i).Object.Name);
end loop;
the_texture_count_Uniform.Value_is (for_Model.texture_Count);
end enable_Texturing;
overriding
procedure enable_Textures (Self : in out Item)
is
begin
for i in 1 .. texture_Id (Self.Model.texture_Count)
loop
the_Textures (i).fade_Uniform.Value_is (Real (Self.Model.Fade (i)));
glUniform1i (the_Textures (i).texture_Uniform.gl_Variable,
GLint (i) - 1);
glActiveTexture (all_texture_Units (i));
glBindTexture (GL_TEXTURE_2D,
Self.texture_Set.Textures (i).Object.Name);
end loop;
the_texture_count_Uniform.Value_is (Self.texture_Set.Count);
enable_Texturing (for_Model => Self.Model.all'Access,
texturing_Uniforms => the_Textures,
texture_Set => Self.texture_Set);
--
-- for i in 1 .. texture_Id (Self.Model.texture_Count)
-- loop
-- the_Textures (i).fade_Uniform.Value_is (Real (Self.Model.Fade (i)));
--
-- glUniform1i (the_Textures (i).texture_Uniform.gl_Variable,
-- GLint (i) - 1);
-- glActiveTexture (all_texture_Units (i));
-- glBindTexture (GL_TEXTURE_2D,
-- Self.texture_Set.Textures (i).Object.Name);
-- end loop;
--
-- the_texture_count_Uniform.Value_is (Self.texture_Set.Count);
end enable_Textures;
end openGL.Geometry.lit_textured;

View File

@@ -1,5 +1,5 @@
with
openGL.texturing;
openGL.texture_Set;
package openGL.Geometry.lit_textured
@@ -45,12 +45,12 @@ is
--- Texturing.
--
procedure Fade_is (Self : in out Item; Which : texturing.texture_ID; Now : in texturing.fade_Level);
function Fade (Self : in Item; Which : texturing.texture_ID) return texturing.fade_Level;
procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level);
function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level;
procedure Texture_is (Self : in out Item; Which : texturing.texture_ID; Now : in openGL.Texture.Object);
function Texture (Self : in Item; Which : texturing.texture_ID) return openGL.Texture.Object;
procedure Texture_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in openGL.Texture.Object);
function Texture (Self : in Item; Which : texture_Set.texture_ID) return openGL.Texture.Object;
overriding
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object);
@@ -64,7 +64,7 @@ private
type Item is new Geometry.item with
record
texture_Set : texturing.texture_Set;
texture_Set : openGL.texture_Set.texture_Set;
end record;

View File

@@ -19,7 +19,7 @@ is
use GL.lean,
GL.Pointers,
openGL.texturing,
openGL.texture_Set,
Interfaces,
System;
@@ -169,7 +169,7 @@ is
--- Texturing
--
procedure Fade_is (Self : in out Item; Which : texturing.texture_ID; Now : in texturing.fade_Level)
procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level)
is
begin
Self.Textures.Textures (Which).Fade := Now;
@@ -177,7 +177,7 @@ is
function Fade (Self : in Item; Which : texturing.texture_ID) return texturing.fade_Level
function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level
is
begin
return Self.Textures.Textures (Which).Fade;
@@ -198,7 +198,7 @@ is
function Texture (Self : in Item; Which : texture_ID) return openGL.Texture.Object
is
begin
return openGL.texturing.Texture (in_Set => Self.Textures,
return openGL.texture_Set.Texture (in_Set => Self.Textures,
Which => Which);
end Texture;
@@ -218,7 +218,7 @@ is
function Texture (Self : in Item) return openGL.Texture.Object
is
begin
return openGL.texturing.Texture (in_Set => Self.Textures,
return openGL.texture_Set.Texture (in_Set => Self.Textures,
which => 1);
end Texture;

View File

@@ -1,5 +1,5 @@
with
openGL.texturing;
openGL.texture_Set;
package openGL.Geometry.textured
@@ -42,12 +42,12 @@ is
--- Texturing.
--
procedure Fade_is (Self : in out Item; Which : texturing.texture_ID; Now : in texturing.fade_Level);
function Fade (Self : in Item; Which : texturing.texture_ID) return texturing.fade_Level;
procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level);
function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level;
procedure Texture_is (Self : in out Item; Which : texturing.texture_ID; Now : in openGL.Texture.Object);
function Texture (Self : in Item; Which : texturing.texture_ID) return openGL.Texture.Object;
procedure Texture_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in openGL.Texture.Object);
function Texture (Self : in Item; Which : texture_Set.texture_ID) return openGL.Texture.Object;
overriding
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object);
@@ -61,7 +61,7 @@ private
type Item is new Geometry.item with
record
Textures : texturing.texture_Set;
Textures : texture_Set.texture_Set;
end record;

View File

@@ -3,7 +3,7 @@ with
openGL.Buffer,
openGL.Program,
openGL.Texture,
openGL.texturing;
openGL.texture_Set;
limited
with
@@ -103,7 +103,7 @@ is
private
use ada.Strings.unbounded;
type Textures is array (texturing.texture_Id) of openGL.Texture.Object;
type Textures is array (texture_Set.texture_Id) of openGL.Texture.Object;
type Item is abstract tagged limited

View File

@@ -33,8 +33,8 @@ is
--
overriding
procedure Fade_is (Self : in out Item; Which : in texturing.texture_Id;
Now : in texturing.fade_Level)
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
Now : in texture_Set.fade_Level)
is
begin
Self.Face.Fades (which) := Now;
@@ -43,7 +43,7 @@ is
overriding
function Fade (Self : in Item; Which : in texturing.texture_Id) return texturing.fade_Level
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
is
begin
return Self.Face.Fades (which);
@@ -51,7 +51,7 @@ is
procedure Texture_is (Self : in out Item; Which : in texturing.texture_Id;
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
Now : in openGL.asset_Name)
is
begin
@@ -88,7 +88,7 @@ is
function new_Face (Vertices : in geometry.lit_textured.Vertex_array) return Geometry.lit_textured.view
is
use Primitive,
texturing;
texture_Set;
the_Geometry : constant Geometry.lit_textured.view
:= Geometry.lit_textured.new_Geometry;
@@ -96,7 +96,7 @@ is
the_Primitive : constant Primitive.indexed.view
:= Primitive.indexed.new_Primitive (triangle_Fan, the_Indices);
Id : texturing.texture_Id;
Id : texture_Set.texture_Id;
begin
the_Geometry.Vertices_are (Vertices);
the_Geometry.add (Primitive.view (the_Primitive));

View File

@@ -1,5 +1,5 @@
with
openGL.texturing,
openGL.texture_Set,
openGL.Texture;
@@ -14,8 +14,8 @@ is
type Face is
record
Fades : texturing.fade_Levels (texturing.texture_Id) := [others => 0.0];
Textures : openGL.asset_Names (1 .. Positive (texturing.texture_Id'Last)) := [others => null_Asset]; -- The textures to be applied to the hex.
Fades : texture_Set.fade_Levels (texture_Set.texture_Id) := [others => 0.0];
Textures : openGL.asset_Names (1 .. Positive (texture_Set.texture_Id'Last)) := [others => null_Asset]; -- The textures to be applied to the hex.
texture_Count : Natural := 0;
end record;
@@ -41,13 +41,13 @@ is
--
overriding
function Fade (Self : in Item; Which : in texturing.texture_Id) return texturing.fade_Level;
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
overriding
procedure Fade_is (Self : in out Item; Which : in texturing.texture_Id;
Now : in texturing.fade_Level);
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
Now : in texture_Set.fade_Level);
procedure Texture_is (Self : in out Item; Which : in texturing.texture_Id;
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
Now : in asset_Name);
overriding

View File

@@ -218,8 +218,8 @@ is
-- Texturing
--
procedure Fade_is (Self : in out Item; which : in texturing.texture_Id;
now : in texturing.fade_Level)
procedure Fade_is (Self : in out Item; which : in texture_Set.texture_Id;
now : in texture_Set.fade_Level)
is
begin
raise program_Error with "Model does not support texturing.";
@@ -227,7 +227,7 @@ is
function Fade (Self : in Item; which : in texturing.texture_Id) return texturing.fade_Level
function Fade (Self : in Item; which : in texture_Set.texture_Id) return texture_Set.fade_Level
is
begin
raise program_Error with "Model does not support texturing.";

View File

@@ -3,7 +3,7 @@ with
openGL.Font,
openGL.Texture,
openGL.Geometry,
openGL.texturing;
openGL.texture_Set;
package openGL.Model
@@ -74,9 +74,9 @@ is
-- Texturing
--
function Fade (Self : in Item; Which : in texturing.texture_Id) return texturing.fade_Level;
procedure Fade_is (Self : in out Item; Which : in texturing.texture_Id;
Now : in texturing.fade_Level);
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
Now : in texture_Set.fade_Level);
function texture_Count (Self : in Item) return Natural;

View File

@@ -9,16 +9,16 @@ with
with ada.Text_IO; use ada.Text_IO;
package body openGL.texturing
package body openGL.texture_Set
is
procedure Texture_is (in_Set : in out texture_Set; Which : texture_ID; Now : in openGL.Texture.Object)
is
begin
in_Set.Textures (Which) := (0.0,
Now,
texture_Uniform => <>,
fade_Uniform => <>);
Now); --,
-- texture_Uniform => <>,
-- fade_Uniform => <>);
in_Set.is_Transparent := in_Set.is_Transparent
or Now .is_Transparent;
@@ -87,11 +87,11 @@ is
begin
null;
declare
uniform_Name : aliased constant String :="Textures[" & Trim (Natural'Image (i - 1), Left) & "]";
begin
the_Textures.Textures (Id).texture_Uniform := Program.uniform_Variable (Named => uniform_Name);
end;
-- declare
-- uniform_Name : aliased constant String :="Textures[" & Trim (Natural'Image (i - 1), Left) & "]";
-- begin
-- the_Textures.Textures (Id).texture_Uniform := Program.uniform_Variable (Named => uniform_Name);
-- end;
-- declare
-- uniform_Name : constant String := "Fade[" & Trim (Natural'Image (i - 1), Left) & "]";
@@ -150,11 +150,11 @@ is
Id : constant texture_Id := texture_Id (i);
begin
null;
glUniform1i (the_Textures.Textures (Id).texture_Uniform.gl_Variable,
GLint (i) - 1);
glActiveTexture (all_texture_Units (Id));
glBindTexture (GL_TEXTURE_2D,
the_Textures.Textures (Id).Object.Name);
-- glUniform1i (the_Textures.Textures (Id).texture_Uniform.gl_Variable,
-- GLint (i) - 1);
-- glActiveTexture (all_texture_Units (Id));
-- glBindTexture (GL_TEXTURE_2D,
-- the_Textures.Textures (Id).Object.Name);
end;
@@ -183,4 +183,4 @@ is
end enable;
end openGL.texturing;
end openGL.texture_Set;

View File

@@ -4,7 +4,7 @@ with
openGL.Variable.uniform;
package openGL.texturing
package openGL.texture_Set
--
-- Facilitates texturing of geometries.
--
@@ -25,8 +25,8 @@ is
record
Fade : fade_Level := 0.0;
Object : openGL.Texture.Object := openGL.Texture.null_Object;
texture_Uniform : openGL.Variable.uniform.sampler2D;
fade_Uniform : openGL.Variable.uniform.float;
-- texture_Uniform : openGL.Variable.uniform.sampler2D;
-- fade_Uniform : openGL.Variable.uniform.float;
end record;
type fadeable_Textures is array (texture_Id range 1 .. max_Textures) of fadeable_Texture;
@@ -51,4 +51,4 @@ is
function Texture (in_Set : in texture_Set) return openGL.Texture.Object;
end openGL.texturing;
end openGL.texture_Set;