From fdebe21c71a783c14c5e419107535e1c13f2befc Mon Sep 17 00:00:00 2001 From: Rod Kay Date: Fri, 5 Sep 2025 03:18:01 +1000 Subject: [PATCH] opengl: Work on texture tiling. --- .../opengl-model-polygon-lit_textured.adb | 8 ++++---- .../opengl/source/lean/opengl-texture_set.ads | 19 +++++++++++++------ 4-high/gel/source/forge/gel-forge.adb | 7 ++++--- 4-high/gel/source/forge/gel-forge.ads | 5 +++-- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/3-mid/opengl/source/lean/model/opengl-model-polygon-lit_textured.adb b/3-mid/opengl/source/lean/model/opengl-model-polygon-lit_textured.adb index f951d87..c6d9df2 100644 --- a/3-mid/opengl/source/lean/model/opengl-model-polygon-lit_textured.adb +++ b/3-mid/opengl/source/lean/model/opengl-model-polygon-lit_textured.adb @@ -198,15 +198,15 @@ is loop the_Vertices (Index_t (i)) := (Site => Vector_3 (the_Sites (i) & 0.0), Normal => Normal, - Coords => (Coords_and_Centroid.Coords (Index_t (i)).S * Self.Face.texture_Details.texture_Tiling, - Coords_and_Centroid.Coords (Index_t (i)).T * 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.T), Shine => default_Shine); end loop; the_Vertices (the_Vertices'Last) := (Site => Vector_3 (Coords_and_Centroid.Centroid & 0.0), Normal => Normal, - Coords => (S => 0.5 * Self.Face.texture_Details.texture_Tiling, - T => 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), Shine => default_Shine); face_Geometry := new_Geometry (Vertices => the_Vertices); diff --git a/3-mid/opengl/source/lean/opengl-texture_set.ads b/3-mid/opengl/source/lean/opengl-texture_set.ads index 1f26517..4b13c58 100644 --- a/3-mid/opengl/source/lean/opengl-texture_set.ads +++ b/3-mid/opengl/source/lean/opengl-texture_set.ads @@ -90,14 +90,21 @@ is --- Details -- + type Tiling is -- The number of times the texture should be wrapped. + record + S : Real; + T : Real; + end record; + type Details is record - 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. - texture_Count : Natural := 0; - texture_Tiling : Real := 1.0; -- The number of times the texture should be wrapped. - texture_Applies : texture_Apply_array := [1 => True, others => False]; - Animation : Animation_view; + 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. + texture_Count : Natural := 0; + texture_Tiling : Tiling := (S => 1.0, + T => 1.0); + texture_Applies : texture_Apply_array := [1 => True, others => False]; + Animation : Animation_view; end record; diff --git a/4-high/gel/source/forge/gel-forge.adb b/4-high/gel/source/forge/gel-forge.adb index 46cc99f..462057c 100644 --- a/4-high/gel/source/forge/gel-forge.adb +++ b/4-high/gel/source/forge/gel-forge.adb @@ -1,3 +1,4 @@ +with openGL.texture_Set; with openGL.Model.text .lit_colored, @@ -167,7 +168,7 @@ is texture_Applies => [1 => True, others => <>], Textures => [1 => Texture, others => <>], texture_Count => 1, - texture_Tiling => 1.0, + texture_Tiling => (S => 1.0, T => 1.0), Animation => null))).all'Access; end if; @@ -194,7 +195,7 @@ is Vertices : in Geometry_2d.Sites; Color : in openGL.Color := opengl.Palette.White; 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 is use type Geometry_2d.Sites, @@ -249,7 +250,7 @@ is Height : in math.Real; Color : in openGL.Color := opengl.Palette.White; 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 is use Math; diff --git a/4-high/gel/source/forge/gel-forge.ads b/4-high/gel/source/forge/gel-forge.ads index 4a4d798..c998385 100644 --- a/4-high/gel/source/forge/gel-forge.ads +++ b/4-high/gel/source/forge/gel-forge.ads @@ -10,6 +10,7 @@ with openGL.Primitive, openGL.Model.sphere, + openGL.texture_Set, openGL.Font, openGL.Palette; @@ -77,7 +78,7 @@ is Vertices : in Geometry_2d.Sites; Color : in openGL.Color := opengl.Palette.White; 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; function new_rectangle_Sprite (in_World : in gel.World.view; @@ -91,7 +92,7 @@ is Height : in math.Real; Color : in openGL.Color := opengl.Palette.White; 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;