Class Scene


  • public class Scene
    extends Object
    This keeps track of objects visible to the Client. This scene uses coordinates to determine which objects are in range. Scene is updated when client moves more than resolution meters, or when timeout occurs.
    • Constructor Detail

      • Scene

        protected Scene()
      • Scene

        public Scene​(WorldManager world,
                     Client client)
        Creates new Scene for Client client
    • Method Detail

      • size

        public int size()
      • update

        public void update()
        Update the scene current client's coordinates.
      • offer

        public void offer​(VRObject o)
        Offer an object to the scene. Accepted new objects in range and visible (passing all filters). Objects without positions, or with zero positions are also accepted, so that new objects become immediately visible. If accepted, sends Add command to the client.
        Parameters:
        o -
      • offer

        public void offer​(Collection<VRObject> objects)
        Offer object(s) to the scene. Sends out only one Add command with accepted objects.
        Parameters:
        objects -
        See Also:
        offer(VRObject)
      • publishAll

        public void publishAll​(Collection<VRObject> objects)
        Offer some object(s) to scenes of all listeners. E.g. a new object just added to the space, or client just logged in (starting the session), or entering a new space.
        Parameters:
        objects -
        See Also:
        offer(Collection)
      • publish

        public void publish​(VRObject obj)
        Publish an object - notify all clients in range
        Parameters:
        obj -
        See Also:
        offer(VRObject)
      • unpublish

        public void unpublish​(Collection<VRObject> objects)
        Remove objects and notify all clients they are removed.
        Parameters:
        objects -
      • logout

        public void logout​(Client c)
        Notification that a client has logged out - removes it from the scene and sends Remove message.
        Parameters:
        c -
      • unpublish

        public void unpublish()
        Unpublish this client - notifies all clients in the range that it has logged out.
        See Also:
        logout(Client)
      • setDirty

        public void setDirty()
        Ensure the scene will be updated on next update() call.
      • removeAll

        public void removeAll()
        Remove all objects from the scene, and stop listening to changes. Next call to update() will reestablish the event model, and may cause sending removal messages to the client.
      • isVisible

        protected boolean isVisible​(VRObject o)
        Test Transform against set of filters. Client's transform don't pass the test.
      • get

        public VRObject get​(ID id)
        Retrieve an object in the scene FIXME used only in tests?
      • getClosest

        public VRObject getClosest​(double x,
                                   double y,
                                   double z)
        Returns the closest Transform to the specified point
        Throws:
        NoSuchElementException - if scene is empty
      • get

        public List<VRObject> get​(double x,
                                  double y,
                                  double z,
                                  double range)
        Returns transforms within the range Does not return permanent objects TODO: check bounding boxes
      • addFilter

        public void addFilter​(String name,
                              Filter filter)
      • removeFilter

        public void removeFilter​(String name)