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

View File

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

View File

@@ -107,7 +107,8 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null)
is is
use type physics.Model.view; use type physics.Model.view;
begin begin
@@ -120,6 +121,8 @@ is
Self.owns_Physics := owns_Physics; Self.owns_Physics := owns_Physics;
Self.is_Kinematic := is_Kinematic; Self.is_Kinematic := is_Kinematic;
Self.user_Data := user_Data;
-- set_Translation (Self.Transform, To => physics_Model.Site); -- set_Translation (Self.Transform, To => physics_Model.Site);
-- Physics -- Physics
@@ -128,7 +131,6 @@ is
then then
Self.rebuild_Shape; Self.rebuild_Shape;
Self.rebuild_Solid (at_Site); Self.rebuild_Solid (at_Site);
null;
end if; end if;
end define; end define;
@@ -228,13 +230,14 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) return Item is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return Item
is is
begin begin
return Self : Item := (lace.Subject_and_deferred_Observer.forge.to_Subject_and_Observer (Name) return Self : Item := (lace.Subject_and_deferred_Observer.forge.to_Subject_and_Observer (Name)
with others => <>) with others => <>)
do do
Self.define (World, at_Site, graphics_Model, physics_Model, owns_Graphics, owns_Physics, is_Kinematic); Self.define (World, at_Site, graphics_Model, physics_Model, owns_Graphics, owns_Physics, is_Kinematic, user_Data);
end return; end return;
end to_Sprite; end to_Sprite;
@@ -245,9 +248,10 @@ is
at_Site : in Vector_3; at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class; graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean := True; owns_Graphics : in Boolean := True;
owns_Physics : in Boolean := True; owns_Physics : in Boolean := True;
is_Kinematic : in Boolean := False) return View is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return View
is is
Self : constant View := new Item' (to_Sprite (Name, Self : constant View := new Item' (to_Sprite (Name,
World, World,
@@ -256,8 +260,10 @@ is
physics_Model, physics_Model,
owns_Graphics, owns_Graphics,
owns_Physics, owns_Physics,
is_Kinematic)); is_Kinematic,
user_Data => user_Data));
begin begin
return Self; return Self;
end new_Sprite; end new_Sprite;
@@ -469,6 +475,24 @@ is
end Shape; end Shape;
function user_Data (Self : in Item) return any_user_Data_view
is
begin
return Self.user_Data;
end user_Data;
procedure user_Data_is (Self : in out Item; Now : in any_user_Data_view)
is
begin
Self.user_Data := Now;
end user_Data_is;
------------- -------------
--- Dynamics --- Dynamics
-- --

View File

@@ -12,6 +12,7 @@ with
lace.Subject_and_deferred_Observer, lace.Subject_and_deferred_Observer,
lace.Response, lace.Response,
lace.Any,
ada.Containers.Vectors; ada.Containers.Vectors;
@@ -35,7 +36,10 @@ is
type physics_Space_view is access all physics.Space.item'Class; type physics_Space_view is access all physics.Space.item'Class;
type World_view is access all gel.World.item'Class; type World_view is access all gel.World .item'Class;
type any_user_Data is new lace.Any.limited_item with null record;
type any_user_Data_view is access all any_user_Data'Class;
use Math; use Math;
@@ -56,13 +60,14 @@ is
--- Forge --- Forge
-- --
procedure define (Self : access Item; World : in World_view; procedure define (Self : access Item; World : in World_view;
at_Site : in Vector_3; at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class; graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False); is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null);
procedure destroy (Self : access Item; and_Children : in Boolean); procedure destroy (Self : access Item; and_Children : in Boolean);
function is_Destroyed (Self : in Item) return Boolean; function is_Destroyed (Self : in Item) return Boolean;
@@ -78,16 +83,18 @@ is
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean; owns_Graphics : in Boolean;
owns_Physics : in Boolean; owns_Physics : in Boolean;
is_Kinematic : in Boolean := False) return Item; is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return Item;
function new_Sprite (Name : in String; function new_Sprite (Name : in String;
World : in World_view; World : in World_view;
at_Site : in Vector_3; at_Site : in Vector_3;
graphics_Model : access openGL. Model.item'Class; graphics_Model : access openGL. Model.item'Class;
physics_Model : access physics.Model.item'Class; physics_Model : access physics.Model.item'Class;
owns_Graphics : in Boolean := True; owns_Graphics : in Boolean := True;
owns_Physics : in Boolean := True; owns_Physics : in Boolean := True;
is_Kinematic : in Boolean := False) return View; is_Kinematic : in Boolean := False;
user_Data : in any_user_Data_view := null) return View;
end Forge; end Forge;
@@ -95,7 +102,7 @@ is
--- Attributes --- Attributes
-- --
function World (Self : in Item) return access gel.World.item'Class; function World (Self : in Item) return access gel.World.item'Class;
function Id (Self : in Item) return gel.sprite_Id; function Id (Self : in Item) return gel.sprite_Id;
procedure Id_is (Self : in out Item; Now : in gel.sprite_Id); procedure Id_is (Self : in out Item; Now : in gel.sprite_Id);
@@ -140,6 +147,10 @@ is
function to_GEL (the_Solid : in physics_Object_view) return gel.Sprite.view; function to_GEL (the_Solid : in physics_Object_view) return gel.Sprite.view;
function user_Data (Self : in Item) return any_user_Data_view;
procedure user_Data_is (Self : in out Item; Now : in any_user_Data_view);
------------- -------------
--- Dynamics --- Dynamics
-- --
@@ -406,6 +417,7 @@ private
is_Visible : Boolean := True; is_Visible : Boolean := True;
key_Response : lace.Response.view; key_Response : lace.Response.view;
user_Data : any_user_Data_view;
is_Destroyed : Boolean := False; is_Destroyed : Boolean := False;
end record; end record;