Package heronarts.glx.ui
Class UI3dContext
java.lang.Object
heronarts.glx.ui.UIEventHandler
heronarts.glx.ui.UIObject
heronarts.glx.ui.UI3dContext
- All Implemented Interfaces:
UILayer
,UITabFocus
,LXLoopTask
,LXSerializable
- Direct Known Subclasses:
UIPreviewWindow
This is a layer that contains a 3d scene with a camera. Mouse movements
control the camera, and the scene can contain components.
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
static enum
Mode of mouse interactionstatic interface
static enum
Nested classes/interfaces inherited from interface heronarts.lx.LXSerializable
LXSerializable.Utils
-
Field Summary
Modifier and TypeFieldDescriptionfinal BooleanParameter
Whether to animate between camera positionsfinal BoundedParameter
Animation timefinal UI3dContext.Camera
final MutableParameter
Acceleration used to change camera radius (zoom)final MutableParameter
Max velocity used to damp changes to radius (zoom)final UI3dContext.Camera[]
final BoundedParameter
Depth of perspective field, exponential factor of radius by exp(10, Depth)Mouse interaction modestatic final int
final BoundedParameter
Perspective of viewProjection modefinal MutableParameter
Acceleration used to change rotation (theta/phi)final MutableParameter
Max velocity used to damp changes to rotation (theta/phi)protected final View
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal UI3dContext
addComponent
(UI3dComponent component) Adds a component to the layerfinal void
clearCamera
(int index) Clears the camera stored at the given indexvoid
dispose()
final void
org.joml.Vector3f
Gets the center position of the sceneorg.joml.Vector3f
getEye()
Gets the latest computed eye positionfloat
org.joml.Matrix4f
org.joml.Matrix4f
float
getWidth()
float
getX()
float
getY()
void
load
(LX lx, JsonObject object) Restores this instance from a JSON objectprotected void
onKeyPressed
(KeyEvent keyEvent, char keyChar, int keyCode) Subclasses override to receive key eventsprotected void
onMouseDragged
(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsprotected void
onMousePressed
(MouseEvent mouseEvent, float mx, float my) Subclasses override to receive mouse eventsprotected void
onMouseScroll
(MouseEvent mouseEvent, float mx, float my, float dx, float dy) Subclasses override to receive mouse eventsfinal UI3dContext
removeComponent
(UI3dComponent component) Removes a component from the layerfinal void
void
save
(LX lx, JsonObject object) Serializes this instance into the JSON objectsetCamera
(int index) Sets the cue position index of the camerasetCameraAcceleration
(float cameraAcceleration) Set's the camera's zoom acceleration, 0 is infinitesetCameraVelocity
(float cameraVelocity) Sets the camera's maximum zoom speedsetCenter
(float x, float y, float z) Sets the center of the scene, only respected in ZOOM modesetMaxRadius
(float maxRadius) Set maximum radiussetMinRadius
(float minRadius) Set minimum radiussetPerspective
(float perspective) Sets perspective angle of the camera in degreessetPhi
(float phi) Set the phi angle of viewingsetPosition
(float x, float y) setRadius
(float radius) Set radius of the camerasetRadiusBounds
(float minRadius, float maxRadius) Sets bounds on the radiussetRect
(float x, float y, float width, float height) setRotationAcceleration
(float rotationAcceleration) Set's the camera's rotational acceleration, 0 is infinitesetRotationVelocity
(float rotationVelocity) Sets the camera's maximum rotation speedsetSize
(float width, float height) setTheta
(double theta) Set the theta angle of viewingMethods inherited from class heronarts.glx.ui.UIObject
addListener, addListener, addLoopTask, blur, bringToFront, contains, focus, getDescription, getFocusedChild, getLX, getParent, getUI, hasDirectFocus, hasFocus, isVisible, loop, onBlur, onFocus, onUIResize, removeLoopTask, requireUIThread, setConsumeMousePress, setDebugId, setDescription, setVisible, toggleVisible, toString
Methods inherited from class heronarts.glx.ui.UIEventHandler
onKeyReleased, onMouseMoved, onMouseOut, onMouseOver, onMouseReleased
-
Field Details
-
NUM_CAMERA_POSITIONS
public static final int NUM_CAMERA_POSITIONS- See Also:
-
mouseMode
Mouse interaction mode -
projection
Projection mode -
perspective
Perspective of view -
depth
Depth of perspective field, exponential factor of radius by exp(10, Depth) -
animation
Whether to animate between camera positions -
animationTime
Animation time -
cameraVelocity
Max velocity used to damp changes to radius (zoom) -
cameraAcceleration
Acceleration used to change camera radius (zoom) -
rotationVelocity
Max velocity used to damp changes to rotation (theta/phi) -
rotationAcceleration
Acceleration used to change rotation (theta/phi) -
cue
-
focusCamera
-
camera
-
animationProgress
-
view
-
-
Constructor Details
-
UI3dContext
-
-
Method Details
-
addMovementListener
-
removeMovementListener
-
dispose
public void dispose() -
getX
public float getX() -
getY
public float getY() -
getWidth
public float getWidth() -
getHeight
public float getHeight() -
setPosition
-
setSize
-
setRect
-
addComponent
Adds a component to the layer- Parameters:
component
- Component- Returns:
- this
-
removeComponent
Removes a component from the layer- Parameters:
component
- Component- Returns:
- this
-
clearCamera
Clears the camera stored at the given index- Parameters:
index
- Camera index to clear- Returns:
- this
-
setCamera
Sets the cue position index of the camera- Parameters:
index
- Camera index- Returns:
- this
-
setRadius
Set radius of the camera- Parameters:
radius
- Camera radius- Returns:
- this
-
setPerspective
Sets perspective angle of the camera in degrees- Parameters:
perspective
- Angle in degrees- Returns:
- this
-
setCameraVelocity
Sets the camera's maximum zoom speed- Parameters:
cameraVelocity
- Max units/per second radius may change by- Returns:
- this
-
setCameraAcceleration
Set's the camera's zoom acceleration, 0 is infinite- Parameters:
cameraAcceleration
- Acceleration for camera- Returns:
- this
-
setRotationVelocity
Sets the camera's maximum rotation speed- Parameters:
rotationVelocity
- Max radians/per second viewing angle may change by- Returns:
- this
-
setRotationAcceleration
Set's the camera's rotational acceleration, 0 is infinite- Parameters:
rotationAcceleration
- Acceleration of camera rotation- Returns:
- this
-
setTheta
Set the theta angle of viewing- Parameters:
theta
- Angle about the y axis- Returns:
- this
-
setPhi
Set the phi angle of viewing- Parameters:
phi
- Angle about the y axis- Returns:
- this
-
setRadiusBounds
Sets bounds on the radius- Parameters:
minRadius
- Minimum camera radiusmaxRadius
- Maximum camera radius- Returns:
- this
-
setMinRadius
Set minimum radius- Parameters:
minRadius
- Minimum camera radius- Returns:
- this
-
setMaxRadius
Set maximum radius- Parameters:
maxRadius
- Maximum camera radius- Returns:
- this
-
setCenter
Sets the center of the scene, only respected in ZOOM mode- Parameters:
x
- X-coordinatey
- Y-coordinatez
- Z-coordinate- Returns:
- this
-
getCenter
public org.joml.Vector3f getCenter()Gets the center position of the scene- Returns:
- center of scene
-
getEye
public org.joml.Vector3f getEye()Gets the latest computed eye position- Returns:
- eye position
-
draw
-
getViewMatrix
public org.joml.Matrix4f getViewMatrix() -
getProjectionMatrix
public org.joml.Matrix4f getProjectionMatrix() -
onMousePressed
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMousePressed
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinate
-
onMouseDragged
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseDragged
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatedx
- movement in xdy
- movement in y
-
onMouseScroll
Description copied from class:UIEventHandler
Subclasses override to receive mouse events- Overrides:
onMouseScroll
in classUIEventHandler
- Parameters:
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatedx
- Amount of horizontal scrolldy
- Amount of vertical scroll
-
onKeyPressed
Description copied from class:UIEventHandler
Subclasses override to receive key events- Overrides:
onKeyPressed
in classUIEventHandler
- Parameters:
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code value
-
save
Description copied from interface:LXSerializable
Serializes this instance into the JSON object- Specified by:
save
in interfaceLXSerializable
- Parameters:
lx
- LX instanceobject
- Object to serialize into
-
load
Description copied from interface:LXSerializable
Restores this instance from a JSON object- Specified by:
load
in interfaceLXSerializable
- Parameters:
lx
- LX instanceobject
- Object to deserialize
-