indexing description: "[ This factory creates targets. ]" date: "$Date$" revision: "$Revision$" class TARGET_FACTORY inherit EM_3D_OBJECT_FACTORY EM_SHARED_BITMAP_FACTORY export {NONE} all end EM_CONSTANTS export {NONE} all end GL_FUNCTIONS export {NONE} all end GLU_FUNCTIONS export {NONE} all end create make feature -- Initialization make is -- Create object. local bitmap: EM_BITMAP a_texture: GL_STATIC_MIPMAP_TEXTURE do bitmap_factory.create_bitmap_from_image ("objects/cubemap.jpg") bitmap := bitmap_factory.last_bitmap create a_texture.make_from_surface (bitmap) a_texture.save tex_spheremap := a_texture.id end feature -- Commands create_target_object: TARGET is -- Create a new target object that is collidable and includes the model do create result.make (create_object) end feature -- Status object_width: DOUBLE is 2.0 -- Size of bounding box in x direction of created objects object_height: DOUBLE is 2.0 -- Size of bounding box in y direction of created objects object_depth: DOUBLE is 2.0 -- Size of bounding box in z direction of created objects feature {NONE} -- implementation tex_spheremap: INTEGER; -- Spheremap texture specify_object is -- Specify an object that can be drawn in the origin -- (front, left, lower corner of bounding box = 0,0,0) local quadric: POINTER do gl_push_attrib ( Em_gl_enable_bit | Em_gl_color_buffer_bit) gl_enable (Em_gl_texture_2d) -- enable texture generation and set texture gl_tex_geni (EM_GL_S, EM_GL_TEXTURE_GEN_MODE, EM_GL_SPHERE_MAP) gl_tex_geni (EM_GL_T, Em_GL_TEXTURE_GEN_MODE, Em_GL_SPHERE_MAP) gl_enable (Em_GL_TEXTURE_GEN_S) gl_enable (Em_GL_TEXTURE_GEN_T) gl_bind_texture (Em_gl_texture_2d, tex_spheremap) -- draw a sphere in the center gl_translatef (1, 1, -1) quadric := glu_new_quadric glu_sphere (quadric, 1, 64, 64) glu_quadric_normals (quadric, Em_GLU_SMOOTH) glu_quadric_texture (quadric, Em_GL_TRUE ) -- restore old attrib stack gl_pop_attrib end end