indexing description: "[ Transition effect. Source image explodes into 50 cubes. After a 270 degrees rotation the cubes assemble to the destination image. This class is part of the XAE Extended Adventure Engine Project. ]" author: "Ralph Wiedemeier, ralphw@student.ethz.ch" date: "$Date$" revision: "$Revision$" class GUI_TRANSITION_EXPLODE inherit GUI_TRANSITION feature -- Operation do_transition (source: GUI_SCENE; destination: GUI_SCENE; surface: EM_VIDEO_SURFACE) is -- Scene transition: The source scene explodes into 50 cubes which rotate -- and assemble to the destination scene local rel_time: INTEGER start_time: INTEGER time: DOUBLE cubes: LINKED_LIST [GUI_SFX_SMALL_CUBE] x, y, i: INTEGER cube: GUI_SFX_SMALL_CUBE angle_x, angle_y, angle_z, trans_y, trans_z, sz: DOUBLE do initialization make_snapshots (source, destination) emgl_matrix_mode (EM_gl_modelview) macro_enable_depth_test macro_disable_alpha_blending create cubes.make from y := 0 i := 1 until y >= rows loop from x := 0 until x >= columns loop create cube.make_with_pos (y, x, dst_cols.item (i), fx_texture_1, fx_texture_2) cubes.extend (cube) x := x + 1 i := i + 1 end y := y + 1 end from start_time := gui_constants.ticks rel_time := 0 until rel_time > duration loop emgl_clear (EM_gl_color_buffer_bit | EM_gl_depth_buffer_bit) emgl_enable (EM_gl_polygon_smooth) time := rel_time / duration sz := gui_timing.smooth_zero (time) angle_y := 270 * gui_timing.super_smooth (time) angle_x := -40 * sz angle_z := -25 * sz trans_y := 230 * sz trans_z := 150 * sz emgl_load_identity emgl_translatef (0, 52 + trans_y, -700-512 + trans_z) emgl_rotatef (angle_z, 0, 0, 1) emgl_rotatef (-angle_x, 1, 0, 0) emgl_rotatef (-angle_y, 0, 1, 0) emgl_translatef (-512, -256, 512) from cubes.start until cubes.after loop cubes.item.draw (time) cubes.forth end -- CHANGES surface.enable_opengl_blitting game_skin.draw (surface) surface.disable_opengl_blitting surface.redraw -- DON'T EXIST ANYMORE rel_time := gui_constants.ticks - start_time end emgl_disable (EM_gl_polygon_smooth) destination.reset_scene_time end feature {NONE} -- Implementation default_duration: INTEGER is 5000 -- Duration of cube explosion transition in milliseconds rows: INTEGER is 5 columns: INTEGER is 10 dst_cols: ARRAY[INTEGER] is -- Random positions for cube explosion effect once result := << 5, 8, 2, 3, 9, 1, 7, 4, 0, 6, 8, 1, 4, 6, 0, 2, 9, 3, 7, 5, 6, 9, 0, 3, 1, 8, 5, 7, 4, 2, 3, 6, 9, 1, 4, 7, 0, 2, 8, 5, 9, 4, 1, 5, 6, 0, 8, 3, 7, 2 >> end end -- class GUI_TRANSITION_EXPLODE