opengl: Add tiling for multi-textures.
This commit is contained in:
@@ -62,8 +62,10 @@ is
|
||||
then
|
||||
for i in 1 .. openGL.texture_Set.texture_Id (for_Model.texture_Count)
|
||||
loop
|
||||
Uniforms.Textures (i).fade_Uniform .Value_is (Real (for_Model.Fade (Which => i)));
|
||||
Uniforms.Textures (i).texture_applied_Uniform.Value_is (for_Model.texture_Applied (Which => i));
|
||||
Uniforms.Textures (i).tiling_Uniform .Value_is (Vector_2' ((for_Model.Tiling (Which => i).S,
|
||||
for_Model.Tiling (Which => i).T)));
|
||||
Uniforms.Textures (i).fade_Uniform .Value_is (Real (for_Model.Fade (Which => i)));
|
||||
Uniforms.Textures (i).texture_applied_Uniform.Value_is (for_Model.texture_Applied (Which => i));
|
||||
|
||||
glUniform1i (Uniforms.Textures (i).texture_Uniform.gl_Variable,
|
||||
GLint (i) - 1);
|
||||
@@ -92,10 +94,12 @@ is
|
||||
texture_uniform_Name : constant String := "Textures[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||
fade_uniform_Name : constant String := "Fade[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||
texture_applies_uniform_Name : constant String := "texture_Applies[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||
tiling_uniform_Name : constant String := "Tiling[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||
begin
|
||||
Uniforms.Textures (Id). texture_Uniform := for_Program.uniform_Variable (Named => texture_uniform_Name);
|
||||
Uniforms.Textures (Id). fade_Uniform := for_Program.uniform_Variable (Named => fade_uniform_Name);
|
||||
Uniforms.Textures (Id).texture_applied_Uniform := for_Program.uniform_Variable (Named => texture_applies_uniform_Name);
|
||||
Uniforms.Textures (Id).tiling_Uniform := for_Program.uniform_Variable (Named => tiling_uniform_Name);
|
||||
end;
|
||||
end loop;
|
||||
|
||||
@@ -139,7 +143,7 @@ is
|
||||
function Fade (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.fade_Level
|
||||
is
|
||||
begin
|
||||
return Self.texture_Set.Textures (which).Fade;
|
||||
return Self.texture_Set.Textures (Which).Fade;
|
||||
end Fade;
|
||||
|
||||
|
||||
@@ -180,11 +184,34 @@ is
|
||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean
|
||||
is
|
||||
begin
|
||||
return Self.texture_Set.Textures (which).Applied;
|
||||
return Self.texture_Set.Textures (Which).Applied;
|
||||
end texture_Applied;
|
||||
|
||||
|
||||
|
||||
overriding
|
||||
procedure Tiling_is (Self : in out Item; Now : in texture_Set.Tiling;
|
||||
Which : in texture_Set.texture_ID := 1)
|
||||
is
|
||||
begin
|
||||
Self.texture_Set.Textures (Which).Tiling := Now;
|
||||
end Tiling_is;
|
||||
|
||||
|
||||
|
||||
overriding
|
||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling
|
||||
is
|
||||
begin
|
||||
return Self.texture_Set.Textures (Which).Tiling;
|
||||
end Tiling;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
overriding
|
||||
procedure enable_Textures (Self : in out Item)
|
||||
is
|
||||
|
||||
@@ -22,6 +22,7 @@ is
|
||||
texture_Uniform : openGL.Variable.uniform.sampler2D;
|
||||
fade_Uniform : openGL.Variable.uniform.float;
|
||||
texture_applied_Uniform : openGL.Variable.uniform.bool;
|
||||
tiling_Uniform : openGL.Variable.uniform.vec2;
|
||||
end record;
|
||||
|
||||
|
||||
@@ -50,7 +51,6 @@ is
|
||||
|
||||
|
||||
|
||||
|
||||
-------------
|
||||
--- Mixin ---
|
||||
-------------
|
||||
@@ -64,7 +64,6 @@ is
|
||||
procedure create_Uniforms (for_Program : in openGL.Program.view);
|
||||
|
||||
|
||||
|
||||
overriding
|
||||
procedure Fade_is (Self : in out Item; Now : in texture_Set.fade_Level;
|
||||
Which : in texture_Set.texture_ID := 1);
|
||||
@@ -85,6 +84,11 @@ is
|
||||
overriding
|
||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean;
|
||||
|
||||
overriding
|
||||
procedure Tiling_is (Self : in out Item; Now : in texture_Set.Tiling;
|
||||
Which : in texture_Set.texture_ID := 1);
|
||||
overriding
|
||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling;
|
||||
|
||||
|
||||
overriding
|
||||
|
||||
@@ -136,6 +136,17 @@ is
|
||||
|
||||
|
||||
|
||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling
|
||||
is
|
||||
begin
|
||||
raise program_Error with "Geometry has no texture.";
|
||||
return (S => 0.0,
|
||||
T => 0.0);
|
||||
end Tiling;
|
||||
|
||||
|
||||
|
||||
|
||||
procedure Program_is (Self : in out Item; Now : in openGL.Program.view)
|
||||
is
|
||||
begin
|
||||
|
||||
@@ -66,6 +66,10 @@ is
|
||||
Which : in texture_Set.texture_ID := 1) is null;
|
||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean;
|
||||
|
||||
procedure Tiling_is (Self : in out Item; Now : in texture_Set.Tiling;
|
||||
Which : in texture_Set.texture_ID := 1) is null;
|
||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling;
|
||||
|
||||
|
||||
|
||||
procedure Bounds_are (Self : in out Item'Class; Now : in Bounds);
|
||||
|
||||
Reference in New Issue
Block a user