|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.expr.DynamicScope
com.threerings.tudey.client.TudeySceneView
public class TudeySceneView
Displays a view of a Tudey scene.
| Nested Class Summary | |
|---|---|
protected static class |
TudeySceneView.FloorMaskFilter
Used to select sprites according to their floor flags. |
static interface |
TudeySceneView.TickParticipant
An interface for objects (such as sprites and observers) that require per-tick updates. |
protected static class |
TudeySceneView.UpdateRecord
Contains the state at a single update. |
| Field Summary | |
|---|---|
protected HashSpace |
_actorSpace
The actor space (used for client-side collision detection). |
protected HashIntMap<ActorSprite> |
_actorSprites
Sprites corresponding to the actors in the scene. |
protected TimeSmoother |
_advancedSmoother
Smooths the advanced time. |
protected int |
_advancedTime
The advanced time. |
protected CameraConfig |
_camcfg
The current camera config. |
protected List<CameraConfig> |
_camcfgs
The priority-ordered list of active camera configs. |
protected OrbitCameraHandler |
_camhand
The view's camera handler. |
protected Tickable |
_camtrans
The active camera transition, if any. |
protected ActorSprite |
_controlledSprite
The sprite that the user is controlling. |
protected TudeySceneController |
_ctrl
The controller that created this view. |
protected TudeyContext |
_ctx
The application context. |
protected TimeSmoother |
_delayedSmoother
Smooths the delayed time. |
protected int |
_delayedTime
The delayed time. |
protected boolean |
_disposed
Set when we've been disposed. |
protected TruncatedAverage |
_elapsedAverage
The trailing average of the elapsed times. |
protected List<SpaceElement> |
_elements
Holds collected elements during queries. |
protected HashMap<Object,EntrySprite> |
_entrySprites
Sprites corresponding to the scene entries. |
protected TudeySceneView.FloorMaskFilter |
_floorMaskFilter
Used to find the floor. |
protected Window |
_inputWindow
A window used to gather input events. |
protected Vector3f |
_isect
Used to find the floor. |
protected List<Actor> |
_loadingActors
The remaining actors to add during loading. |
protected List<TudeySceneModel.Entry> |
_loadingEntries
The remaining entries to add during loading. |
protected List<Sprite> |
_loadingMerged
The remaining merged sprites to be initialized during loading. |
protected Window |
_loadingWindow
The loading window, if any. |
protected Map<Coord,Sprite> |
_mergedSprites
Sprites for merged static models mapped by coordinates. |
protected Vector2f |
_penetration
Stores penetration vector during queries. |
protected int |
_ping
The last estimated ping time. |
protected TruncatedAverage |
_pingAverage
The trailing average of the ping times. |
protected TudeySceneConfig |
_placeConfig
The place configuration. |
protected PreloadableSet |
_preloads
The set of resources to preload. |
protected Ray3D |
_ray
Used to find the floor. |
protected List<TudeySceneView.UpdateRecord> |
_records
Records of each update received from the server. |
protected HashScene |
_scene
The OpenGL scene. |
protected TudeySceneModel |
_sceneModel
The scene model. |
protected int |
_smoothedTime
The smoothed time. |
protected TimeSmoother |
_smoother
Smoother used to provide a smoothed time estimate. |
protected boolean |
_suppressMergeUpdates
When set, indicates that we should hold off on updating merged sprites. |
protected ActorSprite |
_targetSprite
The sprite that the camera is tracking. |
protected List<TudeySceneView.TickParticipant> |
_tickParticipants
The list of participants in the tick. |
protected TudeySceneObject |
_tsobj
A casted reference to the scene object. |
protected static float |
ACTOR_LOAD_PERCENT
The percentage of load progress devoted to loading actors. |
protected static long |
BATCH_LOAD_DURATION
The amount of time to spend on each batch when loading. |
protected static float |
ENTRY_LOAD_PERCENT
The percentage of load progress devoted to loading entries. |
protected static float |
ENTRY_MERGE_PERCENT
The percentage of load progress devoted to merging entries. |
protected static float |
PRELOAD_PERCENT
The percentage of load progress devoted to preloading. |
| Fields inherited from class com.threerings.expr.DynamicScope |
|---|
_compoundDepth, _listeners, _owner, _parentScope, _scopeName, _symbols, INVALID_SCOPE |
| Fields inherited from interface com.threerings.tudey.data.TudeyCodes |
|---|
DEFAULT_BUFFER_DELAY, DEFAULT_TICK_INTERVAL |
| Fields inherited from interface com.threerings.presents.data.InvocationCodes |
|---|
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR |
| Fields inherited from interface com.threerings.expr.Scope |
|---|
EPOCH, NOW |
| Constructor Summary | |
|---|---|
TudeySceneView(TudeyContext ctx)
Creates a new scene view for use in the editor. |
|
TudeySceneView(TudeyContext ctx,
TudeySceneController ctrl)
Creates a new scene view. |
|
| Method Summary | |
|---|---|
protected void |
addActorSprite(Actor actor)
Adds a sprite for the specified actor. |
void |
addCameraConfig(CameraConfig camcfg)
Adds a camera config to the stack with no transition. |
void |
addCameraConfig(CameraConfig camcfg,
float transition,
Easing easing)
Adds a camera config to the stack with an option transition. |
protected void |
addEntrySprite(TudeySceneModel.Entry entry)
Adds a sprite for the specified entry. |
protected void |
addExtraPreloads()
Gives the view a chance to add any required additional preloads to the set. |
protected void |
addPreloads(Actor actor)
Adds the specified actor's preloads to the set if appropriate. |
protected void |
addPreloads(Effect effect)
Adds the specified effect's preloads to the set if appropriate. |
protected void |
addPreloads(TudeySceneModel.Entry entry)
Adds the specified entry's preloads to the set if appropriate. |
void |
addTickParticipant(TudeySceneView.TickParticipant participant)
Adds a participant to tick at each frame. |
void |
addTickParticipant(TudeySceneView.TickParticipant participant,
boolean prepend)
Adds a participant to tick at each frame. |
boolean |
canMerge()
Checks whether we should attempt to merge static models. |
void |
clear()
|
boolean |
collides(Actor actor,
Shape shape)
Checks whether the actor is colliding with anything. |
boolean |
collides(int mask,
Shape shape)
Checks for collision against a mask. |
void |
composite()
Adds this object's Dependencys and Enqueueables to the compositor in
preparation for rendering. |
protected float |
createActorSpriteBatch()
Creates a batch of actor sprites as part of the loading process. |
protected OrbitCameraHandler |
createCameraHandler()
Creates the camera handler for the view. |
protected float |
createEntrySpriteBatch()
Creates a batch of entry sprites as part of the loading process. |
void |
didLeavePlace(PlaceObject plobj)
|
boolean |
displayMessage(ChatMessage msg,
boolean alreadyDisplayed)
|
protected boolean |
doLoading()
Returns true if we should perform loading operations. |
void |
entryAdded(TudeySceneModel.Entry entry)
Notes that an entry has been added to the scene. |
void |
entryRemoved(TudeySceneModel.Entry oentry)
Notes that an entry has been removed from the scene. |
void |
entryUpdated(TudeySceneModel.Entry oentry,
TudeySceneModel.Entry nentry)
Notes that an entry has been updated within the scene. |
HashSpace |
getActorSpace()
Returns a reference to the actor space. |
ActorSprite |
getActorSprite(int id)
Returns a reference to the actor sprite with the supplied id, or null if it
doesn't exist. |
int |
getAdvancedTime()
Returns the advanced time, which is the smoothed time plus an interval that compensates for buffering and latency. |
int |
getBufferDelay()
Returns the delay with which to display information received from the server in order to compensate for network jitter and dropped packets. |
OrbitCameraHandler |
getCameraHandler()
Returns a reference to the camera handler. |
protected String |
getChatType()
Returns the valid chat type for this view. |
int |
getControlDelta()
Returns the client control delta (the difference between the advanced and delayed times). |
ActorSprite |
getControlledSprite()
Returns a reference to the controlled sprite. |
TudeySceneController |
getController()
Returns a reference to the scene controller. |
int |
getDelayedTime()
Returns the delayed client time, which is the smoothed time minus a delay that compensates for network jitter and dropped packets. |
int |
getElapsed()
Returns the average of the elapsed times. |
EntrySprite |
getEntrySprite(Object key)
Returns the sprite corresponding to the entry with the given key. |
Transform3D |
getFloorTransform(float x,
float y,
float rotation,
int mask)
Gets the transform of an object on the floor with the provided coordinates. |
Transform3D |
getFloorTransform(float x,
float y,
float rotation,
int mask,
Transform3D result)
Gets the transform of an object on the floor with the provided coordinates. |
Transform3D |
getFloorTransform(float x,
float y,
float rotation,
com.google.common.base.Predicate<? super SceneElement> filter)
Gets the transform of an object on the floor with the provided coordinates. |
Transform3D |
getFloorTransform(float x,
float y,
float rotation,
com.google.common.base.Predicate<? super SceneElement> filter,
Transform3D result)
Gets the transform of an object on the floor with the provided coordinates. |
float |
getFloorZ(float x,
float y,
int mask,
float defvalue)
Returns the z coordinate of the floor at the provided coordinates, or the provided default if no floor is found. |
float |
getFloorZ(float x,
float y,
com.google.common.base.Predicate<? super SceneElement> filter,
float defvalue)
Returns the z coordinate of the floor at the provided coordinates, or the provided default if no floor is found. |
int |
getInputAdvance()
Returns the interval ahead of the smoothed server time (which estimates the server time minus one-way latency) at which we schedule input events. |
Window |
getInputWindow()
Returns a reference to the window used to gather input events. |
Sprite |
getIntersection(Ray3D ray,
Vector3f location)
Checks for an intersection between the provided ray and the sprites in the scene. |
Sprite |
getIntersection(Ray3D ray,
Vector3f location,
com.google.common.base.Predicate<? super Sprite> filter)
Checks for an intersection between the provided ray and the sprites in the scene. |
protected int |
getMergeGranularity()
Returns the merge granularity to use for static tile models. |
boolean |
getPenetration(Actor actor,
Shape shape,
Vector2f result)
Checks whether the actor is colliding with anything and, if it is, populates the provided object with the penetration vector (the minimum translation required to cancel the penetration). |
int |
getPing()
Returns the average of the ping times. |
HashScene |
getScene()
Returns a reference to the view scene. |
TudeySceneModel |
getSceneModel()
Returns a reference to the scene model. |
int |
getSmoothedTime()
Returns the smoothed estimate of the server time (plus network latency) calculated at the start of each tick. |
Sprite |
getSprite(EntityKey key)
Returns the sprite corresponding to the entity with the given key. |
ActorSprite |
getTargetSprite()
Returns a reference to the target sprite. |
protected float |
initMergedSpriteBatch()
Initializes a batch of merged sprites as part of the loading process. |
protected Window |
maybeCreateLoadingWindow(TudeySceneModel model)
Creates the loading window, or returns null to skip preloading. |
Model |
maybeMerge(int x,
int y,
ConfigReference<ModelConfig> ref,
Transform3D transform,
int floorFlags)
Attempts to merge a static model. |
protected void |
noteJitter(int value)
Notes a jitter value (difference between elapsed time on server and elapsed time on client between two successive updates). |
void |
occupantEntered(OccupantInfo info)
|
void |
occupantLeft(OccupantInfo info)
|
void |
occupantUpdated(OccupantInfo oinfo,
OccupantInfo ninfo)
|
EffectSprite |
prefireEffect(int timestamp,
EntityKey target,
Vector2f translation,
float rotation,
ConfigReference<EffectConfig> ref)
Requests to prefire an effect. |
ActorSprite |
prespawnActor(int timestamp,
ActorSprite source,
Vector2f translation,
float rotation,
ConfigReference<ActorConfig> ref)
Requests to prespawn an actor. |
boolean |
processSceneDelta(SceneDeltaEvent event)
Processes a scene delta received from the server. |
protected boolean |
pruneRecords(int reference)
Prunes all records before the supplied reference time, if found. |
void |
removeCameraConfig(CameraConfig camcfg)
Removes a camera config from the stack with no transition. |
void |
removeCameraConfig(CameraConfig camcfg,
float transition,
Easing easing)
Removes a camera config from the stack with an optional transition. |
void |
removeTickParticipant(TudeySceneView.TickParticipant participant)
Removes a participant from the tick list. |
protected void |
setCameraConfig(CameraConfig camcfg,
float transition,
Easing easing)
Sets the camera configuration (optionally transitioning to it over time). |
void |
setSceneModel(TudeySceneModel model)
Sets the scene model for this view. |
void |
tick(float elapsed)
Updates the state of this object based on the elapsed time in seconds. |
boolean |
unmerge(int x,
int y,
ConfigReference<ModelConfig> ref,
Transform3D transform)
Unmerges a model. |
void |
updateControlledSprite()
Updates the controlled sprite base on the controlled id. |
protected void |
updateLoadingWindow(float pct)
Updates the loading window with the current percentage of resources loaded. |
void |
updateTargetSprite()
Updates the target sprite based on the target id. |
void |
wasAdded()
Notifies the view that it is going to be rendered. |
void |
wasRemoved()
Notifies the view that it will no longer be rendered. |
void |
willEnterPlace(PlaceObject plobj)
|
| Methods inherited from class com.threerings.expr.DynamicScope |
|---|
addListener, dispose, endCompoundUpdate, get, getParentScope, getScopeName, put, remove, removeListener, scopeUpdated, setParentScope, startCompoundUpdate, wasUpdated |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected TudeyContext _ctx
protected TudeySceneController _ctrl
protected TudeySceneConfig _placeConfig
protected TudeySceneObject _tsobj
protected OrbitCameraHandler _camhand
protected Window _inputWindow
protected Window _loadingWindow
protected PreloadableSet _preloads
protected List<TudeySceneModel.Entry> _loadingEntries
protected List<Sprite> _loadingMerged
protected List<Actor> _loadingActors
@Scoped protected HashScene _scene
protected TudeySceneModel _sceneModel
protected TimeSmoother _smoother
protected int _smoothedTime
protected TimeSmoother _delayedSmoother
protected int _delayedTime
protected TimeSmoother _advancedSmoother
protected int _advancedTime
protected int _ping
protected TruncatedAverage _pingAverage
protected TruncatedAverage _elapsedAverage
protected List<TudeySceneView.UpdateRecord> _records
protected HashMap<Object,EntrySprite> _entrySprites
protected HashIntMap<ActorSprite> _actorSprites
protected HashSpace _actorSpace
protected List<TudeySceneView.TickParticipant> _tickParticipants
protected Map<Coord,Sprite> _mergedSprites
protected boolean _suppressMergeUpdates
protected ActorSprite _targetSprite
protected ActorSprite _controlledSprite
protected List<CameraConfig> _camcfgs
protected CameraConfig _camcfg
protected Tickable _camtrans
protected boolean _disposed
protected Ray3D _ray
protected Vector3f _isect
protected TudeySceneView.FloorMaskFilter _floorMaskFilter
protected List<SpaceElement> _elements
protected Vector2f _penetration
protected static final long BATCH_LOAD_DURATION
protected static final float PRELOAD_PERCENT
protected static final float ENTRY_LOAD_PERCENT
protected static final float ENTRY_MERGE_PERCENT
protected static final float ACTOR_LOAD_PERCENT
| Constructor Detail |
|---|
public TudeySceneView(TudeyContext ctx)
public TudeySceneView(TudeyContext ctx,
TudeySceneController ctrl)
| Method Detail |
|---|
public TudeySceneController getController()
public OrbitCameraHandler getCameraHandler()
public Window getInputWindow()
public HashScene getScene()
public HashSpace getActorSpace()
public int getControlDelta()
public int getDelayedTime()
public int getBufferDelay()
public int getPing()
public int getElapsed()
public int getAdvancedTime()
public int getInputAdvance()
public int getSmoothedTime()
public void setSceneModel(TudeySceneModel model)
public Sprite getSprite(EntityKey key)
public EntrySprite getEntrySprite(Object key)
public ActorSprite getActorSprite(int id)
null if it
doesn't exist.
public ActorSprite getTargetSprite()
public ActorSprite getControlledSprite()
public boolean canMerge()
public Model maybeMerge(int x,
int y,
ConfigReference<ModelConfig> ref,
Transform3D transform,
int floorFlags)
null if the model cannot be merged.
public boolean unmerge(int x,
int y,
ConfigReference<ModelConfig> ref,
Transform3D transform)
public Sprite getIntersection(Ray3D ray,
Vector3f location)
location - a vector to populate with the location of the intersection, if any.
null for
none.
public Sprite getIntersection(Ray3D ray,
Vector3f location,
com.google.common.base.Predicate<? super Sprite> filter)
location - a vector to populate with the location of the intersection, if any.
null for
none.
public Transform3D getFloorTransform(float x,
float y,
float rotation,
int mask)
mask - the floor mask to use for the query.
public Transform3D getFloorTransform(float x,
float y,
float rotation,
com.google.common.base.Predicate<? super SceneElement> filter)
filter - the floor filter to use for the query.
public Transform3D getFloorTransform(float x,
float y,
float rotation,
int mask,
Transform3D result)
mask - the floor mask to use for the query.
public Transform3D getFloorTransform(float x,
float y,
float rotation,
com.google.common.base.Predicate<? super SceneElement> filter,
Transform3D result)
filter - the floor filter to use for the query.
public float getFloorZ(float x,
float y,
int mask,
float defvalue)
mask - the floor mask to use for the query.
public float getFloorZ(float x,
float y,
com.google.common.base.Predicate<? super SceneElement> filter,
float defvalue)
filter - the floor filter to use for the query.
public ActorSprite prespawnActor(int timestamp,
ActorSprite source,
Vector2f translation,
float rotation,
ConfigReference<ActorConfig> ref)
public EffectSprite prefireEffect(int timestamp,
EntityKey target,
Vector2f translation,
float rotation,
ConfigReference<EffectConfig> ref)
public boolean processSceneDelta(SceneDeltaEvent event)
public void addTickParticipant(TudeySceneView.TickParticipant participant)
public void addTickParticipant(TudeySceneView.TickParticipant participant,
boolean prepend)
prepend - if true, prepend the participant so that it is ticked last (participants
are usually ticked in reverse order of addition).public void removeTickParticipant(TudeySceneView.TickParticipant participant)
public void updateTargetSprite()
public void updateControlledSprite()
public void addCameraConfig(CameraConfig camcfg)
public void addCameraConfig(CameraConfig camcfg,
float transition,
Easing easing)
public void removeCameraConfig(CameraConfig camcfg)
public void removeCameraConfig(CameraConfig camcfg,
float transition,
Easing easing)
public void wasAdded()
GlView
wasAdded in interface GlViewpublic void wasRemoved()
GlView
wasRemoved in interface GlViewpublic void tick(float elapsed)
Tickable
tick in interface Tickablepublic void composite()
CompositableDependencys and Enqueueables to the compositor in
preparation for rendering.
composite in interface Compositablepublic void willEnterPlace(PlaceObject plobj)
willEnterPlace in interface PlaceViewpublic void didLeavePlace(PlaceObject plobj)
didLeavePlace in interface PlaceViewpublic void entryAdded(TudeySceneModel.Entry entry)
TudeySceneModel.Observer
entryAdded in interface TudeySceneModel.Observer
public void entryUpdated(TudeySceneModel.Entry oentry,
TudeySceneModel.Entry nentry)
TudeySceneModel.Observer
entryUpdated in interface TudeySceneModel.Observerpublic void entryRemoved(TudeySceneModel.Entry oentry)
TudeySceneModel.Observer
entryRemoved in interface TudeySceneModel.Observerpublic void occupantEntered(OccupantInfo info)
occupantEntered in interface OccupantObserverpublic void occupantLeft(OccupantInfo info)
occupantLeft in interface OccupantObserver
public void occupantUpdated(OccupantInfo oinfo,
OccupantInfo ninfo)
occupantUpdated in interface OccupantObserver
public boolean displayMessage(ChatMessage msg,
boolean alreadyDisplayed)
displayMessage in interface ChatDisplaypublic void clear()
clear in interface ChatDisplaypublic TudeySceneModel getSceneModel()
ActorAdvancer.Environment
getSceneModel in interface ActorAdvancer.Environment
public boolean getPenetration(Actor actor,
Shape shape,
Vector2f result)
ActorAdvancer.Environment
getPenetration in interface ActorAdvancer.Environment
public boolean collides(Actor actor,
Shape shape)
ActorAdvancer.Environment
collides in interface ActorAdvancer.Environment
public boolean collides(int mask,
Shape shape)
protected OrbitCameraHandler createCameraHandler()
protected void setCameraConfig(CameraConfig camcfg,
float transition,
Easing easing)
protected Window maybeCreateLoadingWindow(TudeySceneModel model)
null to skip preloading.
protected float createEntrySpriteBatch()
protected float initMergedSpriteBatch()
protected float createActorSpriteBatch()
protected void updateLoadingWindow(float pct)
pct is equal to 1.0, this method should remove the loading window (or start
fading it out).
protected void addEntrySprite(TudeySceneModel.Entry entry)
protected void addActorSprite(Actor actor)
protected void addPreloads(TudeySceneModel.Entry entry)
protected void addPreloads(Actor actor)
protected void addPreloads(Effect effect)
protected void addExtraPreloads()
protected int getMergeGranularity()
protected void noteJitter(int value)
protected boolean pruneRecords(int reference)
protected String getChatType()
protected boolean doLoading()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||