opengl: Work on texture tiling.

This commit is contained in:
Rod Kay
2025-09-05 03:18:01 +10:00
parent 7c3ba40482
commit fdebe21c71
4 changed files with 24 additions and 15 deletions

View File

@@ -198,15 +198,15 @@ is
loop loop
the_Vertices (Index_t (i)) := (Site => Vector_3 (the_Sites (i) & 0.0), the_Vertices (Index_t (i)) := (Site => Vector_3 (the_Sites (i) & 0.0),
Normal => Normal, Normal => Normal,
Coords => (Coords_and_Centroid.Coords (Index_t (i)).S * Self.Face.texture_Details.texture_Tiling, Coords => (Coords_and_Centroid.Coords (Index_t (i)).S * Self.Face.texture_Details.texture_Tiling.S,
Coords_and_Centroid.Coords (Index_t (i)).T * Self.Face.texture_Details.texture_Tiling), Coords_and_Centroid.Coords (Index_t (i)).T * Self.Face.texture_Details.texture_Tiling.T),
Shine => default_Shine); Shine => default_Shine);
end loop; end loop;
the_Vertices (the_Vertices'Last) := (Site => Vector_3 (Coords_and_Centroid.Centroid & 0.0), the_Vertices (the_Vertices'Last) := (Site => Vector_3 (Coords_and_Centroid.Centroid & 0.0),
Normal => Normal, Normal => Normal,
Coords => (S => 0.5 * Self.Face.texture_Details.texture_Tiling, Coords => (S => 0.5 * Self.Face.texture_Details.texture_Tiling.S,
T => 0.5 * Self.Face.texture_Details.texture_Tiling), T => 0.5 * Self.Face.texture_Details.texture_Tiling.T),
Shine => default_Shine); Shine => default_Shine);
face_Geometry := new_Geometry (Vertices => the_Vertices); face_Geometry := new_Geometry (Vertices => the_Vertices);

View File

@@ -90,14 +90,21 @@ is
--- Details --- Details
-- --
type Tiling is -- The number of times the texture should be wrapped.
record
S : Real;
T : Real;
end record;
type Details is type Details is
record record
Fades : fade_Levels (texture_Id) := [others => 0.0]; Fades : fade_Levels (texture_Id) := [others => 0.0];
Textures : asset_Names (1 .. Positive (texture_Id'Last)) := [others => null_Asset]; -- The textures to be applied to the visual. Textures : asset_Names (1 .. Positive (texture_Id'Last)) := [others => null_Asset]; -- The textures to be applied to the visual.
texture_Count : Natural := 0; texture_Count : Natural := 0;
texture_Tiling : Real := 1.0; -- The number of times the texture should be wrapped. texture_Tiling : Tiling := (S => 1.0,
texture_Applies : texture_Apply_array := [1 => True, others => False]; T => 1.0);
Animation : Animation_view; texture_Applies : texture_Apply_array := [1 => True, others => False];
Animation : Animation_view;
end record; end record;

View File

@@ -1,3 +1,4 @@
with openGL.texture_Set;
with with
openGL.Model.text .lit_colored, openGL.Model.text .lit_colored,
@@ -167,7 +168,7 @@ is
texture_Applies => [1 => True, others => <>], texture_Applies => [1 => True, others => <>],
Textures => [1 => Texture, others => <>], Textures => [1 => Texture, others => <>],
texture_Count => 1, texture_Count => 1,
texture_Tiling => 1.0, texture_Tiling => (S => 1.0, T => 1.0),
Animation => null))).all'Access; Animation => null))).all'Access;
end if; end if;
@@ -194,7 +195,7 @@ is
Vertices : in Geometry_2d.Sites; Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White; Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
texture_Tiling : in openGL.Real := 1.0; texture_Tiling : in openGL.texture_Set.Tiling := (S => 1.0, T => 1.0);
user_Data : in any_user_Data_view := null) return gel.Sprite.view user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use type Geometry_2d.Sites, use type Geometry_2d.Sites,
@@ -249,7 +250,7 @@ is
Height : in math.Real; Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White; Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
texture_Tiling : in openGL.Real := 1.0; texture_Tiling : in openGL.texture_Set.Tiling := (S => 1.0, T => 1.0);
user_Data : in any_user_Data_view := null) return gel.Sprite.view user_Data : in any_user_Data_view := null) return gel.Sprite.view
is is
use Math; use Math;

View File

@@ -10,6 +10,7 @@ with
openGL.Primitive, openGL.Primitive,
openGL.Model.sphere, openGL.Model.sphere,
openGL.texture_Set,
openGL.Font, openGL.Font,
openGL.Palette; openGL.Palette;
@@ -77,7 +78,7 @@ is
Vertices : in Geometry_2d.Sites; Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White; Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
texture_Tiling : in openGL.Real := 1.0; texture_Tiling : in openGL.texture_Set.Tiling := (S => 1.0, T => 1.0);
user_Data : in any_user_Data_view := null) return gel.Sprite.view; user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_rectangle_Sprite (in_World : in gel.World.view; function new_rectangle_Sprite (in_World : in gel.World.view;
@@ -91,7 +92,7 @@ is
Height : in math.Real; Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White; Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset; Texture : in openGL.asset_Name := openGL.null_Asset;
texture_Tiling : in openGL.Real := 1.0; texture_Tiling : in openGL.texture_Set.Tiling := (S => 1.0, T => 1.0);
user_Data : in any_user_Data_view := null) return gel.Sprite.view; user_Data : in any_user_Data_view := null) return gel.Sprite.view;