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 SceneProperties
props
-
Constructor Summary
Constructors Modifier Constructor Description protected
Scene()
Scene(WorldManager world, Client client)
Creates new Scene for Client client
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFilter(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 boxesVRObject
get(ID id)
Retrieve an object in the scene FIXME used only in tests?VRObject
getClosest(double x, double y, double z)
Returns the closest Transform to the specified pointprotected boolean
isVisible(VRObject o)
Test Transform against set of filters.void
loadPermanents()
void
logout(Client c)
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(VRObject o)
Offer an object to the scene.void
publish(VRObject obj)
Publish an object - notify all clients in rangevoid
publishAll(Collection<VRObject> objects)
Offer some object(s) to scenes of all listeners.void
removeAll()
Remove all objects from the scene, and stop listening to changes.void
removeFilter(String name)
void
setDirty()
Ensure the scene will be updated on next update() call.int
size()
void
unpublish()
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
update()
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)
-
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)
-
-