indexing description: "[ Transition effect. Destination scene zooms out of source scene. Zoom starts at specified position. 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_ZOOM inherit GUI_TRANSITION feature -- Operation do_transition (source: GUI_SCENE; destination: GUI_SCENE; surface: EM_VIDEO_SURFACE) is -- Scene transition: The new scene is zooming out from the specified location local rel_time: INTEGER start_time: INTEGER time, blend, fade, t, ti: DOUBLE x1, y1, x2, y2: DOUBLE x, y: INTEGER angle: DOUBLE texture: EM3D_TEXTURE_2D [EMGL_FORMAT_RGBA] do initialization make_snapshots (source, destination) macro_set_projection_perspective macro_enable_alpha_blending macro_disable_depth_test x := center_x - 512 y := 308 - center_y from start_time := gui_constants.ticks rel_time := 0 until rel_time > duration loop time := rel_time / duration blend := time * 5 if time > 0.1 then blend := 0.5 + time * 0.5 end fade := 1 - time * 0.05 t := time ti := 1 - t x1 := x * ti*ti*ti - x * 1*ti*ti*t - 512 * 3*ti*t*t - 512 * t*t*t y1 := y * ti*ti*ti - y * 1*ti*ti*t - 256 * 3*ti*t*t - 256 * t*t*t x2 := x * ti*ti*ti - x * 1*ti*ti*t + 512 * 3*ti*t*t + 512 * t*t*t y2 := y * ti*ti*ti - y * 1*ti*ti*t + 256 * 3*ti*t*t + 256 * t*t*t angle := 0 emgl_load_identity emgl_translatef (0, 52, -700) emgl_clear (EM_gl_color_buffer_bit | EM_gl_depth_buffer_bit) texture := fx_texture_1 macro_bind_texture_antialiased_replace (texture) emgl_begin (EM_gl_quads) emgl_color4d (1, 1, 1, 1) emgl_tex_coord2d (0.0, 0.0) emgl_vertex3d (-512, -256, 0) emgl_tex_coord2d (1.0, 0.0) emgl_vertex3d ( 512, -256, 0) emgl_tex_coord2d (1.0, 1.0) emgl_vertex3d ( 512, 256, 0) emgl_tex_coord2d (0.0, 1.0) emgl_vertex3d (-512, 256, 0) emgl_end texture.unbind emgl_rotatef (angle, 1, 0, 0) texture := fx_texture_2 macro_bind_texture_antialiased_modulate (texture) emgl_begin (EM_gl_quads) emgl_color4d (1, 1, 1, blend) emgl_tex_coord2d (0.0, 0.0) emgl_vertex3d (x1, y1, 0) emgl_tex_coord2d (1.0, 0.0) emgl_vertex3d (x2, y1, 0) emgl_tex_coord2d (1.0, 1.0) emgl_vertex3d (x2, y2, 0) emgl_tex_coord2d (0.0, 1.0) emgl_vertex3d (x1, y2, 0) emgl_end texture.unbind -- Trail effect --gl_finish --gl_read_buffer (EM_gl_back) --gl_bind_texture (EM_gl_texture_2d, fx_texture_1) --gl_copy_tex_image2d (EM_gl_texture_2d, 0, EM_gl_rgb, 0, 180, 1024, 512, 0) -- Draw game skin and swap buffers -- 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 destination.reset_scene_time end feature {NONE} -- Implementation default_duration: INTEGER is 1300 end -- class GUI_TRANSITION_ZOOM