com.threerings.opengl.gui
Class RenderableView

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.RenderableView
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>, Tickable

public class RenderableView
extends Component
implements Tickable

Displays an embedded 3D view.


Field Summary
protected  Camera _camera
          The renderer camera.
protected  CameraHandler _camhand
          The handler that controls the camera's parameters.
protected  List<Compositable> _compositables
          The list of other compositables to include.
protected  Model[] _configModels
          The models loaded from the configuration.
protected  Map<Dependency,Dependency> _dependencies
          Stores the dependency set.
protected  RenderQueue.Group.State _gstate
          Stores the state of the render queue.
protected  Image _image
          For static views, the rendered image.
protected  Rectangle _oscissor
          Used to save the scissor region.
protected  TextureRenderer _renderer
          For static views, the texture renderer.
protected  Root _root
          The UI root with which we've registered as a tick participant.
protected  DynamicScope _scope
          The view scope.
protected  boolean _static
          Whether or not the view is static.
protected  String _viewNode
          The name of the view node, if any.
protected  Transform3D _viewTransform
          A scoped reference to the camera's view transform.
protected  TransformState _viewTransformState
          A transform state containing the camera's view transform.
 
Fields inherited from class com.threerings.opengl.gui.Component
_alpha, _backgrounds, _borders, _colors, _ctx, _cursor, _enabled, _height, _hover, _hoverable, _insets, _listeners, _parent, _preferredSize, _properties, _rect, _styleConfigs, _tipmouse, _tiptext, _tooltipStyle, _transferHandler, _valid, _visible, _width, _x, _y, DEFAULT, DISABLED, HOVER, STATE_COUNT, STATE_PCLASSES
 
Constructor Summary
RenderableView(GlContext ctx)
          Creates a new renderable view.
 
Method Summary
 void add(Compositable compositable)
          Adds a compositable to the view.
protected  CameraHandler createCameraHandler()
          Creates the camera handler for the view.
 Camera getCamera()
          Returns a reference to the view camera.
 CameraHandler getCameraHandler()
          Returns a reference to the camera handler.
 Model[] getConfigModels()
          Returns a reference to the array of config models.
 DynamicScope getScope()
          Returns a reference to the view's scope.
 String getViewNode()
          Returns the name of the view node.
protected  Transform3D getViewNodeTransform()
          Returns the transform corresponding to the view node, or null for none.
 boolean isStatic()
          Checks whether this view is configured as static.
protected  void layout()
          Instructs this component to lay itself out.
 void remove(Compositable compositable)
          Removes a compositable from the view.
 void removeAll()
          Removes all compositables from the view.
 void render()
          Manually rerenders the (static) view.
protected  void renderComponent(Renderer renderer)
          Renders any custom bits for this component.
protected  void renderView(Renderer renderer)
          Renders the view.
 void setConfigModels(Model[] models)
          Sets the array of config models.
 void setStatic(boolean stat)
          Sets whether this view is static and must be rendered manually.
 void setViewNode(String node)
          Sets the name of the view node.
 void tick(float elapsed)
          Updates the state of this object based on the elapsed time in seconds.
protected  void wasAdded()
          This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up).
protected  void wasRemoved()
          This method is called when we are removed from a hierarchy that is connected to a top-level window.
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, changeCursor, computePreferredSize, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, createTooltipComponent, dispatchEvent, emitEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getDefaultStyleConfig, getFallbackState, getFirstDescendantFocus, getFocusTarget, getHeight, getHitComponent, getInsets, getLastDescendantFocus, getNextFocus, getParent, getPreferredSize, getPreviousFocus, getProperty, getState, getStateCount, getStatePseudoClass, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getWindow, getX, getY, hasFocus, intersectScissor, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, renderBackground, renderBorder, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlpha, setBackground, setBounds, setCursor, setEnabled, setHoverable, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, stateDidChange, updateCursor, updateFromStyleConfig, updateFromStyleConfig, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_scope

protected DynamicScope _scope
The view scope.


_root

protected Root _root
The UI root with which we've registered as a tick participant.


_camera

protected Camera _camera
The renderer camera.


_camhand

protected CameraHandler _camhand
The handler that controls the camera's parameters.


_gstate

protected RenderQueue.Group.State _gstate
Stores the state of the render queue.


_dependencies

protected Map<Dependency,Dependency> _dependencies
Stores the dependency set.


_static

protected boolean _static
Whether or not the view is static.


_viewNode

protected String _viewNode
The name of the view node, if any.


_configModels

protected Model[] _configModels
The models loaded from the configuration.


_compositables

protected List<Compositable> _compositables
The list of other compositables to include.


_image

protected Image _image
For static views, the rendered image.


_renderer

protected TextureRenderer _renderer
For static views, the texture renderer.


_viewTransform

@Scoped
protected Transform3D _viewTransform
A scoped reference to the camera's view transform.


_viewTransformState

@Scoped
protected TransformState _viewTransformState
A transform state containing the camera's view transform.


_oscissor

protected Rectangle _oscissor
Used to save the scissor region.

Constructor Detail

RenderableView

public RenderableView(GlContext ctx)
Creates a new renderable view.

Method Detail

getScope

public DynamicScope getScope()
Returns a reference to the view's scope.


getCamera

public Camera getCamera()
Returns a reference to the view camera.


getCameraHandler

public CameraHandler getCameraHandler()
Returns a reference to the camera handler.


setStatic

public void setStatic(boolean stat)
Sets whether this view is static and must be rendered manually.


isStatic

public boolean isStatic()
Checks whether this view is configured as static.


setViewNode

public void setViewNode(String node)
Sets the name of the view node. If non-blank, the camera transform will assume the transform of the first node encountered with this name in the model list (overriding the transform applied by the camera handler).


getViewNode

public String getViewNode()
Returns the name of the view node.


setConfigModels

public void setConfigModels(Model[] models)
Sets the array of config models.


getConfigModels

public Model[] getConfigModels()
Returns a reference to the array of config models.


add

public void add(Compositable compositable)
Adds a compositable to the view.


remove

public void remove(Compositable compositable)
Removes a compositable from the view.


removeAll

public void removeAll()
Removes all compositables from the view.


render

public void render()
Manually rerenders the (static) view.


tick

public void tick(float elapsed)
Description copied from interface: Tickable
Updates the state of this object based on the elapsed time in seconds.

Specified by:
tick in interface Tickable

wasAdded

protected void wasAdded()
Description copied from class: Component
This method is called when we are added to a hierarchy that is connected to a top-level window (at which point we can rely on having a look and feel and can set ourselves up).

Overrides:
wasAdded in class Component

wasRemoved

protected void wasRemoved()
Description copied from class: Component
This method is called when we are removed from a hierarchy that is connected to a top-level window. If we wish to clean up after things done in Component.wasAdded(), this is a fine place to do so.

Overrides:
wasRemoved in class Component

layout

protected void layout()
Description copied from class: Component
Instructs this component to lay itself out. This is called as a result of the component changing size.

Overrides:
layout in class Component

renderComponent

protected void renderComponent(Renderer renderer)
Description copied from class: Component
Renders any custom bits for this component. This is called with the graphics context translated to (0, 0) relative to this component.

Overrides:
renderComponent in class Component

createCameraHandler

protected CameraHandler createCameraHandler()
Creates the camera handler for the view.


renderView

protected void renderView(Renderer renderer)
Renders the view.


getViewNodeTransform

protected Transform3D getViewNodeTransform()
Returns the transform corresponding to the view node, or null for none.