opengl.light: Add a forge.

This commit is contained in:
Rod Kay
2024-03-10 14:23:13 +11:00
parent 96a0b9ad56
commit ccfaff517b
2 changed files with 56 additions and 13 deletions

View File

@@ -1,6 +1,37 @@
package body openGL.Light package body openGL.Light
is is
package body Forge
is
function to_Light (Id : in Id_t := null_Id;
Kind : in Kind_t := Direct;
is_On : in Boolean := True;
Site : in openGL.Site := [0.0, 0.0, 1.0];
Strength : in Intensity := 1.0;
Color : in openGL.Color := (1.0, 1.0, 1.0);
Attenuation : in Real := 0.0;
ambient_Coefficient : in Real := 0.0;
cone_Angle : in Degrees := 90.0;
cone_Direction : in Vector_3 := [0.0, 0.0, -1.0]) return Item
is
begin
return (Id => Id,
Kind => Kind,
On => is_On,
Site => Site,
Color => Color,
Strength => Strength,
Attenuation => Attenuation,
ambient_Coefficient => ambient_Coefficient,
cone_Angle => cone_Angle,
cone_Direction => cone_Direction);
end to_Light;
end Forge;
function Id (Self : in Item) return light.Id_t function Id (Self : in Item) return light.Id_t
is is
begin begin

View File

@@ -1,8 +1,4 @@
with package openGL.Light with Pure
openGL.Palette;
package openGL.Light
-- --
-- Models a light. -- Models a light.
-- --
@@ -11,15 +7,31 @@ is
type Items is array (Positive range <>) of Item; type Items is array (Positive range <>) of Item;
--------------
--- Attributes
--
type Id_t is new Natural; type Id_t is new Natural;
type Kind_t is (Diffuse, Direct); type Kind_t is (Diffuse, Direct);
type Intensity is digits 5 range 0.0 .. 10.0; type Intensity is digits 5 range 0.0 .. 10.0;
null_Id : constant Id_t; null_Id : constant Id_t;
package Forge
is
function to_Light (Id : in Id_t := null_Id;
Kind : in Kind_t := Direct;
is_On : in Boolean := True;
Site : in openGL.Site := [0.0, 0.0, 1.0];
Strength : in Intensity := 1.0;
Color : in openGL.Color := (1.0, 1.0, 1.0);
Attenuation : in Real := 0.0;
ambient_Coefficient : in Real := 0.0;
cone_Angle : in Degrees := 90.0;
cone_Direction : in Vector_3 := [0.0, 0.0, -1.0]) return Item;
end Forge;
--------------
--- Attributes
--
function Id (Self : in Item) return light.Id_t; function Id (Self : in Item) return light.Id_t;
procedure Id_is (Self : in out Item; Now : in light.Id_t); procedure Id_is (Self : in out Item; Now : in light.Id_t);
@@ -60,11 +72,11 @@ private
On : Boolean := True; On : Boolean := True;
Site : openGL.Site := [0.0, 0.0, 1.0]; -- The GL default. Site : openGL.Site := [0.0, 0.0, 1.0]; -- The GL default.
Strength : Intensity := 1.0; Color : openGL.Color := (1.0, 1.0, 1.0);
Color : openGL.Color := Palette.White; Strength : Intensity := 1.0;
Attenuation : Real := 0.0; Attenuation : Real := 0.0;
ambient_Coefficient : Real := 0.0; ambient_Coefficient : Real := 0.0;
cone_Angle : Degrees := 90.0; cone_Angle : Degrees := 90.0;
cone_Direction : Vector_3 := [0.0, 0.0, -1.0]; cone_Direction : Vector_3 := [0.0, 0.0, -1.0];
end record; end record;