In the WorldWind architecture, theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nasaworldwind/worldwindjava/llms.txt
Use this file to discover all available pages before exploring further.
Model and SceneController form the backbone of every rendered frame. A Model is a pure data container: it holds the Globe (geometry, elevation, and projection of the planet) and the LayerList (the ordered stack of imagery, annotations, shapes, and any other visual content). The SceneController is the engine that consumes the model each frame: it sets up the DrawContext, runs the render pass, runs the pick pass, accumulates performance statistics, and fires rendering events. A WorldWindow delegates all frame-generation work to its SceneController, which in turn queries the Model for what to draw.
Model Interface
Package:gov.nasa.worldwind
Interface: public interface Model extends WWObject
The Model interface aggregates a globe and a set of layers. Through the globe it also indirectly includes the elevation model and the surface-geometry tessellator. A default model is defined in worldwind.xml (or an application-supplied alternate) and is used whenever BasicModel is constructed with its no-argument constructor.
getGlobe / setGlobe
Globe access
Globe associated with this model. When a new globe is set, the model registers itself as a PropertyChangeListener on the new globe and deregisters from the old one, so that globe changes (e.g., projection switches) automatically propagate to the model’s observers.
The replacement globe. May be
null to detach the current globe from the model.getLayers / setLayers
Layer list access
LayerList. Layers are rendered in list order — earlier entries are drawn first (further from the viewer). Replacing the list fires an AVKey.LAYERS property-change event so the scene controller can schedule a repaint.
The replacement layer list. May be
null to detach the current layers.getExtent
Bounding extent
null if neither can produce an extent.
Returns: Extent — the bounding sphere, or null.
Wireframe Debugging Flags
These flags are intended for development and debugging. All default tofalse.
Wireframe and bounding-volume flags
| Method pair | Effect when true |
|---|---|
showWireframeInterior | Renders the interior faces of the globe’s tessellated surface geometry as wireframe. |
showWireframeExterior | Renders the exterior faces of the tessellated surface geometry as wireframe. |
showTessellationBoundingVolumes | Draws the bounding boxes/spheres of each tessellation tile — useful for diagnosing LOD and culling behaviour. |
Enabling wireframe for debugging
BasicModel
Package:gov.nasa.worldwind
Class: public class BasicModel extends WWObjectImpl implements Model
BasicModel is the standard Model implementation used in virtually all WorldWind applications. It extends WWObjectImpl so it participates fully in the attribute-value list and property-change event infrastructure.
Constructors
No-argument constructor — configuration-driven
Configuration (AVKey.GLOBE_CLASS_NAME) and instantiates it via WorldWind.createComponent(). The default globe is gov.nasa.worldwind.globes.Earth — a WGS84 ellipsoid.
Layer construction follows a two-path strategy:
- Legacy path: if
AVKey.LAYERS_CLASS_NAMESis present in the configuration (a comma-separated list of class names), those layers are instantiated directly. - Modern path (default): the
<LayerList>XML element inworldwind.xmlis parsed byBasicFactoryusingAVKey.LAYER_FACTORY. The default configuration produces a layer list that typically includes:- Stars — background star field
- Atmosphere — sky/atmosphere effect
- NASA Blue Marble — base satellite imagery
- Landsat Imagery — medium-resolution imagery
- USGS Topo Maps — vector topographic overlays
- Political Boundaries — country/region outlines
- Place Names — geographic labels
LayerList is used (not an error).
Programmatic constructor
null for layers to start with an empty list.
The globe to use (e.g.,
new Earth(), new EarthFlat()).The initial layer list. May be
null for an empty list.Creating a custom BasicModel
Restorable and Disposable
WorldWind defines two small lifecycle interfaces that several core classes implement. Understanding them is important when managing objects that hold XML state or OpenGL resources.Restorable
Package:gov.nasa.worldwind
Interface: public interface Restorable
Restorable enables serialisation and deserialisation of an object’s internal state as an XML document string. This allows shapes, views, and other stateful objects to be saved to a file or database and restored exactly.
Restorable interface
An XML document string previously produced by
getRestorableState() on an instance of the same class. Implementations are required to silently ignore unknown XML elements to ensure forward compatibility.Saving and restoring a view
Disposable
Package:gov.nasa.worldwind
Interface: public interface Disposable
Disposable marks objects that allocate resources requiring explicit cleanup — most commonly OpenGL objects (textures, VBOs, display lists) that must be freed on the correct OpenGL context thread. SceneController implements Disposable; so do many layer and shape types.
Disposable interface
dispose() only when an OpenGL context for the relevant window is current. After dispose() returns the object must not be used again.
Disposing a layer
SceneController Interface
Package:gov.nasa.worldwind
Interface: public interface SceneController extends WWObject, Disposable
SceneController drives everything that happens inside a single rendered frame. Each call to repaint() performs a full render pass (geometry, imagery, shapes, annotations) followed by a pick pass (identifying objects under the cursor and within the selection rectangle). The controller maintains timing statistics and exposes the DrawContext that custom renderers use during the render pass.
getModel / setModel
Model binding
Model to this controller. Fires an AVKey.MODEL property-change event on assignment, which causes the owning WorldWindow to schedule a repaint.
getView / setView
View binding
View (camera) to this controller. Fires an AVKey.VIEW property-change event on assignment.
getDrawContext
Draw context access
DrawContext for the current (or most recently completed) frame. Custom renderers and layers receive the DrawContext as a method argument during rendering; this accessor is for post-frame inspection.
Returns: DrawContext
Pick Control
Pick enabling
PickedObjectList. Deep pick has a measurable performance cost and should only be enabled when the application genuinely needs the complete list.
true to enable deep picking of all objects under the cursor; false (default) for top-object-only picking.getPickedObjectList
Picked object list
null if no objects are under the cursor.
Returns: PickedObjectList
Performance Metrics
Frame rate and timing
getFramesPerSecond() returns the rolling-average frames rendered per second across recent frames. getFrameTime() returns the timestamp (in milliseconds) of the most recently completed frame — useful for synchronising external animations.
Returns: double
setPerFrameStatisticsKeys
Activating per-frame statistics
PerformanceStatistic (e.g., PerformanceStatistic.FRAME_RATE, PerformanceStatistic.TERRAIN_TILE_COUNT). The matching Collection<PerformanceStatistic> can be retrieved from the scene controller or from WorldWindow.getPerFrameStatistics() after each frame.
The set of
PerformanceStatistic key strings to activate. Pass an empty set to disable all metrics.Vertical Exaggeration
Vertical exaggeration
1.0 (the default) shows true-scale terrain. Larger values visually exaggerate mountains and valleys; useful for educational presentations of subtle topography. This value is written into the DrawContext each frame and affects all terrain-following rendering.
Elevation scale factor. Default is
1.0.AbstractSceneController and BasicSceneController
AbstractSceneController (gov.nasa.worldwind.AbstractSceneController) is the abstract base class that provides the concrete implementation of nearly all SceneController methods. It manages the DrawContext (DrawContextImpl), pick point/rectangle state, per-frame timing (framesPerSecond, frameTime, pickTime), the PickedObjectList (lastPickedObjects, lastObjectsInPickRect), and the colour-coded pick map used to resolve multiple simultaneous picks.
BasicSceneController (gov.nasa.worldwind.BasicSceneController) extends AbstractSceneController and provides the concrete doRepaint(DrawContext) implementation. It handles both normal (3D) and 2D-contiguous (flat/cylindrical) rendering modes by delegating to doNormalRepaint or do2DContiguousRepaint based on the globe type. This is the default controller installed by WorldWindowImpl via AVKey.SCENE_CONTROLLER_CLASS_NAME.
StereoSceneController (gov.nasa.worldwind.StereoSceneController) is an alternate controller that renders the scene twice per frame — once for each eye — using either quad-buffered stereo (hardware stereo glasses) or red/cyan anaglyph. It is specified in the default worldwind.xml configuration and falls back transparently to mono rendering when no stereo device is available.
Enabling deep pick via the scene controller
Adjusting vertical exaggeration