Package org.vrspace.server.core
Class Scene
java.lang.Object
org.vrspace.server.core.Scene
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
-
Constructor Summary
ModifierConstructorDescriptionprotected
Scene()
Scene
(WorldManager world, Client client) Creates new Scene for Client client -
Method Summary
Modifier and TypeMethodDescriptionvoid
dirty()
Ensure the scene will be updated on next update() call.get
(double x, double y, double z, double range) Returns transforms within the range Does not return permanent objects TODO: check bounding boxesRetrieve an object in the scene FIXME used only in tests?getClosest
(double x, double y, double z) Returns the closest Transform to the specified pointprotected boolean
Test Transform against set of filters.void
void
Notification that a client has logged out - removes it from the scene and sends Remove message.void
offer
(Collection<VRObject> objects) Offer object(s) to the scene.void
Offer an object to the scene.void
Publish an object - notify all clients in rangevoid
publishAll
(Collection<VRObject> objects) Offer some object(s) to scenes of all listeners.void
Remove all objects from the scene, and stop listening to changes.void
removeFilter
(String name) int
size()
void
Unpublish this client - notifies all clients in the range that it has logged out.void
unpublish
(Collection<VRObject> objects) Remove objects and notify all clients they are removed.void
Unpublish an object: WorldManager deletes all temporary owned objects when guest client exits, but they also need to be removed from all scenes.void
update()
Update the scene current client's coordinates.
-
Field Details
-
props
-
-
Constructor Details
-
Scene
protected Scene() -
Scene
Creates new Scene for Client client
-
-
Method Details
-
size
public int size() -
loadPermanents
public void loadPermanents() -
update
public void update()Update the scene current client's coordinates. -
offer
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
Offer object(s) to the scene. Sends out only one Add command with accepted objects.- Parameters:
objects
-- See Also:
-
publishAll
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:
-
publish
Publish an object - notify all clients in range- Parameters:
obj
-- See Also:
-
unpublish
Remove objects and notify all clients they are removed.- Parameters:
objects
-
-
logout
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:
-
unpublish
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
-
-
dirty
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
Test Transform against set of filters. Client's transform don't pass the test. -
get
Retrieve an object in the scene FIXME used only in tests? -
getClosest
Returns the closest Transform to the specified point- Throws:
NoSuchElementException
- if scene is empty
-
get
Returns transforms within the range Does not return permanent objects TODO: check bounding boxes -
addFilter
-
removeFilter
-