Add initial prototype.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
with
|
||||
"gel",
|
||||
"lace_shared";
|
||||
|
||||
|
||||
project human_Model
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_human_model.adb");
|
||||
for Languages use ("Ada");
|
||||
|
||||
package Ide renames Lace_shared.Ide;
|
||||
package Builder renames Lace_shared.Builder;
|
||||
package Compiler renames Lace_shared.Compiler;
|
||||
package Binder renames Lace_shared.Binder;
|
||||
|
||||
end human_Model;
|
||||
@@ -0,0 +1,135 @@
|
||||
with gel.Window.setup,
|
||||
gel.Applet.gui_world,
|
||||
gel.Camera;
|
||||
|
||||
with gel.Sprite,
|
||||
openGL.Model.box.lit_colored_textured,
|
||||
openGL.Model.any,
|
||||
openGL.Model.sphere.lit_colored_textured,
|
||||
gel.Human,
|
||||
gel.Forge;
|
||||
|
||||
with opengl.Palette,
|
||||
opengl.IO,
|
||||
float_Math,
|
||||
ada.Calendar,
|
||||
ada.Strings.fixed;
|
||||
|
||||
with float_Math.algebra.linear.d3; use float_Math.algebra.linear.d3;
|
||||
-- with float_Math.algebra.linear.d4; use float_Math.algebra.linear.d4;
|
||||
|
||||
with ada.Text_IO;
|
||||
with GEL.human_Types;
|
||||
with physics.Model;
|
||||
with ada.Exceptions;
|
||||
|
||||
|
||||
|
||||
procedure launch_human_Model
|
||||
--
|
||||
-- Drops an gel human model onto a simple box terrain.
|
||||
--
|
||||
--
|
||||
is
|
||||
use gel.Applet, openGL.Model.box, gel.Human, gel.human_Types,
|
||||
openGL, opengl.Palette,
|
||||
float_Math,
|
||||
ada.Calendar, ada.Strings, ada.Strings.fixed, ada.Text_IO, ada.Exceptions;
|
||||
|
||||
use type math.Real, opengl.Real;
|
||||
|
||||
the_Applet : constant gel.Applet.gui_World.view := gel.Forge.new_gui_Applet ("human Model", 1920, 1200);
|
||||
|
||||
the_Ground : constant gel.Sprite.view := gel.Forge.new_box_Sprite (the_Applet.gui_World,
|
||||
mass => 0.0,
|
||||
size => (50.0, 1.0, 50.0));
|
||||
-- the_human_graphics_Model : aliased gel.graphics_Model.open_gl.view
|
||||
-- := gel.graphics_Model.open_gl.forge.new_Model (scale => (1.0, 1.0, 1.0),
|
||||
-- -- model => gel.to_Asset ("assets/gel/model/gel-human.dae"),
|
||||
-- model => gel.to_Asset ("assets/gel/collada/mh-human-dae.dae"),
|
||||
-- -- model => gel.to_Asset ("assets/gel/collada/alfieri.dae"),
|
||||
-- texture => gel.null_Asset, -- gel.to_Asset ("assets/collada/gel-human-texture.tga"),
|
||||
-- Texture_is_lucid => False);
|
||||
-- the_human_physics_Model : constant gel.physics_Model.view
|
||||
-- := gel.physics_Model.Forge.new_physics_Model (shape_Info => (kind => gel.physics_Model.Cube,
|
||||
-- half_extents => 0.5 * (4.0, 1.0, 2.0)),
|
||||
-- mass => 1.0);
|
||||
-- -- the_human_physics_Model : constant gel.physics_Model.view
|
||||
-- -- := gel.physics_Model.Forge.new_physics_Model (shape_Info => (kind => gel.physics_Model.a_Sphere,
|
||||
-- -- sphere_radius => 0.2),
|
||||
-- -- mass => 0.5);
|
||||
my_Human : aliased gel.Human.item;
|
||||
|
||||
Counter : Integer := 0;
|
||||
next_render_Time : ada.calendar.Time;
|
||||
|
||||
begin
|
||||
the_Applet.gui_World.Gravity_is ((0.0, -1.0, 0.0));
|
||||
|
||||
the_Applet.gui_Camera.Site_is ((0.0, 0.0, 40.0)); -- Position the camera
|
||||
the_Applet.enable_simple_Dolly (1); -- Enable user camera control via keyboards
|
||||
the_Applet.enable_Mouse (detect_Motion => False); -- Enable mouse events.
|
||||
|
||||
gel.Human.use_Model ("assets/gel/collada/mh-human-dae.dae");
|
||||
-- gel.Human.use_Model ("assets/gel/collada/alfieri.dae");
|
||||
my_Human.define (the_Applet.gui_World,
|
||||
null, -- the_human_graphics_Model,
|
||||
null, -- the_human_physics_Model,
|
||||
mass => 1.0);
|
||||
|
||||
the_Applet.gui_World.add (my_Human.base_Sprite, and_Children => True); -- Add the human
|
||||
my_Human.base_Sprite.move ((0.0, 10.0, 0.0)); --
|
||||
|
||||
|
||||
the_Applet.gui_World.add (the_Ground); -- Add the ground
|
||||
the_Ground.Site_is ((0.0, -10.0, 0.0)); --
|
||||
|
||||
my_Human.motion_Mode_is (gel.Human.Animation);
|
||||
-- the_Human.motion_Mode_is (gel.Human_v1.Physics);
|
||||
|
||||
-- my_Human.enable_Graphics;
|
||||
-- my_Human.attach_program_Parameters_to_model_Faces;
|
||||
|
||||
|
||||
next_render_Time := ada.Calendar.clock;
|
||||
|
||||
while the_Applet.is_open
|
||||
loop
|
||||
|
||||
-- if Counter = 150 then
|
||||
-- my_Human.Sprite (Head).Speed_is ((5.0, 5.0, 0.0));
|
||||
-- my_Human.Sprite (Head).Gyre_is ((0.0, 5.0, 0.0));
|
||||
--
|
||||
-- my_Human.Sprite (Hand_L).Speed_is ((5.0, 10.0, 0.0));
|
||||
-- my_Human.Sprite (Hand_L).Gyre_is ((0.0, 5.0, 0.0));
|
||||
--
|
||||
-- my_Human.Sprite (upLeg_L).Speed_is ((-5.0, 10.0, 0.0));
|
||||
-- my_Human.Sprite (upLeg_L).Gyre_is ((0.0, 5.0, 0.0));
|
||||
--
|
||||
-- my_Human.Sprite (Foot_L).Speed_is ((-5.0, 10.0, 0.0));
|
||||
-- my_Human.Sprite (Foot_L).Gyre_is ((0.0, 5.0, 0.0));
|
||||
--
|
||||
-- Counter := 0;
|
||||
-- else
|
||||
-- Counter := Counter + 1;
|
||||
-- end if;
|
||||
|
||||
the_Applet.gui_World.evolve; -- (by => 1.0/60.0); -- evolve the world
|
||||
|
||||
-- my_Human .evolve;
|
||||
my_Human.animate (world_Age => the_Applet.World.Age);
|
||||
the_Applet.freshen; -- handle any new events and update the screen
|
||||
delay 0.5;
|
||||
|
||||
next_render_Time := next_render_Time + 1.0/60.0;
|
||||
delay until next_render_Time;
|
||||
end loop;
|
||||
|
||||
-- opengl.IO.stop_Capture;
|
||||
|
||||
the_Applet.destroy;
|
||||
|
||||
exception
|
||||
when E : others =>
|
||||
put_Line (Exception_Information (E));
|
||||
end launch_human_Model;
|
||||
@@ -0,0 +1,146 @@
|
||||
with "gel";
|
||||
|
||||
|
||||
project Human_Model_V1
|
||||
is
|
||||
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_human_model_v1.adb");
|
||||
for Languages use ("Ada");
|
||||
type Os_Type is
|
||||
("Windows_NT", "Linux", "MacOSX");
|
||||
Os : Os_Type := external ("OS");
|
||||
type Restrictions is
|
||||
("xgc", "ravenscar");
|
||||
Restrictions : Restrictions := external ("restrictions");
|
||||
type Platform is
|
||||
("egl", "glx");
|
||||
Opengl_Platform : Platform := external ("opengl_platform");
|
||||
type Profile is
|
||||
("safe", "lean", "desk");
|
||||
Opengl_Profile : Profile := external ("opengl_profile");
|
||||
|
||||
package Compiler is
|
||||
for Default_Switches ("ada") use ("-gnato", "-fstack-check", "-g", "-gnata");
|
||||
end Compiler;
|
||||
|
||||
package Builder is
|
||||
|
||||
case Os is
|
||||
|
||||
when "Windows_NT" =>
|
||||
|
||||
when "Linux" =>
|
||||
|
||||
case Restrictions is
|
||||
|
||||
when "xgc" =>
|
||||
|
||||
case Opengl_Platform is
|
||||
|
||||
when "egl" =>
|
||||
|
||||
when "glx" =>
|
||||
|
||||
case Opengl_Profile is
|
||||
|
||||
when "safe" =>
|
||||
|
||||
when "lean" =>
|
||||
for Default_Switches ("ada") use ("-j13", "-g", "-k");
|
||||
|
||||
when "desk" =>
|
||||
for Default_Switches ("ada") use ("-j13", "-k", "-g");
|
||||
end case;
|
||||
end case;
|
||||
|
||||
when "ravenscar" =>
|
||||
|
||||
end case;
|
||||
|
||||
when "MacOSX" =>
|
||||
|
||||
end case;
|
||||
end Builder;
|
||||
|
||||
package Binder is
|
||||
|
||||
case Os is
|
||||
|
||||
when "Windows_NT" =>
|
||||
|
||||
when "Linux" =>
|
||||
|
||||
case Restrictions is
|
||||
|
||||
when "xgc" =>
|
||||
|
||||
case Opengl_Platform is
|
||||
|
||||
when "egl" =>
|
||||
|
||||
when "glx" =>
|
||||
|
||||
case Opengl_Profile is
|
||||
|
||||
when "safe" =>
|
||||
|
||||
when "lean" =>
|
||||
for Default_Switches ("ada") use ("-E");
|
||||
|
||||
when "desk" =>
|
||||
for Default_Switches ("ada") use ("-E");
|
||||
end case;
|
||||
end case;
|
||||
|
||||
when "ravenscar" =>
|
||||
|
||||
end case;
|
||||
|
||||
when "MacOSX" =>
|
||||
|
||||
end case;
|
||||
end Binder;
|
||||
|
||||
package Linker is
|
||||
|
||||
case Os is
|
||||
|
||||
when "Windows_NT" =>
|
||||
|
||||
when "Linux" =>
|
||||
|
||||
case Restrictions is
|
||||
|
||||
when "xgc" =>
|
||||
|
||||
case Opengl_Platform is
|
||||
|
||||
when "egl" =>
|
||||
|
||||
when "glx" =>
|
||||
|
||||
case Opengl_Profile is
|
||||
|
||||
when "safe" =>
|
||||
|
||||
when "lean" =>
|
||||
for Default_Switches ("ada") use ("-g", "-lexpat", "-lGL", "-lX11", "-lm");
|
||||
|
||||
when "desk" =>
|
||||
for Default_Switches ("ada") use ("-g", "-lGL", "-lX11", "-lm", "-lexpat");
|
||||
end case;
|
||||
end case;
|
||||
|
||||
when "ravenscar" =>
|
||||
|
||||
end case;
|
||||
|
||||
when "MacOSX" =>
|
||||
|
||||
end case;
|
||||
end Linker;
|
||||
|
||||
end Human_Model_V1;
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
with
|
||||
gel.Window.setup,
|
||||
gel.Applet.gui_world,
|
||||
gel.Camera,
|
||||
gel.Sprite,
|
||||
gel.Human_v1,
|
||||
gel.Forge,
|
||||
gel.human_Types,
|
||||
gel.human_Types_v1,
|
||||
physics.Model,
|
||||
|
||||
openGL.Model.box.lit_colored_textured,
|
||||
openGL.Model.any,
|
||||
openGL.Model.sphere.lit_colored_textured,
|
||||
opengl.Palette,
|
||||
opengl.IO,
|
||||
|
||||
float_Math.algebra.linear.d3,
|
||||
|
||||
ada.Calendar,
|
||||
ada.Strings.fixed,
|
||||
ada.Text_IO,
|
||||
ada.Exceptions;
|
||||
|
||||
|
||||
procedure launch_human_Model_v1
|
||||
--
|
||||
-- Drops an gel human model onto a simple box terrain.
|
||||
--
|
||||
--
|
||||
is
|
||||
use gel.Applet, openGL.Model.box, gel.Human_v1, gel.human_Types,
|
||||
openGL, opengl.Palette,
|
||||
float_Math, float_Math.algebra.linear.d3,
|
||||
ada.Calendar, ada.Strings, ada.Strings.fixed, ada.Text_IO, ada.Exceptions;
|
||||
|
||||
use type math.Real, opengl.Real;
|
||||
|
||||
the_Applet : constant gel.Applet.gui_World.view := gel.Forge.new_gui_Applet ("human Model", 1920, 1200);
|
||||
the_Ground : constant gel.Sprite.view := gel.Forge.new_box_Sprite (the_Applet.gui_World,
|
||||
mass => 0.0,
|
||||
size => (50.0, 1.0, 50.0));
|
||||
|
||||
-- the_human_graphics_Model : aliased gel.graphics_Model.open_gl.view
|
||||
-- := gel.graphics_Model.open_gl.forge.new_Model (scale => (1.0, 1.0, 1.0),
|
||||
-- -- model => gel.to_Asset ("assets/gel/model/gel-human.dae"),
|
||||
-- model => gel.to_Asset ("assets/gel/collada/mh-human-dae.dae"),
|
||||
-- -- model => gel.to_Asset ("assets/gel/collada/alfieri.dae"),
|
||||
-- texture => gel.null_Asset, -- gel.to_Asset ("assets/collada/gel-human-texture.tga"),
|
||||
-- Texture_is_lucid => False);
|
||||
-- the_human_physics_Model : constant gel.physics_Model.view
|
||||
-- := gel.physics_Model.Forge.new_physics_Model (shape_Info => (kind => gel.physics_Model.Cube,
|
||||
-- half_extents => 0.5 * (4.0, 1.0, 2.0)),
|
||||
-- mass => 1.0);
|
||||
-- -- the_human_physics_Model : constant gel.physics_Model.view
|
||||
-- -- := gel.physics_Model.Forge.new_physics_Model (shape_Info => (kind => gel.physics_Model.a_Sphere,
|
||||
-- -- sphere_radius => 0.2),
|
||||
-- -- mass => 0.5);
|
||||
my_Human : aliased gel.Human_v1.item;
|
||||
use gel.Human_v1;
|
||||
|
||||
next_render_Time : ada.calendar.Time;
|
||||
|
||||
begin
|
||||
gel.Human_v1.Mode_is (Skin);
|
||||
gel.Human_v1.Mode_is (Bones);
|
||||
-- gel.Human_v1.Mode_is (Skin_and_Bones);
|
||||
|
||||
the_Applet.gui_World.Gravity_is ((0.0, -0.0, 0.0));
|
||||
-- the_Applet.gui_World.Gravity_is ((0.0, -9.8, 0.0));
|
||||
-- the_Applet.gui_World.Gravity_is ((0.0, -0.5, 0.0));
|
||||
|
||||
-- -- the_Applet.gui_Camera.Site_is ((0.0, 1.0, 5.0)); -- Position the camera
|
||||
-- the_Applet.gui_Camera.Site_is ((0.0, -9.0, 5.0)); -- Position the camera
|
||||
the_Applet.gui_Camera.Site_is ((0.0, -0.0, 5.0)); -- Position the camera
|
||||
the_Applet.enable_simple_Dolly (1); -- Enable user camera control via keyboards
|
||||
the_Applet.Dolly.Speed_is (0.1);
|
||||
the_Applet.enable_Mouse (detect_Motion => False); -- Enable mouse events.
|
||||
|
||||
-- gel.Human_v1.use_Model ("assets/mh-blender-no_bones.dae");
|
||||
-- gel.Human_v1.use_Model ("assets/mh-blender-2.dae");
|
||||
-- gel.Human_v1.use_Model ("assets/mh-blender-2-y_up.dae");
|
||||
-- gel.Human_v1.use_Model ("assets/human-default.dae");
|
||||
gel.Human_v1.use_Model ("assets/human-default-animated-01_01.dae");
|
||||
|
||||
-- gel.Human_v1.use_Model ("assets/human-new.dae");
|
||||
-- gel.Human_v1.use_Model ("assets/human-default-1.dae");
|
||||
-- gel.Human.use_Model ("assets/gel/collada/alfieri.dae");
|
||||
|
||||
my_Human.define (the_Applet.gui_World,
|
||||
null, -- the_human_graphics_Model,
|
||||
null, -- the_human_physics_Model,
|
||||
mass => 1.0,
|
||||
is_Kinematic => False);
|
||||
|
||||
-- my_Human.base_Sprite.rotate (to_spin => x_Rotation_from (to_Radians (0.0)));
|
||||
-- my_Human.base_Sprite.move ((0.0, 2.0, 0.0));
|
||||
the_Applet.gui_World.add (my_Human.base_Sprite, and_Children => True); -- Add the human
|
||||
-- my_Human.base_Sprite.move ((0.0, 0.0, 0.0)); --
|
||||
|
||||
|
||||
-- my_Human.skin_Sprite.rotate (to_spin => (x_Rotation_from (to_Radians (0.0))));
|
||||
-- my_Human.skin_Sprite.move ((0.0, 2.0, 0.0));
|
||||
the_Applet.gui_World.add (my_Human.skin_Sprite); -- Add human skin.
|
||||
|
||||
|
||||
the_Applet.gui_World.add (the_Ground); -- Add the ground
|
||||
the_Ground.Site_is ((0.0, -10.0, 0.0)); --
|
||||
|
||||
my_Human.motion_Mode_is (gel.Human_v1.Animation);
|
||||
|
||||
-- my_Human.enable_Graphics;
|
||||
-- my_Human.attach_program_Parameters_to_model_Faces;
|
||||
|
||||
|
||||
next_render_Time := ada.Calendar.clock;
|
||||
|
||||
while the_Applet.is_open
|
||||
loop
|
||||
-- my_Human.base_Sprite.apply_Force ((0.0, 100.0, 0.0));
|
||||
-- my_Human.Sprite (for_Bone => gel.human_Types_v1.upper_Arm_R).apply_Force ((0.0, 10000.0, 0.0));
|
||||
-- gel.Human_v1.Sprite (my_Human, for_Bone => gel.human_Types_v1.upper_Arm_R).apply_Force ((0.0, 100.0, 0.0));
|
||||
|
||||
the_Applet.gui_World.evolve; -- (by => 1.0/60.0); -- Evolve the world.
|
||||
my_Human .evolve (the_Applet.gui_World.Age);
|
||||
the_Applet.freshen; -- Handle any new events and update the screen.
|
||||
|
||||
next_render_Time := next_render_Time + 1.0/60.0;
|
||||
delay until next_render_Time;
|
||||
end loop;
|
||||
|
||||
-- opengl.IO.stop_Capture;
|
||||
|
||||
the_Applet.destroy;
|
||||
|
||||
-- exception
|
||||
-- when E : others =>
|
||||
-- put_Line (Exception_Information (E));
|
||||
end launch_human_Model_v1;
|
||||
@@ -0,0 +1,185 @@
|
||||
with gel.Sprite,
|
||||
gel.Human_v1,
|
||||
physics.Model,
|
||||
openGL.Model.any,
|
||||
gel.Window.setup,
|
||||
gel.Applet.gui_world,
|
||||
openGL.Model.box,
|
||||
gel.any_Joint,
|
||||
gel.Forge,
|
||||
|
||||
-- physics.Motor.spring.angular,
|
||||
openGL.Palette,
|
||||
float_math.algebra.linear.d3,
|
||||
float_math.Random,
|
||||
|
||||
ada.Calendar,
|
||||
ada.Exceptions;
|
||||
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
|
||||
|
||||
procedure launch_simple_Animation
|
||||
--
|
||||
-- Runs a single animation of a human model.
|
||||
--
|
||||
is
|
||||
package Math renames float_Math;
|
||||
|
||||
use openGL.Model.box, gel.Human_v1,
|
||||
openGL, openGL.Palette,
|
||||
Math, math.Algebra.linear.d3,
|
||||
ada.Calendar, ada.Exceptions;
|
||||
|
||||
use type math.Real, math.Index;
|
||||
|
||||
-- Options
|
||||
--
|
||||
-- add_Balls : Boolean := True;
|
||||
add_Balls : Boolean := False;
|
||||
|
||||
|
||||
-- the Applet
|
||||
--
|
||||
use gel.Applet.gui_world;
|
||||
|
||||
the_Applet : gel.Applet.gui_World.view := gel.Forge.new_gui_Applet ("Simple Animation", 1800, 1100);
|
||||
|
||||
|
||||
-- the Ground
|
||||
--
|
||||
the_Ground : gel.Sprite.view := gel.Forge.new_box_Sprite (in_world => the_Applet.gui_World,
|
||||
mass => 0.0,
|
||||
size => (50.0, 1.0, 50.0));
|
||||
|
||||
-- human_model_Name : constant String := "assets/human-default-animated-01_01-y_up.dae";
|
||||
human_model_Name : constant String := "assets/human-default-animated-01_01.dae";
|
||||
-- human_model_Name : constant String := "assets/mh-blender-2.dae";
|
||||
|
||||
|
||||
-- human_model_Name : constant String := "assets/human_animation.dae";
|
||||
-- human_model_Name : constant String := "assets/alfieri.dae";
|
||||
|
||||
-- -- human_model_Name : constant String := "./assets/human-golf_swing-v1.dae";
|
||||
-- human_model_Name : constant String := "assets/human-default-animated-01_01.dae";
|
||||
-- -- human_model_Name : constant String := "assets/human-default-animated-01_02.dae";
|
||||
-- -- human_model_Name : constant String := "assets/human-default-animated-01_03.dae";
|
||||
-- -- human_model_Name : constant String := "assets/human-default-animated-01_04.dae";
|
||||
-- -- human_model_Name : constant String := "assets/human-default-animated-01_05.dae";
|
||||
|
||||
next_render_Time : ada.calendar.Time;
|
||||
Now : ada.calendar.Time := Ada.Calendar.Clock;
|
||||
Counter : Integer := 0;
|
||||
|
||||
begin
|
||||
-- gel.Human_v1.Mode_is (Skin);
|
||||
gel.Human_v1.Mode_is (Skin_and_Bones);
|
||||
-- gel.Human_v1.Mode_is (Bones);
|
||||
|
||||
--- Setup the applet.
|
||||
--
|
||||
the_Applet.gui_World.Gravity_is ((0.0, -10.0, 0.0));
|
||||
|
||||
the_Applet.gui_Camera.Site_is ((0.0, 0.0, 8.0)); -- Position the camera.
|
||||
the_Applet.enable_simple_Dolly (in_World => 1); -- Enable user camera control via keyboard.
|
||||
the_Applet.enable_Mouse (detect_Motion => False); -- Enable mouse events.
|
||||
|
||||
|
||||
gel.Human_v1.use_Model (human_model_Name);
|
||||
|
||||
declare
|
||||
the_Human : gel.Human_v1.view
|
||||
:= gel.Human_v1.Forge.new_Human (the_Applet.gui_World,
|
||||
null,
|
||||
null,
|
||||
Mass => 0.0,
|
||||
is_Kinematic => True);
|
||||
begin
|
||||
--- Setup the human model.
|
||||
--
|
||||
-- -- the_Human.base_Sprite.rotate (to_spin => x_Rotation_from (to_Radians (0.0)));
|
||||
-- the_Human.base_Sprite.rotate (to_spin => y_Rotation_from (to_Radians (90.0)));
|
||||
-- the_Human.base_Sprite.move ((0.0, -10.0, 0.0));
|
||||
|
||||
-- the_Human.skin_Sprite.rotate (to_spin => (y_Rotation_from (to_Radians (45.0))));
|
||||
-- the_Human.skin_Sprite.move ((0.0, 5.0, 0.0));
|
||||
|
||||
the_Applet.gui_World.add (the_Human.base_Sprite, and_Children => True); -- Add human.
|
||||
the_Applet.gui_World.add (the_Human.skin_Sprite); -- Add human skin.
|
||||
|
||||
the_Human.motion_Mode_is (gel.Human_v1.Animation);
|
||||
-- the_Human.motion_Mode_is (gel.Human_v1.Physics);
|
||||
|
||||
|
||||
--- Add balls, if desired.
|
||||
--
|
||||
if add_Balls
|
||||
then
|
||||
declare
|
||||
the_Balls : array (1 .. 150) of gel.Sprite.view := (others => gel.Forge.new_ball_Sprite (in_World => the_Applet.gui_World,
|
||||
Mass => 1.0,
|
||||
Radius => 0.5,
|
||||
Color => (openGL.Palette.random_Color, Opaque)));
|
||||
function random_Site return math.Vector_3
|
||||
is
|
||||
use math.Random;
|
||||
|
||||
half_Extent : constant math.Real := 25.0 / 2.0;
|
||||
begin
|
||||
return (random_Real (-half_Extent, half_Extent),
|
||||
0.0,
|
||||
random_Real (-half_Extent, half_Extent));
|
||||
end;
|
||||
|
||||
begin
|
||||
for i in the_Balls'Range
|
||||
loop
|
||||
the_Balls (i).Site_is (random_Site);
|
||||
the_Applet.gui_World.add (the_Balls (i));
|
||||
end loop;
|
||||
end;
|
||||
end if;
|
||||
|
||||
|
||||
--- Setup the simulation world.
|
||||
--
|
||||
-- the_Applet.gui_World.add (the_Ground); -- Add the ground.
|
||||
-- the_Ground.Site_is ((0.0, -0.5, 0.0));
|
||||
|
||||
-- the_Human.evolve (0.0); --the_Applet.gui_World.Age);
|
||||
|
||||
--- Run the simulation.
|
||||
--
|
||||
next_render_Time := ada.calendar.Clock;
|
||||
|
||||
while the_Applet.is_open
|
||||
loop
|
||||
Counter := Counter + 1;
|
||||
|
||||
|
||||
the_Applet.gui_World.evolve; -- (by => 1.0/60.0); -- Evolve the world.
|
||||
|
||||
the_Human .evolve (the_Applet.gui_World.Age);
|
||||
-- the_Human .evolve (0.0); --the_Applet.gui_World.Age);
|
||||
the_Applet.freshen; -- Handle any new events and update the screen.
|
||||
delay 0.1;
|
||||
|
||||
-- if Counter mod 600 = 0
|
||||
-- then
|
||||
-- null;
|
||||
-- -- the_Human.base_Sprite.move (the_Human.base_Sprite.Site + (0.0, 0.0, -1.0));
|
||||
-- the_Human.evolve (the_Applet.gui_World.Age);
|
||||
-- end if;
|
||||
|
||||
next_render_Time := next_render_Time + 1.0/60.0;
|
||||
-- delay until next_render_Time;
|
||||
end loop;
|
||||
|
||||
the_Applet.destroy;
|
||||
end;
|
||||
|
||||
-- exception
|
||||
-- when E : others =>
|
||||
-- put_Line (Exception_Information (E));
|
||||
end launch_simple_Animation;
|
||||
@@ -0,0 +1,18 @@
|
||||
with
|
||||
"gel",
|
||||
"lace_shared";
|
||||
|
||||
|
||||
project simple_Animation
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_simple_animation.adb");
|
||||
for Languages use ("Ada");
|
||||
|
||||
package Ide renames Lace_shared.Ide;
|
||||
package Builder renames Lace_shared.Builder;
|
||||
package Compiler renames Lace_shared.Compiler;
|
||||
package Binder renames Lace_shared.Binder;
|
||||
|
||||
end simple_Animation;
|
||||
Reference in New Issue
Block a user