public class Cube extends ApplicationTemplate implements Renderable
Renderable
that draws a cube at a geographic position. This class shows the simplest
possible example of a custom Renderable, while still following World Wind best practices. See
http://goworldwind.org/developers-guide/how-to-build-a-custom-renderable/ for a complete description of this
example.Modifier and Type | Class and Description |
---|---|
protected static class |
Cube.AppFrame |
protected class |
Cube.OrderedCube
This class holds the Cube's Cartesian coordinates.
|
ApplicationTemplate.AppPanel
Modifier and Type | Field and Description |
---|---|
protected Cube.OrderedCube |
currentFramesOrderedCube |
protected long |
frameTimestamp |
protected PickSupport |
pickSupport
Support object to help with pick resolution.
|
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.
|
protected boolean |
intersectsFrustum(DrawContext dc,
Cube.OrderedCube orderedCube)
Determines whether the cube intersects the view frustum.
|
static void |
main(String[] args) |
protected Cube.OrderedCube |
makeOrderedRenderable(DrawContext dc)
Compute per-frame attributes, and add the ordered renderable to the ordered renderable list.
|
void |
render(DrawContext dc)
Causes this
Renderable to render itself using the provided draw context. |
insertAfterPlacenames, insertBeforeCompass, insertBeforeLayerName, insertBeforePlacenames, start
protected Cube.OrderedCube currentFramesOrderedCube
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.protected boolean intersectsFrustum(DrawContext dc, Cube.OrderedCube orderedCube)
dc
- the current draw context.public static void main(String[] args)
protected Cube.OrderedCube makeOrderedRenderable(DrawContext dc)
dc
- Current draw context.public void render(DrawContext dc)
Renderable
Renderable
to render itself using the provided draw context.render
in interface Renderable
dc
- the DrawContext
to be usedDrawContext