opengl: Revamp multi-texturing.
This commit is contained in:
@@ -19,82 +19,110 @@ is
|
||||
|
||||
|
||||
|
||||
procedure animate (the_Animation : in out Animation;
|
||||
texture_Applies : in out texture_Apply_array)
|
||||
-- procedure animate (the_Animation : in out Animation;
|
||||
-- texture_Applies : in out texture_Apply_array)
|
||||
-- is
|
||||
-- use ada.Calendar;
|
||||
--
|
||||
-- Now : constant ada.Calendar.Time := Clock;
|
||||
--
|
||||
-- begin
|
||||
-- if Now >= the_Animation.next_frame_Time
|
||||
-- then
|
||||
-- declare
|
||||
-- next_frame_Id : constant frame_Id := (if the_Animation.Current < the_Animation.frame_Count then the_Animation.Current + 1
|
||||
-- else 1);
|
||||
-- old_Frame : Frame renames the_Animation.Frames (the_Animation.Current);
|
||||
-- new_Frame : Frame renames the_Animation.Frames (next_frame_Id);
|
||||
-- begin
|
||||
-- texture_Applies (old_Frame.texture_Id) := False;
|
||||
-- texture_Applies (new_Frame.texture_Id) := True;
|
||||
--
|
||||
-- the_Animation.Current := next_frame_Id;
|
||||
-- the_Animation.next_frame_Time := Now + the_Animation.frame_Duration;
|
||||
-- end;
|
||||
-- end if;
|
||||
-- end animate;
|
||||
|
||||
|
||||
|
||||
procedure animate (Self : in out Item)
|
||||
is
|
||||
use ada.Calendar;
|
||||
|
||||
Now : constant ada.Calendar.Time := Clock;
|
||||
|
||||
begin
|
||||
if Now >= the_Animation.next_frame_Time
|
||||
if Now >= Self.Animation.next_frame_Time
|
||||
then
|
||||
declare
|
||||
next_frame_Id : constant frame_Id := (if the_Animation.Current < the_Animation.frame_Count then the_Animation.Current + 1
|
||||
else 1);
|
||||
old_Frame : Frame renames the_Animation.Frames (the_Animation.Current);
|
||||
new_Frame : Frame renames the_Animation.Frames (next_frame_Id);
|
||||
next_frame_Id : constant frame_Id := (if Self.Animation.Current < Self.Animation.frame_Count then Self.Animation.Current + 1
|
||||
else 1);
|
||||
old_Frame : Frame renames Self.Animation.Frames (Self.Animation.Current);
|
||||
new_Frame : Frame renames Self.Animation.Frames (next_frame_Id);
|
||||
begin
|
||||
texture_Applies (old_Frame.texture_Id) := False;
|
||||
texture_Applies (new_Frame.texture_Id) := True;
|
||||
Self.Details (detail_Count (old_Frame.texture_Id)).texture_Apply := False;
|
||||
Self.Details (detail_Count (new_Frame.texture_Id)).texture_Apply := True;
|
||||
|
||||
the_Animation.Current := next_frame_Id;
|
||||
the_Animation.next_frame_Time := Now + the_Animation.frame_Duration;
|
||||
Self.Animation.Current := next_frame_Id;
|
||||
Self.Animation.next_frame_Time := Now + Self.Animation.frame_Duration;
|
||||
end;
|
||||
end if;
|
||||
end animate;
|
||||
|
||||
|
||||
|
||||
|
||||
-----------
|
||||
--- Details
|
||||
--
|
||||
|
||||
function to_Details (texture_Assets : in asset_Names;
|
||||
Animation : in Animation_view := null) return Details
|
||||
is
|
||||
Result : Details;
|
||||
begin
|
||||
Result.texture_Count := texture_Assets'Length;
|
||||
|
||||
for i in 1 .. texture_Assets'Length
|
||||
loop
|
||||
Result.Textures (i) := texture_Assets (i);
|
||||
end loop;
|
||||
|
||||
Result.Animation := Animation;
|
||||
|
||||
return Result;
|
||||
end to_Details;
|
||||
|
||||
|
||||
|
||||
-- function to_Set (texture_Assets : in asset_Names;
|
||||
-- Animation : in Animation_view := null) return Item
|
||||
-- function to_Details (texture_Assets : in asset_Names;
|
||||
-- Animation : in Animation_view := null) return Details
|
||||
-- is
|
||||
-- Result : Item (Count => texture_Assets'Length);
|
||||
--
|
||||
-- Result : Details;
|
||||
-- begin
|
||||
-- for i in 1 .. Result.Count
|
||||
-- loop
|
||||
-- Result.Details (i).Object := texture.null_Object;
|
||||
-- Result.Details (i).Texture := texture_Assets (Integer (i));
|
||||
-- Result.Details (i).Fade := 0.0;
|
||||
-- Result.Details (i).texture_Tiling := (S => 1.0, T => 1.0);
|
||||
-- Result.texture_Count := texture_Assets'Length;
|
||||
--
|
||||
-- if i = 1
|
||||
-- then
|
||||
-- Result.Details (i).texture_Apply := True;
|
||||
-- else
|
||||
-- Result.Details (i).texture_Apply := False;
|
||||
-- end if;
|
||||
-- for i in 1 .. texture_Assets'Length
|
||||
-- loop
|
||||
-- Result.Textures (i) := texture_Assets (i);
|
||||
-- end loop;
|
||||
--
|
||||
-- Result.Animation := Animation;
|
||||
--
|
||||
-- return Result;
|
||||
-- end to_Set;
|
||||
-- end to_Details;
|
||||
|
||||
|
||||
|
||||
function to_Set (texture_Assets : in asset_Names;
|
||||
texture_Tilings : in Tilings := [others => (S => 1.0,
|
||||
T => 1.0)];
|
||||
|
||||
Animation : in Animation_view := null) return Item
|
||||
is
|
||||
Result : Item (Count => texture_Assets'Length);
|
||||
|
||||
begin
|
||||
for i in 1 .. Result.Count
|
||||
loop
|
||||
Result.Details (i).Object := texture.null_Object;
|
||||
Result.Details (i).Texture := texture_Assets (Integer (i));
|
||||
Result.Details (i).Fade := 0.0;
|
||||
Result.Details (i).texture_Tiling := texture_Tilings (texture_Id (i));
|
||||
|
||||
if i = 1
|
||||
then
|
||||
Result.Details (i).texture_Apply := True;
|
||||
else
|
||||
Result.Details (i).texture_Apply := False;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
Result.Animation := Animation;
|
||||
|
||||
return Result;
|
||||
end to_Set;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user