indexing description: "[ A scene which displays moving pyramids. ]" date: "$Date$" revision: "$Revision$" class FIRST_SCENE inherit EM_GL_SCENE GL_FUNCTIONS export {NONE} all end GLU_FUNCTIONS export {NONE} all end create make feature {NONE} -- Initialisation make is -- Initialise default values. local my_pyramid_factory: PYRAMID_FACTORY do make_scene -- Create pyramids create my_pyramid_factory.make big_pyramid := my_pyramid_factory.create_object left_pyramid := my_pyramid_factory.create_object right_pyramid := my_pyramid_factory.create_object -- Initialize speed for rotation create speed speed.set_speed (100) ensure big_pyramid_not_void: big_pyramid /= Void left_pyramid_not_void: left_pyramid /= Void right_pyramid_not_void: right_pyramid /= Void speed_not_void: speed /= Void end feature -- Access speed: EM_NORMALIZED_SPEED -- Rotation speed for pyramid angle: DOUBLE -- Angle of rotation in degrees big_pyramid: EM_3D_OBJECT -- Middle Pyramid left_pyramid: EM_3D_OBJECT -- Left pyramid right_pyramid: EM_3D_OBJECT -- Right pyramid feature -- Drawing draw is -- Draw scene. do -- Move the camera away from the screen and rotate gl_translatef(0,-1,-9) gl_rotatef (angle, 0, 1, 0) big_pyramid.set_origin (-1.5, 0, 0) big_pyramid.set_scale (1.5, 1.5, 1.5) big_pyramid.draw left_pyramid.set_origin (-6, 0, 0) left_pyramid.set_rotation (angle, 0, 0) left_pyramid.draw right_pyramid.set_origin (4, 0, 0) right_pyramid.set_rotation (360-angle, 0, 0) right_pyramid.draw -- Increment the angle if angle < 360 then angle := angle + speed.get_delta else angle := 0 end end invariant speed_not_void: speed /= Void big_pyramid_not_void: big_pyramid /= void left_pyramid_not_void: left_pyramid /= void right_pyramid_not_void: right_pyramid /= void end