Add initial prototype.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,129 @@
|
||||
with
|
||||
openGL.Model,
|
||||
openGL.Visual,
|
||||
openGL.Light,
|
||||
openGL.Palette,
|
||||
openGL.Demo;
|
||||
|
||||
|
||||
procedure launch_render_Models
|
||||
--
|
||||
-- Exercise the renderer with an example of all the models.
|
||||
--
|
||||
is
|
||||
use openGL,
|
||||
openGL.Math,
|
||||
openGL.linear_Algebra_3D,
|
||||
openGL.Palette;
|
||||
|
||||
begin
|
||||
Demo.print_Usage ("Use space ' ' to cycle through models.");
|
||||
Demo.define ("openGL 'Render Models' Demo");
|
||||
Demo.Camera.Position_is ([0.0, 2.0, 10.0],
|
||||
y_Rotation_from (to_Radians (0.0)));
|
||||
|
||||
declare
|
||||
use openGL.Light;
|
||||
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
|
||||
begin
|
||||
-- the_Light.Kind_is (Diffuse);
|
||||
-- the_Light.Site_is ((0.0, 0.0, 5.0));
|
||||
the_Light.Site_is ([5_000.0, 2_000.0, 5_000.0]);
|
||||
-- the_Light.Site_is ((000.0, 5_000.0, 000.0));
|
||||
|
||||
the_Light.Color_is (White);
|
||||
-- the_Light.ambient_Coefficient_is (0.91);
|
||||
|
||||
Demo.Renderer.set (the_Light);
|
||||
end;
|
||||
|
||||
|
||||
-- Set the lights initial position to far behind and far to the left.
|
||||
--
|
||||
-- declare
|
||||
-- use openGL.Palette;
|
||||
--
|
||||
-- initial_Site : constant openGL.Vector_3 := (0.0, 0.0, 15.0);
|
||||
-- cone_Direction : constant openGL.Vector_3 := (0.0, 0.0, -1.0);
|
||||
--
|
||||
-- Light : openGL.Light.diffuse.item := Demo.Renderer.Light (Id => 1);
|
||||
-- begin
|
||||
-- Light.Color_is (Ambient => (Grey, Opaque),
|
||||
-- Diffuse => (White, Opaque));
|
||||
-- -- Specular => (White, Opaque));
|
||||
--
|
||||
-- Light.Position_is (initial_Site);
|
||||
-- Light.cone_Direction_is (cone_Direction);
|
||||
--
|
||||
-- Demo.Renderer.Light_is (Id => 1, Now => Light);
|
||||
-- end;
|
||||
|
||||
|
||||
|
||||
declare
|
||||
-- The models.
|
||||
--
|
||||
the_Models : constant openGL.Model.views := openGL.Demo.Models;
|
||||
|
||||
-- The visuals.
|
||||
--
|
||||
use openGL.Visual.Forge;
|
||||
|
||||
the_Visuals : openGL.Visual.views (the_Models'Range);
|
||||
Current : Integer := the_Visuals'First;
|
||||
|
||||
begin
|
||||
for i in the_Visuals'Range
|
||||
loop
|
||||
the_Visuals (i) := new_Visual (the_Models (i));
|
||||
end loop;
|
||||
|
||||
the_Visuals (3).Site_is ([0.0, 0.0, -50.0]);
|
||||
|
||||
-- Main loop.
|
||||
--
|
||||
while not Demo.Done
|
||||
loop
|
||||
Demo.Dolly.evolve;
|
||||
Demo.Done := Demo.Dolly.quit_Requested;
|
||||
|
||||
declare
|
||||
Command : Character;
|
||||
Avail : Boolean;
|
||||
begin
|
||||
Demo.Dolly.get_last_Character (Command, Avail);
|
||||
|
||||
if Avail
|
||||
then
|
||||
case Command
|
||||
is
|
||||
when ' ' =>
|
||||
if Current = the_Visuals'Last
|
||||
then Current := the_Visuals'First;
|
||||
else Current := Current + 1;
|
||||
end if;
|
||||
|
||||
when others =>
|
||||
null;
|
||||
end case;
|
||||
end if;
|
||||
end;
|
||||
|
||||
-- Render all visuals.
|
||||
--
|
||||
Demo.Camera.render ([1 => the_Visuals (Current)]);
|
||||
|
||||
while not Demo.Camera.cull_Completed
|
||||
loop
|
||||
delay Duration'Small;
|
||||
end loop;
|
||||
|
||||
Demo.Renderer.render;
|
||||
Demo.FPS_Counter.increment; -- Frames per second display.
|
||||
|
||||
delay 1.0 / 60.0;
|
||||
end loop;
|
||||
end;
|
||||
|
||||
Demo.destroy;
|
||||
end launch_render_Models;
|
||||
@@ -0,0 +1,16 @@
|
||||
with
|
||||
"opengl_demo",
|
||||
"lace_shared";
|
||||
|
||||
project render_Models
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_render_models.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;
|
||||
|
||||
end render_Models;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 105 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -0,0 +1,97 @@
|
||||
with
|
||||
openGL.Model,
|
||||
openGL.Visual,
|
||||
openGL.Light,
|
||||
openGL.Demo;
|
||||
|
||||
|
||||
procedure launch_render_Screenshot
|
||||
--
|
||||
-- Take a screenshot.
|
||||
--
|
||||
is
|
||||
use openGL,
|
||||
openGL.Math,
|
||||
openGL.linear_Algebra_3d;
|
||||
|
||||
begin
|
||||
Demo.print_Usage ("Use 't' or 'T' to take a screenshot.");
|
||||
Demo.define ("openGL 'Render Screenshot' Demo");
|
||||
Demo.Camera.Position_is ([0.0, 2.0, 10.0],
|
||||
y_Rotation_from (to_Radians (0.0)));
|
||||
|
||||
declare
|
||||
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
|
||||
begin
|
||||
the_Light.Site_is ([5_000.0, 2_000.0, 5_000.0]);
|
||||
Demo.Renderer.set (the_Light);
|
||||
end;
|
||||
|
||||
declare
|
||||
-- The models.
|
||||
--
|
||||
the_Models : constant openGL.Model.views := openGL.Demo.Models;
|
||||
|
||||
-- The visuals.
|
||||
--
|
||||
use openGL.Visual.Forge;
|
||||
|
||||
the_Visuals : openGL.Visual.views (the_Models'Range);
|
||||
Current : Integer := the_Visuals'First;
|
||||
|
||||
begin
|
||||
for i in the_Visuals'Range
|
||||
loop
|
||||
the_Visuals (i) := new_Visual (the_Models (i));
|
||||
end loop;
|
||||
|
||||
-- Main loop.
|
||||
--
|
||||
while not Demo.Done
|
||||
loop
|
||||
Demo.Dolly.evolve;
|
||||
Demo.Done := Demo.Dolly.quit_Requested;
|
||||
|
||||
declare
|
||||
Command : Character;
|
||||
Avail : Boolean;
|
||||
begin
|
||||
Demo.Dolly.get_last_Character (Command, Avail);
|
||||
|
||||
if Avail
|
||||
then
|
||||
case Command
|
||||
is
|
||||
when ' ' =>
|
||||
if Current = the_Visuals'Last
|
||||
then
|
||||
Current := the_Visuals'First;
|
||||
else
|
||||
Current := Current + 1;
|
||||
end if;
|
||||
|
||||
when 't' | 'T' =>
|
||||
Demo.Renderer.Screenshot ("sshot.bmp");
|
||||
|
||||
when others =>
|
||||
null;
|
||||
end case;
|
||||
end if;
|
||||
end;
|
||||
|
||||
-- Render all visuals.
|
||||
--
|
||||
Demo.Camera.render ([1 => the_Visuals (Current)]);
|
||||
|
||||
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_render_Screenshot;
|
||||
@@ -0,0 +1,16 @@
|
||||
with
|
||||
"opengl_demo",
|
||||
"lace_shared";
|
||||
|
||||
project render_Screenshot
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_render_screenshot.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;
|
||||
|
||||
end render_Screenshot;
|
||||
@@ -0,0 +1,94 @@
|
||||
with
|
||||
openGL.Visual,
|
||||
openGL.Palette,
|
||||
openGL.Font,
|
||||
openGL.Model.Text.lit_colored,
|
||||
openGL.Demo;
|
||||
|
||||
procedure launch_render_Text
|
||||
--
|
||||
-- Render updated text.
|
||||
--
|
||||
is
|
||||
use openGL,
|
||||
openGL.Palette,
|
||||
openGL.Math,
|
||||
openGL.linear_Algebra_3d;
|
||||
|
||||
the_font_Id : constant openGL.Font.font_Id := (to_Asset ("assets/opengl/font/LiberationMono-Regular.ttf"), 24);
|
||||
|
||||
begin
|
||||
Demo.print_Usage ("Use space ' ' to cycle the text.");
|
||||
openGL.Demo.define ("openGL 'Render Text' Demo");
|
||||
|
||||
-- Setup the camera.
|
||||
--
|
||||
Demo.Camera.Position_is ([3.0, 0.0, 10.0],
|
||||
y_Rotation_from (to_Radians (0.0)));
|
||||
|
||||
Demo.Renderer.add_Font (the_font_Id);
|
||||
|
||||
declare
|
||||
-- The model.
|
||||
--
|
||||
the_Text_Model : constant Model.Text.lit_colored.view
|
||||
:= Model.Text.lit_colored.new_Text (Text => "Howdy",
|
||||
Font => the_font_Id,
|
||||
Color => (Red, Opaque),
|
||||
Centered => False);
|
||||
|
||||
-- The sprites.
|
||||
--
|
||||
use openGL.Visual.Forge;
|
||||
|
||||
the_Sprites : constant openGL.Visual.views := [1 => new_Visual (the_Text_Model.all'Access)];
|
||||
Current : constant Integer := the_Sprites'First;
|
||||
|
||||
begin
|
||||
-- Main loop.
|
||||
--
|
||||
while not Demo.Done
|
||||
loop
|
||||
Demo.Dolly.evolve;
|
||||
Demo.Done := Demo.Dolly.quit_Requested;
|
||||
|
||||
declare
|
||||
Command : Character;
|
||||
Avail : Boolean;
|
||||
begin
|
||||
Demo.Dolly.get_last_Character (Command, Avail);
|
||||
|
||||
if Avail
|
||||
then
|
||||
case Command
|
||||
is
|
||||
when ' ' =>
|
||||
if the_Text_Model.Text = "Howdy"
|
||||
then
|
||||
the_Text_Model.Text_is ("Doody");
|
||||
else
|
||||
the_Text_Model.Text_is ("Howdy");
|
||||
end if;
|
||||
|
||||
when others =>
|
||||
null;
|
||||
end case;
|
||||
end if;
|
||||
end;
|
||||
|
||||
-- Render all sprites.
|
||||
--
|
||||
Demo.Camera.render ([1 => the_Sprites (Current)]);
|
||||
|
||||
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_render_Text;
|
||||
@@ -0,0 +1,16 @@
|
||||
with
|
||||
"opengl_demo",
|
||||
"lace_shared";
|
||||
|
||||
project render_Text
|
||||
is
|
||||
for Object_Dir use "build";
|
||||
for Exec_Dir use ".";
|
||||
for Main use ("launch_render_text.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;
|
||||
|
||||
end render_Text;
|
||||
Reference in New Issue
Block a user