Add initial prototype.

This commit is contained in:
Rod Kay
2022-07-31 17:34:54 +10:00
commit 54a53b2ac0
1421 changed files with 358874 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
with
openGL.Visual,
openGL.Demo,
openGL.Model.terrain;
procedure launch_Model_scaling
--
-- Exercise the scaling of models.
--
is
use openGL,
openGL.Math,
openGL.linear_Algebra_3d;
begin
Demo.print_Usage;
Demo.define ("openGL 'Model Scaling' Demo");
Demo.Camera.Position_is ([0.0, 0.0, 20.0],
y_Rotation_from (to_Radians (0.0)));
declare
-- The models.
--
the_Models : constant openGL.Model.views := openGL.Demo.Models;
-- The visuals.
--
the_Visuals : openGL.Visual.views (the_Models'Range);
ground_Id : Positive;
-- Scaling
--
scaling_Up : Boolean := True;
Scale : math.Vector_3 := [1.0, 1.0, 1.0];
begin
for i in the_Visuals'Range
loop
the_Visuals (i) := Visual.Forge.new_Visual (the_Models (i));
if the_Models (i).all in openGL.Model.terrain.item'Class
then
ground_Id := i;
end if;
end loop;
Demo.layout (the_Visuals);
the_Visuals (ground_Id).Site_is (the_Visuals (ground_Id).Site_of + [0.0, -15.0, 0.0]);
-- Main loop.
--
while not Demo.Done
loop
if scaling_Up then Scale := Scale + [0.001, 0.001, 0.001];
else Scale := Scale - [0.001, 0.001, 0.001];
end if;
if Scale (1) > 2.0 then scaling_Up := False;
elsif Scale (1) < 0.002 then scaling_Up := True;
end if;
for Each of the_Visuals
loop
Each.Scale_is (Scale);
end loop;
-- Handle user commands.
--
Demo.Dolly.evolve;
Demo.Done := Demo.Dolly.quit_Requested;
-- Render the sprites.
--
Demo.Camera.render (the_Visuals);
while not Demo.Camera.cull_Completed
loop
delay Duration'Small;
end loop;
Demo.Renderer.render;
Demo.FPS_Counter.increment; -- Frames per second display.
end loop;
end;
Demo.destroy;
end launch_Model_scaling;

View File

@@ -0,0 +1,20 @@
with
"opengl_demo",
"lace_shared";
project Model_scaling
is
for Object_Dir use "build";
for Exec_Dir use ".";
for Main use ("launch_model_scaling.adb");
package Ide renames Lace_shared.Ide;
package Builder renames Lace_shared.Builder;
package Compiler renames Lace_shared.Compiler;
package Binder renames Lace_shared.Binder;
package Linker is
for Default_Switches ("ada") use ("-g", "-lX11", "-lGL", "-lexpat");
end Linker;
end Model_scaling;