Compare commits
1 Commits
master
...
box2d_revo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f13488a87e |
@@ -4,6 +4,8 @@ with
|
|||||||
system.RPC,
|
system.RPC,
|
||||||
ada.unchecked_Deallocation;
|
ada.unchecked_Deallocation;
|
||||||
|
|
||||||
|
with ada.Text_IO; use ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
package body lace.event.make_Subject
|
package body lace.event.make_Subject
|
||||||
is
|
is
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
with
|
with
|
||||||
lace.Observer,
|
lace.Observer,
|
||||||
|
lace.Event.Containers,
|
||||||
lace.Event.utility,
|
lace.Event.utility,
|
||||||
lace.event.Containers,
|
|
||||||
|
|
||||||
ada.Containers.indefinite_Holders,
|
|
||||||
ada.Text_IO,
|
ada.Text_IO,
|
||||||
ada.Exceptions,
|
ada.Exceptions,
|
||||||
ada.unchecked_Deallocation,
|
ada.unchecked_Deallocation,
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ with
|
|||||||
private
|
private
|
||||||
with
|
with
|
||||||
lace.Subject,
|
lace.Subject,
|
||||||
|
lace.event.Containers,
|
||||||
|
ada.Containers.indefinite_Holders,
|
||||||
ada.Containers.indefinite_Vectors;
|
ada.Containers.indefinite_Vectors;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ with
|
|||||||
lace.Event.utility,
|
lace.Event.utility,
|
||||||
ada.unchecked_Deallocation;
|
ada.unchecked_Deallocation;
|
||||||
|
|
||||||
|
with ada.Text_IO; use ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
package body lace.event.make_Observer.deferred
|
package body lace.event.make_Observer.deferred
|
||||||
is
|
is
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ with
|
|||||||
ada.Characters.latin_1,
|
ada.Characters.latin_1,
|
||||||
ada.Directories,
|
ada.Directories,
|
||||||
ada.Direct_IO,
|
ada.Direct_IO,
|
||||||
ada.Streams.Stream_IO;
|
ada.Streams.Stream_IO,
|
||||||
|
ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
package body lace.Text.forge
|
package body lace.Text.forge
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
with openGL.Model.texturing;
|
|
||||||
with
|
with
|
||||||
openGL.Light,
|
openGL.Light,
|
||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
openGL.Model.Box.lit_textured,
|
openGL.Model.Box.lit_textured,
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
@@ -40,8 +38,7 @@ begin
|
|||||||
Upper => (texture_Name => the_Texture),
|
Upper => (texture_Name => the_Texture),
|
||||||
Lower => (texture_Name => the_Texture),
|
Lower => (texture_Name => the_Texture),
|
||||||
Left => (texture_Name => the_Texture),
|
Left => (texture_Name => the_Texture),
|
||||||
Right => (texture_Name => the_Texture)),
|
Right => (texture_Name => the_Texture)));
|
||||||
texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]));
|
|
||||||
-- The Visual.
|
-- The Visual.
|
||||||
--
|
--
|
||||||
the_Visuals : constant openGL.Visual.views := (1 => new_Visual (the_Box.all'Access));
|
the_Visuals : constant openGL.Visual.views := (1 => new_Visual (the_Box.all'Access));
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ with
|
|||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
openGL.Model.Sphere.lit_colored_textured,
|
openGL.Model.Sphere.lit_colored_textured,
|
||||||
openGL.Model.Sphere.lit_colored,
|
openGL.Model.Sphere.lit_colored,
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
@@ -30,9 +29,8 @@ begin
|
|||||||
-- The Models.
|
-- The Models.
|
||||||
--
|
--
|
||||||
the_Ball_1_Model : constant Model.Sphere.lit_colored_textured.view
|
the_Ball_1_Model : constant Model.Sphere.lit_colored_textured.view
|
||||||
:= openGL.Model.Sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
|
:= openGL.Model.Sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
|
Image => the_Texture);
|
||||||
Image => the_Texture);
|
|
||||||
the_Ball_2_Model : constant Model.Sphere.lit_colored.view
|
the_Ball_2_Model : constant Model.Sphere.lit_colored.view
|
||||||
:= openGL.Model.Sphere.lit_colored.new_Sphere (Radius => 1.0,
|
:= openGL.Model.Sphere.lit_colored.new_Sphere (Radius => 1.0,
|
||||||
Color => (light_Apricot, Opaque));
|
Color => (light_Apricot, Opaque));
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
with
|
with
|
||||||
openGL.Model.any,
|
openGL.Model.any,
|
||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
openGL.Light,
|
openGL.Light.directional,
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
procedure launch_render_Asteroids
|
procedure launch_render_Asteroids
|
||||||
@@ -17,30 +16,24 @@ is
|
|||||||
begin
|
begin
|
||||||
Demo.define ("openGL 'Render Asteroids' Demo");
|
Demo.define ("openGL 'Render Asteroids' Demo");
|
||||||
Demo.print_Usage ("Use space ' ' to cycle through models.");
|
Demo.print_Usage ("Use space ' ' to cycle through models.");
|
||||||
Demo.Camera.Position_is ([0.0, 0.0, 200.0],
|
Demo.Camera.Position_is ((0.0, 0.0, 200.0),
|
||||||
y_Rotation_from (to_Radians (0.0)));
|
y_Rotation_from (to_Radians (0.0)));
|
||||||
|
|
||||||
declare
|
declare
|
||||||
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
|
the_Light : openGL.Light.directional.item := Demo.Renderer.Light (1);
|
||||||
begin
|
begin
|
||||||
the_Light.Site_is ([5_000.0, 2_000.0, 5_000.0]);
|
the_Light.Site_is ((5_000.0, 2_000.0, 5_000.0));
|
||||||
the_Light.ambient_Coefficient_is (0.05);
|
Demo.Renderer.Light_is (1, the_Light);
|
||||||
Demo.Renderer.set (the_Light);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
declare
|
declare
|
||||||
-- The models.
|
-- The models.
|
||||||
--
|
--
|
||||||
|
|
||||||
-- gaspra_Model : constant openGL.Model.any.view := openGL.Model.any.new_Model (Model => to_Asset ("assets/gaspra.tab"),
|
|
||||||
-- Texture => null_Asset,
|
|
||||||
-- texture_Details => openGL.texture_Set.no_Details,
|
|
||||||
-- Texture_is_lucid => False);
|
|
||||||
gaspra_Model : constant openGL.Model.any.view := openGL.Model.any.new_Model (Model => to_Asset ("assets/gaspra.tab"),
|
gaspra_Model : constant openGL.Model.any.view := openGL.Model.any.new_Model (Model => to_Asset ("assets/gaspra.tab"),
|
||||||
Texture => to_Asset ("./assets/opengl/texture/Face1.bmp"),
|
Texture => null_Asset,
|
||||||
texture_Details => openGL.texture_Set.to_Details ([1 => to_Asset ("./assets/opengl/texture/Face1.bmp")]),
|
|
||||||
Texture_is_lucid => False);
|
Texture_is_lucid => False);
|
||||||
the_Models : constant openGL.Model.views := [1 => gaspra_Model.all'unchecked_Access];
|
the_Models : constant openGL.Model.views := (1 => gaspra_Model.all'unchecked_Access);
|
||||||
|
|
||||||
-- The visuals.
|
-- The visuals.
|
||||||
--
|
--
|
||||||
@@ -86,7 +79,7 @@ begin
|
|||||||
|
|
||||||
-- Render all visuals.
|
-- Render all visuals.
|
||||||
--
|
--
|
||||||
Demo.Camera.render ([1 => the_Visuals (Current)]);
|
Demo.Camera.render ((1 => the_Visuals (Current)));
|
||||||
|
|
||||||
while not Demo.Camera.cull_Completed
|
while not Demo.Camera.cull_Completed
|
||||||
loop
|
loop
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ with
|
|||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
openGL.Model.Billboard. textured,
|
openGL.Model.Billboard. textured,
|
||||||
openGL.Model.Billboard.colored_textured,
|
openGL.Model.Billboard.colored_textured,
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
@@ -28,23 +27,21 @@ begin
|
|||||||
the_Billboard_Model : constant Model.Billboard.textured.view
|
the_Billboard_Model : constant Model.Billboard.textured.view
|
||||||
:= Model.Billboard.textured.forge.new_Billboard (--Scale => (1.0, 1.0, 1.0),
|
:= Model.Billboard.textured.forge.new_Billboard (--Scale => (1.0, 1.0, 1.0),
|
||||||
Plane => Billboard.xy,
|
Plane => Billboard.xy,
|
||||||
Texture => the_Texture,
|
Texture => the_Texture);
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]));
|
|
||||||
|
|
||||||
the_colored_Billboard_Model : constant Model.Billboard.colored_textured.view
|
the_colored_Billboard_Model : constant Model.Billboard.colored_textured.view
|
||||||
:= Model.Billboard.colored_textured.new_Billboard (--Scale => (1.0, 1.0, 1.0),
|
:= Model.Billboard.colored_textured.new_Billboard (--Scale => (1.0, 1.0, 1.0),
|
||||||
Plane => Billboard.xy,
|
Plane => Billboard.xy,
|
||||||
Color => (Palette.Green, Opaque),
|
Color => (Palette.Green, Opaque),
|
||||||
Texture => the_Texture,
|
Texture => the_Texture);
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]));
|
|
||||||
-- The Sprites.
|
-- The Sprites.
|
||||||
--
|
--
|
||||||
use openGL.Visual.Forge;
|
use openGL.Visual.Forge;
|
||||||
|
|
||||||
the_Visuals : constant openGL.Visual.views := [new_Visual ( the_Billboard_Model.all'Access),
|
the_Sprites : constant openGL.Visual.views := [new_Visual ( the_Billboard_Model.all'Access),
|
||||||
new_Visual (the_colored_Billboard_Model.all'Access)];
|
new_Visual (the_colored_Billboard_Model.all'Access)];
|
||||||
begin
|
begin
|
||||||
the_Visuals (2).Site_is ([3.0, 0.0, 0.0]);
|
the_Sprites (2).Site_is ([3.0, 0.0, 0.0]);
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
--
|
--
|
||||||
@@ -57,7 +54,7 @@ begin
|
|||||||
|
|
||||||
-- Render the sprites.
|
-- Render the sprites.
|
||||||
--
|
--
|
||||||
Demo.Camera.render (the_Visuals);
|
Demo.Camera.render (the_Sprites);
|
||||||
|
|
||||||
while not Demo.Camera.cull_Completed
|
while not Demo.Camera.cull_Completed
|
||||||
loop
|
loop
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
with openGL.texture_Set;
|
|
||||||
with
|
with
|
||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
|
|
||||||
@@ -9,7 +8,6 @@ with
|
|||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
|
|
||||||
procedure launch_render_Boxes
|
procedure launch_render_Boxes
|
||||||
--
|
--
|
||||||
-- Exercise the rendering of box models.
|
-- Exercise the rendering of box models.
|
||||||
@@ -60,8 +58,7 @@ begin
|
|||||||
Upper => (texture_Name => the_Texture),
|
Upper => (texture_Name => the_Texture),
|
||||||
Lower => (texture_Name => the_Texture),
|
Lower => (texture_Name => the_Texture),
|
||||||
Left => (texture_Name => the_Texture),
|
Left => (texture_Name => the_Texture),
|
||||||
Right => (texture_Name => the_Texture)],
|
Right => (texture_Name => the_Texture)]);
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
|
|
||||||
|
|
||||||
-- The Visuals.
|
-- The Visuals.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ begin
|
|||||||
the_Capsule_Model : constant Model.Capsule.lit_colored_textured.view
|
the_Capsule_Model : constant Model.Capsule.lit_colored_textured.view
|
||||||
:= Model.Capsule.lit_colored_textured.new_Capsule (Radius => 0.5,
|
:= Model.Capsule.lit_colored_textured.new_Capsule (Radius => 0.5,
|
||||||
Height => 2.0,
|
Height => 2.0,
|
||||||
Color => (Green, Opaque),
|
Color => (White, Opaque),
|
||||||
Image => the_Texture);
|
Image => the_Texture);
|
||||||
-- The Visuals.
|
-- The Visuals.
|
||||||
--
|
--
|
||||||
@@ -42,7 +42,6 @@ begin
|
|||||||
the_Visuals : constant openGL.Visual.views := [1 => new_Visual (the_Capsule_Model.all'Access)];
|
the_Visuals : constant openGL.Visual.views := [1 => new_Visual (the_Capsule_Model.all'Access)];
|
||||||
begin
|
begin
|
||||||
the_Light.Site_is ([0.0, 5.0, 10.0]);
|
the_Light.Site_is ([0.0, 5.0, 10.0]);
|
||||||
the_Light.ambient_Coefficient_is (0.05);
|
|
||||||
Demo.Renderer.set (the_Light);
|
Demo.Renderer.set (the_Light);
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ with
|
|||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
openGL.Light,
|
openGL.Light,
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Demo;
|
openGL.Demo,
|
||||||
|
|
||||||
|
ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
procedure launch_render_Models
|
procedure launch_render_Models
|
||||||
@@ -14,7 +16,8 @@ is
|
|||||||
use openGL,
|
use openGL,
|
||||||
openGL.Math,
|
openGL.Math,
|
||||||
openGL.linear_Algebra_3D,
|
openGL.linear_Algebra_3D,
|
||||||
openGL.Palette;
|
openGL.Palette,
|
||||||
|
ada.Text_IO;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Demo.print_Usage ("Use space ' ' to cycle through models.");
|
Demo.print_Usage ("Use space ' ' to cycle through models.");
|
||||||
@@ -38,6 +41,28 @@ begin
|
|||||||
end;
|
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
|
declare
|
||||||
-- The models.
|
-- The models.
|
||||||
--
|
--
|
||||||
@@ -56,7 +81,7 @@ begin
|
|||||||
the_Visuals (i) := new_Visual (the_Models (i));
|
the_Visuals (i) := new_Visual (the_Models (i));
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
the_Visuals (1).Scale_is ([0.2, 0.2, 1.0]); -- Text visual.
|
the_Visuals (4).Site_is ([0.0, 0.0, -50.0]);
|
||||||
|
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
|
|||||||
@@ -45,9 +45,6 @@ begin
|
|||||||
the_Visuals (i) := new_Visual (the_Models (i));
|
the_Visuals (i) := new_Visual (the_Models (i));
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
the_Visuals (1).Scale_is ([0.2, 0.2, 1.0]); -- Text visual.
|
|
||||||
|
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
--
|
--
|
||||||
while not Demo.Done
|
while not Demo.Done
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ with
|
|||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.Model.Text.lit_colored,
|
openGL.Model.Text.lit_colored,
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
|
|
||||||
procedure launch_render_Text
|
procedure launch_render_Text
|
||||||
--
|
--
|
||||||
-- Render updated text.
|
-- Render updated text.
|
||||||
@@ -37,20 +35,16 @@ begin
|
|||||||
:= Model.Text.lit_colored.new_Text (Text => "Howdy",
|
:= Model.Text.lit_colored.new_Text (Text => "Howdy",
|
||||||
Font => the_font_Id,
|
Font => the_font_Id,
|
||||||
Color => (Red, Opaque),
|
Color => (Red, Opaque),
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => openGL.to_Asset ("assets/texture/Face1.bmp")]),
|
|
||||||
Centered => False);
|
Centered => False);
|
||||||
|
|
||||||
-- The sprites.
|
-- The sprites.
|
||||||
--
|
--
|
||||||
use openGL.Visual.Forge;
|
use openGL.Visual.Forge;
|
||||||
|
|
||||||
the_Visuals : constant openGL.Visual.views := [1 => new_Visual (the_Text_Model.all'Access)];
|
the_Sprites : constant openGL.Visual.views := [1 => new_Visual (the_Text_Model.all'Access)];
|
||||||
Current : constant Integer := the_Visuals'First;
|
Current : constant Integer := the_Sprites'First;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
the_Visuals (1).Scale_is ([0.2, 0.2, 1.0]);
|
|
||||||
|
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
--
|
--
|
||||||
while not Demo.Done
|
while not Demo.Done
|
||||||
@@ -84,7 +78,7 @@ begin
|
|||||||
|
|
||||||
-- Render all sprites.
|
-- Render all sprites.
|
||||||
--
|
--
|
||||||
Demo.Camera.render ([1 => the_Visuals (Current)]);
|
Demo.Camera.render ([1 => the_Sprites (Current)]);
|
||||||
|
|
||||||
while not Demo.Camera.cull_Completed
|
while not Demo.Camera.cull_Completed
|
||||||
loop
|
loop
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
with
|
||||||
|
openGL.Model.hexagon.lit_textured_x2,
|
||||||
|
openGL.Visual,
|
||||||
|
openGL.Light,
|
||||||
|
openGL.Palette,
|
||||||
|
openGL.Geometry.texturing,
|
||||||
|
-- openGL.IO,
|
||||||
|
openGL.Demo;
|
||||||
|
|
||||||
|
with Ada.Text_IO; use Ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
|
procedure launch_render_two_Textures
|
||||||
|
--
|
||||||
|
-- Renders a hexagon grid.
|
||||||
|
--
|
||||||
|
is
|
||||||
|
use openGL,
|
||||||
|
openGL.Math,
|
||||||
|
openGL.linear_Algebra_3D,
|
||||||
|
openGL.Palette,
|
||||||
|
openGL.Light;
|
||||||
|
|
||||||
|
|
||||||
|
--------------
|
||||||
|
-- The model.
|
||||||
|
--
|
||||||
|
-- the_1st_Texture : constant asset_Name := to_Asset ("assets/opengl/texture/blobber_floor.png");
|
||||||
|
the_1st_Texture : constant asset_Name := to_Asset ("assets/crawl-blob-1.png");
|
||||||
|
the_2nd_Texture : constant asset_Name := to_Asset ("assets/crawl-blob-2.png");
|
||||||
|
|
||||||
|
the_textured_hexagon_Model : constant Model.hexagon.lit_textured_x2.view
|
||||||
|
:= Model.hexagon.lit_textured_x2.new_Hexagon (Radius => 0.5,
|
||||||
|
Face => (Texture_1 => the_1st_Texture,
|
||||||
|
Texture_2 => the_2nd_Texture,
|
||||||
|
Fade_1 => 0.5,
|
||||||
|
Fade_2 => 0.5));
|
||||||
|
----------------
|
||||||
|
--- The visual.
|
||||||
|
--
|
||||||
|
use openGL.Visual.Forge;
|
||||||
|
|
||||||
|
the_Hex : constant openGL.Visual.view := new_Visual (the_textured_hexagon_Model.all'Access);
|
||||||
|
|
||||||
|
--------------
|
||||||
|
--- The light.
|
||||||
|
--
|
||||||
|
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
|
||||||
|
light_Site : constant openGL.Vector_3 := [0.0, 0.0, 15.0];
|
||||||
|
cone_Direction : constant openGL.Vector_3 := [0.0, 0.0, -1.0];
|
||||||
|
|
||||||
|
use openGL.Geometry.texturing;
|
||||||
|
Fade : fade_Level := fade_Level'First;
|
||||||
|
increment_Fade : Boolean := True;
|
||||||
|
Epoch : Natural := 0;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Demo.print_Usage;
|
||||||
|
Demo.define ("openGL 'render two Textures' Demo",
|
||||||
|
Width => 1_000,
|
||||||
|
Height =>1_000);
|
||||||
|
|
||||||
|
Demo.Camera.Position_is ([0.0, 2.0, 0.0],
|
||||||
|
x_Rotation_from (to_Radians (90.0)));
|
||||||
|
|
||||||
|
-- Set up the light.
|
||||||
|
--
|
||||||
|
the_Light. Kind_is (Diffuse);
|
||||||
|
the_Light. Site_is (light_Site);
|
||||||
|
the_Light. Color_is (White);
|
||||||
|
the_Light.ambient_Coefficient_is (0.8);
|
||||||
|
the_Light. cone_Angle_is (5.0);
|
||||||
|
the_Light. cone_Direction_is (cone_Direction);
|
||||||
|
|
||||||
|
Demo.Renderer.set (the_Light);
|
||||||
|
|
||||||
|
|
||||||
|
-- Main loop.
|
||||||
|
--
|
||||||
|
while not Demo.Done
|
||||||
|
loop
|
||||||
|
Demo.Dolly.evolve;
|
||||||
|
Demo.Done := Demo.Dolly.quit_Requested;
|
||||||
|
|
||||||
|
Demo.Camera.render ([1 => the_Hex]);
|
||||||
|
|
||||||
|
while not Demo.Camera.cull_Completed
|
||||||
|
loop
|
||||||
|
delay Duration'Small;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
Demo.Renderer.render;
|
||||||
|
Demo.FPS_Counter.increment; -- Frames per second display.
|
||||||
|
|
||||||
|
|
||||||
|
if Epoch mod 20 = 0
|
||||||
|
then
|
||||||
|
-- the_textured_hexagon_Model.Fade_is (which => 1, now => Fade);
|
||||||
|
-- the_textured_hexagon_Model.Fade_is (which => 2, now => 1.0 - Fade);
|
||||||
|
|
||||||
|
the_textured_hexagon_Model.Fade_1_is (Fade);
|
||||||
|
the_textured_hexagon_Model.Fade_2_is (1.0 - Fade);
|
||||||
|
-- the_textured_hexagon_Model.needs_Rebuild;
|
||||||
|
--
|
||||||
|
-- the_textured_hexagon_Model.Fade_1_is (1.0);
|
||||||
|
-- the_textured_hexagon_Model.Fade_2_is (0.0);
|
||||||
|
|
||||||
|
-- put_Line ("my Fade: " & Fade'Image);
|
||||||
|
|
||||||
|
if increment_Fade
|
||||||
|
then
|
||||||
|
Fade := Fade + fade_Level'Small;
|
||||||
|
else
|
||||||
|
Fade := Fade - fade_Level'Small;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
if Fade = fade_Level'Last then increment_Fade := False;
|
||||||
|
elsif Fade = fade_Level'First then increment_Fade := True;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
end if;
|
||||||
|
|
||||||
|
Epoch := Epoch + 1;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
Demo.destroy;
|
||||||
|
end launch_render_two_Textures;
|
||||||
@@ -2,16 +2,15 @@ with
|
|||||||
"opengl_demo",
|
"opengl_demo",
|
||||||
"lace_shared";
|
"lace_shared";
|
||||||
|
|
||||||
|
project render_two_Textures
|
||||||
project tiling_Demo
|
|
||||||
is
|
is
|
||||||
for Object_Dir use "build";
|
for Object_Dir use "build";
|
||||||
for Exec_Dir use ".";
|
for Exec_Dir use ".";
|
||||||
for Main use ("launch_tiling_demo.adb");
|
for Main use ("launch_render_two_textures.adb");
|
||||||
|
|
||||||
package Ide renames Lace_shared.Ide;
|
package Ide renames Lace_shared.Ide;
|
||||||
package Builder renames Lace_shared.Builder;
|
package Builder renames Lace_shared.Builder;
|
||||||
package Compiler renames Lace_shared.Compiler;
|
package Compiler renames Lace_shared.Compiler;
|
||||||
package Binder renames Lace_shared.Binder;
|
package Binder renames Lace_shared.Binder;
|
||||||
|
|
||||||
end tiling_Demo;
|
end render_two_Textures;
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
with
|
|
||||||
openGL.Model.polygon.lit_textured,
|
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Visual,
|
|
||||||
openGL.Light,
|
|
||||||
openGL.Palette,
|
|
||||||
openGL.Demo;
|
|
||||||
|
|
||||||
|
|
||||||
procedure launch_tiling_Demo
|
|
||||||
--
|
|
||||||
-- 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, 0.0, 2.0],
|
|
||||||
y_Rotation_from (to_Radians (0.0)));
|
|
||||||
|
|
||||||
declare
|
|
||||||
use openGL.Light;
|
|
||||||
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
|
|
||||||
begin
|
|
||||||
the_Light.Site_is ([0.0, 0.0, 5.0]);
|
|
||||||
the_Light.Color_is (White);
|
|
||||||
|
|
||||||
Demo.Renderer.set (the_Light);
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
declare
|
|
||||||
the_Texture : constant asset_Name := to_Asset ("assets/opengl/texture/Face1.bmp");
|
|
||||||
Details : openGL.texture_Set.Details := openGL.texture_Set.to_Details ([1 => the_Texture]);
|
|
||||||
|
|
||||||
the_Model : Model.polygon.lit_textured.view;
|
|
||||||
-- := Model.polygon.lit_textured.new_Polygon (vertex_Sites => [[-1.0, -1.0], [1.0, -1.0], [1.0, 1.0], [-1.0, 1.0]],
|
|
||||||
-- texture_Details => openGL.texture_Set.to_Details ([1 => the_Texture]));
|
|
||||||
|
|
||||||
|
|
||||||
-- The visuals.
|
|
||||||
--
|
|
||||||
use openGL.Visual.Forge;
|
|
||||||
|
|
||||||
the_Visual : openGL.Visual.view;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Details.texture_Tilings (1) := (S => 5.0, T => 4.0);
|
|
||||||
|
|
||||||
the_Model := Model.polygon.lit_textured.new_Polygon (vertex_Sites => [[-1.0, -1.0], [1.0, -1.0], [1.0, 1.0], [-1.0, 1.0]],
|
|
||||||
texture_Details => Details);
|
|
||||||
the_Visual := new_Visual (the_Model.all'Access);
|
|
||||||
|
|
||||||
-- Main loop.
|
|
||||||
--
|
|
||||||
while not Demo.Done
|
|
||||||
loop
|
|
||||||
Demo.Dolly.evolve;
|
|
||||||
Demo.Done := Demo.Dolly.quit_Requested;
|
|
||||||
|
|
||||||
|
|
||||||
-- Render all visuals.
|
|
||||||
--
|
|
||||||
Demo.Camera.render ([1 => the_Visual]);
|
|
||||||
|
|
||||||
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_tiling_Demo;
|
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
with openGL.texture_Set;
|
|
||||||
with
|
with
|
||||||
openGL.Camera,
|
openGL.Camera,
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
@@ -55,8 +54,7 @@ begin
|
|||||||
right => (colors => [others => (Red, Opaque)], texture_name => the_Face)]);
|
right => (colors => [others => (Red, Opaque)], texture_name => the_Face)]);
|
||||||
|
|
||||||
the_ball_Model : constant Model.Sphere.lit_colored_textured.view
|
the_ball_Model : constant Model.Sphere.lit_colored_textured.view
|
||||||
:= Model.Sphere.lit_colored_textured.new_Sphere (radius => 0.5,
|
:= Model.Sphere.lit_colored_textured.new_Sphere (radius => 0.5);
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Face]));
|
|
||||||
|
|
||||||
-- The Sprites.
|
-- The Sprites.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,24 +1,15 @@
|
|||||||
// Include 'version.header'.
|
#version 140
|
||||||
// Include 'texturing-frag.snippet'.
|
|
||||||
|
|
||||||
in vec3 frag_Site;
|
uniform sampler2D sTexture;
|
||||||
in vec4 frag_Color;
|
|
||||||
in vec2 frag_Coords;
|
|
||||||
|
|
||||||
out vec4 final_Color;
|
varying vec4 vColor;
|
||||||
|
varying vec2 vCoords;
|
||||||
|
|
||||||
|
|
||||||
void
|
void main()
|
||||||
main()
|
|
||||||
{
|
{
|
||||||
vec4 surface_Color = mix (apply_Texturing (frag_Coords),
|
gl_FragColor = mix (texture2D (sTexture, vCoords),
|
||||||
frag_Color,
|
vColor,
|
||||||
0.5);
|
0.5);
|
||||||
|
|
||||||
vec3 Gamma = vec3 (1.0 / 2.2);
|
|
||||||
final_Color = vec4
|
|
||||||
(pow
|
|
||||||
(surface_Color.rgb, // Final color (after gamma correction).
|
|
||||||
Gamma),
|
|
||||||
surface_Color.a);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,17 @@
|
|||||||
uniform mat4 mvp_Transform;
|
uniform mat4 mvp_Transform;
|
||||||
uniform vec3 Scale;
|
uniform vec3 Scale;
|
||||||
|
|
||||||
in vec3 Site;
|
attribute vec3 Site;
|
||||||
in vec4 Color;
|
attribute vec4 Color;
|
||||||
in vec2 Coords;
|
attribute vec2 Coords;
|
||||||
|
|
||||||
out vec4 frag_Color;
|
varying vec4 vColor;
|
||||||
out vec2 frag_Coords;
|
varying vec2 vCoords;
|
||||||
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
gl_Position = mvp_Transform * vec4 (Site * Scale, 1.0);
|
gl_Position = mvp_Transform * vec4 (Site * Scale, 1.0);
|
||||||
frag_Color = Color;
|
vColor = Color;
|
||||||
frag_Coords = Coords;
|
vCoords = Coords;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,8 @@
|
|||||||
// Texturing snippet.
|
// Texturing snippet.
|
||||||
//
|
//
|
||||||
uniform int texture_Count;
|
uniform int texture_Count;
|
||||||
uniform sampler2D Textures [16];
|
uniform sampler2D Textures [16];
|
||||||
uniform float Fade [16];
|
uniform float Fade [16];
|
||||||
uniform bool texture_Applies [16];
|
|
||||||
uniform vec2 Tiling [16];
|
|
||||||
|
|
||||||
vec4
|
vec4
|
||||||
apply_Texturing (vec2 Coords)
|
apply_Texturing (vec2 Coords)
|
||||||
@@ -17,20 +15,12 @@ apply_Texturing (vec2 Coords)
|
|||||||
|
|
||||||
for (int i = 0; i < texture_Count; ++i)
|
for (int i = 0; i < texture_Count; ++i)
|
||||||
{
|
{
|
||||||
if (texture_Applies [i])
|
Color.rgb += texture (Textures [i], Coords).rgb
|
||||||
{
|
* texture (Textures [i], Coords).a
|
||||||
vec2 tiled_Coords;
|
|
||||||
|
|
||||||
tiled_Coords.s = Coords.s * Tiling [i].s;
|
|
||||||
tiled_Coords.t = Coords.t * Tiling [i].t;
|
|
||||||
|
|
||||||
Color.rgb += texture (Textures [i], tiled_Coords).rgb
|
|
||||||
* texture (Textures [i], tiled_Coords).a
|
|
||||||
* (1.0 - Fade [i]);
|
* (1.0 - Fade [i]);
|
||||||
|
|
||||||
Color.a = max (Color.a, texture (Textures [i],
|
Color.a = max (Color.a, texture (Textures [i],
|
||||||
tiled_Coords).a);
|
Coords).a);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Color;
|
return Color;
|
||||||
@@ -164,9 +154,6 @@ main()
|
|||||||
Surface_to_Camera);
|
Surface_to_Camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
// linear_Color.g = 1.0;
|
|
||||||
linear_Color += surface_Color.rgb;
|
|
||||||
|
|
||||||
vec3 Gamma = vec3 (1.0 / 2.2);
|
vec3 Gamma = vec3 (1.0 / 2.2);
|
||||||
|
|
||||||
final_Color = vec4 (pow (linear_Color, // Final color (after gamma correction).
|
final_Color = vec4 (pow (linear_Color, // Final color (after gamma correction).
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ uniform int texture_Count;
|
|||||||
uniform sampler2D Textures [16];
|
uniform sampler2D Textures [16];
|
||||||
uniform float Fade [16];
|
uniform float Fade [16];
|
||||||
uniform bool texture_Applies [16];
|
uniform bool texture_Applies [16];
|
||||||
uniform vec2 Tiling [16];
|
|
||||||
|
|
||||||
|
|
||||||
vec4
|
vec4
|
||||||
@@ -15,17 +14,17 @@ apply_Texturing (vec2 Coords)
|
|||||||
{
|
{
|
||||||
if (texture_Applies [i])
|
if (texture_Applies [i])
|
||||||
{
|
{
|
||||||
vec2 tiled_Coords;
|
Color.rgb += texture (Textures [i], Coords).rgb
|
||||||
|
* texture (Textures [i], Coords).a
|
||||||
tiled_Coords.s = Coords.s * Tiling [i].s;
|
|
||||||
tiled_Coords.t = Coords.t * Tiling [i].t;
|
|
||||||
|
|
||||||
Color.rgb += texture (Textures [i], tiled_Coords).rgb
|
|
||||||
* texture (Textures [i], tiled_Coords).a
|
|
||||||
* (1.0 - Fade [i]);
|
* (1.0 - Fade [i]);
|
||||||
|
|
||||||
|
// Color.a += texture (Textures [i], Coords).a * (1.0 - Fade [1]);
|
||||||
|
|
||||||
Color.a = max (Color.a,
|
Color.a = max (Color.a,
|
||||||
texture (Textures [i], tiled_Coords).a * (1.0 - Fade [i]));
|
texture (Textures [i],Coords).a * (1.0 - Fade [i]));
|
||||||
|
|
||||||
|
// Color.a = max (Color.a,
|
||||||
|
// texture (Textures [i],Coords).a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ with
|
|||||||
|
|
||||||
interfaces.C.Strings,
|
interfaces.C.Strings,
|
||||||
|
|
||||||
|
ada.unchecked_Conversion,
|
||||||
ada.unchecked_Deallocation,
|
ada.unchecked_Deallocation,
|
||||||
ada.Finalization;
|
ada.Finalization;
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ is
|
|||||||
--- Utility
|
--- Utility
|
||||||
--
|
--
|
||||||
|
|
||||||
|
function to_Flag is new ada.unchecked_Conversion (FT_Kerning_Mode, C.unsigned);
|
||||||
procedure deallocate is new ada.Unchecked_Deallocation (float_Array, float_Array_view);
|
procedure deallocate is new ada.Unchecked_Deallocation (float_Array, float_Array_view);
|
||||||
|
|
||||||
|
|
||||||
@@ -246,7 +248,7 @@ is
|
|||||||
Self.Err := FT_Get_Kerning (Self.ftFace,
|
Self.Err := FT_Get_Kerning (Self.ftFace,
|
||||||
C.unsigned (index1),
|
C.unsigned (index1),
|
||||||
C.unsigned (index2),
|
C.unsigned (index2),
|
||||||
ft_Kerning_unfitted'enum_Rep,
|
to_Flag (ft_Kerning_unfitted),
|
||||||
kernAdvance'unchecked_Access);
|
kernAdvance'unchecked_Access);
|
||||||
if Self.Err /= 0
|
if Self.Err /= 0
|
||||||
then
|
then
|
||||||
@@ -321,7 +323,7 @@ is
|
|||||||
loop
|
loop
|
||||||
Self.Err := FT_Get_Kerning (Self.ftFace,
|
Self.Err := FT_Get_Kerning (Self.ftFace,
|
||||||
i, j,
|
i, j,
|
||||||
ft_Kerning_unfitted'enum_Rep,
|
to_Flag (ft_Kerning_unfitted),
|
||||||
kernAdvance'unchecked_Access);
|
kernAdvance'unchecked_Access);
|
||||||
if Self.Err /= 0
|
if Self.Err /= 0
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
with
|
with
|
||||||
openGL.texture_Set,
|
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.IO,
|
openGL.IO,
|
||||||
@@ -151,27 +150,20 @@ is
|
|||||||
:= Model.sphere.lit_colored.new_Sphere (Radius => 1.0, Color => (Green, Opaque));
|
:= Model.sphere.lit_colored.new_Sphere (Radius => 1.0, Color => (Green, Opaque));
|
||||||
|
|
||||||
the_ball_3_Model : constant Model.sphere.lit_textured.view
|
the_ball_3_Model : constant Model.sphere.lit_textured.view
|
||||||
:= Model.sphere.lit_textured.new_Sphere (Radius => 1.0,
|
:= Model.sphere.lit_textured.new_Sphere (Radius => 1.0, Image => the_Texture);
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
|
|
||||||
Image => the_Texture);
|
|
||||||
|
|
||||||
the_ball_4_Model : constant Model.sphere.lit_colored_textured.view
|
the_ball_4_Model : constant Model.sphere.lit_colored_textured.view
|
||||||
:= Model.sphere.lit_colored_textured.new_Sphere (Radius => 1.0,
|
:= Model.sphere.lit_colored_textured.new_Sphere (Radius => 1.0, Image => the_Texture);
|
||||||
Color => (Green, Opaque),
|
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
|
|
||||||
Image => the_Texture);
|
|
||||||
|
|
||||||
the_billboard_Model : constant Model.billboard.textured.view
|
the_billboard_Model : constant Model.billboard.textured.view
|
||||||
:= Model.billboard.textured.forge.new_Billboard (Size => (1.0, 1.0),
|
:= Model.billboard.textured.forge.new_Billboard (Size => (1.0, 1.0),
|
||||||
Plane => Billboard.xy,
|
Plane => Billboard.xy,
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
|
|
||||||
Texture => the_Texture);
|
Texture => the_Texture);
|
||||||
|
|
||||||
the_colored_billboard_Model : constant Model.billboard.textured.view -- TODO: Add color.
|
the_colored_billboard_Model : constant Model.billboard.textured.view -- TODO: Add color.
|
||||||
:= Model.billboard.textured.forge.new_Billboard (Size => (1.0, 1.0),
|
:= Model.billboard.textured.forge.new_Billboard (Size => (1.0, 1.0),
|
||||||
Plane => Billboard.xy,
|
Plane => Billboard.xy,
|
||||||
Texture => the_Texture,
|
Texture => the_Texture);
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
|
|
||||||
use Model.box;
|
use Model.box;
|
||||||
|
|
||||||
the_box_1_Model : constant Model.box.colored.view
|
the_box_1_Model : constant Model.box.colored.view
|
||||||
@@ -187,25 +179,23 @@ is
|
|||||||
the_box_2_Model : constant Model.box.lit_textured.view
|
the_box_2_Model : constant Model.box.lit_textured.view
|
||||||
:= Model.box.lit_textured.new_Box
|
:= Model.box.lit_textured.new_Box
|
||||||
(Size => [1.0, 2.0, 1.0],
|
(Size => [1.0, 2.0, 1.0],
|
||||||
Faces => [others => (texture_Name => the_Texture)],
|
Faces => [others => (texture_Name => the_Texture)]);
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
|
|
||||||
|
|
||||||
the_box_3_Model : constant Model.box.textured.view
|
the_box_3_Model : constant Model.box.textured.view
|
||||||
:= Model.box.textured.new_Box
|
:= Model.box.textured.new_Box
|
||||||
(Size => [1.0, 2.0, 3.0],
|
(Size => [1.0, 2.0, 3.0],
|
||||||
Faces => [others => (texture_Name => the_Texture)],
|
Faces => [others => (texture_Name => the_Texture)]);
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
|
|
||||||
|
|
||||||
|
|
||||||
the_capsule_Model : constant Model.capsule.lit_textured.view
|
the_capsule_Model : constant Model.capsule.lit_textured.view
|
||||||
:= Model.capsule.lit_textured.new_Capsule (Radius => 0.5,
|
:= Model.capsule.lit_textured.new_Capsule (Radius => 0.5,
|
||||||
Height => 2.0,
|
Height => 2.0,
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]),
|
|
||||||
Image => the_Texture);
|
Image => the_Texture);
|
||||||
|
|
||||||
the_lit_textured_circle_Model : constant Model.circle.lit_textured.view
|
the_lit_textured_circle_Model : constant Model.circle.lit_textured.view
|
||||||
:= Model.circle.lit_textured.new_Circle (Radius => 1.5,
|
:= Model.circle.lit_textured.new_Circle (Radius => 1.5,
|
||||||
Texture_Details => (openGL.texture_Set.to_Set ([1 => the_Texture])),
|
Face => (Fades => (1 => 0.0, others => <>),
|
||||||
|
Textures => (1 => the_Texture, others => <>),
|
||||||
|
texture_Count => 1),
|
||||||
Sides => 24);
|
Sides => 24);
|
||||||
|
|
||||||
the_grid_Model : constant Model.grid.view
|
the_grid_Model : constant Model.grid.view
|
||||||
@@ -220,7 +210,9 @@ is
|
|||||||
|
|
||||||
the_textured_hexagon_Model : constant Model.hexagon.lit_textured.view
|
the_textured_hexagon_Model : constant Model.hexagon.lit_textured.view
|
||||||
:= Model.hexagon.lit_textured.new_Hexagon (Radius => 0.5,
|
:= Model.hexagon.lit_textured.new_Hexagon (Radius => 0.5,
|
||||||
texture_Details => texture_Set.to_Set ([1 => the_Texture]));
|
Face => (Fades => (1 => 0.0, others => <>),
|
||||||
|
Textures => (1 => the_Texture, others => <>),
|
||||||
|
texture_Count => 1));
|
||||||
|
|
||||||
the_faceted_hexagon_column_Model : constant Model.hexagon_Column.lit_colored_faceted.view
|
the_faceted_hexagon_column_Model : constant Model.hexagon_Column.lit_colored_faceted.view
|
||||||
:= Model.hexagon_Column.lit_colored_faceted.new_hexagon_Column
|
:= Model.hexagon_Column.lit_colored_faceted.new_hexagon_Column
|
||||||
@@ -255,7 +247,6 @@ is
|
|||||||
:= Model.any.new_Model (--Scale => (1.0, 1.0, 1.0),
|
:= Model.any.new_Model (--Scale => (1.0, 1.0, 1.0),
|
||||||
Model => to_Asset ("assets/opengl/model/human.obj"),
|
Model => to_Asset ("assets/opengl/model/human.obj"),
|
||||||
Texture => the_Texture,
|
Texture => the_Texture,
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
|
|
||||||
Texture_is_lucid => False);
|
Texture_is_lucid => False);
|
||||||
|
|
||||||
the_lit_colored_polygon_Model : constant Model.polygon.lit_colored.view
|
the_lit_colored_polygon_Model : constant Model.polygon.lit_colored.view
|
||||||
@@ -264,13 +255,15 @@ is
|
|||||||
|
|
||||||
the_lit_textured_polygon_Model : constant Model.polygon.lit_textured.view
|
the_lit_textured_polygon_Model : constant Model.polygon.lit_textured.view
|
||||||
:= Model.polygon.lit_textured.new_Polygon (vertex_Sites => [Origin_2D, [1.0, 0.0], [1.0, 1.0], [-1.0, 0.5]],
|
:= Model.polygon.lit_textured.new_Polygon (vertex_Sites => [Origin_2D, [1.0, 0.0], [1.0, 1.0], [-1.0, 0.5]],
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]));
|
Face => (Fades => (1 => 0.0, others => <>),
|
||||||
|
Textures => (1 => the_Texture, others => <>),
|
||||||
|
texture_Tiling => <>,
|
||||||
|
texture_Count => 1));
|
||||||
|
|
||||||
the_text_Model : constant Model.Text.lit_colored.view
|
the_text_Model : constant Model.Text.lit_colored.view
|
||||||
:= Model.Text.lit_colored.new_Text (Text => "Once upon a midnight dreary ...",
|
:= Model.Text.lit_colored.new_Text (Text => "Once upon a midnight dreary ...",
|
||||||
Font => the_font_Id,
|
Font => the_font_Id,
|
||||||
Color => (Green, Opaque),
|
Color => (Green, Opaque),
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => the_Texture]),
|
|
||||||
Centered => True);
|
Centered => True);
|
||||||
|
|
||||||
the_segment_line_Model : constant Model.segment_line.view
|
the_segment_line_Model : constant Model.segment_line.view
|
||||||
@@ -286,13 +279,12 @@ is
|
|||||||
Tiling : constant texture_Transform_2d := (S => (0.0, 1.0),
|
Tiling : constant texture_Transform_2d := (S => (0.0, 1.0),
|
||||||
T => (0.0, 1.0));
|
T => (0.0, 1.0));
|
||||||
the_ground_Model : constant Model.terrain.view
|
the_ground_Model : constant Model.terrain.view
|
||||||
:= Model.Terrain.new_Terrain (heights_Asset => heights_File,
|
:= Model.Terrain.new_Terrain (heights_Asset => heights_File,
|
||||||
Row => 1,
|
Row => 1,
|
||||||
Col => 1,
|
Col => 1,
|
||||||
Heights => the_Region.all'Access,
|
Heights => the_Region.all'Access,
|
||||||
Color_Map => texture_File,
|
Color_Map => texture_File,
|
||||||
texture_Details => openGL.texture_Set.to_Set ([1 => texture_File]),
|
Tiling => Tiling);
|
||||||
Tiling => Tiling);
|
|
||||||
begin
|
begin
|
||||||
Demo.Renderer.add_Font (the_font_Id);
|
Demo.Renderer.add_Font (the_font_Id);
|
||||||
|
|
||||||
@@ -302,10 +294,10 @@ is
|
|||||||
the_segment_line_Model.add_Segment (end_Site => [2.0, 2.0, 0.0]);
|
the_segment_line_Model.add_Segment (end_Site => [2.0, 2.0, 0.0]);
|
||||||
the_segment_line_Model.add_Segment (end_Site => [0.0, 2.0, 0.0]);
|
the_segment_line_Model.add_Segment (end_Site => [0.0, 2.0, 0.0]);
|
||||||
|
|
||||||
return [ the_text_Model.all'Access,
|
return [ the_ground_Model.all'Access,
|
||||||
the_ground_Model.all'Access,
|
|
||||||
the_lit_textured_polygon_Model.all'Access,
|
the_lit_textured_polygon_Model.all'Access,
|
||||||
the_lit_colored_polygon_Model.all'Access,
|
the_lit_colored_polygon_Model.all'Access,
|
||||||
|
the_text_Model.all'Access,
|
||||||
the_arrow_Model.all'Access,
|
the_arrow_Model.all'Access,
|
||||||
the_ball_1_Model.all'Access,
|
the_ball_1_Model.all'Access,
|
||||||
the_ball_2_Model.all'Access,
|
the_ball_2_Model.all'Access,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ with
|
|||||||
|
|
||||||
GL.Pointers;
|
GL.Pointers;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Buffer.general
|
package body openGL.Buffer.general
|
||||||
is
|
is
|
||||||
--------------------------
|
--------------------------
|
||||||
@@ -54,7 +53,6 @@ is
|
|||||||
From'Size / 8,
|
From'Size / 8,
|
||||||
+From (From'First)'Address,
|
+From (From'First)'Address,
|
||||||
to_GL_Enum (Usage));
|
to_GL_Enum (Usage));
|
||||||
Errors.log;
|
|
||||||
end return;
|
end return;
|
||||||
end to_Buffer;
|
end to_Buffer;
|
||||||
|
|
||||||
@@ -80,7 +78,6 @@ is
|
|||||||
Offset => GLintptr ((Position - 1) * Vertex_Size_in_bits / 8),
|
Offset => GLintptr ((Position - 1) * Vertex_Size_in_bits / 8),
|
||||||
Size => new_Vertices'Size / 8,
|
Size => new_Vertices'Size / 8,
|
||||||
Data => +new_Vertices (new_Vertices'First)'Address);
|
Data => +new_Vertices (new_Vertices'First)'Address);
|
||||||
Errors.log;
|
|
||||||
else
|
else
|
||||||
Self.destroy;
|
Self.destroy;
|
||||||
|
|
||||||
@@ -92,8 +89,9 @@ is
|
|||||||
To'Size / 8,
|
To'Size / 8,
|
||||||
+To (To'First)'Address,
|
+To (To'First)'Address,
|
||||||
to_GL_Enum (Self.Usage));
|
to_GL_Enum (Self.Usage));
|
||||||
Errors.log;
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
Errors.log;
|
||||||
end set;
|
end set;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ generic
|
|||||||
type Element is private;
|
type Element is private;
|
||||||
type Element_Array is array (Index range <>) of Element;
|
type Element_Array is array (Index range <>) of Element;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.general
|
package openGL.Buffer.general
|
||||||
--
|
--
|
||||||
-- A generic for producing various types of openGL vertex buffer objects.
|
-- A generic for producing various types of openGL vertex buffer objects.
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Buffer.general;
|
openGL.Buffer.general;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.indices is new openGL.Buffer.general (base_Object => Buffer.element_array_Object,
|
package openGL.Buffer.indices is new openGL.Buffer.general (base_Object => Buffer.element_array_Object,
|
||||||
Index => long_Index_t,
|
Index => long_Index_t,
|
||||||
Element => Index_t,
|
Element => Index_t,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Buffer.general;
|
openGL.Buffer.general;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.long_indices is new openGL.Buffer.general (base_Object => Buffer.element_array_Object,
|
package openGL.Buffer.long_indices is new openGL.Buffer.general (base_Object => Buffer.element_array_Object,
|
||||||
Index => long_Index_t,
|
Index => long_Index_t,
|
||||||
Element => long_Index_t,
|
Element => long_Index_t,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Buffer.general;
|
openGL.Buffer.general;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.normals is new openGL.Buffer.general (base_Object => Buffer.array_Object,
|
package openGL.Buffer.normals is new openGL.Buffer.general (base_Object => Buffer.array_Object,
|
||||||
Index => Index_t,
|
Index => Index_t,
|
||||||
Element => Normal,
|
Element => Normal,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Buffer.general;
|
openGL.Buffer.general;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.short_indices is new openGL.Buffer.general (base_Object => Buffer.element_array_Object,
|
package openGL.Buffer.short_indices is new openGL.Buffer.general (base_Object => Buffer.element_array_Object,
|
||||||
Index => long_Index_t,
|
Index => long_Index_t,
|
||||||
Element => short_Index_t,
|
Element => short_Index_t,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Buffer.general;
|
openGL.Buffer.general;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.texture_coords is new openGL.Buffer.general (base_Object => Buffer.array_Object,
|
package openGL.Buffer.texture_coords is new openGL.Buffer.general (base_Object => Buffer.array_Object,
|
||||||
Index => Index_t,
|
Index => Index_t,
|
||||||
Element => Coordinate_2D,
|
Element => Coordinate_2D,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Buffer.general;
|
openGL.Buffer.general;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer.vertex is new openGL.Buffer.general (base_Object => Buffer.array_Object,
|
package openGL.Buffer.vertex is new openGL.Buffer.general (base_Object => Buffer.array_Object,
|
||||||
Index => Index_t,
|
Index => Index_t,
|
||||||
Element => Site,
|
Element => Site,
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ with
|
|||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
ada.unchecked_Deallocation;
|
ada.unchecked_Deallocation;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Buffer
|
package body openGL.Buffer
|
||||||
is
|
is
|
||||||
use type a_Name;
|
use type a_Name;
|
||||||
@@ -18,7 +17,7 @@ is
|
|||||||
Name : aliased a_Name;
|
Name : aliased a_Name;
|
||||||
begin
|
begin
|
||||||
Tasks.check;
|
Tasks.check;
|
||||||
glGenBuffers (1, Name'unchecked_Access); Errors.log;
|
glGenBuffers (1, Name'unchecked_Access);
|
||||||
return Name;
|
return Name;
|
||||||
end new_vbo_Name;
|
end new_vbo_Name;
|
||||||
|
|
||||||
@@ -29,9 +28,8 @@ is
|
|||||||
Name : aliased a_Name := vbo_Name;
|
Name : aliased a_Name := vbo_Name;
|
||||||
begin
|
begin
|
||||||
Tasks.check;
|
Tasks.check;
|
||||||
glDeleteBuffers (1, Name'unchecked_Access); Errors.log;
|
glDeleteBuffers (1, Name'unchecked_Access);
|
||||||
end free;
|
end free;
|
||||||
|
|
||||||
pragma Unreferenced (free);
|
pragma Unreferenced (free);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ with
|
|||||||
GL.lean,
|
GL.lean,
|
||||||
ada.unchecked_Conversion;
|
ada.unchecked_Conversion;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Buffer
|
package openGL.Buffer
|
||||||
--
|
--
|
||||||
-- Models a buffer object.
|
-- Models a buffer object.
|
||||||
@@ -12,7 +11,7 @@ is
|
|||||||
--------------
|
--------------
|
||||||
--- Core Types
|
--- Core Types
|
||||||
--
|
--
|
||||||
subtype a_Name is GL.GLuint; -- An openGL vertex buffer 'Name'.
|
subtype a_Name is GL.GLuint; -- An openGL vertex buffer 'Name', which is a natural integer.
|
||||||
type a_Kind is (array_Buffer, element_array_Buffer);
|
type a_Kind is (array_Buffer, element_array_Buffer);
|
||||||
type Usage is (stream_Draw, static_Draw, dynamic_Draw);
|
type Usage is (stream_Draw, static_Draw, dynamic_Draw);
|
||||||
|
|
||||||
@@ -122,5 +121,4 @@ private
|
|||||||
--
|
--
|
||||||
procedure verify_Name (Self : in out Object'Class);
|
procedure verify_Name (Self : in out Object'Class);
|
||||||
|
|
||||||
|
|
||||||
end openGL.Buffer;
|
end openGL.Buffer;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ with
|
|||||||
Interfaces.C.Strings,
|
Interfaces.C.Strings,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Geometry.colored
|
package body openGL.Geometry.colored
|
||||||
is
|
is
|
||||||
use GL.lean, GL.Pointers;
|
use GL.lean, GL.Pointers;
|
||||||
|
|||||||
@@ -35,7 +35,9 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new Geometry.item with null record;
|
type Item is new Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
end openGL.Geometry.colored;
|
end openGL.Geometry.colored;
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ with
|
|||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
openGL.Program,
|
openGL.Program,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
|
openGL.Texture,
|
||||||
|
openGL.Palette,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
openGL.Errors,
|
||||||
|
|
||||||
|
GL.Binding,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
@@ -13,7 +16,6 @@ with
|
|||||||
Interfaces.C.Strings,
|
Interfaces.C.Strings,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Geometry.colored_textured
|
package body openGL.Geometry.colored_textured
|
||||||
is
|
is
|
||||||
use GL.lean,
|
use GL.lean,
|
||||||
@@ -27,6 +29,7 @@ is
|
|||||||
vertex_Shader : aliased Shader.item;
|
vertex_Shader : aliased Shader.item;
|
||||||
fragment_Shader : aliased Shader.item;
|
fragment_Shader : aliased Shader.item;
|
||||||
the_Program : openGL.Program.view;
|
the_Program : openGL.Program.view;
|
||||||
|
white_Texture : openGL.Texture.Object;
|
||||||
|
|
||||||
Name_1 : constant String := "Site";
|
Name_1 : constant String := "Site";
|
||||||
Name_2 : constant String := "Color";
|
Name_2 : constant String := "Color";
|
||||||
@@ -61,7 +64,8 @@ is
|
|||||||
if the_Program = null
|
if the_Program = null
|
||||||
then -- Define the shaders and program.
|
then -- Define the shaders and program.
|
||||||
declare
|
declare
|
||||||
use Attribute.Forge;
|
use Palette,
|
||||||
|
Attribute.Forge;
|
||||||
|
|
||||||
Sample : Vertex;
|
Sample : Vertex;
|
||||||
|
|
||||||
@@ -69,11 +73,12 @@ is
|
|||||||
Attribute_2 : Attribute.view;
|
Attribute_2 : Attribute.view;
|
||||||
Attribute_3 : Attribute.view;
|
Attribute_3 : Attribute.view;
|
||||||
|
|
||||||
|
white_Image : constant Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
begin
|
begin
|
||||||
|
white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
|
||||||
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/colored_textured.vert");
|
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/colored_textured.vert");
|
||||||
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
fragment_Shader.define (Shader.Fragment, "assets/opengl/shader/colored_textured.frag");
|
||||||
2 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
|
||||||
3 => to_Asset ("assets/opengl/shader/colored_textured.frag"))));
|
|
||||||
|
|
||||||
the_Program := new openGL.Program.item;
|
the_Program := new openGL.Program.item;
|
||||||
the_Program.define (vertex_Shader 'Access,
|
the_Program.define (vertex_Shader 'Access,
|
||||||
@@ -189,4 +194,23 @@ is
|
|||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- use GL,
|
||||||
|
-- GL.Binding,
|
||||||
|
-- openGL.Texture;
|
||||||
|
-- begin
|
||||||
|
-- Tasks.check;
|
||||||
|
--
|
||||||
|
-- glActiveTexture (gl.GL_TEXTURE0);
|
||||||
|
-- Errors.log;
|
||||||
|
--
|
||||||
|
-- if Self.Texture = openGL.Texture.null_Object
|
||||||
|
-- then enable (white_Texture);
|
||||||
|
-- else enable (Self.Texture);
|
||||||
|
-- end if;
|
||||||
|
-- end enable_Textures;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.colored_textured;
|
end openGL.Geometry.colored_textured;
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
with
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
with
|
with
|
||||||
openGL.Geometry.texturing;
|
openGL.Geometry.texturing;
|
||||||
@@ -43,7 +47,20 @@ private
|
|||||||
|
|
||||||
package textured_Geometry is new texturing.Mixin;
|
package textured_Geometry is new texturing.Mixin;
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with null record;
|
|
||||||
|
|
||||||
|
type Item is new textured_Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- type Item is new Geometry.item with
|
||||||
|
-- record
|
||||||
|
-- null;
|
||||||
|
-- end record;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
end openGL.Geometry.colored_textured;
|
end openGL.Geometry.colored_textured;
|
||||||
|
|||||||
@@ -37,5 +37,4 @@ private
|
|||||||
|
|
||||||
type Item is new Geometry.item with null record;
|
type Item is new Geometry.item with null record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.lit_colored;
|
end openGL.Geometry.lit_colored;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ with
|
|||||||
openGL.Shader,
|
openGL.Shader,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
|
openGL.Texture,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
openGL.Errors,
|
||||||
|
|
||||||
@@ -208,7 +209,6 @@ is
|
|||||||
end define_Program;
|
end define_Program;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
with
|
with
|
||||||
openGL.Program.lit.colored_skinned;
|
openGL.Program.lit.colored_skinned;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Geometry.lit_colored_skinned
|
package openGL.Geometry.lit_colored_skinned
|
||||||
--
|
--
|
||||||
-- Supports per-vertex site color, lighting and skinning.
|
-- Supports per-vertex site color, texture, lighting and skinning.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
type Item is new openGL.Geometry.item with private;
|
type Item is new openGL.Geometry.item with private;
|
||||||
@@ -29,10 +28,8 @@ is
|
|||||||
bone_Ids : Vector_4;
|
bone_Ids : Vector_4;
|
||||||
bone_Weights : Vector_4;
|
bone_Weights : Vector_4;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
pragma Convention (C, Vertex);
|
pragma Convention (C, Vertex);
|
||||||
|
|
||||||
|
|
||||||
type Vertex_array is array (long_Index_t range <>) of aliased Vertex;
|
type Vertex_array is array (long_Index_t range <>) of aliased Vertex;
|
||||||
|
|
||||||
|
|
||||||
@@ -58,5 +55,4 @@ private
|
|||||||
overriding
|
overriding
|
||||||
procedure enable_Textures (Self : in out Item);
|
procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.lit_colored_skinned;
|
end openGL.Geometry.lit_colored_skinned;
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
with
|
with
|
||||||
openGL.Program.lit,
|
openGL.Program.lit,
|
||||||
|
openGL.Palette,
|
||||||
openGL.Shader,
|
openGL.Shader,
|
||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
|
openGL.Texture,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
openGL.Errors,
|
||||||
|
|
||||||
|
GL.Binding,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
@@ -15,7 +18,8 @@ with
|
|||||||
|
|
||||||
package body openGL.Geometry.lit_colored_textured
|
package body openGL.Geometry.lit_colored_textured
|
||||||
is
|
is
|
||||||
use GL.lean,
|
use openGL.texture_Set,
|
||||||
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
Interfaces,
|
Interfaces,
|
||||||
System;
|
System;
|
||||||
@@ -60,6 +64,7 @@ is
|
|||||||
Attribute_4_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_4_Name'Access);
|
Attribute_4_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_4_Name'Access);
|
||||||
Attribute_5_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_5_Name'Access);
|
Attribute_5_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_5_Name'Access);
|
||||||
|
|
||||||
|
white_Texture : openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
@@ -68,7 +73,6 @@ is
|
|||||||
|
|
||||||
type Geometry_view is access all Geometry.lit_colored_textured.item'Class;
|
type Geometry_view is access all Geometry.lit_colored_textured.item'Class;
|
||||||
|
|
||||||
|
|
||||||
function new_Geometry (texture_is_Alpha : in Boolean) return access Geometry.lit_colored_textured.item'Class
|
function new_Geometry (texture_is_Alpha : in Boolean) return access Geometry.lit_colored_textured.item'Class
|
||||||
is
|
is
|
||||||
use type openGL.Program.lit.view;
|
use type openGL.Program.lit.view;
|
||||||
@@ -77,7 +81,8 @@ is
|
|||||||
procedure define (the_Program : access Program;
|
procedure define (the_Program : access Program;
|
||||||
use_fragment_Shader : in String)
|
use_fragment_Shader : in String)
|
||||||
is
|
is
|
||||||
use Attribute.Forge,
|
use openGL.Palette,
|
||||||
|
Attribute.Forge,
|
||||||
system.Storage_Elements;
|
system.Storage_Elements;
|
||||||
|
|
||||||
Sample : Vertex;
|
Sample : Vertex;
|
||||||
@@ -88,7 +93,10 @@ is
|
|||||||
Attribute_4 : openGL.Attribute.view;
|
Attribute_4 : openGL.Attribute.view;
|
||||||
Attribute_5 : openGL.Attribute.view;
|
Attribute_5 : openGL.Attribute.view;
|
||||||
|
|
||||||
|
white_Image : constant openGL.Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
the_Program.Program := new openGL.Program.lit.item;
|
the_Program.Program := new openGL.Program.lit.item;
|
||||||
|
|
||||||
the_Program.vertex_Shader.define (Shader.Vertex, "assets/opengl/shader/lit_colored_textured.vert");
|
the_Program.vertex_Shader.define (Shader.Vertex, "assets/opengl/shader/lit_colored_textured.vert");
|
||||||
@@ -196,7 +204,6 @@ is
|
|||||||
textured_Geometry.create_Uniforms (for_Program => the_Program.Program.all'Access);
|
textured_Geometry.create_Uniforms (for_Program => the_Program.Program.all'Access);
|
||||||
end define;
|
end define;
|
||||||
|
|
||||||
|
|
||||||
Self : constant Geometry_view := new Geometry.lit_colored_textured.item;
|
Self : constant Geometry_view := new Geometry.lit_colored_textured.item;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@@ -227,7 +234,6 @@ is
|
|||||||
end new_Geometry;
|
end new_Geometry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
-- Vertex
|
-- Vertex
|
||||||
--
|
--
|
||||||
@@ -244,7 +250,6 @@ is
|
|||||||
end is_Transparent;
|
end is_Transparent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -261,7 +266,7 @@ is
|
|||||||
begin
|
begin
|
||||||
if Self.Vertices = null
|
if Self.Vertices = null
|
||||||
then
|
then
|
||||||
Self.Vertices := new openGL_Buffer_of_geometry_Vertices.Object' (Forge.to_Buffer (Now,
|
self.Vertices := new openGL_Buffer_of_geometry_Vertices.Object' (Forge.to_Buffer (Now,
|
||||||
usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
else
|
else
|
||||||
set (openGL_Buffer_of_geometry_Vertices.Object (Self.Vertices.all),
|
set (openGL_Buffer_of_geometry_Vertices.Object (Self.Vertices.all),
|
||||||
@@ -283,7 +288,6 @@ is
|
|||||||
end Vertices_are;
|
end Vertices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure Indices_are (Self : in out Item; Now : in Indices;
|
procedure Indices_are (Self : in out Item; Now : in Indices;
|
||||||
for_Facia : in Positive)
|
for_Facia : in Positive)
|
||||||
@@ -293,4 +297,93 @@ is
|
|||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
-- procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Self.Textures.Textures (Which).Fade := Now;
|
||||||
|
-- end Fade_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return Self.Textures.Textures (Which).Fade;
|
||||||
|
-- end Fade;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- procedure Texture_is (Self : in out Item; Which : texture_ID; Now : in openGL.Texture.Object)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Texture_is (in_Set => Self.Textures,
|
||||||
|
-- Which => Which,
|
||||||
|
-- Now => Now);
|
||||||
|
-- end Texture_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- function Texture (Self : in Item; Which : texture_ID) return openGL.Texture.Object
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return openGL.texture_Set.Texture (in_Set => Self.Textures,
|
||||||
|
-- which => Which);
|
||||||
|
-- end Texture;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Texture_is (in_Set => Self.Textures,
|
||||||
|
-- Now => Now);
|
||||||
|
-- end Texture_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- function Texture (Self : in Item) return openGL.Texture.Object
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return openGL.texture_Set.Texture (in_Set => Self.Textures,
|
||||||
|
-- which => 1);
|
||||||
|
-- end Texture;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- enable (Self.Textures, Self.Program);
|
||||||
|
-- end enable_Textures;
|
||||||
|
--
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Texture (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- use GL,
|
||||||
|
-- GL.Binding,
|
||||||
|
-- openGL.Texture;
|
||||||
|
-- begin
|
||||||
|
-- Tasks.check;
|
||||||
|
--
|
||||||
|
-- glActiveTexture (gl.GL_TEXTURE0);
|
||||||
|
-- Errors.log;
|
||||||
|
--
|
||||||
|
-- if Self.Texture = openGL.Texture.null_Object
|
||||||
|
-- then enable (white_Texture);
|
||||||
|
-- else enable (Self.Texture);
|
||||||
|
-- end if;
|
||||||
|
-- end enable_Texture;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.lit_colored_textured;
|
end openGL.Geometry.lit_colored_textured;
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
with
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
|
private
|
||||||
with
|
with
|
||||||
openGL.Geometry.texturing;
|
openGL.Geometry.texturing;
|
||||||
|
|
||||||
@@ -7,10 +11,7 @@ package openGL.Geometry.lit_colored_textured
|
|||||||
-- Supports 'per-vertex' site, color, texture and lighting.
|
-- Supports 'per-vertex' site, color, texture and lighting.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Geometry is new texturing.Mixin;
|
type Item is new openGL.Geometry.item with private;
|
||||||
|
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
function new_Geometry (texture_is_Alpha : in Boolean) return access Geometry.lit_colored_textured.item'Class;
|
function new_Geometry (texture_is_Alpha : in Boolean) return access Geometry.lit_colored_textured.item'Class;
|
||||||
@@ -42,10 +43,44 @@ is
|
|||||||
procedure Indices_are (Self : in out Item; Now : in Indices;
|
procedure Indices_are (Self : in out Item; Now : in Indices;
|
||||||
for_Facia : in Positive);
|
for_Facia : in Positive);
|
||||||
|
|
||||||
|
--- Texturing.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- procedure Fade_is (Self : in out Item; Now : in texture_Set.fade_Level;
|
||||||
|
-- Which : in texture_Set.texture_ID := 1);
|
||||||
|
-- function Fade (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.fade_Level;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object;
|
||||||
|
-- Which : in texture_Set.texture_ID);
|
||||||
|
-- function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object;
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object);
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- function Texture (Self : in Item) return openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with null record;
|
package textured_Geometry is new texturing.Mixin;
|
||||||
|
|
||||||
|
|
||||||
|
type Item is new textured_Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- type Item is new Geometry.item with
|
||||||
|
-- record
|
||||||
|
-- Textures : texture_Set.Item;
|
||||||
|
-- end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
end openGL.Geometry.lit_colored_textured;
|
end openGL.Geometry.lit_colored_textured;
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ with
|
|||||||
openGL.Shader,
|
openGL.Shader,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
|
openGL.Texture,
|
||||||
|
openGL.Palette,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
openGL.Errors,
|
||||||
|
|
||||||
|
GL.Binding,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
@@ -48,6 +51,7 @@ is
|
|||||||
Attribute_6_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_6_Name'Access);
|
Attribute_6_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_6_Name'Access);
|
||||||
Attribute_7_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_7_Name'Access);
|
Attribute_7_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_7_Name'Access);
|
||||||
|
|
||||||
|
white_Texture : openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
@@ -70,7 +74,6 @@ is
|
|||||||
end is_Transparent;
|
end is_Transparent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
-- Forge
|
-- Forge
|
||||||
--
|
--
|
||||||
@@ -90,7 +93,8 @@ is
|
|||||||
|
|
||||||
procedure define_Program
|
procedure define_Program
|
||||||
is
|
is
|
||||||
use Attribute.Forge,
|
use Palette,
|
||||||
|
Attribute.Forge,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
@@ -105,6 +109,8 @@ is
|
|||||||
Attribute_6 : openGL.Attribute.view;
|
Attribute_6 : openGL.Attribute.view;
|
||||||
Attribute_7 : openGL.Attribute.view;
|
Attribute_7 : openGL.Attribute.view;
|
||||||
|
|
||||||
|
white_Image : constant openGL.Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Tasks.check;
|
Tasks.check;
|
||||||
|
|
||||||
@@ -117,6 +123,8 @@ is
|
|||||||
|
|
||||||
-- Define the shaders and program.
|
-- Define the shaders and program.
|
||||||
--
|
--
|
||||||
|
white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
|
||||||
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/lit_colored_textured_skinned.vert");
|
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/lit_colored_textured_skinned.vert");
|
||||||
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
||||||
2 => to_Asset ("assets/opengl/shader/lighting-frag.snippet"),
|
2 => to_Asset ("assets/opengl/shader/lighting-frag.snippet"),
|
||||||
@@ -234,7 +242,6 @@ is
|
|||||||
end define_Program;
|
end define_Program;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -283,4 +290,36 @@ is
|
|||||||
end Vertices_are;
|
end Vertices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- use GL,
|
||||||
|
-- GL.Binding,
|
||||||
|
-- openGL.Texture;
|
||||||
|
-- begin
|
||||||
|
-- Tasks.check;
|
||||||
|
--
|
||||||
|
-- glActiveTexture (gl.GL_TEXTURE0);
|
||||||
|
-- Errors.log;
|
||||||
|
--
|
||||||
|
-- if Self.Texture = openGL.Texture.null_Object
|
||||||
|
-- then
|
||||||
|
-- if not white_Texture.is_Defined
|
||||||
|
-- then
|
||||||
|
-- declare
|
||||||
|
-- use Palette;
|
||||||
|
-- white_Image : constant openGL.Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
-- begin
|
||||||
|
-- white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
-- end;
|
||||||
|
-- end if;
|
||||||
|
--
|
||||||
|
-- white_Texture.enable;
|
||||||
|
-- else
|
||||||
|
-- Self.Texture.enable;
|
||||||
|
-- end if;
|
||||||
|
-- end enable_Textures;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.lit_colored_textured_skinned;
|
end openGL.Geometry.lit_colored_textured_skinned;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Program.lit.colored_textured_skinned;
|
openGL.Program.lit.colored_textured_skinned,
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -7,6 +8,7 @@ with
|
|||||||
openGL.Geometry.texturing;
|
openGL.Geometry.texturing;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Geometry.lit_colored_textured_skinned
|
package openGL.Geometry.lit_colored_textured_skinned
|
||||||
--
|
--
|
||||||
-- Supports 'per-vertex' site, color, texture, lighting and skinning.
|
-- Supports 'per-vertex' site, color, texture, lighting and skinning.
|
||||||
@@ -37,7 +39,6 @@ is
|
|||||||
|
|
||||||
pragma Convention (C, Vertex);
|
pragma Convention (C, Vertex);
|
||||||
|
|
||||||
|
|
||||||
type Vertex_array is array (long_Index_t range <>) of aliased Vertex;
|
type Vertex_array is array (long_Index_t range <>) of aliased Vertex;
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +60,16 @@ private
|
|||||||
|
|
||||||
package textured_Geometry is new texturing.Mixin;
|
package textured_Geometry is new texturing.Mixin;
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with null record;
|
|
||||||
|
|
||||||
|
type Item is new textured_Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- type Item is new Geometry.item with null record;
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
end openGL.Geometry.lit_colored_textured_skinned;
|
end openGL.Geometry.lit_colored_textured_skinned;
|
||||||
|
|||||||
@@ -1,22 +1,30 @@
|
|||||||
with
|
with
|
||||||
|
openGL.Geometry.texturing,
|
||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
|
openGL.Model,
|
||||||
openGL.Shader,
|
openGL.Shader,
|
||||||
openGL.Program.lit,
|
openGL.Program.lit,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
|
openGL.Texture,
|
||||||
|
openGL.Palette,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
openGL.Errors,
|
||||||
|
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
|
ada.Strings.fixed,
|
||||||
Interfaces.C.Strings,
|
Interfaces.C.Strings,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
|
|
||||||
|
-- with ada.Text_IO; use ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Geometry.lit_textured
|
package body openGL.Geometry.lit_textured
|
||||||
is
|
is
|
||||||
use GL.lean,
|
use GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
openGL.texture_Set,
|
||||||
Interfaces;
|
Interfaces;
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
@@ -26,7 +34,8 @@ is
|
|||||||
vertex_Shader : aliased Shader.item;
|
vertex_Shader : aliased Shader.item;
|
||||||
fragment_Shader : aliased Shader.item;
|
fragment_Shader : aliased Shader.item;
|
||||||
|
|
||||||
the_Program : openGL.Program.lit.view;
|
the_Program : openGL.Program.lit.view;
|
||||||
|
white_Texture : openGL.Texture.Object;
|
||||||
|
|
||||||
Name_1 : constant String := "Site";
|
Name_1 : constant String := "Site";
|
||||||
Name_2 : constant String := "Normal";
|
Name_2 : constant String := "Normal";
|
||||||
@@ -43,6 +52,8 @@ is
|
|||||||
Attribute_3_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_3_Name'Access);
|
Attribute_3_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_3_Name'Access);
|
||||||
Attribute_4_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_4_Name'Access);
|
Attribute_4_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_4_Name'Access);
|
||||||
|
|
||||||
|
-- texture_Uniforms : texturing.Uniforms;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
@@ -51,7 +62,8 @@ is
|
|||||||
|
|
||||||
procedure create_Program
|
procedure create_Program
|
||||||
is
|
is
|
||||||
use Attribute.Forge,
|
use Palette,
|
||||||
|
Attribute.Forge,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
|
|
||||||
use type system.Address;
|
use type system.Address;
|
||||||
@@ -63,7 +75,11 @@ is
|
|||||||
Attribute_3 : Attribute.view;
|
Attribute_3 : Attribute.view;
|
||||||
Attribute_4 : Attribute.view;
|
Attribute_4 : Attribute.view;
|
||||||
|
|
||||||
|
white_Image : constant Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
|
||||||
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/lit_textured.vert");
|
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/lit_textured.vert");
|
||||||
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
||||||
2 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
2 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
||||||
@@ -71,7 +87,7 @@ is
|
|||||||
4 => to_Asset ("assets/opengl/shader/lit_textured.frag"))));
|
4 => to_Asset ("assets/opengl/shader/lit_textured.frag"))));
|
||||||
the_Program := new openGL.Program.lit.item;
|
the_Program := new openGL.Program.lit.item;
|
||||||
the_Program.define ( vertex_Shader'Access,
|
the_Program.define ( vertex_Shader'Access,
|
||||||
fragment_Shader'Access);
|
fragment_Shader'Access);
|
||||||
the_Program.enable;
|
the_Program.enable;
|
||||||
|
|
||||||
Attribute_1 := new_Attribute (Name => Name_1,
|
Attribute_1 := new_Attribute (Name => Name_1,
|
||||||
@@ -134,6 +150,27 @@ is
|
|||||||
name => +Attribute_4_Name_ptr);
|
name => +Attribute_4_Name_ptr);
|
||||||
Errors.log;
|
Errors.log;
|
||||||
|
|
||||||
|
|
||||||
|
--- Set up the texturing uniforms.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- for Id in texture_Id'Range
|
||||||
|
-- loop
|
||||||
|
-- declare
|
||||||
|
-- use ada.Strings,
|
||||||
|
-- ada.Strings.fixed;
|
||||||
|
--
|
||||||
|
-- i : constant Positive := Positive (Id);
|
||||||
|
-- texture_uniform_Name : constant String := "Textures[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||||
|
-- fade_uniform_Name : constant String := "Fade[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||||
|
-- begin
|
||||||
|
-- texture_Uniforms.Textures (Id).texture_Uniform := the_Program.uniform_Variable (named => texture_uniform_Name);
|
||||||
|
-- texture_Uniforms.Textures (Id). fade_Uniform := the_Program.uniform_Variable (named => fade_uniform_Name);
|
||||||
|
-- end;
|
||||||
|
-- end loop;
|
||||||
|
--
|
||||||
|
-- texture_Uniforms.Count := the_Program.uniform_Variable ("texture_Count");
|
||||||
|
|
||||||
textured_Geometry.create_Uniforms (for_Program => the_Program.all'Access);
|
textured_Geometry.create_Uniforms (for_Program => the_Program.all'Access);
|
||||||
end create_Program;
|
end create_Program;
|
||||||
|
|
||||||
@@ -160,6 +197,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
-- Vertex
|
-- Vertex
|
||||||
--
|
--
|
||||||
@@ -182,6 +220,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -252,4 +291,75 @@ is
|
|||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
-- procedure Fade_is (Self : in out Item; Which : texture_ID; Now : in texture_Set.fade_Level)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Self.texture_Set.Textures (which).Fade := Now;
|
||||||
|
-- end Fade_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return Self.texture_Set.Textures (which).Fade;
|
||||||
|
-- end Fade;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- procedure Texture_is (Self : in out Item; Which : texture_ID; Now : in openGL.Texture.Object)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Texture_is (in_Set => Self.texture_Set,
|
||||||
|
-- Which => Which,
|
||||||
|
-- Now => Now);
|
||||||
|
-- end Texture_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- function Texture (Self : in Item; Which : texture_ID) return openGL.Texture.Object
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return openGL.texture_Set.Texture (in_Set => Self.texture_Set,
|
||||||
|
-- Which => Which);
|
||||||
|
-- end Texture;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Texture_is (in_Set => Self.texture_Set,
|
||||||
|
-- Now => Now);
|
||||||
|
-- end Texture_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- function Texture (Self : in Item) return openGL.Texture.Object
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return texture_Set.Texture (in_Set => Self.texture_Set,
|
||||||
|
-- Which => 1);
|
||||||
|
-- end Texture;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- texturing.enable (for_Model => Self.Model.all'Access,
|
||||||
|
-- Uniforms => texture_Uniforms,
|
||||||
|
-- texture_Set => Self.texture_Set);
|
||||||
|
-- end enable_Textures;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.lit_textured;
|
end openGL.Geometry.lit_textured;
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
with
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
private
|
private
|
||||||
with
|
with
|
||||||
openGL.Geometry.texturing;
|
openGL.Geometry.texturing;
|
||||||
@@ -43,11 +46,36 @@ is
|
|||||||
for_Facia : in Positive);
|
for_Facia : in Positive);
|
||||||
|
|
||||||
|
|
||||||
|
--- Texturing.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level);
|
||||||
|
-- function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- procedure Texture_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in openGL.Texture.Object);
|
||||||
|
-- function Texture (Self : in Item; Which : texture_Set.texture_ID) return openGL.Texture.Object;
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object);
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- function Texture (Self : in Item) return openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
package textured_Geometry is new texturing.Mixin;
|
package textured_Geometry is new texturing.Mixin;
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with null record;
|
|
||||||
|
|
||||||
|
type Item is new textured_Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
end openGL.Geometry.lit_textured;
|
end openGL.Geometry.lit_textured;
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ with
|
|||||||
openGL.Shader,
|
openGL.Shader,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
|
openGL.Texture,
|
||||||
|
openGL.Palette,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
openGL.Errors,
|
||||||
|
|
||||||
|
GL.Binding,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
@@ -46,6 +49,7 @@ is
|
|||||||
Attribute_5_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_5_Name'Access);
|
Attribute_5_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_5_Name'Access);
|
||||||
Attribute_6_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_6_Name'Access);
|
Attribute_6_Name_ptr : aliased constant C.strings.chars_ptr := C.strings.to_chars_ptr (Attribute_6_Name'Access);
|
||||||
|
|
||||||
|
white_Texture : openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
@@ -79,7 +83,8 @@ is
|
|||||||
|
|
||||||
procedure define_Program
|
procedure define_Program
|
||||||
is
|
is
|
||||||
use Attribute.Forge,
|
use Palette,
|
||||||
|
Attribute.Forge,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
@@ -93,6 +98,8 @@ is
|
|||||||
Attribute_5 : openGL.Attribute.view;
|
Attribute_5 : openGL.Attribute.view;
|
||||||
Attribute_6 : openGL.Attribute.view;
|
Attribute_6 : openGL.Attribute.view;
|
||||||
|
|
||||||
|
white_Image : constant openGL.Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Tasks.check;
|
Tasks.check;
|
||||||
|
|
||||||
@@ -105,7 +112,10 @@ is
|
|||||||
|
|
||||||
-- Define the shaders and program.
|
-- Define the shaders and program.
|
||||||
--
|
--
|
||||||
|
white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
|
||||||
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/lit_textured_skinned.vert");
|
vertex_Shader .define (Shader.Vertex, "assets/opengl/shader/lit_textured_skinned.vert");
|
||||||
|
-- fragment_Shader.define (Shader.Fragment, "assets/opengl/shader/lit_textured_skinned.frag");
|
||||||
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
||||||
2 => to_Asset ("assets/opengl/shader/lighting-frag.snippet"),
|
2 => to_Asset ("assets/opengl/shader/lighting-frag.snippet"),
|
||||||
3 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
3 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
||||||
@@ -253,4 +263,36 @@ is
|
|||||||
end Vertices_are;
|
end Vertices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- use GL,
|
||||||
|
-- GL.Binding,
|
||||||
|
-- openGL.Texture;
|
||||||
|
-- begin
|
||||||
|
-- Tasks.check;
|
||||||
|
--
|
||||||
|
-- glActiveTexture (gl.GL_TEXTURE0);
|
||||||
|
-- Errors.log;
|
||||||
|
--
|
||||||
|
-- if Self.Texture = openGL.Texture.null_Object
|
||||||
|
-- then
|
||||||
|
-- if not white_Texture.is_Defined
|
||||||
|
-- then
|
||||||
|
-- declare
|
||||||
|
-- use Palette;
|
||||||
|
-- white_Image : constant openGL.Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
-- begin
|
||||||
|
-- white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
-- end;
|
||||||
|
-- end if;
|
||||||
|
--
|
||||||
|
-- white_Texture.enable;
|
||||||
|
-- else
|
||||||
|
-- Self.Texture.enable;
|
||||||
|
-- end if;
|
||||||
|
-- end enable_Textures;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.lit_textured_skinned;
|
end openGL.Geometry.lit_textured_skinned;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Program.lit.textured_skinned;
|
openGL.Program.lit.textured_skinned,
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
private
|
private
|
||||||
with
|
with
|
||||||
@@ -57,7 +58,16 @@ private
|
|||||||
|
|
||||||
package textured_Geometry is new texturing.Mixin;
|
package textured_Geometry is new texturing.Mixin;
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with null record;
|
|
||||||
|
|
||||||
|
type Item is new textured_Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- type Item is new Geometry.item with null record;
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
end openGL.Geometry.lit_textured_skinned;
|
end openGL.Geometry.lit_textured_skinned;
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ with
|
|||||||
openGL.Buffer.general,
|
openGL.Buffer.general,
|
||||||
openGL.Shader,
|
openGL.Shader,
|
||||||
openGL.Program,
|
openGL.Program,
|
||||||
|
openGL.Palette,
|
||||||
openGL.Attribute,
|
openGL.Attribute,
|
||||||
openGL.Errors,
|
openGL.Texture,
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
|
System,
|
||||||
Interfaces.C.Strings,
|
Interfaces.C.Strings,
|
||||||
System.storage_Elements;
|
System.storage_Elements;
|
||||||
|
|
||||||
@@ -17,6 +19,8 @@ is
|
|||||||
use GL.lean,
|
use GL.lean,
|
||||||
GL.Pointers,
|
GL.Pointers,
|
||||||
|
|
||||||
|
openGL.texture_Set,
|
||||||
|
|
||||||
Interfaces,
|
Interfaces,
|
||||||
System;
|
System;
|
||||||
|
|
||||||
@@ -29,6 +33,7 @@ is
|
|||||||
fragment_Shader : aliased Shader.item;
|
fragment_Shader : aliased Shader.item;
|
||||||
|
|
||||||
the_Program : openGL.Program.view;
|
the_Program : openGL.Program.view;
|
||||||
|
white_Texture : openGL.Texture.Object;
|
||||||
|
|
||||||
Name_1 : constant String := "Site";
|
Name_1 : constant String := "Site";
|
||||||
Name_2 : constant String := "Coords";
|
Name_2 : constant String := "Coords";
|
||||||
@@ -56,7 +61,8 @@ is
|
|||||||
if the_Program = null
|
if the_Program = null
|
||||||
then -- Define the shaders and program.
|
then -- Define the shaders and program.
|
||||||
declare
|
declare
|
||||||
use Attribute.Forge,
|
use Palette,
|
||||||
|
Attribute.Forge,
|
||||||
system.Storage_Elements;
|
system.Storage_Elements;
|
||||||
|
|
||||||
Sample : Vertex;
|
Sample : Vertex;
|
||||||
@@ -64,7 +70,11 @@ is
|
|||||||
Attribute_1 : Attribute.view;
|
Attribute_1 : Attribute.view;
|
||||||
Attribute_2 : Attribute.view;
|
Attribute_2 : Attribute.view;
|
||||||
|
|
||||||
|
white_Image : constant openGL.Image := [1 .. 2 => [1 .. 2 => +White]];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
white_Texture := openGL.Texture.Forge.to_Texture (white_Image);
|
||||||
|
|
||||||
vertex_Shader .define (Shader.vertex, "assets/opengl/shader/textured.vert");
|
vertex_Shader .define (Shader.vertex, "assets/opengl/shader/textured.vert");
|
||||||
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
fragment_Shader.define (Shader.Fragment, (asset_Names' (1 => to_Asset ("assets/opengl/shader/version.header"),
|
||||||
2 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
2 => to_Asset ("assets/opengl/shader/texturing-frag.snippet"),
|
||||||
@@ -97,12 +107,10 @@ is
|
|||||||
glBindAttribLocation (program => the_Program.gl_Program,
|
glBindAttribLocation (program => the_Program.gl_Program,
|
||||||
index => the_Program.Attribute (named => Name_1).gl_Location,
|
index => the_Program.Attribute (named => Name_1).gl_Location,
|
||||||
name => +Attribute_1_Name_ptr);
|
name => +Attribute_1_Name_ptr);
|
||||||
Errors.log;
|
|
||||||
|
|
||||||
glBindAttribLocation (program => the_Program.gl_Program,
|
glBindAttribLocation (program => the_Program.gl_Program,
|
||||||
index => the_Program.Attribute (named => Name_2).gl_Location,
|
index => the_Program.Attribute (named => Name_2).gl_Location,
|
||||||
name => +Attribute_2_Name_ptr);
|
name => +Attribute_2_Name_ptr);
|
||||||
Errors.log;
|
|
||||||
|
|
||||||
textured_Geometry.create_Uniforms (for_Program => the_Program.all'Access);
|
textured_Geometry.create_Uniforms (for_Program => the_Program.all'Access);
|
||||||
end;
|
end;
|
||||||
@@ -114,6 +122,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -131,12 +140,13 @@ is
|
|||||||
Element => Vertex,
|
Element => Vertex,
|
||||||
Element_Array => Vertex_array);
|
Element_Array => Vertex_array);
|
||||||
|
|
||||||
|
|
||||||
procedure Vertices_are (Self : in out Item; Now : in Vertex_array)
|
procedure Vertices_are (Self : in out Item; Now : in Vertex_array)
|
||||||
is
|
is
|
||||||
use openGL_Buffer_of_geometry_Vertices.Forge;
|
use openGL_Buffer_of_geometry_Vertices.Forge;
|
||||||
begin
|
begin
|
||||||
Self.Vertices := new openGL_Buffer_of_geometry_Vertices.Object' (to_Buffer (Now,
|
Self.Vertices := new openGL_Buffer_of_geometry_Vertices.Object' (to_Buffer (Now,
|
||||||
Usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
-- Set the bounds.
|
-- Set the bounds.
|
||||||
--
|
--
|
||||||
declare
|
declare
|
||||||
@@ -160,4 +170,91 @@ is
|
|||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
-- procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Self.Textures.Textures (Which).Fade := Now;
|
||||||
|
-- end Fade_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return Self.Textures.Textures (Which).Fade;
|
||||||
|
-- end Fade;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- procedure Texture_is (Self : in out Item; Which : texture_ID; Now : in openGL.Texture.Object)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Texture_is (in_Set => Self.Textures,
|
||||||
|
-- Which => Which,
|
||||||
|
-- Now => Now);
|
||||||
|
-- end Texture_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- function Texture (Self : in Item; Which : texture_ID) return openGL.Texture.Object
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return openGL.texture_Set.Texture (in_Set => Self.Textures,
|
||||||
|
-- Which => Which);
|
||||||
|
-- end Texture;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- Texture_is (in_Set => Self.Textures,
|
||||||
|
-- Now => Now);
|
||||||
|
-- end Texture_is;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- function Texture (Self : in Item) return openGL.Texture.Object
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- return openGL.texture_Set.Texture (in_Set => Self.Textures,
|
||||||
|
-- which => 1);
|
||||||
|
-- end Texture;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- begin
|
||||||
|
-- enable (Self.Textures, Self.Program);
|
||||||
|
-- end enable_Textures;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Texture (Self : in out Item)
|
||||||
|
-- is
|
||||||
|
-- use GL,
|
||||||
|
-- GL.Binding,
|
||||||
|
-- openGL.Texture;
|
||||||
|
-- begin
|
||||||
|
-- Tasks.check;
|
||||||
|
--
|
||||||
|
-- glActiveTexture (gl.GL_TEXTURE0);
|
||||||
|
-- Errors.log;
|
||||||
|
--
|
||||||
|
-- if Self.Texture = openGL.Texture.null_Object
|
||||||
|
-- then white_Texture.enable;
|
||||||
|
-- else Self.Texture .enable;
|
||||||
|
-- end if;
|
||||||
|
-- end enable_Texture;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.textured;
|
end openGL.Geometry.textured;
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
with
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
with
|
with
|
||||||
openGL.Geometry.texturing;
|
openGL.Geometry.texturing;
|
||||||
@@ -41,11 +45,42 @@ is
|
|||||||
for_Facia : in Positive);
|
for_Facia : in Positive);
|
||||||
|
|
||||||
|
|
||||||
|
--- Texturing.
|
||||||
|
--
|
||||||
|
|
||||||
|
-- procedure Fade_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in texture_Set.fade_Level);
|
||||||
|
-- function Fade (Self : in Item; Which : texture_Set.texture_ID) return texture_Set.fade_Level;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- procedure Texture_is (Self : in out Item; Which : texture_Set.texture_ID; Now : in openGL.Texture.Object);
|
||||||
|
-- function Texture (Self : in Item; Which : texture_Set.texture_ID) return openGL.Texture.Object;
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object);
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- function Texture (Self : in Item) return openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
package textured_Geometry is new texturing.Mixin;
|
package textured_Geometry is new texturing.Mixin;
|
||||||
|
|
||||||
type Item is new textured_Geometry.item with null record;
|
|
||||||
|
|
||||||
|
type Item is new textured_Geometry.item with
|
||||||
|
record
|
||||||
|
null;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
-- type Item is new Geometry.item with
|
||||||
|
-- record
|
||||||
|
-- Textures : texture_Set.Item;
|
||||||
|
-- end record;
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- overriding
|
||||||
|
-- procedure enable_Textures (Self : in out Item);
|
||||||
|
|
||||||
end openGL.Geometry.textured;
|
end openGL.Geometry.textured;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
with
|
with
|
||||||
openGL.Model,
|
openGL.Model,
|
||||||
openGL.Errors,
|
|
||||||
GL.lean,
|
GL.lean,
|
||||||
GL.Binding,
|
GL.Binding,
|
||||||
ada.Strings.fixed;
|
ada.Strings.fixed;
|
||||||
|
|
||||||
|
with ada.Text_IO;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Geometry.texturing
|
package body openGL.Geometry.texturing
|
||||||
is
|
is
|
||||||
@@ -13,7 +14,7 @@ is
|
|||||||
|
|
||||||
type texture_Units is array (texture_Set.texture_Id) of GLenum;
|
type texture_Units is array (texture_Set.texture_Id) of GLenum;
|
||||||
|
|
||||||
all_texture_Units : constant texture_Units := [GL_TEXTURE0,
|
all_texture_Units : constant texture_Units := (GL_TEXTURE0,
|
||||||
GL_TEXTURE1,
|
GL_TEXTURE1,
|
||||||
GL_TEXTURE2,
|
GL_TEXTURE2,
|
||||||
GL_TEXTURE3,
|
GL_TEXTURE3,
|
||||||
@@ -28,7 +29,7 @@ is
|
|||||||
GL_TEXTURE12,
|
GL_TEXTURE12,
|
||||||
GL_TEXTURE13,
|
GL_TEXTURE13,
|
||||||
GL_TEXTURE14,
|
GL_TEXTURE14,
|
||||||
GL_TEXTURE15];
|
GL_TEXTURE15);
|
||||||
-- GL_TEXTURE16,
|
-- GL_TEXTURE16,
|
||||||
-- GL_TEXTURE17,
|
-- GL_TEXTURE17,
|
||||||
-- GL_TEXTURE18,
|
-- GL_TEXTURE18,
|
||||||
@@ -48,9 +49,10 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure enable (for_Model : in openGL.Model.view;
|
procedure enable (for_Model : in openGL.Model.view;
|
||||||
Uniforms : in texturing.Uniforms)
|
Uniforms : in texturing.Uniforms;
|
||||||
-- texture_Set : in openGL.texture_Set.Item)
|
texture_Set : in openGL.texture_Set.Item)
|
||||||
is
|
is
|
||||||
use GL.Binding,
|
use GL.Binding,
|
||||||
GL.lean;
|
GL.lean;
|
||||||
@@ -58,22 +60,17 @@ is
|
|||||||
use type GLint;
|
use type GLint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if for_Model.texture_Count > 0
|
for i in 1 .. openGL.texture_Set.texture_Id (for_Model.texture_Count)
|
||||||
then
|
loop
|
||||||
for i in 1 .. openGL.texture_Set.texture_Id (for_Model.texture_Count)
|
Uniforms.Textures (i).fade_Uniform .Value_is (Real (for_Model.Fade (i)));
|
||||||
loop
|
Uniforms.Textures (i).texture_applied_Uniform.Value_is (for_Model.texture_Applied (i));
|
||||||
Uniforms.Textures (i).tiling_Uniform .Value_is (Vector_2' ((for_Model.Tiling (Which => i).S,
|
|
||||||
for_Model.Tiling (Which => i).T)));
|
|
||||||
Uniforms.Textures (i).fade_Uniform .Value_is (Real (for_Model.Fade (Which => i)));
|
|
||||||
Uniforms.Textures (i).texture_applied_Uniform.Value_is (for_Model.texture_Applied (Which => i));
|
|
||||||
|
|
||||||
glUniform1i (Uniforms.Textures (i).texture_Uniform.gl_Variable,
|
glUniform1i (Uniforms.Textures (i).texture_Uniform.gl_Variable,
|
||||||
GLint (i) - 1); Errors.log;
|
GLint (i) - 1);
|
||||||
glActiveTexture (all_texture_Units (i)); Errors.log;
|
glActiveTexture (all_texture_Units (i));
|
||||||
glBindTexture (GL_TEXTURE_2D,
|
glBindTexture (GL_TEXTURE_2D,
|
||||||
for_Model.texture_Object (i).Name); Errors.log;
|
texture_Set.Textures (i).Object.Name);
|
||||||
end loop;
|
end loop;
|
||||||
end if;
|
|
||||||
|
|
||||||
Uniforms.Count.Value_is (for_Model.texture_Count);
|
Uniforms.Count.Value_is (for_Model.texture_Count);
|
||||||
end enable;
|
end enable;
|
||||||
@@ -94,12 +91,10 @@ is
|
|||||||
texture_uniform_Name : constant String := "Textures[" & trim (Natural'Image (i - 1), Left) & "]";
|
texture_uniform_Name : constant String := "Textures[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||||
fade_uniform_Name : constant String := "Fade[" & trim (Natural'Image (i - 1), Left) & "]";
|
fade_uniform_Name : constant String := "Fade[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||||
texture_applies_uniform_Name : constant String := "texture_Applies[" & trim (Natural'Image (i - 1), Left) & "]";
|
texture_applies_uniform_Name : constant String := "texture_Applies[" & trim (Natural'Image (i - 1), Left) & "]";
|
||||||
tiling_uniform_Name : constant String := "Tiling[" & trim (Natural'Image (i - 1), Left) & "]";
|
|
||||||
begin
|
begin
|
||||||
Uniforms.Textures (Id). texture_Uniform := for_Program.uniform_Variable (Named => texture_uniform_Name);
|
Uniforms.Textures (Id). texture_Uniform := for_Program.uniform_Variable (Named => texture_uniform_Name);
|
||||||
Uniforms.Textures (Id). fade_Uniform := for_Program.uniform_Variable (Named => fade_uniform_Name);
|
Uniforms.Textures (Id). fade_Uniform := for_Program.uniform_Variable (Named => fade_uniform_Name);
|
||||||
Uniforms.Textures (Id).texture_applied_Uniform := for_Program.uniform_Variable (Named => texture_applies_uniform_Name);
|
Uniforms.Textures (Id).texture_applied_Uniform := for_Program.uniform_Variable (Named => texture_applies_uniform_Name);
|
||||||
Uniforms.Textures (Id).tiling_Uniform := for_Program.uniform_Variable (Named => tiling_uniform_Name);
|
|
||||||
end;
|
end;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
@@ -116,9 +111,11 @@ is
|
|||||||
|
|
||||||
package body Mixin
|
package body Mixin
|
||||||
is
|
is
|
||||||
texture_Uniforms : texturing.Uniforms;
|
use openGL.texture_Set;
|
||||||
|
|
||||||
|
|
||||||
|
texture_Uniforms : texturing.Uniforms;
|
||||||
|
|
||||||
procedure create_Uniforms (for_Program : in openGL.Program.view)
|
procedure create_Uniforms (for_Program : in openGL.Program.view)
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
@@ -132,8 +129,7 @@ is
|
|||||||
Which : in texture_Set.texture_ID := 1)
|
Which : in texture_Set.texture_ID := 1)
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
Self.Model.Fade_is (Which => Which,
|
Self.texture_Set.Textures (Which).Fade := Now;
|
||||||
Now => Now);
|
|
||||||
end Fade_is;
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
@@ -142,7 +138,7 @@ is
|
|||||||
function Fade (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.fade_Level
|
function Fade (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.fade_Level
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
return Self.Model.Fade (Which => Which);
|
return Self.texture_Set.Textures (which).Fade;
|
||||||
end Fade;
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
@@ -152,8 +148,9 @@ is
|
|||||||
Which : in texture_Set.texture_ID := 1)
|
Which : in texture_Set.texture_ID := 1)
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
Self.Model.texture_Object_is (Which => Which,
|
Texture_is (in_Set => Self.texture_Set,
|
||||||
Now => Now);
|
Which => Which,
|
||||||
|
Now => Now);
|
||||||
end Texture_is;
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
@@ -162,7 +159,8 @@ is
|
|||||||
function Texture (Self : in Item; Which : texture_Set.texture_ID := 1) return openGL.Texture.Object
|
function Texture (Self : in Item; Which : texture_Set.texture_ID := 1) return openGL.Texture.Object
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
return Self.Model.texture_Object (Which);
|
return openGL.texture_Set.Texture (in_Set => Self.texture_Set,
|
||||||
|
Which => Which);
|
||||||
end Texture;
|
end Texture;
|
||||||
|
|
||||||
|
|
||||||
@@ -172,50 +170,34 @@ is
|
|||||||
Which : in texture_Set.texture_ID := 1)
|
Which : in texture_Set.texture_ID := 1)
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
Self.Model.texture_Applied_is (Which, Now);
|
Self.texture_Set.Textures (Which).Applied := Now;
|
||||||
end texture_Applied_is;
|
end texture_Applied_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
return Self.Model.texture_Applied (Which);
|
return Self.texture_Set.Textures (which).Applied;
|
||||||
end texture_Applied;
|
end texture_Applied;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
|
||||||
procedure Tiling_is (Self : in out Item; Now : in texture_Set.Tiling;
|
|
||||||
Which : in texture_Set.texture_ID := 1)
|
|
||||||
is
|
|
||||||
begin
|
|
||||||
Self.Model.Tiling_is (Which => Which,
|
|
||||||
Now => Now);
|
|
||||||
end Tiling_is;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
|
||||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling
|
|
||||||
is
|
|
||||||
begin
|
|
||||||
return Self.Model.Tiling (Which);
|
|
||||||
end Tiling;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure enable_Textures (Self : in out Item)
|
procedure enable_Textures (Self : in out Item)
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
|
-- ada.Text_IO.put_Line (Self.Model'Image);
|
||||||
|
|
||||||
texturing.enable (for_Model => Self.Model.all'Access,
|
texturing.enable (for_Model => Self.Model.all'Access,
|
||||||
Uniforms => texture_Uniforms);
|
Uniforms => texture_Uniforms,
|
||||||
|
texture_Set => Self.texture_Set);
|
||||||
end enable_Textures;
|
end enable_Textures;
|
||||||
|
|
||||||
|
|
||||||
end Mixin;
|
end Mixin;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.texturing;
|
end openGL.Geometry.texturing;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ with
|
|||||||
openGL.Model;
|
openGL.Model;
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
package openGL.Geometry.texturing
|
package openGL.Geometry.texturing
|
||||||
--
|
--
|
||||||
-- Provides texturing support for geometries.
|
-- Provides texturing support for geometries.
|
||||||
@@ -22,7 +23,6 @@ is
|
|||||||
texture_Uniform : openGL.Variable.uniform.sampler2D;
|
texture_Uniform : openGL.Variable.uniform.sampler2D;
|
||||||
fade_Uniform : openGL.Variable.uniform.float;
|
fade_Uniform : openGL.Variable.uniform.float;
|
||||||
texture_applied_Uniform : openGL.Variable.uniform.bool;
|
texture_applied_Uniform : openGL.Variable.uniform.bool;
|
||||||
tiling_Uniform : openGL.Variable.uniform.vec2;
|
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,13 +41,17 @@ is
|
|||||||
--
|
--
|
||||||
|
|
||||||
procedure enable (for_Model : in openGL.Model.view;
|
procedure enable (for_Model : in openGL.Model.view;
|
||||||
Uniforms : in texturing.Uniforms);
|
Uniforms : in texturing.Uniforms;
|
||||||
|
texture_Set : in openGL.texture_Set.Item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure create (Uniforms : out texturing.Uniforms;
|
procedure create (Uniforms : out texturing.Uniforms;
|
||||||
for_Program : in openGL.Program.view);
|
for_Program : in openGL.Program.view);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
--- Mixin ---
|
--- Mixin ---
|
||||||
-------------
|
-------------
|
||||||
@@ -61,18 +65,19 @@ is
|
|||||||
procedure create_Uniforms (for_Program : in openGL.Program.view);
|
procedure create_Uniforms (for_Program : in openGL.Program.view);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure Fade_is (Self : in out Item; Now : in texture_Set.fade_Level;
|
procedure Fade_is (Self : in out Item; Now : in texture_Set.fade_Level;
|
||||||
Which : in texture_Set.texture_ID := 1);
|
Which : in texture_Set.texture_ID := 1);
|
||||||
overriding
|
overriding
|
||||||
function Fade (Self : in Item; Which : texture_Set.texture_ID := 1) return texture_Set.fade_Level;
|
function Fade (Self : in Item; Which : texture_Set.texture_ID := 1) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object;
|
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object;
|
||||||
Which : in texture_Set.texture_ID := 1);
|
Which : in texture_Set.texture_ID := 1);
|
||||||
overriding
|
overriding
|
||||||
function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object;
|
function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object;
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
@@ -81,11 +86,6 @@ is
|
|||||||
overriding
|
overriding
|
||||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean;
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean;
|
||||||
|
|
||||||
overriding
|
|
||||||
procedure Tiling_is (Self : in out Item; Now : in texture_Set.Tiling;
|
|
||||||
Which : in texture_Set.texture_ID := 1);
|
|
||||||
overriding
|
|
||||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling;
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
@@ -94,9 +94,13 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new Geometry.item with null record;
|
type Item is new Geometry.item with
|
||||||
|
record
|
||||||
|
texture_Set : openGL.texture_Set.item;
|
||||||
|
end record;
|
||||||
|
|
||||||
end Mixin;
|
end Mixin;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry.texturing;
|
end openGL.Geometry.texturing;
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -111,7 +112,7 @@ is
|
|||||||
function Fade (Self : in Item; Which : texture_Set.texture_ID := 1) return texture_Set.fade_Level
|
function Fade (Self : in Item; Which : texture_Set.texture_ID := 1) return texture_Set.fade_Level
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
raise Error with "Geometry has no texture.";
|
raise program_Error with "Geometry has no texture.";
|
||||||
return texture_Set.fade_Level'Last;
|
return texture_Set.fade_Level'Last;
|
||||||
end Fade;
|
end Fade;
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ is
|
|||||||
function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object
|
function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
raise Error with "Geometry has no texture.";
|
raise program_Error with "Geometry has no texture.";
|
||||||
return openGL.Texture.null_Object;
|
return openGL.Texture.null_Object;
|
||||||
end Texture;
|
end Texture;
|
||||||
|
|
||||||
@@ -129,23 +130,12 @@ is
|
|||||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
raise Error with "Geometry has no texture.";
|
raise program_Error with "Geometry has no texture.";
|
||||||
return False;
|
return False;
|
||||||
end texture_Applied;
|
end texture_Applied;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling
|
|
||||||
is
|
|
||||||
begin
|
|
||||||
raise Error with "Geometry has no texture.";
|
|
||||||
return (S => 0.0,
|
|
||||||
T => 0.0);
|
|
||||||
end Tiling;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure Program_is (Self : in out Item; Now : in openGL.Program.view)
|
procedure Program_is (Self : in out Item; Now : in openGL.Program.view)
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
@@ -161,7 +151,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Bounds (Self : in Item'Class) return openGL.Bounds
|
function Bounds (self : in Item'Class) return openGL.Bounds
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
return Self.Bounds;
|
return Self.Bounds;
|
||||||
@@ -196,6 +186,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Operations
|
-- Operations
|
||||||
--
|
--
|
||||||
@@ -230,6 +221,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
-- Normals
|
-- Normals
|
||||||
--
|
--
|
||||||
@@ -306,7 +298,6 @@ is
|
|||||||
pragma Unreferenced (facet_Count_in);
|
pragma Unreferenced (facet_Count_in);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
----------
|
----------
|
||||||
-- Facets
|
-- Facets
|
||||||
--
|
--
|
||||||
@@ -327,7 +318,6 @@ is
|
|||||||
-- 'Facets_of' returns all non-redundant facets.
|
-- 'Facets_of' returns all non-redundant facets.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function any_Facets_of (face_Kind : in primitive.facet_Kind;
|
function any_Facets_of (face_Kind : in primitive.facet_Kind;
|
||||||
Indices : in any_Indices) return access Facets
|
Indices : in any_Indices) return access Facets
|
||||||
is
|
is
|
||||||
@@ -360,11 +350,9 @@ is
|
|||||||
is
|
is
|
||||||
when Triangles
|
when Triangles
|
||||||
| triangle_Fan =>
|
| triangle_Fan =>
|
||||||
|
|
||||||
the_Facets (Count) := [P1, P2, P3];
|
the_Facets (Count) := [P1, P2, P3];
|
||||||
|
|
||||||
when triangle_Strip =>
|
when triangle_Strip =>
|
||||||
|
|
||||||
if Each mod 2 = 0
|
if Each mod 2 = 0
|
||||||
then -- Is an even facet.
|
then -- Is an even facet.
|
||||||
the_Facets (Count) := [P1, P3, P2];
|
the_Facets (Count) := [P1, P3, P2];
|
||||||
@@ -389,7 +377,6 @@ is
|
|||||||
end any_Facets_of;
|
end any_Facets_of;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Facets_of is new any_Facets_of (Index_t,
|
function Facets_of is new any_Facets_of (Index_t,
|
||||||
Indices);
|
Indices);
|
||||||
pragma Unreferenced (Facets_of);
|
pragma Unreferenced (Facets_of);
|
||||||
@@ -482,7 +469,7 @@ is
|
|||||||
free (the_Facets);
|
free (the_Facets);
|
||||||
free (the_facet_Normals);
|
free (the_facet_Normals);
|
||||||
|
|
||||||
return the_Normals.all'unchecked_Access;
|
return the_Normals.all'Unchecked_Access;
|
||||||
end any_Normals_of;
|
end any_Normals_of;
|
||||||
|
|
||||||
|
|
||||||
@@ -539,6 +526,7 @@ is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Transparency
|
-- Transparency
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -47,29 +47,25 @@ is
|
|||||||
procedure Model_is (Self : in out Item; Now : in Model_view);
|
procedure Model_is (Self : in out Item; Now : in Model_view);
|
||||||
function Model (Self : in Item) return Model_view;
|
function Model (Self : in Item) return Model_view;
|
||||||
|
|
||||||
procedure Label_is (Self : in out Item'Class; Now : in String);
|
procedure Label_is (Self : in out Item'Class; Now : in String);
|
||||||
function Label (Self : in Item'Class) return String;
|
function Label (Self : in Item'Class) return String;
|
||||||
|
|
||||||
|
|
||||||
--- Texturing
|
--- Texturing
|
||||||
--
|
--
|
||||||
|
|
||||||
procedure Fade_is (Self : in out Item; Now : in texture_Set.fade_Level;
|
procedure Fade_is (Self : in out Item; Now : in texture_Set.fade_Level;
|
||||||
Which : in texture_Set.texture_ID := 1) is null;
|
Which : in texture_Set.texture_ID := 1) is null;
|
||||||
function Fade (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.fade_Level;
|
function Fade (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.fade_Level;
|
||||||
|
|
||||||
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object;
|
procedure Texture_is (Self : in out Item; Now : in openGL.Texture.Object;
|
||||||
Which : in texture_Set.texture_ID := 1) is null;
|
Which : in texture_Set.texture_ID := 1) is null;
|
||||||
function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object;
|
function Texture (Self : in Item; Which : in texture_Set.texture_ID := 1) return openGL.Texture.Object;
|
||||||
|
|
||||||
procedure texture_Applied_is (Self : in out Item; Now : in Boolean;
|
procedure texture_Applied_is (Self : in out Item; Now : in Boolean;
|
||||||
Which : in texture_Set.texture_ID := 1) is null;
|
Which : in texture_Set.texture_ID := 1) is null;
|
||||||
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean;
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_ID := 1) return Boolean;
|
||||||
|
|
||||||
procedure Tiling_is (Self : in out Item; Now : in texture_Set.Tiling;
|
|
||||||
Which : in texture_Set.texture_ID := 1) is null;
|
|
||||||
function Tiling (Self : in Item; Which : in texture_Set.texture_ID := 1) return texture_Set.Tiling;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure Bounds_are (Self : in out Item'Class; Now : in Bounds);
|
procedure Bounds_are (Self : in out Item'Class; Now : in Bounds);
|
||||||
@@ -135,15 +131,11 @@ private
|
|||||||
generic
|
generic
|
||||||
type any_Index_t is range <>;
|
type any_Index_t is range <>;
|
||||||
with function get_Site (Index : in any_Index_t) return Vector_3;
|
with function get_Site (Index : in any_Index_t) return Vector_3;
|
||||||
|
|
||||||
function get_Bounds (Count : in Natural) return openGL.Bounds;
|
function get_Bounds (Count : in Natural) return openGL.Bounds;
|
||||||
|
|
||||||
|
|
||||||
generic
|
generic
|
||||||
type any_Index_t is range <>;
|
type any_Index_t is range <>;
|
||||||
with function get_Color (Index : in any_Index_t) return rgba_Color;
|
with function get_Color (Index : in any_Index_t) return rgba_Color;
|
||||||
|
|
||||||
function get_Transparency (Count : in Natural) return Boolean;
|
function get_Transparency (Count : in Natural) return Boolean;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Geometry;
|
end openGL.Geometry;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ with
|
|||||||
GL.Binding,
|
GL.Binding,
|
||||||
GL.lean;
|
GL.lean;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Primitive.indexed
|
package body openGL.Primitive.indexed
|
||||||
is
|
is
|
||||||
---------
|
---------
|
||||||
@@ -49,7 +48,7 @@ is
|
|||||||
|
|
||||||
Self.facet_Kind := Kind;
|
Self.facet_Kind := Kind;
|
||||||
Self.Indices := new openGL.Buffer.indices.Object' (to_Buffer (buffer_Indices'Access,
|
Self.Indices := new openGL.Buffer.indices.Object' (to_Buffer (buffer_Indices'Access,
|
||||||
Usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
Self.line_Width := line_Width;
|
Self.line_Width := line_Width;
|
||||||
end define;
|
end define;
|
||||||
|
|
||||||
@@ -89,7 +88,6 @@ is
|
|||||||
end destroy;
|
end destroy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ private
|
|||||||
with
|
with
|
||||||
openGL.Buffer.indices;
|
openGL.Buffer.indices;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Primitive.indexed
|
package openGL.Primitive.indexed
|
||||||
--
|
--
|
||||||
-- Provides a class for indexed openGL primitives.
|
-- Provides a class for indexed openGL primitives.
|
||||||
@@ -38,7 +37,6 @@ is
|
|||||||
procedure destroy (Self : in out Item);
|
procedure destroy (Self : in out Item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -47,7 +45,6 @@ is
|
|||||||
procedure Indices_are (Self : in out Item; Now : in long_Indices);
|
procedure Indices_are (Self : in out Item; Now : in long_Indices);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Operations
|
-- Operations
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ with
|
|||||||
|
|
||||||
ada.unchecked_Deallocation;
|
ada.unchecked_Deallocation;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Primitive.long_indexed
|
package body openGL.Primitive.long_indexed
|
||||||
is
|
is
|
||||||
---------
|
---------
|
||||||
@@ -26,7 +25,7 @@ is
|
|||||||
|
|
||||||
Self.facet_Kind := Kind;
|
Self.facet_Kind := Kind;
|
||||||
Self.Indices := new Buffer.long_indices.Object' (to_Buffer (buffer_Indices'Access,
|
Self.Indices := new Buffer.long_indices.Object' (to_Buffer (buffer_Indices'Access,
|
||||||
Usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
end define;
|
end define;
|
||||||
|
|
||||||
|
|
||||||
@@ -53,7 +52,6 @@ is
|
|||||||
end destroy;
|
end destroy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -72,7 +70,6 @@ is
|
|||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Operations
|
-- Operations
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ private
|
|||||||
with
|
with
|
||||||
openGL.Buffer.long_indices;
|
openGL.Buffer.long_indices;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Primitive.long_indexed
|
package openGL.Primitive.long_indexed
|
||||||
--
|
--
|
||||||
-- Provides a class for long indexed openGL primitives.
|
-- Provides a class for long indexed openGL primitives.
|
||||||
@@ -28,7 +27,6 @@ is
|
|||||||
procedure destroy (Self : in out Item);
|
procedure destroy (Self : in out Item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -36,7 +34,6 @@ is
|
|||||||
procedure Indices_are (Self : in out Item; Now : in long_Indices);
|
procedure Indices_are (Self : in out Item; Now : in long_Indices);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Operations
|
-- Operations
|
||||||
--
|
--
|
||||||
@@ -53,5 +50,4 @@ private
|
|||||||
Indices : Buffer.long_indices.view;
|
Indices : Buffer.long_indices.view;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Primitive.long_indexed;
|
end openGL.Primitive.long_indexed;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ with
|
|||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
GL.Binding;
|
GL.Binding;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Primitive.non_indexed
|
package body openGL.Primitive.non_indexed
|
||||||
is
|
is
|
||||||
---------
|
---------
|
||||||
@@ -30,7 +29,6 @@ is
|
|||||||
end new_Primitive;
|
end new_Primitive;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
procedure destroy (Self : in out Item) is null;
|
procedure destroy (Self : in out Item) is null;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ is
|
|||||||
type Views is array (Index_t range <>) of View;
|
type Views is array (Index_t range <>) of View;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
-- Forge
|
-- Forge
|
||||||
--
|
--
|
||||||
@@ -24,7 +23,6 @@ is
|
|||||||
function new_Primitive (Kind : in facet_Kind;
|
function new_Primitive (Kind : in facet_Kind;
|
||||||
vertex_Count : in Natural) return Primitive.non_indexed.view;
|
vertex_Count : in Natural) return Primitive.non_indexed.view;
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Operations
|
-- Operations
|
||||||
--
|
--
|
||||||
@@ -41,5 +39,4 @@ private
|
|||||||
vertex_Count : Natural := 0;
|
vertex_Count : Natural := 0;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Primitive.non_indexed;
|
end openGL.Primitive.non_indexed;
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ with
|
|||||||
|
|
||||||
ada.unchecked_Deallocation;
|
ada.unchecked_Deallocation;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Primitive.short_indexed
|
package body openGL.Primitive.short_indexed
|
||||||
is
|
is
|
||||||
---------
|
---------
|
||||||
@@ -26,7 +25,7 @@ is
|
|||||||
|
|
||||||
Self.facet_Kind := Kind;
|
Self.facet_Kind := Kind;
|
||||||
Self.Indices := new Buffer.short_indices.Object' (to_Buffer (buffer_Indices'Access,
|
Self.Indices := new Buffer.short_indices.Object' (to_Buffer (buffer_Indices'Access,
|
||||||
Usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
end define;
|
end define;
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ is
|
|||||||
|
|
||||||
Self.facet_Kind := Kind;
|
Self.facet_Kind := Kind;
|
||||||
Self.Indices := new Buffer.short_indices.Object' (to_Buffer (buffer_Indices'Access,
|
Self.Indices := new Buffer.short_indices.Object' (to_Buffer (buffer_Indices'Access,
|
||||||
Usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
end define;
|
end define;
|
||||||
|
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ is
|
|||||||
|
|
||||||
Self.facet_Kind := Kind;
|
Self.facet_Kind := Kind;
|
||||||
Self.Indices := new Buffer.short_indices.Object' (to_Buffer (buffer_Indices'Access,
|
Self.Indices := new Buffer.short_indices.Object' (to_Buffer (buffer_Indices'Access,
|
||||||
Usage => Buffer.static_Draw));
|
usage => Buffer.static_Draw));
|
||||||
end define;
|
end define;
|
||||||
|
|
||||||
|
|
||||||
@@ -111,7 +110,6 @@ is
|
|||||||
end destroy;
|
end destroy;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -120,14 +118,13 @@ is
|
|||||||
is
|
is
|
||||||
use Buffer.short_indices;
|
use Buffer.short_indices;
|
||||||
buffer_Indices : aliased short_Indices := [Now'Range => <>];
|
buffer_Indices : aliased short_Indices := [Now'Range => <>];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
for Each in buffer_Indices'Range
|
for Each in buffer_Indices'Range
|
||||||
loop
|
loop
|
||||||
buffer_Indices (Each) := Now (Each) - 1; -- Adjust indices to zero-based-indexing for GL.
|
buffer_Indices (Each) := Now (Each) - 1; -- Adjust indices to zero-based-indexing for GL.
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
Self.Indices.set (To => buffer_Indices);
|
Self.Indices.set (to => buffer_Indices);
|
||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
@@ -136,14 +133,13 @@ is
|
|||||||
is
|
is
|
||||||
use Buffer.short_indices;
|
use Buffer.short_indices;
|
||||||
buffer_Indices : aliased short_Indices := [Now'Range => <>];
|
buffer_Indices : aliased short_Indices := [Now'Range => <>];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
for Each in buffer_Indices'Range
|
for Each in buffer_Indices'Range
|
||||||
loop
|
loop
|
||||||
buffer_Indices (Each) := short_Index_t (Now (Each) - 1); -- Adjust indices to zero-based-indexing for GL.
|
buffer_Indices (Each) := short_Index_t (Now (Each) - 1); -- Adjust indices to zero-based-indexing for GL.
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
Self.Indices.set (To => buffer_Indices);
|
Self.Indices.set (to => buffer_Indices);
|
||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
@@ -152,14 +148,13 @@ is
|
|||||||
is
|
is
|
||||||
use Buffer.short_indices;
|
use Buffer.short_indices;
|
||||||
buffer_Indices : aliased short_Indices := [Now'Range => <>];
|
buffer_Indices : aliased short_Indices := [Now'Range => <>];
|
||||||
|
|
||||||
begin
|
begin
|
||||||
for Each in buffer_Indices'Range
|
for Each in buffer_Indices'Range
|
||||||
loop
|
loop
|
||||||
buffer_Indices (Each) := short_Index_t (Now (Each) - 1); -- Adjust indices to zero-based-indexing for GL.
|
buffer_Indices (Each) := short_Index_t (Now (Each) - 1); -- Adjust indices to zero-based-indexing for GL.
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
Self.Indices.set (To => buffer_Indices);
|
Self.Indices.set (to => buffer_Indices);
|
||||||
end Indices_are;
|
end Indices_are;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ private
|
|||||||
with
|
with
|
||||||
openGL.Buffer.short_indices;
|
openGL.Buffer.short_indices;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Primitive.short_indexed
|
package openGL.Primitive.short_indexed
|
||||||
--
|
--
|
||||||
-- Provides a class for short indexed openGL primitives.
|
-- Provides a class for short indexed openGL primitives.
|
||||||
@@ -15,7 +14,6 @@ is
|
|||||||
type Views is array (Index_t range <>) of View;
|
type Views is array (Index_t range <>) of View;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
-- Forge
|
-- Forge
|
||||||
--
|
--
|
||||||
@@ -39,7 +37,6 @@ is
|
|||||||
procedure destroy (Self : in out Item);
|
procedure destroy (Self : in out Item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Attributes
|
-- Attributes
|
||||||
--
|
--
|
||||||
@@ -49,7 +46,6 @@ is
|
|||||||
procedure Indices_are (Self : in out Item; Now : in long_Indices);
|
procedure Indices_are (Self : in out Item; Now : in long_Indices);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
-- Operations
|
-- Operations
|
||||||
--
|
--
|
||||||
@@ -66,5 +62,4 @@ private
|
|||||||
Indices : Buffer.short_indices.view;
|
Indices : Buffer.short_indices.view;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Primitive.short_indexed;
|
end openGL.Primitive.short_indexed;
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
with
|
with
|
||||||
openGL.Tasks,
|
openGL.Tasks,
|
||||||
openGL.Errors,
|
|
||||||
GL.Binding,
|
GL.Binding,
|
||||||
ada.unchecked_Deallocation;
|
ada.unchecked_Deallocation;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Primitive
|
package body openGL.Primitive
|
||||||
is
|
is
|
||||||
---------
|
---------
|
||||||
@@ -18,7 +16,6 @@ is
|
|||||||
end define;
|
end define;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
procedure free (Self : in out View)
|
procedure free (Self : in out View)
|
||||||
is
|
is
|
||||||
procedure deallocate is new ada.Unchecked_Deallocation (Primitive.item'Class,
|
procedure deallocate is new ada.Unchecked_Deallocation (Primitive.item'Class,
|
||||||
@@ -91,7 +88,6 @@ is
|
|||||||
if Self.line_Width /= unused_line_Width
|
if Self.line_Width /= unused_line_Width
|
||||||
then
|
then
|
||||||
glLineWidth (glFloat (Self.line_Width));
|
glLineWidth (glFloat (Self.line_Width));
|
||||||
Errors.log;
|
|
||||||
end if;
|
end if;
|
||||||
end render;
|
end render;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ private
|
|||||||
with
|
with
|
||||||
ada.unchecked_Conversion;
|
ada.unchecked_Conversion;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Primitive
|
package openGL.Primitive
|
||||||
--
|
--
|
||||||
-- Provides a base class for openGL primitives.
|
-- Provides a base class for openGL primitives.
|
||||||
@@ -29,7 +28,7 @@ is
|
|||||||
-- Forge
|
-- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
procedure define (Self : in out Item; Kind : in facet_Kind);
|
procedure define (Self : in out Item; Kind : in facet_Kind);
|
||||||
procedure destroy (Self : in out Item) is abstract;
|
procedure destroy (Self : in out Item) is abstract;
|
||||||
procedure free (Self : in out View);
|
procedure free (Self : in out View);
|
||||||
|
|
||||||
@@ -68,7 +67,7 @@ private
|
|||||||
Texture : openGL.Texture.Object := openGL.Texture.null_Object;
|
Texture : openGL.Texture.Object := openGL.Texture.null_Object;
|
||||||
is_Transparent : Boolean;
|
is_Transparent : Boolean;
|
||||||
Bounds : openGL.Bounds;
|
Bounds : openGL.Bounds;
|
||||||
line_Width : Real := unused_line_Width;
|
line_Width : Real := unused_line_Width;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,34 +31,29 @@ is
|
|||||||
|
|
||||||
function to_Model (Model : in asset_Name;
|
function to_Model (Model : in asset_Name;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Texture_is_lucid : in Boolean) return openGL.Model.any.item
|
Texture_is_lucid : in Boolean) return openGL.Model.any.item
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
-- return Self : openGL.Model.any. := (openGL.Model.item with
|
return Self : openGL.Model.any.item := (openGL.Model.item with
|
||||||
return Self : openGL.Model.any.item := (textured_Model.textured_item with
|
|
||||||
Model,
|
Model,
|
||||||
Texture,
|
Texture,
|
||||||
Texture_is_lucid,
|
Texture_is_lucid,
|
||||||
Geometry => null)
|
Geometry => null)
|
||||||
do
|
do
|
||||||
Self.Bounds.Ball := 1.0;
|
Self.Bounds.Ball := 1.0;
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
end return;
|
end return;
|
||||||
end to_Model;
|
end to_Model;
|
||||||
|
|
||||||
|
|
||||||
function new_Model (Model : in asset_Name;
|
function new_Model (Model : in asset_Name;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Texture_is_lucid : in Boolean) return openGL.Model.any.view
|
Texture_is_lucid : in Boolean) return openGL.Model.any.view
|
||||||
is
|
is
|
||||||
begin
|
begin
|
||||||
return new openGL.Model.any.item' (to_Model (Model, Texture, texture_Details, Texture_is_lucid));
|
return new openGL.Model.any.item' (to_Model (Model, Texture, Texture_is_lucid));
|
||||||
end new_Model;
|
end new_Model;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
--- Attributes
|
--- Attributes
|
||||||
--
|
--
|
||||||
@@ -420,9 +415,6 @@ is
|
|||||||
deallocate (the_Vertices);
|
deallocate (the_Vertices);
|
||||||
destroy (the_Model);
|
destroy (the_Model);
|
||||||
|
|
||||||
Self.Geometry.Model_is (Self'unchecked_Access);
|
|
||||||
|
|
||||||
|
|
||||||
-- Set the geometry texture.
|
-- Set the geometry texture.
|
||||||
--
|
--
|
||||||
if Self.Texture /= null_Asset
|
if Self.Texture /= null_Asset
|
||||||
@@ -509,40 +501,40 @@ is
|
|||||||
-- Texturing
|
-- Texturing
|
||||||
--
|
--
|
||||||
|
|
||||||
-- overriding
|
overriding
|
||||||
-- procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
-- Now : in texture_Set.fade_Level)
|
Now : in texture_Set.fade_Level)
|
||||||
-- is
|
is
|
||||||
-- begin
|
begin
|
||||||
-- null;
|
null;
|
||||||
-- end Fade_is;
|
end Fade_is;
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- overriding
|
overriding
|
||||||
-- function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
-- is
|
is
|
||||||
-- begin
|
begin
|
||||||
-- return 0.0;
|
return 0.0;
|
||||||
-- end Fade;
|
end Fade;
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
-- Now : in openGL.asset_Name)
|
Now : in openGL.asset_Name)
|
||||||
-- is
|
is
|
||||||
-- begin
|
begin
|
||||||
-- null;
|
null;
|
||||||
-- end Texture_is;
|
end Texture_is;
|
||||||
--
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- overriding
|
overriding
|
||||||
-- function texture_Count (Self : in Item) return Natural
|
function texture_Count (Self : in Item) return Natural
|
||||||
-- is
|
is
|
||||||
-- begin
|
begin
|
||||||
-- return 1;
|
return 1;
|
||||||
-- end texture_Count;
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.any
|
package openGL.Model.any
|
||||||
@@ -10,11 +9,7 @@ package openGL.Model.any
|
|||||||
-- This model is largely used by the IO importers of various model formats (ie collada, wavefront, etc).
|
-- This model is largely used by the IO importers of various model formats (ie collada, wavefront, etc).
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.item);
|
type Item is new Model.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
|
|
||||||
-- type Item is new Model.item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -24,7 +19,6 @@ is
|
|||||||
|
|
||||||
function new_Model (Model : in asset_Name;
|
function new_Model (Model : in asset_Name;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Texture_is_lucid : in Boolean) return openGL.Model.any.view;
|
Texture_is_lucid : in Boolean) return openGL.Model.any.view;
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
@@ -49,25 +43,24 @@ is
|
|||||||
-- Texturing
|
-- Texturing
|
||||||
--
|
--
|
||||||
|
|
||||||
-- overriding
|
overriding
|
||||||
-- function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
--
|
|
||||||
-- overriding
|
overriding
|
||||||
-- procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
-- Now : in texture_Set.fade_Level);
|
Now : in texture_Set.fade_Level);
|
||||||
--
|
|
||||||
-- procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
-- Now : in asset_Name);
|
Now : in asset_Name);
|
||||||
--
|
|
||||||
-- overriding
|
overriding
|
||||||
-- function texture_Count (Self : in Item) return Natural;
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
-- type Item is new Model.item with
|
type Item is new Model.item with
|
||||||
type Item is new textured_Model.textured_item with
|
|
||||||
record
|
record
|
||||||
Model : asset_Name := null_Asset; -- A wavefront '.obj' or collada '.dae' file. -- TODO: Rename to 'model_Name'.
|
Model : asset_Name := null_Asset; -- A wavefront '.obj' or collada '.dae' file. -- TODO: Rename to 'model_Name'.
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ is
|
|||||||
--
|
--
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
function to_GL_Geometries (Self : access Item; Textures : access openGL.Texture.name_Map_of_texture'Class;
|
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views
|
||||||
is
|
is
|
||||||
pragma unreferenced (Textures, Fonts);
|
pragma unreferenced (Textures, Fonts);
|
||||||
@@ -99,6 +99,8 @@ is
|
|||||||
|
|
||||||
procedure set_side_Bits (Self : in out Item)
|
procedure set_side_Bits (Self : in out Item)
|
||||||
is
|
is
|
||||||
|
use linear_Algebra_3d;
|
||||||
|
|
||||||
End_1 : Vector_3 renames Self.Vertices (1).Site;
|
End_1 : Vector_3 renames Self.Vertices (1).Site;
|
||||||
End_2 : Vector_3 renames Self.Vertices (2).Site;
|
End_2 : Vector_3 renames Self.Vertices (2).Site;
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ is
|
|||||||
--
|
--
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
function to_GL_Geometries (Self : access Item; Textures : access openGL.Texture.name_Map_of_texture'Class;
|
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
||||||
|
|
||||||
procedure end_Site_is (Self : in out Item; Now : in Vector_3;
|
procedure end_Site_is (Self : in out Item; Now : in Vector_3;
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ is
|
|||||||
function new_Billboard (Size : in Size_t := default_Size;
|
function new_Billboard (Size : in Size_t := default_Size;
|
||||||
Plane : in billboard.Plane;
|
Plane : in billboard.Plane;
|
||||||
Color : in lucid_Color;
|
Color : in lucid_Color;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name) return View
|
||||||
texture_Details : in texture_Set.item) return View
|
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
@@ -24,7 +23,6 @@ is
|
|||||||
Self.Plane := Plane;
|
Self.Plane := Plane;
|
||||||
Self.Color := Color;
|
Self.Color := Color;
|
||||||
Self.Texture_Name := Texture;
|
Self.Texture_Name := Texture;
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Billboard;
|
end new_Billboard;
|
||||||
@@ -57,7 +55,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan,
|
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan,
|
||||||
the_Indices).all'Access;
|
the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
the_Geometry.is_Transparent;
|
the_Geometry.is_Transparent;
|
||||||
@@ -65,8 +62,8 @@ is
|
|||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_Face;
|
end new_Face;
|
||||||
|
|
||||||
Color : constant rgba_Color := +Self.Color;
|
Color : constant rgba_Color := +Self.Color;
|
||||||
the_Face : Geometry_view;
|
the_Face : Geometry_view;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
declare
|
declare
|
||||||
@@ -93,7 +90,6 @@ is
|
|||||||
|
|
||||||
Self.Geometry := the_Face;
|
Self.Geometry := the_Face;
|
||||||
|
|
||||||
|
|
||||||
return [1 => Geometry.view (the_Face)];
|
return [1 => Geometry.view (the_Face)];
|
||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry.colored_textured,
|
openGL.Geometry.colored_textured,
|
||||||
openGL.Texture,
|
openGL.Texture,
|
||||||
openGL.Model.texturing,
|
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.Palette;
|
openGL.Palette;
|
||||||
|
|
||||||
@@ -11,9 +10,7 @@ package openGL.Model.billboard.colored_textured
|
|||||||
-- Models a colored, textured billboard.
|
-- Models a colored, textured billboard.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.billboard.item);
|
type Item is new Model.billboard.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -24,8 +21,7 @@ is
|
|||||||
function new_Billboard (Size : in Size_t := default_Size;
|
function new_Billboard (Size : in Size_t := default_Size;
|
||||||
Plane : in billboard.Plane;
|
Plane : in billboard.Plane;
|
||||||
Color : in lucid_Color;
|
Color : in lucid_Color;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name) return View;
|
||||||
texture_Details : in texture_Set.item) return View;
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
--- Attributes
|
--- Attributes
|
||||||
@@ -48,7 +44,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.billboard.item with
|
||||||
record
|
record
|
||||||
Color : lucid_Color := (Palette.White, Opaque);
|
Color : lucid_Color := (Palette.White, Opaque);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ is
|
|||||||
function new_Billboard (Size : in Size_t := default_Size;
|
function new_Billboard (Size : in Size_t := default_Size;
|
||||||
Plane : in billboard.Plane;
|
Plane : in billboard.Plane;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Lucid : in Boolean := False) return View
|
Lucid : in Boolean := False) return View
|
||||||
is
|
is
|
||||||
Self : constant View := new Item (Lucid);
|
Self : constant View := new Item (Lucid);
|
||||||
@@ -26,8 +25,6 @@ is
|
|||||||
Self.Texture_Name := Texture;
|
Self.Texture_Name := Texture;
|
||||||
Self.define (Size);
|
Self.define (Size);
|
||||||
|
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Billboard;
|
end new_Billboard;
|
||||||
end Forge;
|
end Forge;
|
||||||
@@ -60,7 +57,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan,
|
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan,
|
||||||
the_Indices).all'Access;
|
the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
the_Geometry.is_Transparent;
|
the_Geometry.is_Transparent;
|
||||||
@@ -114,6 +110,8 @@ is
|
|||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
the_Face.Model_is (Self.all'unchecked_Access);
|
||||||
|
|
||||||
return [1 => the_Face.all'Access];
|
return [1 => the_Face.all'Access];
|
||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
@@ -199,4 +197,47 @@ is
|
|||||||
end Image_is;
|
end Image_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 0.0;
|
||||||
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in openGL.asset_Name)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 1;
|
||||||
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.billboard.textured;
|
end openGL.Model.billboard.textured;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.billboard.textured
|
package openGL.Model.billboard.textured
|
||||||
@@ -9,9 +8,7 @@ package openGL.Model.billboard.textured
|
|||||||
-- Models a textured billboard.
|
-- Models a textured billboard.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.billboard.item);
|
type Item (Lucid : Boolean) is new Model.billboard.item with private;
|
||||||
|
|
||||||
type Item (Lucid : Boolean) is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
type Image_view is access Image;
|
type Image_view is access Image;
|
||||||
@@ -24,11 +21,10 @@ is
|
|||||||
|
|
||||||
package Forge
|
package Forge
|
||||||
is
|
is
|
||||||
function new_Billboard (Size : in Size_t := default_Size;
|
function new_Billboard (Size : in Size_t := default_Size;
|
||||||
Plane : in billboard.Plane;
|
Plane : in billboard.Plane;
|
||||||
Texture : in asset_Name;
|
Texture : in asset_Name;
|
||||||
texture_Details : in texture_Set.item;
|
Lucid : in Boolean := False) return View;
|
||||||
Lucid : in Boolean := False) return View;
|
|
||||||
end Forge;
|
end Forge;
|
||||||
|
|
||||||
|
|
||||||
@@ -50,10 +46,28 @@ is
|
|||||||
procedure Image_is (Self : in out Item; Now : in lucid_Image);
|
procedure Image_is (Self : in out Item; Now : in lucid_Image);
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level);
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in asset_Name);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item (Lucid : Boolean) is new textured_Model.textured_item with
|
type Item (Lucid : Boolean) is new Model.billboard.item with
|
||||||
record
|
record
|
||||||
texture_Name : asset_Name := null_Asset;
|
texture_Name : asset_Name := null_Asset;
|
||||||
Texture : openGL.Texture.Object := openGL.Texture.null_Object; -- The texture to be applied to the billboard face.
|
Texture : openGL.Texture.Object := openGL.Texture.null_Object; -- The texture to be applied to the billboard face.
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ is
|
|||||||
(triangle_Fan,
|
(triangle_Fan,
|
||||||
the_Indices).all'Access;
|
the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
@@ -73,7 +72,7 @@ is
|
|||||||
the_Vertices : aliased Geometry.lit_colored_textured.Vertex_array
|
the_Vertices : aliased Geometry.lit_colored_textured.Vertex_array
|
||||||
:= [1 => (Site => the_Sites ( Left_Lower_Front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (1), Coords => (0.0, 0.0), Shine => default_Shine),
|
:= [1 => (Site => the_Sites ( Left_Lower_Front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (1), Coords => (0.0, 0.0), Shine => default_Shine),
|
||||||
2 => (Site => the_Sites (Right_Lower_Front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (2), Coords => (1.0, 0.0), Shine => default_Shine),
|
2 => (Site => the_Sites (Right_Lower_Front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (2), Coords => (1.0, 0.0), Shine => default_Shine),
|
||||||
3 => (Site => the_Sites (Right_Upper_front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (3), Coords => (1.0, 1.0), Shine => default_Shine),
|
3 => (Site => the_Sites (right_upper_front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (3), Coords => (1.0, 1.0), Shine => default_Shine),
|
||||||
4 => (Site => the_Sites ( Left_Upper_Front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (4), Coords => (0.0, 1.0), Shine => default_Shine)];
|
4 => (Site => the_Sites ( Left_Upper_Front), Normal => front_Normal, Color => +Self.Faces (Front).Colors (4), Coords => (0.0, 1.0), Shine => default_Shine)];
|
||||||
begin
|
begin
|
||||||
front_Face := new_Face (Vertices => the_Vertices'Access);
|
front_Face := new_Face (Vertices => the_Vertices'Access);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.Model.texturing,
|
|
||||||
openGL.Texture;
|
openGL.Texture;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +12,7 @@ package openGL.Model.Box.lit_colored_textured
|
|||||||
-- Each face may have a separate texture.
|
-- Each face may have a separate texture.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.box.item);
|
type Item is new Model.box.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +44,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.box.item with
|
||||||
record
|
record
|
||||||
Faces : lit_colored_textured.Faces;
|
Faces : lit_colored_textured.Faces;
|
||||||
end record;
|
end record;
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view := Primitive.indexed .new_Primitive (Triangles, the_Indices).all'Access;
|
the_Primitive : constant Primitive.view := Primitive.indexed .new_Primitive (Triangles, the_Indices).all'Access;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (the_Vertices);
|
the_Geometry.Vertices_are (the_Vertices);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.Model.texturing,
|
|
||||||
openGL.Texture;
|
openGL.Texture;
|
||||||
|
|
||||||
|
|
||||||
@@ -13,9 +12,7 @@ package openGL.Model.Box.lit_colored_textured_x1
|
|||||||
-- All faces use the same texture.
|
-- All faces use the same texture.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.box.item);
|
type Item is new Model.box.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +44,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.box.item with
|
||||||
record
|
record
|
||||||
Faces : lit_colored_textured_x1.Faces;
|
Faces : lit_colored_textured_x1.Faces;
|
||||||
texture_Name : asset_Name := null_Asset; -- The texture applied to all faces.
|
texture_Name : asset_Name := null_Asset; -- The texture applied to all faces.
|
||||||
|
|||||||
@@ -9,18 +9,14 @@ is
|
|||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_Box (Size : in Vector_3;
|
function new_Box (Size : in Vector_3;
|
||||||
Faces : in lit_textured.Faces;
|
Faces : in lit_textured.Faces) return View
|
||||||
texture_Details : in texture_Set.item := texture_Set.null_Set) return View
|
|
||||||
|
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
Self.Faces := Faces;
|
Self.Faces := Faces;
|
||||||
Self.Size := Size;
|
Self.Size := Size;
|
||||||
|
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Box;
|
end new_Box;
|
||||||
|
|
||||||
@@ -48,9 +44,8 @@ is
|
|||||||
the_Geometry : constant Geometry.lit_textured.view := Geometry.lit_textured.new_Geometry;
|
the_Geometry : constant Geometry.lit_textured.view := Geometry.lit_textured.new_Geometry;
|
||||||
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive
|
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive
|
||||||
(triangle_Fan,
|
(triangle_Fan,
|
||||||
the_Indices).all'unchecked_Access;
|
the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
@@ -81,6 +76,7 @@ is
|
|||||||
then
|
then
|
||||||
front_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
front_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
front_Face.is_Transparent (now => front_Face.Texture.is_Transparent);
|
front_Face.is_Transparent (now => front_Face.Texture.is_Transparent);
|
||||||
|
front_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -100,6 +96,7 @@ is
|
|||||||
then
|
then
|
||||||
rear_Face.Texture_is (Textures.fetch (Self.Faces (Rear).texture_Name));
|
rear_Face.Texture_is (Textures.fetch (Self.Faces (Rear).texture_Name));
|
||||||
rear_Face.is_Transparent (now => rear_Face.Texture.is_Transparent);
|
rear_Face.is_Transparent (now => rear_Face.Texture.is_Transparent);
|
||||||
|
rear_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -119,6 +116,7 @@ is
|
|||||||
then
|
then
|
||||||
upper_Face.Texture_is (Textures.fetch (Self.Faces (Upper).texture_Name));
|
upper_Face.Texture_is (Textures.fetch (Self.Faces (Upper).texture_Name));
|
||||||
upper_Face.is_Transparent (now => upper_Face.Texture.is_Transparent);
|
upper_Face.is_Transparent (now => upper_Face.Texture.is_Transparent);
|
||||||
|
upper_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -138,6 +136,7 @@ is
|
|||||||
then
|
then
|
||||||
lower_Face.Texture_is (Textures.fetch (Self.Faces (Lower).texture_Name));
|
lower_Face.Texture_is (Textures.fetch (Self.Faces (Lower).texture_Name));
|
||||||
lower_Face.is_Transparent (now => lower_Face.Texture.is_Transparent);
|
lower_Face.is_Transparent (now => lower_Face.Texture.is_Transparent);
|
||||||
|
lower_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -157,6 +156,7 @@ is
|
|||||||
then
|
then
|
||||||
left_Face.Texture_is (Textures.fetch (Self.Faces (Left).texture_Name));
|
left_Face.Texture_is (Textures.fetch (Self.Faces (Left).texture_Name));
|
||||||
left_Face.is_Transparent (now => left_Face.Texture.is_Transparent);
|
left_Face.is_Transparent (now => left_Face.Texture.is_Transparent);
|
||||||
|
left_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -176,6 +176,7 @@ is
|
|||||||
then
|
then
|
||||||
right_Face.Texture_is (Textures.fetch (Self.Faces (Right).texture_Name));
|
right_Face.Texture_is (Textures.fetch (Self.Faces (Right).texture_Name));
|
||||||
right_Face.is_Transparent (now => right_Face.Texture.is_Transparent);
|
right_Face.is_Transparent (now => right_Face.Texture.is_Transparent);
|
||||||
|
right_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -189,4 +190,48 @@ is
|
|||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 0.0;
|
||||||
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in openGL.asset_Name)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 1;
|
||||||
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.box.lit_textured;
|
end openGL.Model.box.lit_textured;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font;
|
||||||
openGL.Model.texturing,
|
|
||||||
openGL.texture_Set;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.Box.lit_textured
|
package openGL.Model.Box.lit_textured
|
||||||
@@ -12,9 +10,7 @@ package openGL.Model.Box.lit_textured
|
|||||||
-- Each face may have a separate texture.
|
-- Each face may have a separate texture.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.box.item);
|
type Item is new Model.box.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -30,9 +26,8 @@ is
|
|||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_Box (Size : in Vector_3;
|
function new_Box (Size : in Vector_3;
|
||||||
Faces : in lit_textured.Faces;
|
Faces : in lit_textured.Faces) return View;
|
||||||
texture_Details : in texture_Set.item := texture_Set.null_Set) return View;
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
@@ -44,12 +39,30 @@ is
|
|||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level);
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in asset_Name);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.box.item with
|
||||||
record
|
record
|
||||||
Faces : lit_textured.Faces;
|
Faces : lit_textured.Faces;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.Box.lit_textured;
|
end openGL.Model.Box.lit_textured;
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ is
|
|||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_Box (Size : in Vector_3;
|
function new_Box (Size : in Vector_3;
|
||||||
Faces : in textured.Faces;
|
Faces : in textured.Faces;
|
||||||
texture_Details : in texture_Set.item;
|
is_Skybox : in Boolean := False) return View
|
||||||
is_Skybox : in Boolean := False) return View
|
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
@@ -20,8 +19,6 @@ is
|
|||||||
Self.is_Skybox := is_Skybox;
|
Self.is_Skybox := is_Skybox;
|
||||||
Self.Size := Size;
|
Self.Size := Size;
|
||||||
|
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Box;
|
end new_Box;
|
||||||
|
|
||||||
@@ -51,7 +48,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan,
|
the_Primitive : constant Primitive.view := Primitive.indexed.new_Primitive (triangle_Fan,
|
||||||
the_Indices).all'Access;
|
the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
@@ -87,6 +83,7 @@ is
|
|||||||
then
|
then
|
||||||
front_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
front_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
front_Face.is_Transparent (now => front_Face.Texture.is_Transparent);
|
front_Face.is_Transparent (now => front_Face.Texture.is_Transparent);
|
||||||
|
front_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -106,6 +103,7 @@ is
|
|||||||
then
|
then
|
||||||
rear_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
rear_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
rear_Face.is_Transparent (now => rear_Face.Texture.is_Transparent);
|
rear_Face.is_Transparent (now => rear_Face.Texture.is_Transparent);
|
||||||
|
rear_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -125,6 +123,7 @@ is
|
|||||||
then
|
then
|
||||||
upper_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
upper_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
upper_Face.is_Transparent (now => upper_Face.Texture.is_Transparent);
|
upper_Face.is_Transparent (now => upper_Face.Texture.is_Transparent);
|
||||||
|
upper_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -144,6 +143,7 @@ is
|
|||||||
then
|
then
|
||||||
lower_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
lower_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
lower_Face.is_Transparent (now => lower_Face.Texture.is_Transparent);
|
lower_Face.is_Transparent (now => lower_Face.Texture.is_Transparent);
|
||||||
|
lower_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -163,6 +163,7 @@ is
|
|||||||
then
|
then
|
||||||
left_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
left_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
left_Face.is_Transparent (now => left_Face.Texture.is_Transparent);
|
left_Face.is_Transparent (now => left_Face.Texture.is_Transparent);
|
||||||
|
left_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -182,6 +183,7 @@ is
|
|||||||
then
|
then
|
||||||
right_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
right_Face.Texture_is (Textures.fetch (Self.Faces (Front).texture_Name));
|
||||||
right_Face.is_Transparent (now => right_Face.Texture.is_Transparent);
|
right_Face.is_Transparent (now => right_Face.Texture.is_Transparent);
|
||||||
|
right_Face.Model_is (Self.all'unchecked_Access);
|
||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -195,4 +197,46 @@ is
|
|||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 0.0;
|
||||||
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in openGL.asset_Name)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 1;
|
||||||
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.box.textured;
|
end openGL.Model.box.textured;
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.Box.textured
|
package openGL.Model.Box.textured
|
||||||
@@ -12,9 +11,7 @@ package openGL.Model.Box.textured
|
|||||||
-- Each face may have a separate texture.
|
-- Each face may have a separate texture.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.box.item);
|
type Item is new Model.box.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -30,10 +27,9 @@ is
|
|||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_Box (Size : in Vector_3;
|
function new_Box (Size : in Vector_3;
|
||||||
Faces : in textured.Faces;
|
Faces : in textured.Faces;
|
||||||
texture_Details : in texture_Set.item;
|
is_Skybox : in Boolean := False) return View;
|
||||||
is_Skybox : in Boolean := False) return View;
|
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
@@ -44,14 +40,31 @@ is
|
|||||||
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level);
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in asset_Name);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.box.item with
|
||||||
record
|
record
|
||||||
Faces : textured.Faces;
|
Faces : textured.Faces;
|
||||||
is_Skybox : Boolean := False;
|
is_Skybox : Boolean := False;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.Box.textured;
|
end openGL.Model.Box.textured;
|
||||||
|
|||||||
@@ -80,8 +80,6 @@ is
|
|||||||
begin
|
begin
|
||||||
-- Define capsule shaft,
|
-- Define capsule shaft,
|
||||||
--
|
--
|
||||||
the_shaft_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
|
|
||||||
declare
|
declare
|
||||||
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
|
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
|
||||||
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
|
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
|
||||||
@@ -234,10 +232,7 @@ is
|
|||||||
longitude_Spacing : constant Real := Degrees_360 / Real (longitude_Count);
|
longitude_Spacing : constant Real := Degrees_360 / Real (longitude_Count);
|
||||||
|
|
||||||
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
|
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
|
||||||
|
|
||||||
begin
|
begin
|
||||||
cap_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
|
|
||||||
if not is_Fore
|
if not is_Fore
|
||||||
then
|
then
|
||||||
a := Degrees_360;
|
a := Degrees_360;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.capsule.lit_colored_textured
|
package openGL.Model.capsule.lit_colored_textured
|
||||||
@@ -8,9 +7,7 @@ package openGL.Model.capsule.lit_colored_textured
|
|||||||
-- Models a lit, colored and textured capsule.
|
-- Models a lit, colored and textured capsule.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.capsule.item);
|
type Item is new Model.capsule.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -35,7 +32,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.capsule.item with
|
||||||
record
|
record
|
||||||
Radius : Real;
|
Radius : Real;
|
||||||
Height : Real;
|
Height : Real;
|
||||||
@@ -44,5 +41,4 @@ private
|
|||||||
Image : asset_Name := null_Asset;
|
Image : asset_Name := null_Asset;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.capsule.lit_colored_textured;
|
end openGL.Model.capsule.lit_colored_textured;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ is
|
|||||||
|
|
||||||
function new_Capsule (Radius : in Real;
|
function new_Capsule (Radius : in Real;
|
||||||
Height : in Real;
|
Height : in Real;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Image : in asset_Name := null_Asset) return View
|
Image : in asset_Name := null_Asset) return View
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
@@ -22,8 +21,6 @@ is
|
|||||||
Self.Height := Height;
|
Self.Height := Height;
|
||||||
Self.Image := Image;
|
Self.Image := Image;
|
||||||
|
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Capsule;
|
end new_Capsule;
|
||||||
|
|
||||||
@@ -32,6 +29,9 @@ is
|
|||||||
--- Attributes
|
--- Attributes
|
||||||
--
|
--
|
||||||
|
|
||||||
|
-- type Geometry_view is access all Geometry.lit_textured.item'Class;
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views
|
||||||
@@ -77,8 +77,6 @@ is
|
|||||||
begin
|
begin
|
||||||
-- Define capsule shaft,
|
-- Define capsule shaft,
|
||||||
--
|
--
|
||||||
the_shaft_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
|
|
||||||
declare
|
declare
|
||||||
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
|
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
|
||||||
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
|
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
|
||||||
@@ -192,6 +190,8 @@ is
|
|||||||
begin
|
begin
|
||||||
the_shaft_Geometry.add (Primitive.view (the_Primitive));
|
the_shaft_Geometry.add (Primitive.view (the_Primitive));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
the_shaft_Geometry.Model_is (Self.all'unchecked_Access);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@@ -228,8 +228,6 @@ is
|
|||||||
|
|
||||||
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
|
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
|
||||||
begin
|
begin
|
||||||
cap_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
|
|
||||||
if not is_Fore
|
if not is_Fore
|
||||||
then
|
then
|
||||||
a := Degrees_360;
|
a := Degrees_360;
|
||||||
@@ -390,6 +388,8 @@ is
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
cap_Geometry.Model_is (Self.all'unchecked_Access);
|
||||||
|
|
||||||
return cap_Geometry;
|
return cap_Geometry;
|
||||||
end new_Cap;
|
end new_Cap;
|
||||||
|
|
||||||
@@ -404,4 +404,45 @@ is
|
|||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 0.0;
|
||||||
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in openGL.asset_Name)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
null;
|
||||||
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return 1;
|
||||||
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.capsule.lit_textured;
|
end openGL.Model.capsule.lit_textured;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.capsule.lit_textured
|
package openGL.Model.capsule.lit_textured
|
||||||
@@ -8,9 +7,7 @@ package openGL.Model.capsule.lit_textured
|
|||||||
-- Models a lit and textured capsule.
|
-- Models a lit and textured capsule.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.capsule.item);
|
type Item is new Model.capsule.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +17,6 @@ is
|
|||||||
|
|
||||||
function new_Capsule (Radius : in Real;
|
function new_Capsule (Radius : in Real;
|
||||||
Height : in Real;
|
Height : in Real;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Image : in asset_Name := null_Asset) return View;
|
Image : in asset_Name := null_Asset) return View;
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
@@ -32,9 +28,28 @@ is
|
|||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level);
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in asset_Name);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.capsule.item with
|
||||||
record
|
record
|
||||||
Radius : Real;
|
Radius : Real;
|
||||||
Height : Real;
|
Height : Real;
|
||||||
@@ -42,5 +57,4 @@ private
|
|||||||
Image : asset_Name := null_Asset;
|
Image : asset_Name := null_Asset;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.capsule.lit_textured;
|
end openGL.Model.capsule.lit_textured;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ is
|
|||||||
|
|
||||||
function new_Capsule (Radius : in Real;
|
function new_Capsule (Radius : in Real;
|
||||||
Height : in Real;
|
Height : in Real;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Image : in asset_Name := null_Asset) return View
|
Image : in asset_Name := null_Asset) return View
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
@@ -22,8 +21,6 @@ is
|
|||||||
Self.Height := Height;
|
Self.Height := Height;
|
||||||
Self.Image := Image;
|
Self.Image := Image;
|
||||||
|
|
||||||
Self.texture_Details_is (texture_Details);
|
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Capsule;
|
end new_Capsule;
|
||||||
|
|
||||||
@@ -38,7 +35,8 @@ is
|
|||||||
is
|
is
|
||||||
pragma unreferenced (Textures, Fonts);
|
pragma unreferenced (Textures, Fonts);
|
||||||
|
|
||||||
use Geometry.textured,
|
use --Geometry,
|
||||||
|
Geometry.textured,
|
||||||
real_Functions;
|
real_Functions;
|
||||||
|
|
||||||
Length : constant Real := Self.Height;
|
Length : constant Real := Self.Height;
|
||||||
@@ -76,14 +74,12 @@ is
|
|||||||
begin
|
begin
|
||||||
-- Define capsule shaft,
|
-- Define capsule shaft,
|
||||||
--
|
--
|
||||||
the_shaft_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
|
|
||||||
declare
|
declare
|
||||||
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
|
vertex_Count : constant Index_t := Index_t (sides_Count * 2 + 2); -- 2 triangles per side plus 2 since we cannot share the first and last edge.
|
||||||
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
|
indices_Count : constant long_Index_t := long_Index_t (sides_Count * 2 * 3); -- 2 triangles per side with 3 vertices per triangle.
|
||||||
|
|
||||||
the_Vertices : aliased Geometry.textured.Vertex_array := [1 .. vertex_Count => <>];
|
the_Vertices : aliased Geometry.textured.Vertex_array := (1 .. vertex_Count => <>);
|
||||||
the_Indices : aliased Indices := [1 .. indices_Count => <>];
|
the_Indices : aliased Indices := (1 .. indices_Count => <>);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ny := 1.0;
|
ny := 1.0;
|
||||||
@@ -191,14 +187,14 @@ is
|
|||||||
indices_Count : constant long_Index_t := long_Index_t ( (hoop_count - 1) * sides_Count * 2 * 3 -- For each hoop, 2 triangles per side with 3 vertices per triangle
|
indices_Count : constant long_Index_t := long_Index_t ( (hoop_count - 1) * sides_Count * 2 * 3 -- For each hoop, 2 triangles per side with 3 vertices per triangle
|
||||||
+ sides_Count * 3); -- plus the extra indices for the pole triangles.
|
+ sides_Count * 3); -- plus the extra indices for the pole triangles.
|
||||||
|
|
||||||
the_Vertices : aliased Geometry.textured.Vertex_array := [1 .. vertex_Count => <>];
|
the_Vertices : aliased Geometry.textured.Vertex_array := (1 .. vertex_Count => <>);
|
||||||
the_Indices : aliased Indices := [1 .. indices_Count => <>];
|
the_Indices : aliased Indices := (1 .. indices_Count => <>);
|
||||||
|
|
||||||
the_arch_Edges : arch_Edges;
|
the_arch_Edges : arch_Edges;
|
||||||
i : Index_t := 1;
|
i : Index_t := 1;
|
||||||
|
|
||||||
pole_Site : constant Site := (if is_Fore then [0.0, 0.0, L + Radius]
|
pole_Site : constant Site := (if is_Fore then (0.0, 0.0, L + Radius)
|
||||||
else [0.0, 0.0, -L - Radius]);
|
else (0.0, 0.0, -L - Radius));
|
||||||
|
|
||||||
Degrees_90 : constant := Pi / 2.0;
|
Degrees_90 : constant := Pi / 2.0;
|
||||||
Degrees_360 : constant := Pi * 2.0;
|
Degrees_360 : constant := Pi * 2.0;
|
||||||
@@ -210,10 +206,7 @@ is
|
|||||||
longitude_Spacing : constant Real := Degrees_360 / Real (longitude_Count);
|
longitude_Spacing : constant Real := Degrees_360 / Real (longitude_Count);
|
||||||
|
|
||||||
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
|
a, b : Real := 0.0; -- Angular 'cursors' used to track lat/long for texture coords.
|
||||||
|
|
||||||
begin
|
begin
|
||||||
cap_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
|
|
||||||
if not is_Fore
|
if not is_Fore
|
||||||
then
|
then
|
||||||
a := Degrees_360;
|
a := Degrees_360;
|
||||||
@@ -375,10 +368,9 @@ is
|
|||||||
cap_2_Geometry := new_Cap (is_Fore => False);
|
cap_2_Geometry := new_Cap (is_Fore => False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
return (1 => the_shaft_Geometry.all'Access,
|
||||||
return [1 => the_shaft_Geometry.all'Access,
|
|
||||||
2 => cap_1_Geometry.all'Access,
|
2 => cap_1_Geometry.all'Access,
|
||||||
3 => cap_2_Geometry.all'Access];
|
3 => cap_2_Geometry.all'Access);
|
||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.capsule.textured
|
package openGL.Model.capsule.textured
|
||||||
--
|
--
|
||||||
-- Models a textured capsule.
|
-- Models a lit and textured capsule.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (openGL.Model.capsule.item);
|
type Item is new Model.capsule.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -20,7 +17,6 @@ is
|
|||||||
|
|
||||||
function new_Capsule (Radius : in Real;
|
function new_Capsule (Radius : in Real;
|
||||||
Height : in Real;
|
Height : in Real;
|
||||||
texture_Details : in texture_Set.item;
|
|
||||||
Image : in asset_Name := null_Asset) return View;
|
Image : in asset_Name := null_Asset) return View;
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
@@ -35,7 +31,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_item with
|
type Item is new Model.capsule.item with
|
||||||
record
|
record
|
||||||
Radius : Real;
|
Radius : Real;
|
||||||
Height : Real;
|
Height : Real;
|
||||||
@@ -43,5 +39,4 @@ private
|
|||||||
Image : asset_Name := null_Asset;
|
Image : asset_Name := null_Asset;
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
end openGL.Model.capsule.textured;
|
end openGL.Model.capsule.textured;
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ with
|
|||||||
openGL.Primitive.indexed,
|
openGL.Primitive.indexed,
|
||||||
openGL.Texture.Coordinates;
|
openGL.Texture.Coordinates;
|
||||||
|
|
||||||
with ada.Text_IO; use ada.Text_IO;
|
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Model.circle.lit_textured
|
package body openGL.Model.circle.lit_textured
|
||||||
is
|
is
|
||||||
@@ -12,14 +10,14 @@ is
|
|||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_circle (Radius : in Real;
|
function new_circle (Radius : in Real;
|
||||||
texture_Details : in texture_Set.item;
|
Face : in lit_textured.Face_t;
|
||||||
Sides : in Positive := 24) return View
|
Sides : in Positive := 24) return View
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
Self.Radius := Radius;
|
Self.Radius := Radius;
|
||||||
Self.texture_Details_is (texture_Details);
|
Self.Face := Face;
|
||||||
Self.Sides := Sides;
|
Self.Sides := Sides;
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
@@ -31,6 +29,90 @@ is
|
|||||||
--- Attributes ---
|
--- Attributes ---
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
function Face (Self : in Item) return Face_t
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face;
|
||||||
|
end Face;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
Self.Face.texture_Details.Fades (which) := Now;
|
||||||
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face.texture_Details.Fades (which);
|
||||||
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in openGL.asset_Name)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
Self.Face.texture_Details.Textures (Positive (which)) := Now;
|
||||||
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face.texture_Details.texture_Count;
|
||||||
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_Id) return Boolean
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face.texture_Details.texture_Applies (Which);
|
||||||
|
end texture_Applied;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure texture_Applied_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in Boolean)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
Self.Face.texture_Details.texture_Applies (Which) := Now;
|
||||||
|
end texture_Applied_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure animate (Self : in out Item)
|
||||||
|
is
|
||||||
|
use type texture_Set.Animation_view;
|
||||||
|
begin
|
||||||
|
if Self.Face.texture_Details.Animation = null
|
||||||
|
then
|
||||||
|
return;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
texture_Set.animate (Self.Face.texture_Details.Animation.all,
|
||||||
|
Self.Face.texture_Details.texture_Applies);
|
||||||
|
end animate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
--- openGL Geometries
|
--- openGL Geometries
|
||||||
@@ -80,23 +162,23 @@ is
|
|||||||
|
|
||||||
Id : texture_Set.texture_Id;
|
Id : texture_Set.texture_Id;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
for i in 1 .. Self.texture_Details.Count
|
for i in 1 .. Self.Face.texture_Details.texture_Count
|
||||||
loop
|
loop
|
||||||
Id := texture_Id (i);
|
Id := texture_Id (i);
|
||||||
|
|
||||||
-- the_Geometry.Fade_is (which => Id,
|
the_Geometry.Fade_is (which => Id,
|
||||||
-- now => Self.texture_Details.Fades (Id));
|
now => Self.Face.texture_Details.Fades (Id));
|
||||||
|
|
||||||
the_Geometry.Texture_is (Which => Id,
|
the_Geometry.Texture_is (which => Id,
|
||||||
Now => Textures.fetch (Self.texture_Details.Details (i).Texture));
|
now => Textures.fetch (Self.Face.texture_Details.Textures (i)));
|
||||||
the_Geometry.is_Transparent (Now => the_Geometry.Texture.is_Transparent);
|
the_Geometry.is_Transparent (now => the_Geometry.Texture.is_Transparent);
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
the_Geometry.is_Transparent (True); -- TODO: Do transparency properly.
|
the_Geometry.is_Transparent (True); -- TODO: Do transparency properly.
|
||||||
|
the_Geometry.Model_is (Self.all'unchecked_Access);
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_Geometry;
|
end new_Geometry;
|
||||||
|
|||||||
@@ -1,41 +1,78 @@
|
|||||||
with
|
with
|
||||||
openGL.texture_Set,
|
openGL.texture_Set,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.circle.lit_textured
|
package openGL.Model.circle.lit_textured
|
||||||
--
|
--
|
||||||
-- Models a lit and textured circle.
|
-- Models a lit, colored and textured hexagon.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (Model.circle.item);
|
type Item is new Model.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
|
type Face_t is
|
||||||
|
record
|
||||||
|
texture_Details : texture_Set.Details;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_circle (Radius : in Real;
|
function new_circle (Radius : in Real;
|
||||||
texture_Details : in texture_Set.item;
|
Face : in lit_textured.Face_t;
|
||||||
Sides : in Positive := 24) return View;
|
Sides : in Positive := 24) return View;
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
--- Attributes
|
--- Attributes
|
||||||
--
|
--
|
||||||
|
|
||||||
|
function Face (Self : in Item) return Face_t;
|
||||||
|
|
||||||
|
|
||||||
overriding
|
overriding
|
||||||
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level);
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in asset_Name);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_Id) return Boolean;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure texture_Applied_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in Boolean);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure animate (Self : in out Item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with null record;
|
type Item is new Model.circle.item with
|
||||||
|
record
|
||||||
|
Face : lit_textured.Face_t;
|
||||||
|
end record;
|
||||||
|
|
||||||
end openGL.Model.circle.lit_textured;
|
end openGL.Model.circle.lit_textured;
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ is
|
|||||||
Texture;
|
Texture;
|
||||||
|
|
||||||
the_Sites : constant hexagon.Sites := vertex_Sites (Self.Radius);
|
the_Sites : constant hexagon.Sites := vertex_Sites (Self.Radius);
|
||||||
the_Indices : aliased constant Indices := [1, 2, 3, 4, 5, 6, 7, 2];
|
the_Indices : aliased constant Indices := (1, 2, 3, 4, 5, 6, 7, 2);
|
||||||
|
|
||||||
|
|
||||||
function new_Face (Vertices : in geometry.lit_colored_textured.Vertex_array) return Geometry_view
|
function new_Face (Vertices : in geometry.lit_colored_textured.Vertex_array) return Geometry_view
|
||||||
@@ -52,7 +52,6 @@ is
|
|||||||
the_Primitive : constant Primitive.indexed.view
|
the_Primitive : constant Primitive.indexed.view
|
||||||
:= Primitive.indexed.new_Primitive (triangle_Fan, the_Indices);
|
:= Primitive.indexed.new_Primitive (triangle_Fan, the_Indices);
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
@@ -67,13 +66,13 @@ is
|
|||||||
--
|
--
|
||||||
declare
|
declare
|
||||||
the_Vertices : constant Geometry.lit_colored_textured.Vertex_array
|
the_Vertices : constant Geometry.lit_colored_textured.Vertex_array
|
||||||
:= [1 => (Site => [0.0, 0.0, 0.0], Normal => Normal, Color => +Self.Face.center_Color, Coords => (0.0, 0.0), Shine => default_Shine),
|
:= (1 => (Site => (0.0, 0.0, 0.0), Normal => Normal, Color => +Self.Face.center_Color, Coords => (0.0, 0.0), Shine => default_Shine),
|
||||||
2 => (Site => the_Sites (1), Normal => Normal, Color => +Self.Face.Colors (1), Coords => (0.0, 0.0), Shine => default_Shine),
|
2 => (Site => the_Sites (1), Normal => Normal, Color => +Self.Face.Colors (1), Coords => (0.0, 0.0), Shine => default_Shine),
|
||||||
3 => (Site => the_Sites (2), Normal => Normal, Color => +Self.Face.Colors (2), Coords => (1.0, 0.0), Shine => default_Shine),
|
3 => (Site => the_Sites (2), Normal => Normal, Color => +Self.Face.Colors (2), Coords => (1.0, 0.0), Shine => default_Shine),
|
||||||
4 => (Site => the_Sites (3), Normal => Normal, Color => +Self.Face.Colors (3), Coords => (1.0, 1.0), Shine => default_Shine),
|
4 => (Site => the_Sites (3), Normal => Normal, Color => +Self.Face.Colors (3), Coords => (1.0, 1.0), Shine => default_Shine),
|
||||||
5 => (Site => the_Sites (4), Normal => Normal, Color => +Self.Face.Colors (4), Coords => (0.0, 1.0), Shine => default_Shine),
|
5 => (Site => the_Sites (4), Normal => Normal, Color => +Self.Face.Colors (4), Coords => (0.0, 1.0), Shine => default_Shine),
|
||||||
6 => (Site => the_Sites (5), Normal => Normal, color => +Self.Face.Colors (5), Coords => (0.0, 1.0), Shine => default_Shine),
|
6 => (Site => the_Sites (5), Normal => Normal, color => +Self.Face.Colors (5), Coords => (0.0, 1.0), Shine => default_Shine),
|
||||||
7 => (Site => the_Sites (6), Normal => Normal, Color => +Self.Face.Colors (6), Coords => (0.0, 1.0), Shine => default_Shine)];
|
7 => (Site => the_Sites (6), Normal => Normal, Color => +Self.Face.Colors (6), Coords => (0.0, 1.0), Shine => default_Shine));
|
||||||
begin
|
begin
|
||||||
upper_Face := new_Face (Vertices => the_Vertices);
|
upper_Face := new_Face (Vertices => the_Vertices);
|
||||||
|
|
||||||
@@ -83,7 +82,7 @@ is
|
|||||||
end if;
|
end if;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
return [1 => upper_Face.all'Access];
|
return (1 => upper_Face.all'Access);
|
||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.hexagon.lit_colored_textured
|
package openGL.Model.hexagon.lit_colored_textured
|
||||||
@@ -9,16 +8,14 @@ package openGL.Model.hexagon.lit_colored_textured
|
|||||||
-- Models a lit, colored and textured hexagon.
|
-- Models a lit, colored and textured hexagon.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (Model.hexagon.item);
|
type Item is new Model.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
type Face is
|
type Face is
|
||||||
record
|
record
|
||||||
center_Color : lucid_Color; -- The color at the center of the hex.
|
center_Color : lucid_Color; -- The color at the center of the hex.
|
||||||
Colors : lucid_Colors (1 .. 6); -- The color at each of the hexes 6 vertices.
|
Colors : lucid_Colors (1 .. 6); -- The color at each of the hexes 6 vertices.
|
||||||
Texture : openGL.Texture.Object := openGL.Texture.null_Object; -- The texture to be applied to the hex.
|
Texture : openGL.Texture.Object := openGL.Texture.null_Object; -- The texture to be applied to the hex..
|
||||||
end record;
|
end record;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,7 +38,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with
|
type Item is new Model.hexagon.item with
|
||||||
record
|
record
|
||||||
Face : lit_colored_textured.Face;
|
Face : lit_colored_textured.Face;
|
||||||
end record;
|
end record;
|
||||||
|
|||||||
@@ -9,13 +9,13 @@ is
|
|||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_Hexagon (Radius : in Real;
|
function new_Hexagon (Radius : in Real;
|
||||||
texture_Details : in texture_Set.item) return View
|
Face : in lit_textured.Face) return View
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
Self.Radius := Radius;
|
Self.Radius := Radius;
|
||||||
Self.texture_Details_is (texture_Details);
|
Self.Face := Face;
|
||||||
|
|
||||||
return Self;
|
return Self;
|
||||||
end new_Hexagon;
|
end new_Hexagon;
|
||||||
@@ -28,6 +28,84 @@ is
|
|||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
Self.Face.Fades (Which) := Now;
|
||||||
|
end Fade_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face.Fades (Which);
|
||||||
|
end Fade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in openGL.asset_Name)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
Self.Face.Textures (Positive (Which)) := Now;
|
||||||
|
end Texture_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face.texture_Count;
|
||||||
|
end texture_Count;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_Id) return Boolean
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
return Self.Face.texture_Applies (Which);
|
||||||
|
end texture_Applied;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure texture_Applied_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in Boolean)
|
||||||
|
is
|
||||||
|
begin
|
||||||
|
Self.Face.texture_Applies (Which) := Now;
|
||||||
|
end texture_Applied_is;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure animate (Self : in out Item)
|
||||||
|
is
|
||||||
|
use type texture_Set.Animation_view;
|
||||||
|
begin
|
||||||
|
if Self.Face.Animation = null
|
||||||
|
then
|
||||||
|
return;
|
||||||
|
end if;
|
||||||
|
|
||||||
|
texture_Set.animate (Self.Face.Animation.all,
|
||||||
|
Self.Face.texture_Applies);
|
||||||
|
end animate;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---------------------
|
---------------------
|
||||||
--- openGL Geometries
|
--- openGL Geometries
|
||||||
--
|
--
|
||||||
@@ -43,7 +121,7 @@ is
|
|||||||
Texture;
|
Texture;
|
||||||
|
|
||||||
the_Sites : constant hexagon.Sites := vertex_Sites (Self.Radius);
|
the_Sites : constant hexagon.Sites := vertex_Sites (Self.Radius);
|
||||||
the_Indices : aliased constant Indices := [1, 2, 3, 4, 5, 6, 7, 2];
|
the_Indices : aliased constant Indices := (1, 2, 3, 4, 5, 6, 7, 2);
|
||||||
|
|
||||||
|
|
||||||
function new_Face (Vertices : in geometry.lit_textured.Vertex_array) return Geometry.lit_textured.view
|
function new_Face (Vertices : in geometry.lit_textured.Vertex_array) return Geometry.lit_textured.view
|
||||||
@@ -58,25 +136,24 @@ is
|
|||||||
:= Primitive.indexed.new_Primitive (triangle_Fan, the_Indices);
|
:= Primitive.indexed.new_Primitive (triangle_Fan, the_Indices);
|
||||||
|
|
||||||
Id : texture_Set.texture_Id;
|
Id : texture_Set.texture_Id;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
for i in 1 .. Self.texture_Details.Count
|
for i in 1 .. Self.Face.texture_Count
|
||||||
loop
|
loop
|
||||||
Id := texture_Id (i);
|
Id := texture_Id (i);
|
||||||
|
|
||||||
-- the_Geometry.Fade_is (Which => Id,
|
the_Geometry.Fade_is (which => Id,
|
||||||
-- Now => Self.texture_Details.Fades (Id));
|
now => Self.Face.Fades (Id));
|
||||||
|
|
||||||
the_Geometry.Texture_is (Which => Id,
|
the_Geometry.Texture_is (which => Id,
|
||||||
Now => Textures.fetch (Self.texture_Details.Details (i).Texture));
|
now => Textures.fetch (Self.Face.Textures (i)));
|
||||||
the_Geometry.is_Transparent (Now => the_Geometry.Texture.is_Transparent);
|
the_Geometry.is_Transparent (now => the_Geometry.Texture.is_Transparent);
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
the_Geometry.is_Transparent (True); -- TODO: Do transparency properly.
|
the_Geometry.is_Transparent (True); -- TODO: Do transparency properly.
|
||||||
|
the_Geometry.Model_is (Self.all'unchecked_Access);
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_Face;
|
end new_Face;
|
||||||
@@ -89,19 +166,19 @@ is
|
|||||||
--
|
--
|
||||||
declare
|
declare
|
||||||
the_Vertices : constant Geometry.lit_textured.Vertex_array
|
the_Vertices : constant Geometry.lit_textured.Vertex_array
|
||||||
:= [1 => (Site => [0.0, 0.0, 0.0], Normal => Normal, Coords => (0.50, 0.50), Shine => default_Shine), -- Center.
|
:= (1 => (Site => (0.0, 0.0, 0.0), Normal => Normal, Coords => (0.50, 0.50), Shine => default_Shine), -- Center.
|
||||||
|
|
||||||
2 => (Site => the_Sites (1), Normal => Normal, Coords => (1.00, 0.50), Shine => default_Shine), -- Mid right.
|
2 => (Site => the_Sites (1), Normal => Normal, Coords => (1.00, 0.50), Shine => default_Shine), -- Mid right.
|
||||||
3 => (Site => the_Sites (2), Normal => Normal, Coords => (0.75, 1.00), Shine => default_Shine), -- Bottom right.
|
3 => (Site => the_Sites (2), Normal => Normal, Coords => (0.75, 1.00), Shine => default_Shine), -- Bottom right.
|
||||||
4 => (Site => the_Sites (3), Normal => Normal, Coords => (0.25, 1.00), Shine => default_Shine), -- Bottom left.
|
4 => (Site => the_Sites (3), Normal => Normal, Coords => (0.25, 1.00), Shine => default_Shine), -- Bottom left.
|
||||||
5 => (Site => the_Sites (4), Normal => Normal, Coords => (0.00, 0.50), Shine => default_Shine), -- Mid left.
|
5 => (Site => the_Sites (4), Normal => Normal, Coords => (0.00, 0.50), Shine => default_Shine), -- Mid left.
|
||||||
6 => (Site => the_Sites (5), Normal => Normal, Coords => (0.25, 0.00), Shine => default_Shine), -- Top left.
|
6 => (Site => the_Sites (5), Normal => Normal, Coords => (0.25, 0.00), Shine => default_Shine), -- Top left.
|
||||||
7 => (Site => the_Sites (6), Normal => Normal, Coords => (0.75, 0.00), Shine => default_Shine)]; -- Top right.
|
7 => (Site => the_Sites (6), Normal => Normal, Coords => (0.75, 0.00), Shine => default_Shine)); -- Top right.
|
||||||
begin
|
begin
|
||||||
upper_Face := new_Face (Vertices => the_Vertices);
|
upper_Face := new_Face (Vertices => the_Vertices);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
return [1 => upper_Face.all'Access];
|
return (1 => upper_Face.all'Access);
|
||||||
end to_GL_Geometries;
|
end to_GL_Geometries;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +1,33 @@
|
|||||||
with
|
with
|
||||||
openGL.texture_Set,
|
openGL.texture_Set,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.hexagon.lit_textured
|
package openGL.Model.hexagon.lit_textured
|
||||||
--
|
--
|
||||||
-- Models a lit and textured hexagon.
|
-- Models a lit, colored and textured hexagon.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (Model.hexagon.item);
|
type Item is new Model.item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
|
type Face is
|
||||||
|
record
|
||||||
|
Fades : texture_Set.fade_Levels (texture_Set.texture_Id) := [others => 0.0];
|
||||||
|
Textures : openGL.asset_Names (1 .. Positive (texture_Set.texture_Id'Last)) := [others => null_Asset]; -- The textures to be applied to the hex.
|
||||||
|
texture_Count : Natural := 0;
|
||||||
|
texture_Applies : texture_Set.texture_Apply_array := [others => True];
|
||||||
|
Animation : texture_Set.Animation_view;
|
||||||
|
end record;
|
||||||
|
|
||||||
|
|
||||||
---------
|
---------
|
||||||
--- Forge
|
--- Forge
|
||||||
--
|
--
|
||||||
|
|
||||||
function new_Hexagon (Radius : in Real;
|
function new_Hexagon (Radius : in Real;
|
||||||
texture_Details : in texture_Set.item) return View;
|
Face : in lit_textured.Face) return View;
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
@@ -31,10 +38,41 @@ is
|
|||||||
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
function to_GL_Geometries (Self : access Item; Textures : access Texture.name_Map_of_texture'Class;
|
||||||
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
Fonts : in Font.font_id_Map_of_font) return Geometry.views;
|
||||||
|
|
||||||
|
------------
|
||||||
|
-- Texturing
|
||||||
|
--
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function Fade (Self : in Item; Which : in texture_Set.texture_Id) return texture_Set.fade_Level;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure Fade_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in texture_Set.fade_Level);
|
||||||
|
|
||||||
|
procedure Texture_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in asset_Name);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Count (Self : in Item) return Natural;
|
||||||
|
|
||||||
|
|
||||||
|
overriding
|
||||||
|
function texture_Applied (Self : in Item; Which : in texture_Set.texture_Id) return Boolean;
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure texture_Applied_is (Self : in out Item; Which : in texture_Set.texture_Id;
|
||||||
|
Now : in Boolean);
|
||||||
|
|
||||||
|
overriding
|
||||||
|
procedure animate (Self : in out Item);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with null record;
|
type Item is new Model.hexagon.item with
|
||||||
|
record
|
||||||
|
Face : lit_textured.Face;
|
||||||
|
end record;
|
||||||
|
|
||||||
end openGL.Model.hexagon.lit_textured;
|
end openGL.Model.hexagon.lit_textured;
|
||||||
|
|||||||
@@ -70,9 +70,8 @@ is
|
|||||||
:= Primitive.indexed.new_Primitive (triangle_Fan,
|
:= Primitive.indexed.new_Primitive (triangle_Fan,
|
||||||
the_Indices);
|
the_Indices);
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_hexagon_Face;
|
end new_hexagon_Face;
|
||||||
@@ -91,7 +90,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view
|
the_Primitive : constant Primitive.view
|
||||||
:= Primitive.indexed.new_Primitive (triangle_Strip, the_Indices).all'Access;
|
:= Primitive.indexed.new_Primitive (triangle_Strip, the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,8 @@ is
|
|||||||
:= Primitive.indexed.new_Primitive (triangle_Fan,
|
:= Primitive.indexed.new_Primitive (triangle_Fan,
|
||||||
the_Indices);
|
the_Indices);
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_hexagon_Face;
|
end new_hexagon_Face;
|
||||||
@@ -96,7 +95,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view
|
the_Primitive : constant Primitive.view
|
||||||
:= Primitive.indexed.new_Primitive (triangle_Strip, the_Indices).all'Access;
|
:= Primitive.indexed.new_Primitive (triangle_Strip, the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.hexagon_Column.lit_colored_textured_faceted
|
package openGL.Model.hexagon_Column.lit_colored_textured_faceted
|
||||||
@@ -9,10 +8,7 @@ package openGL.Model.hexagon_Column.lit_colored_textured_faceted
|
|||||||
-- Models a lit, colored and textured column with 6 faceted shaft sides.
|
-- Models a lit, colored and textured column with 6 faceted shaft sides.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (Model.hexagon_Column.item);
|
type Item is new Model.hexagon_Column.Item with private;
|
||||||
|
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -55,7 +51,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with
|
type Item is new Model.hexagon_Column.item with
|
||||||
record
|
record
|
||||||
upper_Face,
|
upper_Face,
|
||||||
lower_Face : hex_Face;
|
lower_Face : hex_Face;
|
||||||
|
|||||||
@@ -77,7 +77,6 @@ is
|
|||||||
the_Indices).all'Access;
|
the_Indices).all'Access;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
@@ -100,7 +99,6 @@ is
|
|||||||
:= Primitive.indexed.new_Primitive (triangle_Strip,
|
:= Primitive.indexed.new_Primitive (triangle_Strip,
|
||||||
the_Indices);
|
the_Indices);
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices);
|
the_Geometry.Vertices_are (Vertices);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.hexagon_Column.lit_colored_textured_rounded
|
package openGL.Model.hexagon_Column.lit_colored_textured_rounded
|
||||||
@@ -11,10 +10,7 @@ package openGL.Model.hexagon_Column.lit_colored_textured_rounded
|
|||||||
-- The shaft of the column appears rounded, whereas the top and bottom appear as hexagons.
|
-- The shaft of the column appears rounded, whereas the top and bottom appear as hexagons.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (Model.hexagon_Column.item);
|
type Item is new Model.hexagon_Column.item with private;
|
||||||
|
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +54,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with
|
type Item is new Model.hexagon_Column.item with
|
||||||
record
|
record
|
||||||
upper_Face,
|
upper_Face,
|
||||||
lower_Face : hex_Face;
|
lower_Face : hex_Face;
|
||||||
|
|||||||
@@ -71,9 +71,8 @@ is
|
|||||||
:= Primitive.indexed.new_Primitive (triangle_Fan,
|
:= Primitive.indexed.new_Primitive (triangle_Fan,
|
||||||
the_Indices);
|
the_Indices);
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (Primitive.view (the_Primitive));
|
the_Geometry.add (Primitive.view (the_Primitive));
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_hexagon_Face;
|
end new_hexagon_Face;
|
||||||
@@ -92,7 +91,6 @@ is
|
|||||||
the_Primitive : constant Primitive.view
|
the_Primitive : constant Primitive.view
|
||||||
:= Primitive.indexed.new_Primitive (triangle_Strip, the_Indices).all'Access;
|
:= Primitive.indexed.new_Primitive (triangle_Strip, the_Indices).all'Access;
|
||||||
begin
|
begin
|
||||||
the_Geometry.Model_is (Self.all'unchecked_Access);
|
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Texture,
|
openGL.Texture;
|
||||||
openGL.Model.texturing;
|
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.hexagon_Column.lit_textured_faceted
|
package openGL.Model.hexagon_Column.lit_textured_faceted
|
||||||
@@ -9,9 +8,7 @@ package openGL.Model.hexagon_Column.lit_textured_faceted
|
|||||||
-- Models a lit, colored and textured column with 6 faceted shaft sides.
|
-- Models a lit, colored and textured column with 6 faceted shaft sides.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
package textured_Model is new texturing.Mixin (Model.hexagon_Column.item);
|
type Item is new Model.hexagon_Column.Item with private;
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with private;
|
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +48,7 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new textured_Model.textured_Item with
|
type Item is new Model.hexagon_Column.item with
|
||||||
record
|
record
|
||||||
upper_Face,
|
upper_Face,
|
||||||
lower_Face : hex_Face;
|
lower_Face : hex_Face;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user