|
|||||||||
| Home >> All >> org >> vrspace >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.vrspace.server
Class Scene

java.lang.Objectorg.vrspace.server.Scene
- public class Scene
- extends java.lang.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.
It also has some basic filtering capabilities - not tested.
| Field Summary | |
private boolean |
active
|
private Client |
client
|
private Dispatcher |
dispatcher
|
private boolean |
filterChanged
|
private java.util.HashSet |
inactive
|
private long |
lastUpdate
|
private java.util.LinkedList |
members
|
private java.util.Vector |
objectFilter
|
private double |
oldx
|
private double |
oldy
|
private double |
oldz
|
private java.lang.Object[] |
permanents
|
private double |
range
|
private double |
resolution
|
private int |
size
|
private long |
timeout
|
private java.util.Vector |
transformFilter
|
| Constructor Summary | |
Scene(Client client)
Creates new Scene for Client client |
|
| Method Summary | |
void |
addFilter(org.vrspace.attributes.ObjectFilter filter)
Add TransformFilter or VRObjectFilter |
protected void |
addTransform(Transform t)
Add Transform and it's members to the scene. |
void |
clear()
Clears the scene |
boolean |
contains(java.lang.Object o)
Does the scene contain o? |
VRObject[] |
get(java.lang.Class cl)
Returns all class instances within the scene |
Transform[] |
get(double x,
double y,
double z,
double range)
Returns transforms within the range Does not return permanent objects TODO: check bounding boxes |
VRObject |
get(java.lang.String className,
long id)
Retreives a VRObject from the scene or null if it's not in the scene. TODO: implement! |
Transform[] |
getAll()
Retreive all the Transforms in the scene |
VRObject |
getClosest(double x,
double y,
double z,
java.lang.Class cl)
Returns the closest object of some class to the specified point |
double |
getRange()
returns scene range (meters) |
int |
getSize()
return the scene size |
void |
init()
Initialize the scene. |
void |
remove(Transform t)
Removes an object from the scene. |
void |
removeAll()
Remove all objects from the scene. |
void |
removeFilter(org.vrspace.attributes.ObjectFilter filter)
Remove a TransformFilter/VRObjectFilter |
void |
setDirty()
Ensure the scene will be updated on next update() call. |
void |
setRange(double range)
set scene size, in meters |
void |
setResolution(double resolution)
set scene update resolution, in meters |
void |
setSize(int size)
set scene size, in number of transforms |
void |
setTimeout(long timeout)
set scene timeout, in milliseconds |
protected VRObject |
testObject(VRObject o)
Test an object against set of filters. |
protected boolean |
testTransform(Transform t)
Test Transform against set of filters. |
void |
update()
Update the scene with old coordinates. |
void |
update(double x,
double y,
double z)
Update the scene with coordinates xyz |
void |
update(Transform t)
Update the scene with coordinates of t |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
oldx
private double oldx
oldy
private double oldy
oldz
private double oldz
range
private double range
resolution
private double resolution
size
private int size
timeout
private long timeout
members
private java.util.LinkedList members
permanents
private java.lang.Object[] permanents
inactive
private java.util.HashSet inactive
dispatcher
private Dispatcher dispatcher
client
private Client client
transformFilter
private java.util.Vector transformFilter
objectFilter
private java.util.Vector objectFilter
filterChanged
private boolean filterChanged
lastUpdate
private long lastUpdate
active
private boolean active
| Constructor Detail |
Scene
public Scene(Client client)
- Creates new Scene for Client client
| Method Detail |
init
public void init()
- Initialize the scene.
addTransform
protected void addTransform(Transform t) throws java.lang.Exception
- Add Transform and it's members to the scene. Filters are checked, called from constructor
get
public VRObject get(java.lang.String className, long id) throws java.lang.Exception
- Retreives a VRObject from the scene or null if it's not in the scene.
TODO: implement!
getClosest
public VRObject getClosest(double x, double y, double z, java.lang.Class cl)
- Returns the closest object of some class to the specified point
get
public VRObject[] get(java.lang.Class cl)
- Returns all class instances within the scene
get
public Transform[] get(double x, double y, double z, double range)
- Returns transforms within the range
Does not return permanent objects
TODO: check bounding boxes
update
public void update()
throws java.lang.Exception
- Update the scene with old coordinates. Use this after setDirty() and
scene parameter changes i.e. setSize(), in addFilter() etc.
update
public void update(Transform t) throws java.lang.Exception
- Update the scene with coordinates of t
update
public void update(double x,
double y,
double z)
throws java.lang.Exception
- Update the scene with coordinates xyz
setDirty
public void setDirty()
- Ensure the scene will be updated on next update() call.
getAll
public Transform[] getAll()
- Retreive all the Transforms in the scene
remove
public void remove(Transform t) throws java.lang.Exception
- Removes an object from the scene. Next update() may add it again.
removeAll
public void removeAll()
- Remove all objects from the scene. Calls Client.removeObject() for each
object in the scene, except for user's Client object, but removes
client's parent Transform. Usage: entering new world. After client's
transform has been removed, it should stop sending movement
clear
public void clear()
- Clears the scene
contains
public boolean contains(java.lang.Object o)
- Does the scene contain o?
setRange
public void setRange(double range)
- set scene size, in meters
getRange
public double getRange()
- returns scene range (meters)
setSize
public void setSize(int size)
- set scene size, in number of transforms
getSize
public int getSize()
- return the scene size
setResolution
public void setResolution(double resolution)
- set scene update resolution, in meters
setTimeout
public void setTimeout(long timeout)
- set scene timeout, in milliseconds
addFilter
public void addFilter(org.vrspace.attributes.ObjectFilter filter)
- Add TransformFilter or VRObjectFilter
removeFilter
public void removeFilter(org.vrspace.attributes.ObjectFilter filter)
- Remove a TransformFilter/VRObjectFilter
testTransform
protected boolean testTransform(Transform t)
- Test Transform against set of filters. Client's transform don't pass the test.
testObject
protected VRObject testObject(VRObject o)
- Test an object against set of filters. Owner of this scene and his Transform
never pass the test. Returns null if object did not pass, or the same object,
maybe modified by filter(s).
|
|||||||||
| Home >> All >> org >> vrspace >> [ server overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.vrspace.server.Scene