opengl.demos: Update code to use new openGL updates.
This commit is contained in:
@@ -1,7 +1,9 @@
|
|||||||
|
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;
|
||||||
|
|
||||||
@@ -38,7 +40,8 @@ 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,6 +3,7 @@ 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,6 +31,7 @@ begin
|
|||||||
--
|
--
|
||||||
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_Details ([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,
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
with
|
with
|
||||||
openGL.Model.any,
|
openGL.Model.any,
|
||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
openGL.Light.directional,
|
openGL.Light,
|
||||||
|
openGL.texture_Set,
|
||||||
openGL.Demo;
|
openGL.Demo;
|
||||||
|
|
||||||
procedure launch_render_Asteroids
|
procedure launch_render_Asteroids
|
||||||
@@ -16,24 +17,30 @@ 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.directional.item := Demo.Renderer.Light (1);
|
the_Light : openGL.Light.item := Demo.Renderer.new_Light;
|
||||||
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]);
|
||||||
Demo.Renderer.Light_is (1, the_Light);
|
the_Light.ambient_Coefficient_is (0.05);
|
||||||
|
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 => null_Asset,
|
Texture => to_Asset ("./assets/opengl/texture/Face1.bmp"),
|
||||||
|
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.
|
||||||
--
|
--
|
||||||
@@ -79,7 +86,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,6 +2,7 @@ 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;
|
||||||
|
|
||||||
@@ -27,21 +28,23 @@ 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_Details ([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_Details ([1 => the_Texture]));
|
||||||
-- The Sprites.
|
-- The Sprites.
|
||||||
--
|
--
|
||||||
use openGL.Visual.Forge;
|
use openGL.Visual.Forge;
|
||||||
|
|
||||||
the_Sprites : constant openGL.Visual.views := [new_Visual ( the_Billboard_Model.all'Access),
|
the_Visuals : 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_Sprites (2).Site_is ([3.0, 0.0, 0.0]);
|
the_Visuals (2).Site_is ([3.0, 0.0, 0.0]);
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
--
|
--
|
||||||
@@ -54,7 +57,7 @@ begin
|
|||||||
|
|
||||||
-- Render the sprites.
|
-- Render the sprites.
|
||||||
--
|
--
|
||||||
Demo.Camera.render (the_Sprites);
|
Demo.Camera.render (the_Visuals);
|
||||||
|
|
||||||
while not Demo.Camera.cull_Completed
|
while not Demo.Camera.cull_Completed
|
||||||
loop
|
loop
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
with openGL.texture_Set;
|
||||||
with
|
with
|
||||||
openGL.Visual,
|
openGL.Visual,
|
||||||
|
|
||||||
@@ -5,9 +6,11 @@ with
|
|||||||
openGL.Model.Box.textured,
|
openGL.Model.Box.textured,
|
||||||
openGL.Model.Box.lit_colored_textured,
|
openGL.Model.Box.lit_colored_textured,
|
||||||
|
|
||||||
|
openGL.texture_Set,
|
||||||
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.
|
||||||
@@ -58,7 +61,8 @@ 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_Details ([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 => (White, Opaque),
|
Color => (Green, Opaque),
|
||||||
Image => the_Texture);
|
Image => the_Texture);
|
||||||
-- The Visuals.
|
-- The Visuals.
|
||||||
--
|
--
|
||||||
@@ -42,6 +42,7 @@ 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.
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ begin
|
|||||||
|
|
||||||
the_Visuals (4).Site_is ([0.0, 0.0, -50.0]);
|
the_Visuals (4).Site_is ([0.0, 0.0, -50.0]);
|
||||||
|
|
||||||
the_Visuals (1).Scale_is ([2.0, 2.0, 1.0]); -- Text visual.
|
the_Visuals (1).Scale_is ([0.2, 0.2, 1.0]); -- Text visual.
|
||||||
|
|
||||||
-- Main loop.
|
-- Main loop.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ 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,8 +3,10 @@ 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.
|
||||||
@@ -35,16 +37,20 @@ 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_Details ([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_Sprites : constant openGL.Visual.views := [1 => new_Visual (the_Text_Model.all'Access)];
|
the_Visuals : constant openGL.Visual.views := [1 => new_Visual (the_Text_Model.all'Access)];
|
||||||
Current : constant Integer := the_Sprites'First;
|
Current : constant Integer := the_Visuals'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
|
||||||
@@ -78,7 +84,7 @@ begin
|
|||||||
|
|
||||||
-- Render all sprites.
|
-- Render all sprites.
|
||||||
--
|
--
|
||||||
Demo.Camera.render ([1 => the_Sprites (Current)]);
|
Demo.Camera.render ([1 => the_Visuals (Current)]);
|
||||||
|
|
||||||
while not Demo.Camera.cull_Completed
|
while not Demo.Camera.cull_Completed
|
||||||
loop
|
loop
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
with openGL.texture_Set;
|
||||||
with
|
with
|
||||||
openGL.Camera,
|
openGL.Camera,
|
||||||
openGL.Palette,
|
openGL.Palette,
|
||||||
@@ -54,7 +55,8 @@ 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_Details ([1 => the_Face]));
|
||||||
|
|
||||||
-- The Sprites.
|
-- The Sprites.
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ is
|
|||||||
use type GLint;
|
use type GLint;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
if for_Model.texture_Count > 0
|
||||||
|
then
|
||||||
for i in 1 .. openGL.texture_Set.texture_Id (for_Model.texture_Count)
|
for i in 1 .. openGL.texture_Set.texture_Id (for_Model.texture_Count)
|
||||||
loop
|
loop
|
||||||
Uniforms.Textures (i).fade_Uniform .Value_is (Real (for_Model.Fade (Which => i)));
|
Uniforms.Textures (i).fade_Uniform .Value_is (Real (for_Model.Fade (Which => i)));
|
||||||
@@ -71,6 +73,7 @@ is
|
|||||||
glBindTexture (GL_TEXTURE_2D,
|
glBindTexture (GL_TEXTURE_2D,
|
||||||
texture_Set.Textures (i).Object.Name);
|
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;
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ 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) return View
|
Texture : in asset_Name;
|
||||||
|
texture_Details : in texture_Set.Details) return View
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
@@ -23,6 +24,7 @@ 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;
|
||||||
@@ -58,6 +60,7 @@ is
|
|||||||
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;
|
||||||
|
the_Geometry.Model_is (Self.all'unchecked_Access);
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_Face;
|
end new_Face;
|
||||||
@@ -90,6 +93,7 @@ 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,6 +1,7 @@
|
|||||||
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;
|
||||||
|
|
||||||
@@ -10,7 +11,11 @@ package openGL.Model.billboard.colored_textured
|
|||||||
-- Models a colored, textured billboard.
|
-- Models a colored, textured billboard.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
type Item is new Model.billboard.item with private;
|
package textured_Model is new texturing.Mixin (openGL.Model.billboard.item);
|
||||||
|
|
||||||
|
type Item is new textured_Model.textured_item with private;
|
||||||
|
|
||||||
|
-- type Item is new Model.billboard.item with private;
|
||||||
type View is access all Item'Class;
|
type View is access all Item'Class;
|
||||||
|
|
||||||
|
|
||||||
@@ -21,7 +26,8 @@ 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) return View;
|
Texture : in asset_Name;
|
||||||
|
texture_Details : in texture_Set.Details) return View;
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
--- Attributes
|
--- Attributes
|
||||||
@@ -44,7 +50,8 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new Model.billboard.item with
|
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);
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ is
|
|||||||
begin
|
begin
|
||||||
the_Geometry.Vertices_are (Vertices.all);
|
the_Geometry.Vertices_are (Vertices.all);
|
||||||
the_Geometry.add (the_Primitive);
|
the_Geometry.add (the_Primitive);
|
||||||
|
the_Geometry.Model_is (Self.all'unchecked_Access);
|
||||||
|
|
||||||
return the_Geometry;
|
return the_Geometry;
|
||||||
end new_Face;
|
end new_Face;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
|
openGL.Model.texturing,
|
||||||
openGL.Texture;
|
openGL.Texture;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,7 +13,10 @@ package openGL.Model.Box.lit_colored_textured
|
|||||||
-- Each face may have a separate texture.
|
-- Each face may have a separate texture.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
type Item is new Model.box.item with private;
|
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;
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +48,8 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new Model.box.item with
|
-- type Item is new Model.box.item with
|
||||||
|
type Item is new textured_Model.textured_item with
|
||||||
record
|
record
|
||||||
Faces : lit_colored_textured.Faces;
|
Faces : lit_colored_textured.Faces;
|
||||||
end record;
|
end record;
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ 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,6 +1,7 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
|
openGL.Model.texturing,
|
||||||
openGL.Texture;
|
openGL.Texture;
|
||||||
|
|
||||||
|
|
||||||
@@ -12,7 +13,10 @@ package openGL.Model.Box.lit_colored_textured_x1
|
|||||||
-- All faces use the same texture.
|
-- All faces use the same texture.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
type Item is new Model.box.item with private;
|
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;
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +48,8 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new Model.box.item with
|
-- type Item is new Model.box.item with
|
||||||
|
type Item is new textured_Model.textured_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.
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ is
|
|||||||
|
|
||||||
function new_Box (Size : in Vector_3;
|
function new_Box (Size : in Vector_3;
|
||||||
Faces : in lit_textured.Faces;
|
Faces : in lit_textured.Faces;
|
||||||
texture_Details : in texture_Set.Details) return View
|
texture_Details : in texture_Set.Details := texture_Set.no_Details) return View
|
||||||
|
|
||||||
is
|
is
|
||||||
Self : constant View := new Item;
|
Self : constant View := new Item;
|
||||||
begin
|
begin
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Font,
|
openGL.Font,
|
||||||
openGL.Model.texturing;
|
openGL.Model.texturing,
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.Box.lit_textured
|
package openGL.Model.Box.lit_textured
|
||||||
@@ -32,7 +33,7 @@ is
|
|||||||
|
|
||||||
function new_Box (Size : in Vector_3;
|
function new_Box (Size : in Vector_3;
|
||||||
Faces : in lit_textured.Faces;
|
Faces : in lit_textured.Faces;
|
||||||
texture_Details : in texture_Set.Details) return View;
|
texture_Details : in texture_Set.Details := texture_Set.no_Details) return View;
|
||||||
|
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|||||||
@@ -197,6 +197,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;
|
||||||
|
|
||||||
|
|
||||||
@@ -395,6 +397,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;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry;
|
openGL.Geometry,
|
||||||
|
openGL.Model.texturing;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.capsule.lit_colored_textured
|
package openGL.Model.capsule.lit_colored_textured
|
||||||
@@ -7,7 +8,10 @@ package openGL.Model.capsule.lit_colored_textured
|
|||||||
-- Models a lit, colored and textured capsule.
|
-- Models a lit, colored and textured capsule.
|
||||||
--
|
--
|
||||||
is
|
is
|
||||||
type Item is new Model.capsule.item with private;
|
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;
|
||||||
|
|
||||||
|
|
||||||
@@ -32,7 +36,9 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
type Item is new Model.capsule.item with
|
-- type Item is new Model.capsule.item with
|
||||||
|
|
||||||
|
type Item is new textured_Model.textured_item with
|
||||||
record
|
record
|
||||||
Radius : Real;
|
Radius : Real;
|
||||||
Height : Real;
|
Height : Real;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ is
|
|||||||
Row, Col : in Integer;
|
Row, Col : in Integer;
|
||||||
Heights : in height_Map_view;
|
Heights : in height_Map_view;
|
||||||
color_Map : in asset_Name;
|
color_Map : in asset_Name;
|
||||||
texture_Details : in texture_Set.Details;
|
texture_Details : in texture_Set.Details := texture_Set.no_Details;
|
||||||
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
|
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
|
||||||
T => (0.0, 1.0))) return View
|
T => (0.0, 1.0))) return View
|
||||||
is
|
is
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
with
|
with
|
||||||
openGL.Geometry,
|
openGL.Geometry,
|
||||||
openGL.Model.texturing;
|
openGL.Model.texturing,
|
||||||
|
openGL.texture_Set;
|
||||||
|
|
||||||
|
|
||||||
package openGL.Model.terrain
|
package openGL.Model.terrain
|
||||||
@@ -25,7 +26,7 @@ is
|
|||||||
Row, Col : in Integer;
|
Row, Col : in Integer;
|
||||||
Heights : in height_Map_view;
|
Heights : in height_Map_view;
|
||||||
color_Map : in asset_Name;
|
color_Map : in asset_Name;
|
||||||
texture_Details : in texture_Set.Details;
|
texture_Details : in texture_Set.Details := texture_Set.no_Details;
|
||||||
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
|
Tiling : in texture_Transform_2d := (S => (0.0, 1.0),
|
||||||
T => (0.0, 1.0))) return View;
|
T => (0.0, 1.0))) return View;
|
||||||
overriding
|
overriding
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
with
|
with
|
||||||
openGL.Model.Terrain,
|
openGL.Model.Terrain,
|
||||||
openGL.IO,
|
openGL.IO,
|
||||||
|
openGL.texture_Set,
|
||||||
|
|
||||||
ada.unchecked_Deallocation,
|
ada.unchecked_Deallocation,
|
||||||
ada.unchecked_Conversion;
|
ada.unchecked_Conversion;
|
||||||
|
|
||||||
|
|
||||||
package body openGL.Terrain
|
package body openGL.Terrain
|
||||||
is
|
is
|
||||||
type Heightmap_view is access all height_Map;
|
type Heightmap_view is access all height_Map;
|
||||||
@@ -121,6 +123,7 @@ is
|
|||||||
Col => Col,
|
Col => Col,
|
||||||
Heights => the_Region.all'Access,
|
Heights => the_Region.all'Access,
|
||||||
color_Map => texture_File,
|
color_Map => texture_File,
|
||||||
|
texture_Details => texture_Set.to_Details ([1 => texture_File]),
|
||||||
Tiling => Tiling);
|
Tiling => Tiling);
|
||||||
|
|
||||||
the_height_Extents : constant Vector_2 := height_Extent (the_Region.all);
|
the_height_Extents : constant Vector_2 := height_Extent (the_Region.all);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ is
|
|||||||
function to_Details (texture_Assets : in asset_Names;
|
function to_Details (texture_Assets : in asset_Names;
|
||||||
Animation : in Animation_view := null) return Details;
|
Animation : in Animation_view := null) return Details;
|
||||||
|
|
||||||
|
no_Details : constant Details;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -142,6 +142,8 @@ is
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------
|
-----------
|
||||||
--- Streams
|
--- Streams
|
||||||
--
|
--
|
||||||
@@ -156,4 +158,7 @@ private
|
|||||||
for Animation_view'read use read;
|
for Animation_view'read use read;
|
||||||
|
|
||||||
|
|
||||||
|
no_Details : constant Details := (others => <>);
|
||||||
|
|
||||||
|
|
||||||
end openGL.texture_Set;
|
end openGL.texture_Set;
|
||||||
|
|||||||
Reference in New Issue
Block a user