indexing description: "[ A movable is something that can be moved inside a scene. There objects whose type conforms to EM3D_MOVABLE can be attached to a EM3D_SCENE_NODE. It may be curious at first: An instance of EM3D_MOVEABLE has no position attributes. Instead you may invoke the `scene_node' feature to get it's scene node and then use `world_position'. Other features like `world_orientation' exist. ]" date: "$Date$" revision: "$Revision$" deferred class EM3D_MOVABLE inherit EM3D_IDENTIFIED[ EM3D_MOVABLE ] redefine type, default_name end EM3D_VISIBILITY_SUPPORT undefine copy, is_equal end feature{NONE} -- Initialisation make(a_scene_manager: EM3D_SCENE_MANAGER) is -- Init do scene_manager := a_scene_manager ensure scene_manager_set: scene_manager = a_scene_manager end feature {EM3D_IDENTIFIED} default_name: STRING is once result := "MOVABLE" end type: INTEGER is -- Specify the identified type once result := em3d_movable_identified end feature -- Access parent: EM3D_SCENE_NODE -- Parent scene node of movable. -- require -- has_parent: has_parent -- attribute -- end feature {EM3D_SCENE_NODE} -- Access scene_manager: EM3D_SCENE_MANAGER -- Scene manager -- The scene manager can never be changed again. -- This can later be used to check for conforming usage of movable objects (avoid CAT calls) -- and express invariants. world_position: EM_VECTOR3D is -- Specify the world position do if has_parent then result := parent.world_position end end world_orientation: EM_QUATERNION is -- Specify the world orientation do if has_parent then result := parent.world_orientation end end world_transformation: EM_MATRIX44 is -- Specify the world orientation do if has_parent then result := parent.world_transformation end end feature -- Status report has_parent: BOOLEAN is -- Has object a parent scene node? do Result := parent /= Void end feature -- Cursor movement feature {EM3D_SCENE_NODE}-- Element change set_parent (a_parent: EM3D_SCENE_NODE) is -- Set `parent' to `a_parent' require no_parent_or_void: (not has_parent) or (a_parent = Void) -- this ensures, that this object is not already added to a certain list. do parent := a_parent ensure parent_set: parent = a_parent end feature -- Removal remove is -- Remove object from parens list require has_parent: has_parent do parent.remove_object (Current) parent := Void end feature {EM3D_SCENE_NODE} -- Basic operations render_opengl is -- Perform opengl command. This is a hack to test the current implementation, maybe do this different later... deferred end feature {NONE} -- Implementation invariant properly_linked: has_parent implies parent.has_object (Current) end