indexing description: "[ This class describes a building ]" date: "$Date$" revision: "$Revision$" "This class describes a building" date: "$Date$" revision: "$Revision$" class BUILDING inherit EM_3D_SPHERE_COLLIDABLE EM_3D_OBJECT GLU_FUNCTIONS export {NONE} all end DOUBLE_MATH export {NONE} all end create make feature -- Initialization make (a_model: EM_3D_OBJECT) is -- Initialise building with 'a_model'. do model := a_model width := model.width height := model.height depth := model.depth scale.set(1,1,1) end feature -- Status type_id: INTEGER is 2 -- The id given to all instances of `current' generating class feature -- Collision detection bounding_sphere_center: EM_3D_VECT is -- Center of the bounding sphere do -- We don't use a correct bounding sphere -- our sphere should be positioned at the base of the building -- and only depends on width and depth result.set (origin.x + 0.5*width, origin.y, origin.z - 0.5*depth) end bounding_sphere_radius: DOUBLE is -- Radius of the bounding sphere do -- We don't use a correct bounding sphere -- our sphere should be positioned at the base of the building -- and only depends on width and depth result := width.max (depth) result := result / 2 end feature {EM_3D_OBJECT} -- Implementation of the 3d object draw_object is do model.draw_object end feature {EM_COLLISION_DETECTOR_3D} -- Implementation of collision detection on_collide (other: EM_COLLIDABLE_3D) is -- `current' collided with `other' do end feature {NONE} -- Implementation model: EM_3D_OBJECT -- The building model end