Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with media.Video;
- with mmi.Window.sdl,
- mmi.Applet,
- mmi.Sprite.forge,
- mmi.Model,
- mmi.textured_box_Model;
- with opengl.Texture,
- opengl.Palette,
- opengl.Face,
- opengl.IO,
- opengl.Face.lit_textured_geometry;
- with Math;
- with ada.Calendar,
- ada.Strings.unbounded,
- ada.text_IO;
- procedure launch_video_Sprite
- --
- -- A sample program demonstrating ...
- --
- is
- use openGL, opengl.Palette;
- use mmi.Applet,
- mmi.textured_box_Model;
- use ada.calendar,
- ada.Strings.unbounded,
- ada.text_IO;
- use type math.Real;
- the_Movie : media.Video.view := media.Video.new_Video ("MVI_0922.ogv");
- the_Window : mmi.Window.View := mmi.window.sdl.Forge.new_Window ("video sprite Demo",
- 500, 500);
- the_Applet : mmi.Applet.view := mmi.applet.forge.new_Applet (the_Window);
- the_Texture : opengl.Texture.Object := opengl.Texture.to_Texture (the_Movie.next_Frame);
- the_box_Model : aliased mmi.textured_box_Model.item
- := (mmi.Model.item with
- scale => (10.0, 10.0, 1.0),
- faces => (front => (colors => (others => (White, Opaque)), texture => the_Texture),
- rear => (colors => (others => (Blue, Opaque)), texture => <>),
- upper => (colors => (others => (Green, Opaque)), texture => <>),
- lower => (colors => (others => (Yellow, Opaque)), texture => <>),
- left => (colors => (others => (Cyan, Opaque)), texture => <>),
- right => (colors => (others => (Magenta, Opaque)), texture => <>)));
- the_Box : mmi.Sprite.view := mmi.Sprite.forge.new_Sprite (the_box_Model'access, mass => 0.0);
- next_render_Time : ada.calendar.Time;
- begin
- --- setup
- --
- -- add box
- --
- the_Applet.add (the_Box);
- the_Box.Site_is ((0.0, -1.0, 0.0));
- -- user interface
- --
- the_Applet.Camera.Site_is ((0.0, 1.0, 15.0));
- the_Applet.enable_Dolly;
- the_Applet.enable_Mouse;
- --- begin processing
- --
- next_render_Time := ada.Calendar.clock;
- while the_Applet.is_open loop
- opengl.Texture.set_Image (the_Texture, to => the_Movie.next_Frame);
- the_Applet.World.evolve (by => 1.0/60.0);
- the_Applet.freshen;
- next_render_Time := next_render_Time + 1.0/60.0;
- delay until next_render_Time;
- end loop;
- --- close
- --
- the_Applet.destroy;
- the_Movie.destroy;
- end launch_video_Sprite;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement