Package org.vrspace.server.core
Class Scene
- java.lang.Object
-
- org.vrspace.server.core.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.
-
-
Field Summary
Fields Modifier and Type Field Description protected ScenePropertiesprops
-
Constructor Summary
Constructors Modifier Constructor Description protectedScene()Scene(WorldManager world, Client client)Creates new Scene for Client client
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFilter(String name, Filter filter)List<VRObject>get(double x, double y, double z, double range)Returns transforms within the range Does not return permanent objects TODO: check bounding boxesVRObjectget(ID id)Retrieve an object in the scene FIXME used only in tests?VRObjectgetClosest(double x, double y, double z)Returns the closest Transform to the specified pointprotected booleanisVisible(VRObject o)Test Transform against set of filters.voidloadPermanents()voidlogout(Client c)Notification that a client has logged out - removes it from the scene and sends Remove message.voidoffer(Collection<VRObject> objects)Offer object(s) to the scene.voidoffer(VRObject o)Offer an object to the scene.voidpublish(VRObject obj)Publish an object - notify all clients in rangevoidpublishAll(Collection<VRObject> objects)Offer some object(s) to scenes of all listeners.voidremoveAll()Remove all objects from the scene, and stop listening to changes.voidremoveFilter(String name)voidsetDirty()Ensure the scene will be updated on next update() call.intsize()voidunpublish()Unpublish this client - notifies all clients in the range that it has logged out.voidunpublish(Collection<VRObject> objects)Remove objects and notify all clients they are removed.voidunpublish(VRObject obj)Unpublish an object: WorldManager deletes all temporary owned objects when guest client exits, but they also need to be removed from all scenes.voidupdate()Update the scene current client's coordinates.
-
-
-
Field Detail
-
props
protected SceneProperties props
-
-
Constructor Detail
-
Scene
protected Scene()
-
Scene
public Scene(WorldManager world, Client client)
Creates new Scene for Client client
-
-
Method Detail
-
size
public int size()
-
loadPermanents
public void loadPermanents()
-
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)
-
unpublish
public void unpublish(VRObject obj)
Unpublish an object: WorldManager deletes all temporary owned objects when guest client exits, but they also need to be removed from all scenes.- Parameters:
obj-
-
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. Also stops listening to changes of permanent objects
-
isVisible
protected boolean isVisible(VRObject o)
Test Transform against set of filters. Client's transform don't pass the test.
-
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
-
removeFilter
public void removeFilter(String name)
-
-