public class Cube extends ApplicationTemplate implements OrderedRenderable
Renderable that draws a cube at a geographic position. This class shows the simplest
possible example of a Renderable, while still following World Wind best practices.
What happens when the cube is rendered:
1) Scene controller calls render in picking mode. 2) Scene controller calls render in normal rendering mode. 3) Scene
controller calls render in ordered rendering mode.| Modifier and Type | Class and Description |
|---|---|
protected static class |
Cube.AppFrame |
ApplicationTemplate.AppPanel| Modifier and Type | Field and Description |
|---|---|
protected Extent |
extent |
protected double |
eyeDistance
Distance from the eye point to the cube.
|
protected long |
frameTimestamp |
protected PickSupport |
pickSupport
Support object to help with pick resolution.
|
protected Vec4 |
placePoint
Cartesian position of the cube, computed from
position. |
protected Position |
position
Geographic position of the cube.
|
protected double |
size
Length of each face, in meters.
|
| Constructor and Description |
|---|
Cube(Position position,
double sizeInMeters) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beginDrawing(DrawContext dc)
Setup drawing state in preparation for drawing the cube.
|
protected void |
drawOrderedRenderable(DrawContext dc,
PickSupport pickCandidates)
Set up drawing state, and draw the cube.
|
protected void |
drawUnitCube(DrawContext dc)
Draw a unit cube, using the active modelview matrix to orient the shape.
|
protected void |
endDrawing(DrawContext dc)
Restore drawing state changed in beginDrawing to the default.
|
double |
getDistanceFromEye()
Returns the ordered renderable's distance from the current view's eye point.
|
protected boolean |
intersectsFrustum(DrawContext dc)
Determines whether the cube intersects the view frustum.
|
static void |
main(String[] args) |
protected void |
makeOrderedRenderable(DrawContext dc)
Compute per-frame attributes, and add the ordered renderable to the ordered renderable list.
|
void |
pick(DrawContext dc,
Point pickPoint)
Executes a pick of the ordered renderable.
|
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
insertAfterPlacenames, insertBeforeCompass, insertBeforeLayerName, insertBeforePlacenames, startprotected Extent extent
protected double eyeDistance
protected long frameTimestamp
protected PickSupport pickSupport
protected Position position
protected double size
public Cube(Position position, double sizeInMeters)
protected void beginDrawing(DrawContext dc)
dc - Active draw context.protected void drawOrderedRenderable(DrawContext dc, PickSupport pickCandidates)
dc - Current draw context.protected void drawUnitCube(DrawContext dc)
dc - Current draw context.protected void endDrawing(DrawContext dc)
dc - Active draw context.public double getDistanceFromEye()
OrderedRenderablegetDistanceFromEye in interface OrderedRenderableprotected boolean intersectsFrustum(DrawContext dc)
dc - the current draw context.public static void main(String[] args)
protected void makeOrderedRenderable(DrawContext dc)
dc - Current draw context.public void pick(DrawContext dc, Point pickPoint)
OrderedRenderablepick in interface OrderedRenderabledc - the current draw context.pickPoint - the pick point.public void render(DrawContext dc)
RenderableRenderable to render itself using the provided draw context.render in interface Renderabledc - the DrawContext to be usedDrawContext