public class UI3dContext extends UIObject implements LXSerializable, UITabFocus
Modifier and Type | Class and Description |
---|---|
class |
UI3dContext.Camera |
static class |
UI3dContext.InteractionMode
Mode of interaction from keyboard mouse events
|
static class |
UI3dContext.MouseMode
Mode of mouse interaction
|
static interface |
UI3dContext.MovementListener |
static class |
UI3dContext.ProjectionMode |
LXSerializable.Utils
Modifier and Type | Field and Description |
---|---|
BooleanParameter |
animation
Whether to animate between camera positions
|
UIInputBox.ProgressIndicator |
animationProgress |
BoundedParameter |
animationTime
Animation time
|
MutableParameter |
cameraAcceleration
Acceleration used to change camera radius (zoom)
|
MutableParameter |
cameraVelocity
Max velocity used to damp changes to radius (zoom)
|
UI3dContext.Camera[] |
cue |
BoundedParameter |
depth
Depth of perspective field, exponential factor of radius by exp(10, Depth)
|
ObjectParameter<UI3dContext.Camera> |
focusCamera |
EnumParameter<UI3dContext.MouseMode> |
mouseMode
Mouse interaction mode
|
static int |
NUM_CAMERA_POSITIONS |
BoundedParameter |
perspective
Perspective of view
|
BooleanParameter |
phiLock
Phi lock prevents crazy vertical rotations
|
EnumParameter<UI3dContext.ProjectionMode> |
projection
Projection mode
|
MutableParameter |
rotationAcceleration
Acceleration used to change rotation (theta/phi)
|
MutableParameter |
rotationVelocity
Max velocity used to damp changes to rotation (theta/phi)
|
BooleanParameter |
showCenterPoint |
children, hasFocus, mousePressContextMenu, visible
Modifier | Constructor and Description |
---|---|
|
UI3dContext(UI ui,
int x,
int y,
int w,
int h)
Creates a UI3dContext with the given frame position.
|
protected |
UI3dContext(UI ui,
PGraphics pg,
int x,
int y) |
Modifier and Type | Method and Description |
---|---|
UI3dContext |
addComponent(UI3dComponent component)
Adds a component to the layer
|
void |
addMovementListener(UI3dContext.MovementListener listener) |
UI3dContext |
clearCamera(int index)
Clears the camera stored at the given index
|
void |
draw(UI ui,
PGraphics dstPg) |
PVector |
getCenter()
Gets the center position of the scene
|
PVector |
getEye()
Gets the latest computed eye position
|
PGraphics |
getGraphics() |
float |
getHeight() |
float |
getWidth() |
void |
load(LX lx,
JsonObject object)
Restores this instance from a JSON object
|
static UI3dContext |
newTopLevelContext(UI ui)
Creates a UI3dContext which draws into the parent Processing
graphics context, bypassing any compositing of UI layers.
|
protected void |
onKeyPressed(KeyEvent keyEvent,
char keyChar,
int keyCode)
Subclasses override to receive key events
|
protected void |
onMouseDragged(MouseEvent mouseEvent,
float mx,
float my,
float dx,
float dy)
Subclasses override to receive mouse events
|
protected void |
onMousePressed(MouseEvent mouseEvent,
float mx,
float my)
Subclasses override to receive mouse events
|
protected void |
onMouseWheel(MouseEvent mouseEvent,
float mx,
float my,
float delta)
Subclasses override to receive mouse events
|
protected void |
onResize()
Subclasses may override to handle situation in which the size of the graphics
context has changed.
|
UI3dContext |
removeComponent(UI3dComponent component)
Removes a component from the layer
|
void |
removeMovementListener(UI3dContext.MovementListener listener) |
void |
save(LX lx,
JsonObject object)
Serializes this instance into the JSON object
|
UI3dContext |
setBackground(boolean hasBackground)
Sets whether this context has a background or not
|
UI3dContext |
setBackgroundColor(int backgroundColor)
Sets the background color for this 3d context
|
UI3dContext |
setCamera(int index)
Sets the cue position index of the camera
|
UI3dContext |
setCameraAcceleration(float cameraAcceleration)
Set's the camera's zoom acceleration, 0 is infinite
|
UI3dContext |
setCameraVelocity(float cameraVelocity)
Sets the camera's maximum zoom speed
|
UI3dContext |
setCenter(float x,
float y,
float z)
Sets the center of the scene, only respected in ZOOM mode
|
UI3dContext |
setEye(float x,
float y,
float z)
Sets the eye position, only respected in MOVE mode
|
UI3dContext |
setInteractionMode(UI3dContext.InteractionMode interactionMode)
Set interaction mode for mouse/key events.
|
UI3dContext |
setMaxRadius(float maxRadius)
Set maximum radius
|
UI3dContext |
setMinRadius(float minRadius)
Set minimum radius
|
UI3dContext |
setPerspective(float perspective)
Sets perspective angle of the camera in degrees
|
UI3dContext |
setPhi(float phi)
Set the phi angle of viewing
|
UI3dContext |
setRadius(float radius)
Set radius of the camera
|
UI3dContext |
setRadiusBounds(float minRadius,
float maxRadius)
Sets bounds on the radius
|
UI3dContext |
setRotationAcceleration(float rotationAcceleration)
Set's the camera's rotational acceleration, 0 is infinite
|
UI3dContext |
setRotationVelocity(float rotationVelocity)
Sets the camera's maximum rotation speed
|
UI3dContext |
setSize(float width,
float height) |
UI3dContext |
setTheta(double theta)
Set the theta angle of viewing
|
addLoopTask, beginDraw, blur, bringToFront, consumeKeyEvent, consumeMousePress, consumeMouseWheelEvent, contains, endDraw, focus, getDescription, getFocusedChild, getLX, getParent, getUI, hasDirectFocus, hasFocus, isVisible, keyEventConsumed, loop, mousePressConsumed, onBlur, onDraw, onFocus, onUIResize, removeLoopTask, setDescription, setVisible, toggleVisible
onKeyReleased, onKeyTyped, onMouseClicked, onMouseMoved, onMouseOut, onMouseOver, onMouseReleased
public static final int NUM_CAMERA_POSITIONS
public EnumParameter<UI3dContext.MouseMode> mouseMode
public final EnumParameter<UI3dContext.ProjectionMode> projection
public final BoundedParameter perspective
public final BoundedParameter depth
public final BooleanParameter phiLock
public final BooleanParameter showCenterPoint
public final BooleanParameter animation
public final BoundedParameter animationTime
public final MutableParameter cameraVelocity
public final MutableParameter cameraAcceleration
public final MutableParameter rotationVelocity
public final MutableParameter rotationAcceleration
public final UI3dContext.Camera[] cue
public final ObjectParameter<UI3dContext.Camera> focusCamera
public final UIInputBox.ProgressIndicator animationProgress
public UI3dContext(UI ui, int x, int y, int w, int h)
ui
- UI contextx
- Frame x-positiony
- Frame y-positionw
- Frame widthh
- Frame heightpublic final void addMovementListener(UI3dContext.MovementListener listener)
public final void removeMovementListener(UI3dContext.MovementListener listener)
public static UI3dContext newTopLevelContext(UI ui)
ui
- UI objectpublic PGraphics getGraphics()
public UI3dContext setSize(float width, float height)
public UI3dContext setBackgroundColor(int backgroundColor)
backgroundColor
- Background colorpublic UI3dContext setBackground(boolean hasBackground)
hasBackground
- Whether there's a background, if false content cleared each frameprotected void onResize()
public final UI3dContext addComponent(UI3dComponent component)
component
- Componentpublic final UI3dContext removeComponent(UI3dComponent component)
component
- Componentpublic UI3dContext clearCamera(int index)
index
- Camera index to clearpublic UI3dContext setCamera(int index)
index
- Camera indexpublic UI3dContext setRadius(float radius)
radius
- Camera radiuspublic UI3dContext setInteractionMode(UI3dContext.InteractionMode interactionMode)
interactionMode
- Interaction modepublic UI3dContext setPerspective(float perspective)
perspective
- Angle in degreespublic UI3dContext setCameraVelocity(float cameraVelocity)
cameraVelocity
- Max units/per second radius may change bypublic UI3dContext setCameraAcceleration(float cameraAcceleration)
cameraAcceleration
- Acceleration for camerapublic UI3dContext setRotationVelocity(float rotationVelocity)
rotationVelocity
- Max radians/per second viewing angle may change bypublic UI3dContext setRotationAcceleration(float rotationAcceleration)
rotationAcceleration
- Acceleration of camera rotationpublic UI3dContext setTheta(double theta)
theta
- Angle about the y axispublic UI3dContext setPhi(float phi)
phi
- Angle about the y axispublic UI3dContext setRadiusBounds(float minRadius, float maxRadius)
minRadius
- Minimum camera radiusmaxRadius
- Maximum camera radiuspublic UI3dContext setMinRadius(float minRadius)
minRadius
- Minimum camera radiuspublic UI3dContext setMaxRadius(float maxRadius)
maxRadius
- Maximum camera radiuspublic UI3dContext setCenter(float x, float y, float z)
x
- X-coordinatey
- Y-coordinatez
- Z-coordinatepublic UI3dContext setEye(float x, float y, float z)
x
- X-coordinatey
- Y-coordinatez
- Z-coordinatepublic PVector getCenter()
public PVector getEye()
protected void onMousePressed(MouseEvent mouseEvent, float mx, float my)
UIEventHandler
onMousePressed
in class UIEventHandler
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinateprotected void onMouseDragged(MouseEvent mouseEvent, float mx, float my, float dx, float dy)
UIEventHandler
onMouseDragged
in class UIEventHandler
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatedx
- movement in xdy
- movement in yprotected void onMouseWheel(MouseEvent mouseEvent, float mx, float my, float delta)
UIEventHandler
onMouseWheel
in class UIEventHandler
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatedelta
- Amount of wheel movementprotected void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
UIEventHandler
onKeyPressed
in class UIEventHandler
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code valuepublic void save(LX lx, JsonObject object)
LXSerializable
save
in interface LXSerializable
lx
- LX instanceobject
- Object to serialize intopublic void load(LX lx, JsonObject object)
LXSerializable
load
in interface LXSerializable
lx
- LX instanceobject
- Object to deserializeLX library by Mark C. Slee. © 2012-2020