public class PickEventSession
extends java.lang.Object
Collision roots may either be perspective or orthogonal and the appropriate type of collision is done. The ViewPort's camera is used to detect the difference.
Events are delivered in near to far order to any 'target' that the cursor ray collides with until the event is consumed. Enter and exit events are delivered as targets are acquired or lost.
If a button down event happens over a target then it is considered 'captured'. This spatial will be provided to subsequent events in addition to the normal target. Furthermore, any new motion events are always delivered to the captured spatial first.
Modifier and Type | Class and Description |
---|---|
static class |
PickEventSession.RootEntry |
Modifier | Constructor and Description |
---|---|
|
PickEventSession() |
protected |
PickEventSession(java.util.Map<com.jme3.collision.Collidable,PickEventSession.RootEntry> roots) |
Modifier and Type | Method and Description |
---|---|
void |
addCollisionRoot(com.jme3.scene.Spatial root,
com.jme3.renderer.ViewPort viewPort) |
void |
addCollisionRoot(com.jme3.scene.Spatial root,
com.jme3.renderer.ViewPort viewPort,
java.lang.String layer) |
void |
addCollisionRoot(com.jme3.renderer.ViewPort viewPort) |
void |
addCollisionRoot(com.jme3.renderer.ViewPort viewPort,
java.lang.String layer) |
boolean |
buttonEvent(int buttonIndex,
int x,
int y,
boolean pressed) |
void |
clearHitTarget()
Clears the current hit target that is used for entered/exited processing.
|
PickEventSession |
clone()
Creates a new PickEventSession with the same roots that his pick event
session has at the time of cloning.
|
void |
close()
Clears the hit target and clears all internal data including collision roots.
|
boolean |
cursorMoved(int x,
int y)
Called when the cursor has moved.
|
boolean |
cursorMoved(int x,
int y,
int scroll)
Called when the cursor has moved in an environment where there is
also a separate scroll wheel or other scroll control.
|
protected com.jme3.scene.Spatial |
findHitTarget(com.jme3.scene.Spatial hit)
Finds a spatial in the specified spatial's hierarchy that
is capable of recieving mouse events.
|
protected PickEventSession.RootEntry |
findRootEntry(com.jme3.scene.Spatial s) |
com.jme3.renderer.ViewPort |
findViewPort(com.jme3.scene.Spatial s) |
java.lang.String[] |
getPickLayerOrder() |
protected com.jme3.math.Ray |
getPickRay(PickEventSession.RootEntry rootEntry,
com.jme3.math.Vector2f cursor) |
protected com.jme3.util.SafeArrayList<PickEventSession.RootEntry> |
getRootList() |
protected float[] |
getZBounds(com.jme3.scene.Spatial s)
Returns the min and max world z values for the specified
spatial.
|
boolean |
isDebugOn()
Returns true if extra debug logging has been turned on.
|
protected boolean |
isTraceEnabled() |
void |
removeCollisionRoot(com.jme3.scene.Spatial root) |
void |
removeCollisionRoot(com.jme3.renderer.ViewPort viewPort) |
protected void |
setCurrentHitTarget(com.jme3.renderer.ViewPort viewport,
com.jme3.scene.Spatial s,
com.jme3.math.Vector2f cursor,
com.jme3.collision.CollisionResult cr) |
void |
setDebugOn(boolean f)
Turns on extra debug logging.
|
void |
setPickLayerOrder(java.lang.String... layers) |
protected void |
trace(java.lang.String msg) |
protected boolean |
viewContains(com.jme3.renderer.Camera cam,
com.jme3.math.Vector2f cursor) |
public PickEventSession()
protected PickEventSession(java.util.Map<com.jme3.collision.Collidable,PickEventSession.RootEntry> roots)
public void setDebugOn(boolean f)
public boolean isDebugOn()
protected boolean isTraceEnabled()
protected void trace(java.lang.String msg)
public PickEventSession clone()
clone
in class java.lang.Object
public com.jme3.renderer.ViewPort findViewPort(com.jme3.scene.Spatial s)
protected PickEventSession.RootEntry findRootEntry(com.jme3.scene.Spatial s)
public void addCollisionRoot(com.jme3.renderer.ViewPort viewPort)
public void addCollisionRoot(com.jme3.renderer.ViewPort viewPort, java.lang.String layer)
public void addCollisionRoot(com.jme3.scene.Spatial root, com.jme3.renderer.ViewPort viewPort)
public void addCollisionRoot(com.jme3.scene.Spatial root, com.jme3.renderer.ViewPort viewPort, java.lang.String layer)
public void removeCollisionRoot(com.jme3.renderer.ViewPort viewPort)
public void removeCollisionRoot(com.jme3.scene.Spatial root)
public void setPickLayerOrder(java.lang.String... layers)
public java.lang.String[] getPickLayerOrder()
public void clearHitTarget()
public void close()
protected com.jme3.scene.Spatial findHitTarget(com.jme3.scene.Spatial hit)
protected void setCurrentHitTarget(com.jme3.renderer.ViewPort viewport, com.jme3.scene.Spatial s, com.jme3.math.Vector2f cursor, com.jme3.collision.CollisionResult cr)
protected com.jme3.util.SafeArrayList<PickEventSession.RootEntry> getRootList()
protected boolean viewContains(com.jme3.renderer.Camera cam, com.jme3.math.Vector2f cursor)
protected float[] getZBounds(com.jme3.scene.Spatial s)
protected com.jme3.math.Ray getPickRay(PickEventSession.RootEntry rootEntry, com.jme3.math.Vector2f cursor)
public boolean cursorMoved(int x, int y)
public boolean cursorMoved(int x, int y, int scroll)
public boolean buttonEvent(int buttonIndex, int x, int y, boolean pressed)