gel.sprite: Add 'user_Data'.

This commit is contained in:
Rod Kay
2023-04-24 16:34:21 +10:00
parent ac87a2e6ca
commit bd5557cb67
4 changed files with 271 additions and 194 deletions

View File

@@ -115,14 +115,15 @@ is
-- 2D
--
function new_circle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Radius : in math.Real := 0.5;
Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view
function new_circle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Radius : in math.Real := 0.5;
Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use openGL;
use type Vector_2;
@@ -152,18 +153,20 @@ is
the_physics_Model,
owns_graphics => True,
owns_physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
end new_circle_Sprite;
function new_polygon_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view
function new_polygon_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use Math;
use type Geometry_2d.Sites;
@@ -190,19 +193,21 @@ is
the_physics_Model,
owns_graphics => True,
owns_physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
end new_polygon_Sprite;
function new_rectangle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
function new_rectangle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Width,
Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view
Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use Math;
@@ -214,7 +219,7 @@ is
[ half_Width, half_Height],
[-half_Width, half_Height]];
begin
return new_polygon_Sprite (in_World, Site, Mass, Friction, Bounce, the_Vertices, Color);
return new_polygon_Sprite (in_World, Site, Mass, Friction, Bounce, the_Vertices, Color, user_Data);
end new_rectangle_Sprite;
@@ -223,14 +228,15 @@ is
--
function new_ball_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Radius : in math.Real := 0.5;
lat_Count : in Positive := openGL.Model.sphere.default_latitude_Count;
long_Count : in Positive := openGL.Model.sphere.default_longitude_Count;
is_Lit : in Boolean := True;
Color : in openGL.lucid_Color := opengl.no_lucid_Color;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Radius : in math.Real := 0.5;
lat_Count : in Positive := openGL.Model.sphere.default_latitude_Count;
long_Count : in Positive := openGL.Model.sphere.default_longitude_Count;
is_Lit : in Boolean := True;
Color : in openGL.lucid_Color := opengl.no_lucid_Color;
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use type openGL.lucid_Color;
@@ -268,15 +274,17 @@ is
the_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
end new_ball_Sprite;
function new_skysphere_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Radius : in math.Real := 1_000_000.0;
Texture : in openGL.asset_Name) return gel.Sprite.view
function new_skysphere_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Radius : in math.Real := 1_000_000.0;
Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
the_graphics_Model : openGL.Model.sphere.view;
@@ -295,17 +303,19 @@ is
the_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
end new_skysphere_Sprite;
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Colors : in box_Colors := [others => opengl.Palette.random_Color];
is_Kinematic : in Boolean := False) return gel.Sprite.view
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Colors : in box_Colors := [others => opengl.Palette.random_Color];
is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use openGL.Model.box,
openGL,
@@ -332,18 +342,20 @@ is
the_box_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => is_Kinematic);
is_Kinematic => is_Kinematic,
user_Data => user_Data);
begin
return the_Box;
end new_box_Sprite;
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name) return gel.Sprite.view
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use openGL.Model.box,
Math;
@@ -369,18 +381,20 @@ is
the_box_physics_Model,
owns_graphics => True,
owns_physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
begin
return the_Box;
end new_box_Sprite;
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use Math;
@@ -404,19 +418,21 @@ is
the_billboard_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
begin
return the_Billboard;
end new_billboard_Sprite;
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Color : in openGL.lucid_Color;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Color : in openGL.lucid_Color;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use Math;
@@ -439,20 +455,22 @@ is
the_billboard_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
begin
return the_Billboard;
end new_billboard_Sprite;
function new_arrow_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view
function new_arrow_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
pragma Unreferenced (Texture);
use Math;
@@ -474,20 +492,22 @@ is
the_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
begin
return the_Arrow;
end new_arrow_Sprite;
function new_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view
function new_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
pragma Unreferenced (Texture, line_Width);
use Math;
@@ -508,20 +528,22 @@ is
the_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
begin
return the_Line;
end new_line_Sprite;
function new_segment_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view
function new_segment_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
pragma Unreferenced (Texture, line_Width);
use Math;
@@ -541,7 +563,8 @@ is
the_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
begin
return the_Line;
end new_segment_line_Sprite;
@@ -551,13 +574,14 @@ is
-- Text
--
function new_text_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Text : in String;
Font : in openGL.Font.font_Id;
Color : in openGL.Color := opengl.Palette.Black;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Centered : in Boolean := True) return gel.Sprite.view
function new_text_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Text : in String;
Font : in openGL.Font.font_Id;
Color : in openGL.Color := opengl.Palette.Black;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Centered : in Boolean := True;
user_Data : in any_user_Data_view := null) return gel.Sprite.view
is
use Math;
use type Physics.space_Kind;
@@ -597,7 +621,8 @@ is
the_physics_Model,
owns_Graphics => True,
owns_Physics => True,
is_Kinematic => False);
is_Kinematic => False,
user_Data => user_Data);
end new_text_Sprite;

View File

@@ -47,34 +47,40 @@ is
--- Sprites
--
use gel.Sprite;
-- 2D
--
function new_circle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Radius : in math.Real := 0.5;
Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view;
function new_circle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Radius : in math.Real := 0.5;
Color : in openGL.Color := opengl.Palette.White;
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_polygon_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view;
function new_polygon_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Vertices : in Geometry_2d.Sites;
Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_rectangle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
function new_rectangle_Sprite (in_World : in gel.World.view;
Site : in math.Vector_2 := math.Origin_2D;
Mass : in math.Real := 1.0;
Friction : in math.Real := 0.5;
Bounce : in math.Real := 0.5;
Width,
Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view;
Height : in math.Real;
Color : in openGL.Color := opengl.Palette.White;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
-- 3D
--
@@ -86,74 +92,84 @@ is
long_Count : in Positive := openGL.Model.sphere.default_longitude_Count;
is_Lit : in Boolean := True;
Color : in openGL.lucid_Color := opengl.no_lucid_Color;
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view;
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_skysphere_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Radius : in math.Real := 1_000_000.0;
Texture : in openGL.asset_Name) return gel.Sprite.view;
function new_skysphere_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Radius : in math.Real := 1_000_000.0;
Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
subtype box_Colors is openGL.Colors (1 .. 6);
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Colors : in box_Colors := [others => opengl.Palette.random_Color];
is_Kinematic : in Boolean := False) return gel.Sprite.view;
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Colors : in box_Colors := [others => opengl.Palette.random_Color];
is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name) return gel.Sprite.view;
function new_box_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view;
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Color : in openGL.lucid_Color;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view;
function new_billboard_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Color : in openGL.lucid_Color;
Mass : in math.Real := 1.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_arrow_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view;
function new_arrow_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view;
function new_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
function new_segment_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view;
function new_segment_line_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Mass : in math.Real := 0.0;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Texture : in openGL.asset_Name := openGL.null_Asset;
Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque);
line_Width : in openGL.Real := openGL.Primitive.unused_line_Width;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
-- Text
--
function new_text_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Text : in String;
Font : in openGL.Font.font_Id;
Color : in openGL.Color := opengl.Palette.Black;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Centered : in Boolean := True) return gel.Sprite.view;
function new_text_Sprite (in_World : in gel.World.view;
Site : in math.Vector_3 := math.Origin_3D;
Text : in String;
Font : in openGL.Font.font_Id;
Color : in openGL.Color := opengl.Palette.Black;
Size : in math.Vector_3 := [1.0, 1.0, 1.0];
Centered : in Boolean := True;
user_Data : in any_user_Data_view := null) return gel.Sprite.view;
end gel.Forge;