Class DrawContextImpl
- java.lang.Object
-
- gov.nasa.worldwind.avlist.AVListImpl
-
- gov.nasa.worldwind.WWObjectImpl
-
- gov.nasa.worldwind.render.DrawContextImpl
-
- All Implemented Interfaces:
AVList
,Disposable
,MessageListener
,DrawContext
,WWObject
,java.beans.PropertyChangeListener
,java.util.EventListener
public class DrawContextImpl extends WWObjectImpl implements DrawContext
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DrawContextImpl.OrderedRenderableEntry
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationRenderer
annotationRenderer
protected java.awt.Color
clearColor
protected ClutterFilter
clutterFilter
protected java.util.LinkedHashMap<ScreenCredit,java.lang.Long>
credits
protected Layer
currentLayer
protected DeclutteringTextRenderer
declutteringTextRenderer
protected boolean
deepPickingMode
static float
DEFAULT_DEPTH_OFFSET_FACTOR
static float
DEFAULT_DEPTH_OFFSET_UNITS
protected long
frameTimestamp
protected SurfaceTileRenderer
geographicSurfaceTileRenderer
protected com.jogamp.opengl.GLContext
glContext
protected Globe
globe
protected GLRuntimeCapabilities
glRuntimeCaps
protected com.jogamp.opengl.glu.GLU
glu
protected GpuResourceCache
gpuResourceCache
protected boolean
isOrderedRenderingMode
protected Model
model
protected PickedObjectList
objectsInPickRect
The list of objects intersecting the pick rectangle during the most recent pick traversal.protected java.util.PriorityQueue<DrawContextImpl.OrderedRenderableEntry>
orderedRenderables
protected java.util.Queue<OrderedRenderable>
orderedSurfaceRenderables
protected java.util.Collection<PerformanceStatistic>
perFrameStatistics
protected java.util.Set<java.lang.String>
perFrameStatisticsKeys
protected PickedObjectList
pickedObjects
The list of objects at the pick point during the most recent pick traversal.protected PickPointFrustumList
pickFrustumList
protected boolean
pickingMode
protected java.awt.Point
pickPoint
Indicates the current pick point in AWT screen coordinates, ornull
to indicate that there is no pick point.protected java.awt.Dimension
pickPointFrustumDimension
protected java.awt.Rectangle
pickRect
Indicates the current pick rectangle in AWT screen coordinates, ornull
to indicate that there is no pick rectangle.protected java.nio.ByteBuffer
pixelColors
Buffer of RGB colors used to read back the framebuffer's colors and store them in client memory.protected boolean
preRenderMode
protected int
redrawRequested
protected java.util.Collection<java.lang.Throwable>
renderingExceptions
protected LightingModel
standardLighting
protected SectorGeometryList
surfaceGeometry
protected Terrain
terrain
protected TextRendererCache
textRendererCache
protected int
uniquePickNumber
protected IntSet
uniquePixelColors
Set of ints used bygetPickColorsInRectangle(java.awt.Rectangle, int[])
to identify the unique color codes in the specified rectangle.protected double
verticalExaggeration
protected View
view
protected Position
viewportCenterPosition
protected java.awt.Point
viewportCenterScreenPoint
protected Sector
visibleSector
protected SectorVisibilityTree
visibleSectors
-
Constructor Summary
Constructors Constructor Description DrawContextImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObjectInPickRectangle(PickedObject pickedObject)
Adds the specified picked object to the current list of objects intersecting the pick rectangle.void
addOrderedRenderable(OrderedRenderable orderedRenderable)
Adds anOrderedRenderable
to the draw context's ordered renderable list.void
addOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)
Adds anOrderedRenderable
to the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables.void
addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
Adds anOrderedRenderable
to the draw context's ordered surface renderable queue.void
addPickedObject(PickedObject pickedObject)
Adds the specified picked object to the list of objects at the pick point.void
addPickedObjects(PickedObjectList pickedObjects)
Adds a list of picked objects to the current list of objects at the pick point.void
addPickPointFrustum()
Creates a frustum around the current pick point and adds it to the current list of pick frustums.void
addPickRectangleFrustum()
Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.void
addRenderingException(java.lang.Throwable t)
Adds the specifiedThrowable
to this DrawContext's collection of rendering exceptions.void
addScreenCredit(ScreenCredit credit)
Adds a screen-credit icon to display.void
applyClutterFilter()
Filter overlapping text from the ordered renderable list.void
beginStandardLighting()
Enables the current standard lighting model.Vec4
computePointFromPosition(Position position, int altitudeMode)
Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.Vec4
computeTerrainPoint(Angle lat, Angle lon, double offset)
Compute a model-coordinate point on the terrain.void
disablePickingMode()
Specifies that the scene controller has ended its pick traversal.void
dispose()
Free internal resources held by this draw context.void
drawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.FloatBuffer nBuf)
This is a diagnostic method to display normal vectors.void
drawOutlinedShape(OutlinedShape renderer, java.lang.Object shape)
Performs a multi-pass rendering technique to ensure that outlines around filled shapes are drawn correctly when blending or ant-aliasing is performed, and that filled portions of the shape resolve depth-buffer fighting with shapes previously drawn in favor of the current shape.void
drawUnitQuad()
Draws a quadrilateral using the current OpenGL state.void
drawUnitQuad(com.jogamp.opengl.util.texture.TextureCoords texCoords)
Draws a quadrilateral using the current OpenGL state and specified texture coordinates.void
drawUnitQuadOutline()
Draws a quadrilateral outline using the current OpenGL state.void
enablePickingMode()
Specifies that the scene controller is beginning its pick traversal.void
endStandardLighting()
Pops the OpenGL state previously established byDrawContext.beginStandardLighting()
.AnnotationRenderer
getAnnotationRenderer()
Returns the draw context's annotation renderer, typically used by annotations that are not contained in anAnnotationLayer
.java.awt.Color
getClearColor()
Returns the WorldWindow's background color.ClutterFilter
getClutterFilter()
Returns the current clutter filter.Layer
getCurrentLayer()
Returns the current-layer.DeclutteringTextRenderer
getDeclutteringTextRenderer()
Returns the draw context's decluttering text renderer.int
getDrawableHeight()
Indicates the height in pixels of the drawing target associated with thisDrawContext
.int
getDrawableWidth()
Indicates the width in pixels of the drawing target associated with thisDrawContext
.long
getFrameTimeStamp()
Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence.SurfaceTileRenderer
getGeographicSurfaceTileRenderer()
Returns this draw context's surface tile renderer.com.jogamp.opengl.GL
getGL()
Retrieves the currentcom.jogamp.opengl.GL
.com.jogamp.opengl.GLContext
getGLContext()
Retrieves thisDrawContext
scom.jogamp.opengl.GLContext
.com.jogamp.opengl.GLDrawable
getGLDrawable()
Retrieves the currentcom.jogamp.opengl.GLDrawable
.Globe
getGlobe()
Retrieves the currentGlobe
, which may be null.GLRuntimeCapabilities
getGLRuntimeCapabilities()
Returns theGLRuntimeCapabilities
associated with this DrawContext.com.jogamp.opengl.glu.GLU
getGLU()
Retrieves the currentcom.jogamp.opengl.glu.GLU
.GpuResourceCache
getGpuResourceCache()
Returns the GPU resource cache used by this draw context.LayerList
getLayers()
Retrieves a list containing all the current layers.Model
getModel()
Retrieves the currentModel
, which may be null.PickedObjectList
getObjectsInPickRectangle()
Returns the list of objects intersecting the pick rectangle during the most recent pick traversal.java.util.Queue<OrderedRenderable>
getOrderedSurfaceRenderables()
Returns the draw context's ordered surface renderable queue.java.util.Collection<PerformanceStatistic>
getPerFrameStatistics()
Returns the performance statistics that are gathered during each frame.java.util.Set<java.lang.String>
getPerFrameStatisticsKeys()
Indicates the statistics that are monitored for each frame.int
getPickColorAtPoint(java.awt.Point point)
Returns the framebuffer RGB color for a point in AWT screen coordinates, formatted as a pick color code.int[]
getPickColorsInRectangle(java.awt.Rectangle rectangle, int[] minAndMaxColorCodes)
Returns an array of the unique framebuffer RGB colors within a rectangle in AWT screen coordinates, formatted as pick color codes.PickedObjectList
getPickedObjects()
Returns the list of objects at the pick point during the most recent pick traversal.PickPointFrustumList
getPickFrustums()
Gets the FrustumList containing all the current Pick Frustumsjava.awt.Point
getPickPoint()
Returns the current pick point in AWT screen coordinates.java.awt.Dimension
getPickPointFrustumDimension()
Gets the dimension of the current Pick Point Frustumjava.awt.Rectangle
getPickRectangle()
Returns the current pick rectangle in AWT screen coordinates.Vec4
getPointOnTerrain(Angle latitude, Angle longitude)
Computes a location's Cartesian point on the currently visible terrain.int
getRedrawRequested()
Indicates whether a new frame should be generated by theSceneController
.java.util.Collection<java.lang.Throwable>
getRenderingExceptions()
Gets the rendering exceptions associated with this DrawContext as aCollection
ofThrowable
objects.java.util.Map<ScreenCredit,java.lang.Long>
getScreenCredits()
Returns the screen credits currently held and displayed by this draw context.LightingModel
getStandardLightingModel()
Returns the current model used for standard lighting.SectorGeometryList
getSurfaceGeometry()
Retrieves a list of all the sectors rendered so far this frame.Terrain
getTerrain()
Returns aTerrain
object that uses the current sector geometry or the current globe to compute surface points.TextRendererCache
getTextRendererCache()
Returns this draw context's text-renderer cache.GpuResourceCache
getTextureCache()
Returns the GPU resource cache for this draw context.java.awt.Color
getUniquePickColor()
Returns a unique color to serve as a pick identifier during picking.java.awt.Color
getUniquePickColorRange(int count)
Returns a range of unique colors to serve as pick identifiers during picking.double
getVerticalExaggeration()
Retrieves the current vertical exaggeration.View
getView()
Retrieves the currentView
, which may be null.Position
getViewportCenterPosition()
Indicates the geographic coordinates of the point on the terrain at the current viewport's center.java.awt.Point
getViewportCenterScreenPoint()
Indicates the screen-coordinate point of the current viewport's center.Sector
getVisibleSector()
Retrieves aSector
which is at least as large as the current visible sector.java.util.List<Sector>
getVisibleSectors(double[] resolutions, long timeLimit, Sector sector)
Returns the visible sectors at one of several specified resolutions within a specified search sector.void
initialize(com.jogamp.opengl.GLContext glContext)
Initializes thisDrawContext
.boolean
is2DGlobe()
boolean
isContinuous2DGlobe()
boolean
isDeepPickingEnabled()
Indicates whether all items under cursor are picked.boolean
isOrderedRenderingMode()
Indicates whether theSceneController
is currently rendering the draw context'sOrderedRenderable
s.boolean
isPickingMode()
Indicates whether the scene controller is currently picking.boolean
isPreRenderMode()
Indicates whether the scene controller is currently pre-rendering.boolean
isSmall(Extent extent, int numPixels)
Indicates whether a specified extent is smaller than a specified number of pixels for the current view.OrderedRenderable
peekOrderedRenderables()
Returns the nextOrderedRenderable
on the ordered-renderable priority queue but does not remove it from the queue.OrderedRenderable
pollOrderedRenderables()
Returns the nextOrderedRenderable
on the ordered-renderable priority queue and removes it from the queue.void
popProjectionOffest()
Removes the current projection matrix offset added byDrawContext.pushProjectionOffest(Double)
.void
pushProjectionOffest(java.lang.Double offset)
Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point.void
restoreDefaultBlending()
Restores the current OpenGL context's blending state to its default.void
restoreDefaultCurrentColor()
Restores the current OpenGL context's current color to its default.void
restoreDefaultDepthTesting()
Restores the current OpenGL context's depth testing state to its default.void
setAnnotationRenderer(AnnotationRenderer ar)
SinceAnnotation
s areRenderable
s, they can be exist outside anAnnotationLayer
, in which case they are responsible for rendering themselves.void
setClutterFilter(ClutterFilter filter)
Specifies the clutter filter to use.void
setCurrentLayer(Layer layer)
Sets the current-layer field to the specified layer or null.void
setDeepPickingEnabled(boolean tf)
Specifies whether all items under the cursor are picked.void
setFrameTimeStamp(long frameTimeStamp)
Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence.void
setGLContext(com.jogamp.opengl.GLContext glContext)
Assigns thisDrawContext
a newcom.jogamp.opengl.GLContext
.void
setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
Sets theGLRuntimeCapabilities
associated with this DrawContext to the specified parameter.void
setGpuResourceCache(GpuResourceCache gpuResourceCache)
Specifies the GPU resource cache for this draw context.void
setModel(Model model)
Assign a newModel
.void
setOrderedRenderingMode(boolean tf)
Called by theSceneController
to indicate whether it is currently drawing the draw context'sOrderedRenderable
s.void
setPerFrameStatistic(java.lang.String key, java.lang.String displayName, java.lang.Object value)
Specifies a performance statistic that's assigned for each frame.void
setPerFrameStatistics(java.util.Collection<PerformanceStatistic> stats)
Specifies a collection of per-frame performance statistics.void
setPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys, java.util.Collection<PerformanceStatistic> stats)
Specifies the performance statistics that are monitored during each frame.void
setPickPoint(java.awt.Point pickPoint)
Specifies the current pick point in AWT screen coordinates, ornull
to indicate that there is no pick point.void
setPickPointFrustumDimension(java.awt.Dimension dim)
Set the size (in pixels) of the pick point frustum at the near plane.void
setPickRectangle(java.awt.Rectangle pickRect)
Specifies the current pick rectangle in AWT screen coordinates, ornull
to indicate that there is no pick rectangle.void
setPreRenderMode(boolean preRenderMode)
Specifies whether the scene controller is pre-rendering.void
setRedrawRequested(int redrawRequested)
Requests that a new frame should be generated by theSceneController
.void
setRenderingExceptions(java.util.Collection<java.lang.Throwable> exceptions)
Sets the rendering exceptions associated with this DrawContext to the specifiedCollection
ofThrowable
objects.void
setStandardLightingModel(LightingModel standardLighting)
Specifies the lighting model used for standard lighting.void
setSurfaceGeometry(SectorGeometryList surfaceGeometry)
Specifies the current surface geometry.void
setTextRendererCache(TextRendererCache textRendererCache)
Specifies this context's text renderer cache.void
setVerticalExaggeration(double verticalExaggeration)
Sets the vertical exaggeration.void
setView(View view)
Assigns a newView
.void
setViewportCenterPosition(Position viewportCenterPosition)
Specifies the geographic coordinates of the point on the terrain at the current viewport's center.void
setViewportCenterScreenPoint(java.awt.Point viewportCenterScreenPoint)
Specifies the screen-coordinate point of the current viewport's center.void
setVisibleSector(Sector s)
Sets the visibleSector
.-
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
-
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
-
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
-
-
-
-
Field Detail
-
frameTimestamp
protected long frameTimestamp
-
glContext
protected com.jogamp.opengl.GLContext glContext
-
glRuntimeCaps
protected GLRuntimeCapabilities glRuntimeCaps
-
glu
protected com.jogamp.opengl.glu.GLU glu
-
view
protected View view
-
model
protected Model model
-
globe
protected Globe globe
-
verticalExaggeration
protected double verticalExaggeration
-
visibleSector
protected Sector visibleSector
-
surfaceGeometry
protected SectorGeometryList surfaceGeometry
-
pickedObjects
protected PickedObjectList pickedObjects
The list of objects at the pick point during the most recent pick traversal. Initialized to an empty PickedObjectList.
-
objectsInPickRect
protected PickedObjectList objectsInPickRect
The list of objects intersecting the pick rectangle during the most recent pick traversal. Initialized to an empty PickedObjectList.
-
uniquePickNumber
protected int uniquePickNumber
-
clearColor
protected java.awt.Color clearColor
-
pixelColors
protected java.nio.ByteBuffer pixelColors
Buffer of RGB colors used to read back the framebuffer's colors and store them in client memory.
-
uniquePixelColors
protected IntSet uniquePixelColors
Set of ints used bygetPickColorsInRectangle(java.awt.Rectangle, int[])
to identify the unique color codes in the specified rectangle. This consolidates duplicate colors to a single entry. We use IntSet to achieve constant time insertion, and to reduce overhead associated associated with storing integer primitives in a HashSet.
-
pickingMode
protected boolean pickingMode
-
deepPickingMode
protected boolean deepPickingMode
-
pickPoint
protected java.awt.Point pickPoint
Indicates the current pick point in AWT screen coordinates, ornull
to indicate that there is no pick point. Initiallynull
.
-
pickRect
protected java.awt.Rectangle pickRect
Indicates the current pick rectangle in AWT screen coordinates, ornull
to indicate that there is no pick rectangle. Initiallynull
.
-
isOrderedRenderingMode
protected boolean isOrderedRenderingMode
-
preRenderMode
protected boolean preRenderMode
-
viewportCenterScreenPoint
protected java.awt.Point viewportCenterScreenPoint
-
viewportCenterPosition
protected Position viewportCenterPosition
-
geographicSurfaceTileRenderer
protected SurfaceTileRenderer geographicSurfaceTileRenderer
-
annotationRenderer
protected AnnotationRenderer annotationRenderer
-
gpuResourceCache
protected GpuResourceCache gpuResourceCache
-
textRendererCache
protected TextRendererCache textRendererCache
-
perFrameStatisticsKeys
protected java.util.Set<java.lang.String> perFrameStatisticsKeys
-
perFrameStatistics
protected java.util.Collection<PerformanceStatistic> perFrameStatistics
-
visibleSectors
protected SectorVisibilityTree visibleSectors
-
currentLayer
protected Layer currentLayer
-
redrawRequested
protected int redrawRequested
-
pickFrustumList
protected PickPointFrustumList pickFrustumList
-
renderingExceptions
protected java.util.Collection<java.lang.Throwable> renderingExceptions
-
pickPointFrustumDimension
protected java.awt.Dimension pickPointFrustumDimension
-
standardLighting
protected LightingModel standardLighting
-
declutteringTextRenderer
protected DeclutteringTextRenderer declutteringTextRenderer
-
clutterFilter
protected ClutterFilter clutterFilter
-
orderedRenderables
protected java.util.PriorityQueue<DrawContextImpl.OrderedRenderableEntry> orderedRenderables
-
orderedSurfaceRenderables
protected java.util.Queue<OrderedRenderable> orderedSurfaceRenderables
-
credits
protected java.util.LinkedHashMap<ScreenCredit,java.lang.Long> credits
-
DEFAULT_DEPTH_OFFSET_FACTOR
public static final float DEFAULT_DEPTH_OFFSET_FACTOR
- See Also:
- Constant Field Values
-
DEFAULT_DEPTH_OFFSET_UNITS
public static final float DEFAULT_DEPTH_OFFSET_UNITS
- See Also:
- Constant Field Values
-
terrain
protected Terrain terrain
-
-
Method Detail
-
dispose
public void dispose()
Free internal resources held by this draw context. A GL context must be current when this method is called.- Specified by:
dispose
in interfaceDisposable
- Throws:
com.jogamp.opengl.GLException
- - If an OpenGL context is not current when this method is called.
-
getGL
public final com.jogamp.opengl.GL getGL()
Description copied from interface:DrawContext
Retrieves the currentcom.jogamp.opengl.GL
. AGL
orGLU
is required for all graphical rendering in WorldWind.- Specified by:
getGL
in interfaceDrawContext
- Returns:
- the current
GL
if available, null otherwise
-
getGLU
public final com.jogamp.opengl.glu.GLU getGLU()
Description copied from interface:DrawContext
Retrieves the currentcom.jogamp.opengl.glu.GLU
. AGLU
orGL
is required for all graphical rendering in WorldWind.- Specified by:
getGLU
in interfaceDrawContext
- Returns:
- the current
GLU
if available, null otherwise
-
getGLContext
public final com.jogamp.opengl.GLContext getGLContext()
Description copied from interface:DrawContext
Retrieves thisDrawContext
scom.jogamp.opengl.GLContext
. If this method returns null, then there are potentially no activeGLContext
s and rendering should be aborted.- Specified by:
getGLContext
in interfaceDrawContext
- Returns:
- this
DrawContext
scom.jogamp.opengl.GLContext
.
-
getDrawableHeight
public final int getDrawableHeight()
Description copied from interface:DrawContext
Indicates the height in pixels of the drawing target associated with thisDrawContext
. The returned height is potentially different from the GL viewport height. If this DrawContext is associated with aGLJPanel
, the returned height is the power-of-two ceiling of the viewport, and is therefore almost always larger than the GL viewport height.The GL viewport dimensions can be accessed by calling
getView().getViewport()
on thisDrawContext
.- Specified by:
getDrawableHeight
in interfaceDrawContext
- Returns:
- the height of the drawing target associated with this
DrawContext
, in pixels.
-
getDrawableWidth
public final int getDrawableWidth()
Description copied from interface:DrawContext
Indicates the width in pixels of the drawing target associated with thisDrawContext
. The returned width is potentially different from the GL viewport width. If this DrawContext is associated with aGLJPanel
, the returned width is the power-of-two ceiling of the viewport, and is therefore almost always larger than the GL viewport width.The GL viewport dimensions can be accessed by calling
getView().getViewport()
on thisDrawContext
.- Specified by:
getDrawableWidth
in interfaceDrawContext
- Returns:
- the width of the drawing target associated with this
DrawContext
, in pixels.
-
getGLDrawable
public final com.jogamp.opengl.GLDrawable getGLDrawable()
Description copied from interface:DrawContext
Retrieves the currentcom.jogamp.opengl.GLDrawable
. AGLDrawable
can be used to create aGLContext
, which can then be used for rendering.- Specified by:
getGLDrawable
in interfaceDrawContext
- Returns:
- the current
GLDrawable
, null if none available
-
getGLRuntimeCapabilities
public GLRuntimeCapabilities getGLRuntimeCapabilities()
Description copied from interface:DrawContext
Returns theGLRuntimeCapabilities
associated with this DrawContext.- Specified by:
getGLRuntimeCapabilities
in interfaceDrawContext
- Returns:
- this DrawContext's associated GLRuntimeCapabilities.
-
setGLRuntimeCapabilities
public void setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
Description copied from interface:DrawContext
Sets theGLRuntimeCapabilities
associated with this DrawContext to the specified parameter.- Specified by:
setGLRuntimeCapabilities
in interfaceDrawContext
- Parameters:
capabilities
- the GLRuntimeCapabilities to be associated with this DrawContext.
-
initialize
public final void initialize(com.jogamp.opengl.GLContext glContext)
Description copied from interface:DrawContext
Initializes thisDrawContext
. This method should be called at the beginning of each frame to prepare theDrawContext
for the coming render pass.- Specified by:
initialize
in interfaceDrawContext
- Parameters:
glContext
- thecom.jogamp.opengl.GLContext
to use for this render pass
-
setModel
public final void setModel(Model model)
Description copied from interface:DrawContext
Assign a newModel
. Some layers cannot function properly with a nullModel
. It is recommended that theModel
is never set to null during a normal render pass.- Specified by:
setModel
in interfaceDrawContext
- Parameters:
model
- the newModel
-
getModel
public final Model getModel()
Description copied from interface:DrawContext
Retrieves the currentModel
, which may be null.- Specified by:
getModel
in interfaceDrawContext
- Returns:
- the current
Model
, which may be null
-
getLayers
public final LayerList getLayers()
Description copied from interface:DrawContext
Retrieves a list containing all the current layers. No guarantee is made about the order of the layers.- Specified by:
getLayers
in interfaceDrawContext
- Returns:
- a
LayerList
containing all the current layers
-
getVisibleSector
public final Sector getVisibleSector()
Description copied from interface:DrawContext
Retrieves aSector
which is at least as large as the current visible sector. The value returned is the value passed toSetVisibleSector
. This method may return null.- Specified by:
getVisibleSector
in interfaceDrawContext
- Returns:
- a
Sector
at least the size of the current visible sector, null if unavailable
-
setVisibleSector
public final void setVisibleSector(Sector s)
Description copied from interface:DrawContext
Sets the visibleSector
. The new visible sector must completely encompass the Sector which is visible on the display.- Specified by:
setVisibleSector
in interfaceDrawContext
- Parameters:
s
- the new visibleSector
-
setSurfaceGeometry
public void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
Description copied from interface:DrawContext
Specifies the current surface geometry.- Specified by:
setSurfaceGeometry
in interfaceDrawContext
- Parameters:
surfaceGeometry
- the surface geometry to make current. May be null, indicating no surface geometry.
-
getSurfaceGeometry
public SectorGeometryList getSurfaceGeometry()
Description copied from interface:DrawContext
Retrieves a list of all the sectors rendered so far this frame.- Specified by:
getSurfaceGeometry
in interfaceDrawContext
- Returns:
- a
SectorGeometryList
containing everySectorGeometry
rendered so far this render pass.
-
getGlobe
public final Globe getGlobe()
Description copied from interface:DrawContext
Retrieves the currentGlobe
, which may be null.- Specified by:
getGlobe
in interfaceDrawContext
- Returns:
- the current
Globe
, which may be null
-
setView
public final void setView(View view)
Description copied from interface:DrawContext
Assigns a newView
. Some layers cannot function properly with a nullView
. It is recommended that theView
is never set to null during a normal render pass.- Specified by:
setView
in interfaceDrawContext
- Parameters:
view
- the enwView
-
getView
public final View getView()
Description copied from interface:DrawContext
Retrieves the currentView
, which may be null.- Specified by:
getView
in interfaceDrawContext
- Returns:
- the current
View
, which may be null
-
setGLContext
public final void setGLContext(com.jogamp.opengl.GLContext glContext)
Description copied from interface:DrawContext
Assigns thisDrawContext
a newcom.jogamp.opengl.GLContext
. May throw aNullPointerException
ifglContext
is null.- Specified by:
setGLContext
in interfaceDrawContext
- Parameters:
glContext
- the newcom.jogamp.opengl.GLContext
-
getVerticalExaggeration
public final double getVerticalExaggeration()
Description copied from interface:DrawContext
Retrieves the current vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlyingGlobe
. A vertical exaggeration of 3 will create mountains and valleys which are three times as high/deep as they really are.- Specified by:
getVerticalExaggeration
in interfaceDrawContext
- Returns:
- the current vertical exaggeration
-
setVerticalExaggeration
public final void setVerticalExaggeration(double verticalExaggeration)
Description copied from interface:DrawContext
Sets the vertical exaggeration. Vertical exaggeration affects the appearance of areas with varied elevation. A vertical exaggeration of zero creates a surface which exactly fits the shape of the underlyingGlobe
. A vertical exaggeration of 3 will create mountains and valleys which are three times as high/deep as they really are.- Specified by:
setVerticalExaggeration
in interfaceDrawContext
- Parameters:
verticalExaggeration
- the new vertical exaggeration.
-
getTextureCache
public GpuResourceCache getTextureCache()
Description copied from interface:DrawContext
Returns the GPU resource cache for this draw context. This method returns the same value asDrawContext.getGpuResourceCache()
.- Specified by:
getTextureCache
in interfaceDrawContext
- Returns:
- the GPU resource cache for this draw context.
- See Also:
DrawContext.getGpuResourceCache()
-
getGpuResourceCache
public GpuResourceCache getGpuResourceCache()
Description copied from interface:DrawContext
Returns the GPU resource cache used by this draw context.- Specified by:
getGpuResourceCache
in interfaceDrawContext
- Returns:
- the GPU resource cache used by this draw context.
-
setGpuResourceCache
public void setGpuResourceCache(GpuResourceCache gpuResourceCache)
Description copied from interface:DrawContext
Specifies the GPU resource cache for this draw context.- Specified by:
setGpuResourceCache
in interfaceDrawContext
- Parameters:
gpuResourceCache
- the GPU resource cache for this draw context.
-
getTextRendererCache
public TextRendererCache getTextRendererCache()
Description copied from interface:DrawContext
Returns this draw context's text-renderer cache.- Specified by:
getTextRendererCache
in interfaceDrawContext
- Returns:
- this context's text renderer cache.
-
setTextRendererCache
public void setTextRendererCache(TextRendererCache textRendererCache)
Description copied from interface:DrawContext
Specifies this context's text renderer cache.- Specified by:
setTextRendererCache
in interfaceDrawContext
- Parameters:
textRendererCache
- the context's text renderer cache.
-
getAnnotationRenderer
public AnnotationRenderer getAnnotationRenderer()
Description copied from interface:DrawContext
Returns the draw context's annotation renderer, typically used by annotations that are not contained in anAnnotationLayer
.- Specified by:
getAnnotationRenderer
in interfaceDrawContext
- Returns:
- the annotation renderer.
-
setAnnotationRenderer
public void setAnnotationRenderer(AnnotationRenderer ar)
Description copied from interface:DrawContext
SinceAnnotation
s areRenderable
s, they can be exist outside anAnnotationLayer
, in which case they are responsible for rendering themselves. The draw context's annotation renderer provides an active renderer for that purpose.- Specified by:
setAnnotationRenderer
in interfaceDrawContext
- Parameters:
ar
- the new annotation renderer for the draw context.
-
getStandardLightingModel
public LightingModel getStandardLightingModel()
Description copied from interface:DrawContext
Returns the current model used for standard lighting.- Specified by:
getStandardLightingModel
in interfaceDrawContext
- Returns:
- the current standard lighting model, or null if no model is defined.
-
setStandardLightingModel
public void setStandardLightingModel(LightingModel standardLighting)
Description copied from interface:DrawContext
Specifies the lighting model used for standard lighting.- Specified by:
setStandardLightingModel
in interfaceDrawContext
- Parameters:
standardLighting
- the lighting model to use for standard lighting, or null to disable standard lighting.
-
getPickPoint
public java.awt.Point getPickPoint()
Description copied from interface:DrawContext
Returns the current pick point in AWT screen coordinates.- Specified by:
getPickPoint
in interfaceDrawContext
- Returns:
- the current pick point, or
null
if no pick point is available. - See Also:
DrawContext.setPickPoint(java.awt.Point)
-
setPickPoint
public void setPickPoint(java.awt.Point pickPoint)
Description copied from interface:DrawContext
Specifies the current pick point in AWT screen coordinates, ornull
to indicate that there is no pick point. During each pick traversal, layers determine if their contents are drawn at the pick point. If so, layers add each unique picked object to a PickedObjectList on this draw context by callingDrawContext.addPickedObject(gov.nasa.worldwind.pick.PickedObject)
. This list can be accessed by callingDrawContext.getPickedObjects()
.If the pick point is
null
, the pick point is ignored during each pick traversal, and the list of objects returned by getPickedObjects is empty.- Specified by:
setPickPoint
in interfaceDrawContext
- Parameters:
pickPoint
- the current pick point, ornull
to specify that there is no pick point.
-
getPickRectangle
public java.awt.Rectangle getPickRectangle()
Description copied from interface:DrawContext
Returns the current pick rectangle in AWT screen coordinates.- Specified by:
getPickRectangle
in interfaceDrawContext
- Returns:
- the current pick rectangle, or
null
if no pick rectangle is current. - See Also:
DrawContext.setPickRectangle(java.awt.Rectangle)
-
setPickRectangle
public void setPickRectangle(java.awt.Rectangle pickRect)
Description copied from interface:DrawContext
Specifies the current pick rectangle in AWT screen coordinates, ornull
to indicate that there is no pick rectangle. During each pick traversal, layers determine if their contents intersect the pick rectangle. If so, layers add each unique picked object to a PickedObjectList on this draw context by callingDrawContext.addObjectInPickRectangle(gov.nasa.worldwind.pick.PickedObject)
. This is list can be accessed by callingDrawContext.getObjectsInPickRectangle()
.If the pick rectangle is
null
, the pick rectangle is ignored during each pick traversal, and the list of objects returned by getObjectsInPickRectangle is empty.- Specified by:
setPickRectangle
in interfaceDrawContext
- Parameters:
pickRect
- the current pick rectangle, ornull
to specify that there is no pick rectangle.
-
getViewportCenterScreenPoint
public java.awt.Point getViewportCenterScreenPoint()
Description copied from interface:DrawContext
Indicates the screen-coordinate point of the current viewport's center.- Specified by:
getViewportCenterScreenPoint
in interfaceDrawContext
- Returns:
- the screen-coordinate point of the current viewport's center.
-
setViewportCenterScreenPoint
public void setViewportCenterScreenPoint(java.awt.Point viewportCenterScreenPoint)
Description copied from interface:DrawContext
Specifies the screen-coordinate point of the current viewport's center.- Specified by:
setViewportCenterScreenPoint
in interfaceDrawContext
- Parameters:
viewportCenterScreenPoint
- the screen-coordinate point of the current viewport's center.
-
getViewportCenterPosition
public Position getViewportCenterPosition()
Description copied from interface:DrawContext
Indicates the geographic coordinates of the point on the terrain at the current viewport's center.- Specified by:
getViewportCenterPosition
in interfaceDrawContext
- Returns:
- the geographic coordinates of the current viewport's center. Returns null if the globe's surface is not under the viewport's center point.
-
setViewportCenterPosition
public void setViewportCenterPosition(Position viewportCenterPosition)
Description copied from interface:DrawContext
Specifies the geographic coordinates of the point on the terrain at the current viewport's center.- Specified by:
setViewportCenterPosition
in interfaceDrawContext
- Parameters:
viewportCenterPosition
- the geographic coordinates of the current viewport's center. May be null.
-
addPickedObjects
public void addPickedObjects(PickedObjectList pickedObjects)
Description copied from interface:DrawContext
Adds a list of picked objects to the current list of objects at the pick point. This list can be accessed by callingDrawContext.getPickedObjects()
.- Specified by:
addPickedObjects
in interfaceDrawContext
- Parameters:
pickedObjects
- the list to add.
-
addPickedObject
public void addPickedObject(PickedObject pickedObject)
Description copied from interface:DrawContext
Adds the specified picked object to the list of objects at the pick point. This list can be accessed by callingDrawContext.getPickedObjects()
.- Specified by:
addPickedObject
in interfaceDrawContext
- Parameters:
pickedObject
- the object to add.
-
getPickedObjects
public PickedObjectList getPickedObjects()
Description copied from interface:DrawContext
Returns the list of objects at the pick point during the most recent pick traversal. The returned list is empty if nothing is at the pick point, or if the pick point isnull
.- Specified by:
getPickedObjects
in interfaceDrawContext
- Returns:
- the list of picked objects.
-
getObjectsInPickRectangle
public PickedObjectList getObjectsInPickRectangle()
Description copied from interface:DrawContext
Returns the list of objects intersecting the pick rectangle during the most recent pick traversal. The returned list is empty if nothing intersects the pick rectangle, or if the pick rectangle isnull
.- Specified by:
getObjectsInPickRectangle
in interfaceDrawContext
- Returns:
- the list of picked objects.
-
addObjectInPickRectangle
public void addObjectInPickRectangle(PickedObject pickedObject)
Description copied from interface:DrawContext
Adds the specified picked object to the current list of objects intersecting the pick rectangle. This list can be accessed by callingDrawContext.getObjectsInPickRectangle()
.- Specified by:
addObjectInPickRectangle
in interfaceDrawContext
- Parameters:
pickedObject
- the object to add.
-
getUniquePickColor
public java.awt.Color getUniquePickColor()
Description copied from interface:DrawContext
Returns a unique color to serve as a pick identifier during picking. This allocates a single unique color from the pick color address space and returns that color. The color's RGB components represent an address to the pick color code.- Specified by:
getUniquePickColor
in interfaceDrawContext
- Returns:
- a unique pick color.
-
getUniquePickColorRange
public java.awt.Color getUniquePickColorRange(int count)
Description copied from interface:DrawContext
Returns a range of unique colors to serve as pick identifiers during picking. This allocatescount
unique colors from the pick color address space and returns the first color in the range. The first color's RGB components represent an address to the beginning of a sequential range of pick color codes. This method is similar to calling the no-argumentDrawContext.getUniquePickColor()
count
times, but guarantees a contiguous range of color codes and is more efficient whencount
is large.The number of pick colors is limited to a finite address space. This method returns null when there are fewer than
count
remaining unique colors in the pick color address space, or whencount
is less than 1.- Specified by:
getUniquePickColorRange
in interfaceDrawContext
- Parameters:
count
- the number of unique colors to allocate.- Returns:
- the first unique pick color if there are sufficient unique colors remaining and
count
is greater than 0, otherwise null.
-
getClearColor
public java.awt.Color getClearColor()
Description copied from interface:DrawContext
Returns the WorldWindow's background color.- Specified by:
getClearColor
in interfaceDrawContext
- Returns:
- the WorldWindow's background color.
-
getPickColorAtPoint
public int getPickColorAtPoint(java.awt.Point point)
Returns the framebuffer RGB color for a point in AWT screen coordinates, formatted as a pick color code. The red, green, and blue components are each stored as an 8-bit unsigned integer, and packed into bits 0-23 of the returned integer as follows: bits 16-23 are red, bits 8-15 are green, and bits 0-7 are blue. This format is consistent with the RGB integers used to create the pick colors in getUniquePickColor.This returns 0 if the point contains the clear color, or is outside this draw context's drawable area.
- Specified by:
getPickColorAtPoint
in interfaceDrawContext
- Parameters:
point
- the point to return a color for, in AWT screen coordinates.- Returns:
- the RGB color corresponding to the specified point.
-
getPickColorsInRectangle
public int[] getPickColorsInRectangle(java.awt.Rectangle rectangle, int[] minAndMaxColorCodes)
Returns an array of the unique framebuffer RGB colors within a rectangle in AWT screen coordinates, formatted as pick color codes. The red, green, and blue components are each stored as an 8-bit unsigned integer, and packed into bits 0-23 of the returned integers as follows: bits 16-23 are red, bits 8-15 are green, and bits 0-7 are blue. This format is consistent with the RGB integers used to create the pick colors in getUniquePickColor.The returned array contains one entry for each unique color. Points in the rectangle that contain the clear color or are outside this draw context's drawable area are ignored. This returns
null
if the specified rectangle is empty, or contains only the clear color.The minAndMaxColorCodes parameter limits the unique colors that this method returns to the specified range. The minimum color must be stored in array index 0, and the maximum color must be stored in array index 1. These values can be used to specify a small range of colors relative to the framebuffer contents, effectively culling the colors that must be considered by this method and the caller. When specified, these integers must be formatted exactly as the integers this method returns.
- Specified by:
getPickColorsInRectangle
in interfaceDrawContext
- Parameters:
rectangle
- the rectangle to return unique colors for, in AWT screen coordinates.minAndMaxColorCodes
- an two element array representing the minimum and maximum RGB colors to return. May benull
to specify that all color codes must be returned.- Returns:
- the unique RGB colors corresponding to the specified rectangle, or
null
if the rectangle is empty or the rectangle contains only the clear color.
-
isPickingMode
public boolean isPickingMode()
Description copied from interface:DrawContext
Indicates whether the scene controller is currently picking.- Specified by:
isPickingMode
in interfaceDrawContext
- Returns:
- true if the scene controller is picking, otherwise false
-
enablePickingMode
public void enablePickingMode()
Description copied from interface:DrawContext
Specifies that the scene controller is beginning its pick traversal.- Specified by:
enablePickingMode
in interfaceDrawContext
-
disablePickingMode
public void disablePickingMode()
Description copied from interface:DrawContext
Specifies that the scene controller has ended its pick traversal.- Specified by:
disablePickingMode
in interfaceDrawContext
-
isDeepPickingEnabled
public boolean isDeepPickingEnabled()
Description copied from interface:DrawContext
Indicates whether all items under cursor are picked.- Specified by:
isDeepPickingEnabled
in interfaceDrawContext
- Returns:
- true if all items under the cursor are picked, otherwise false
-
setDeepPickingEnabled
public void setDeepPickingEnabled(boolean tf)
Description copied from interface:DrawContext
Specifies whether all items under the cursor are picked.- Specified by:
setDeepPickingEnabled
in interfaceDrawContext
- Parameters:
tf
- true to pick all objects under the cursor
-
isPreRenderMode
public boolean isPreRenderMode()
Description copied from interface:DrawContext
Indicates whether the scene controller is currently pre-rendering.- Specified by:
isPreRenderMode
in interfaceDrawContext
- Returns:
- true if pre-rendering, otherwise false.
- See Also:
PreRenderable
-
setPreRenderMode
public void setPreRenderMode(boolean preRenderMode)
Description copied from interface:DrawContext
Specifies whether the scene controller is pre-rendering.- Specified by:
setPreRenderMode
in interfaceDrawContext
- Parameters:
preRenderMode
- true to indicate pre-rendering, otherwise false.- See Also:
PreRenderable
-
isOrderedRenderingMode
public boolean isOrderedRenderingMode()
Description copied from interface:DrawContext
Indicates whether theSceneController
is currently rendering the draw context'sOrderedRenderable
s. When the this method returns false during a call to an ordered renderable'sRenderable.render(DrawContext)
method, the ordered renderable should add itself to the draw context viaDrawContext.addOrderedRenderable(OrderedRenderable)
rather than draw it. When this method returns true during a call to its render method, the ordered renderable should draw itself.- Specified by:
isOrderedRenderingMode
in interfaceDrawContext
- Returns:
- true if the scene controller is currently rendering its ordered renderables, otherwise false.
-
setOrderedRenderingMode
public void setOrderedRenderingMode(boolean tf)
Description copied from interface:DrawContext
Called by theSceneController
to indicate whether it is currently drawing the draw context'sOrderedRenderable
s. SeeDrawContext.isOrderedRenderingMode()
for more information.- Specified by:
setOrderedRenderingMode
in interfaceDrawContext
- Parameters:
tf
- true if ordered renderables are being drawn, false if ordered renderables are only being accumulated.
-
getDeclutteringTextRenderer
public DeclutteringTextRenderer getDeclutteringTextRenderer()
Description copied from interface:DrawContext
Returns the draw context's decluttering text renderer.- Specified by:
getDeclutteringTextRenderer
in interfaceDrawContext
- Returns:
- the decluttering text renderer.
-
is2DGlobe
public boolean is2DGlobe()
- Specified by:
is2DGlobe
in interfaceDrawContext
-
isContinuous2DGlobe
public boolean isContinuous2DGlobe()
- Specified by:
isContinuous2DGlobe
in interfaceDrawContext
-
addOrderedRenderable
public void addOrderedRenderable(OrderedRenderable orderedRenderable)
Description copied from interface:DrawContext
Adds anOrderedRenderable
to the draw context's ordered renderable list.- Specified by:
addOrderedRenderable
in interfaceDrawContext
- Parameters:
orderedRenderable
- the ordered renderable to add.
-
addOrderedRenderable
public void addOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)
Adds anOrderedRenderable
to the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables. IfisBehind
istrue
, the draw context treats the specified ordered renderable as though it is behind all other ordered renderables and ignores the ordered renderable's eye distance. If multiple ordered renderables are added withisBehind
specified astrue
, those ordered renderables are drawn according to the order in which they are added.- Specified by:
addOrderedRenderable
in interfaceDrawContext
- Parameters:
orderedRenderable
- the ordered renderable to add.isBehind
-true
to specify that the ordered renderable is behind all other ordered renderables, orfalse
to interpret the ordered renderable according to its eye distance.
-
peekOrderedRenderables
public OrderedRenderable peekOrderedRenderables()
Description copied from interface:DrawContext
Returns the nextOrderedRenderable
on the ordered-renderable priority queue but does not remove it from the queue.- Specified by:
peekOrderedRenderables
in interfaceDrawContext
- Returns:
- the next ordered renderable, or null if there are no more ordered renderables on the queue.
-
pollOrderedRenderables
public OrderedRenderable pollOrderedRenderables()
Description copied from interface:DrawContext
Returns the nextOrderedRenderable
on the ordered-renderable priority queue and removes it from the queue.- Specified by:
pollOrderedRenderables
in interfaceDrawContext
- Returns:
- the next ordered renderable, or null if there are no more ordered renderables on the queue.
-
setClutterFilter
public void setClutterFilter(ClutterFilter filter)
Description copied from interface:DrawContext
Specifies the clutter filter to use. May be null to indicate no decluttering.- Specified by:
setClutterFilter
in interfaceDrawContext
- Parameters:
filter
- the clutter filter.
-
getClutterFilter
public ClutterFilter getClutterFilter()
Description copied from interface:DrawContext
Returns the current clutter filter.- Specified by:
getClutterFilter
in interfaceDrawContext
- Returns:
- the current clutter filter.
-
applyClutterFilter
public void applyClutterFilter()
Description copied from interface:DrawContext
Filter overlapping text from the ordered renderable list.- Specified by:
applyClutterFilter
in interfaceDrawContext
-
addOrderedSurfaceRenderable
public void addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
Adds anOrderedRenderable
to the draw context's ordered surface renderable queue. This queue is populated during layer rendering with objects to render on the terrain surface, and is processed immediately after layer rendering.- Specified by:
addOrderedSurfaceRenderable
in interfaceDrawContext
- Parameters:
orderedRenderable
- the ordered renderable to add.
-
getOrderedSurfaceRenderables
public java.util.Queue<OrderedRenderable> getOrderedSurfaceRenderables()
Returns the draw context's ordered surface renderable queue. This queue is populated during layer rendering with objects to render on the terrain surface, and is processed immediately after layer rendering.- Specified by:
getOrderedSurfaceRenderables
in interfaceDrawContext
- Returns:
- the draw context's ordered surface renderable queue.
-
drawUnitQuad
public void drawUnitQuad()
Description copied from interface:DrawContext
Draws a quadrilateral using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).- Specified by:
drawUnitQuad
in interfaceDrawContext
-
drawUnitQuad
public void drawUnitQuad(com.jogamp.opengl.util.texture.TextureCoords texCoords)
Description copied from interface:DrawContext
Draws a quadrilateral using the current OpenGL state and specified texture coordinates. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).- Specified by:
drawUnitQuad
in interfaceDrawContext
- Parameters:
texCoords
- texture coordinates to assign to each quadrilateral vertex.
-
drawUnitQuadOutline
public void drawUnitQuadOutline()
Description copied from interface:DrawContext
Draws a quadrilateral outline using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).- Specified by:
drawUnitQuadOutline
in interfaceDrawContext
-
drawNormals
public void drawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.FloatBuffer nBuf)
Description copied from interface:DrawContext
This is a diagnostic method to display normal vectors.- Specified by:
drawNormals
in interfaceDrawContext
- Parameters:
length
- the length to draw the vectors, in meters.vBuf
- a vertex buffer. If null, no vectors are drawn.nBuf
- a buffer of normal vectors corresponding to the vertex buffer. If null, no vectors are drawn.
-
getPointOnTerrain
public Vec4 getPointOnTerrain(Angle latitude, Angle longitude)
Description copied from interface:DrawContext
Computes a location's Cartesian point on the currently visible terrain.- Specified by:
getPointOnTerrain
in interfaceDrawContext
- Parameters:
latitude
- the location's latitude.longitude
- the location's longitude.- Returns:
- the location's corresponding Cartesian point, or null if the location is not currently visible.
-
getGeographicSurfaceTileRenderer
public SurfaceTileRenderer getGeographicSurfaceTileRenderer()
Description copied from interface:DrawContext
Returns this draw context's surface tile renderer.- Specified by:
getGeographicSurfaceTileRenderer
in interfaceDrawContext
- Returns:
- this draw context's surface tile renderer.s
-
getPerFrameStatistics
public java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
Description copied from interface:DrawContext
Returns the performance statistics that are gathered during each frame.- Specified by:
getPerFrameStatistics
in interfaceDrawContext
- Returns:
- the performance statistics that are gathered during each frame.
-
setPerFrameStatisticsKeys
public void setPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys, java.util.Collection<PerformanceStatistic> stats)
Description copied from interface:DrawContext
Specifies the performance statistics that are monitored during each frame. Both arguments to this method may be null. If either is null then statistics are not gathered.- Specified by:
setPerFrameStatisticsKeys
in interfaceDrawContext
- Parameters:
statKeys
- the keys identifying the statistics to monitor.stats
- a list in which the statistics are placed as they're monitored.
-
getPerFrameStatisticsKeys
public java.util.Set<java.lang.String> getPerFrameStatisticsKeys()
Description copied from interface:DrawContext
Indicates the statistics that are monitored for each frame.- Specified by:
getPerFrameStatisticsKeys
in interfaceDrawContext
- Returns:
- the keys of the statistics monitored for each frame.
-
setPerFrameStatistic
public void setPerFrameStatistic(java.lang.String key, java.lang.String displayName, java.lang.Object value)
Description copied from interface:DrawContext
Specifies a performance statistic that's assigned for each frame. Use this method to update the value of a specific statistic.- Specified by:
setPerFrameStatistic
in interfaceDrawContext
- Parameters:
key
- the key identifying the statistic to monitor.displayName
- the name to use when displaying this statistic.value
- the statistic's value. May be null.- See Also:
DrawContext.setPerFrameStatistics(java.util.Collection)
-
setPerFrameStatistics
public void setPerFrameStatistics(java.util.Collection<PerformanceStatistic> stats)
Description copied from interface:DrawContext
Specifies a collection of per-frame performance statistics. Use this method to update a group of statistics.- Specified by:
setPerFrameStatistics
in interfaceDrawContext
- Parameters:
stats
- the statistic keys and their associated values.- See Also:
DrawContext.setPerFrameStatistic(String, String, Object)
-
getFrameTimeStamp
public long getFrameTimeStamp()
Description copied from interface:DrawContext
Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence. The stamp remains constant across these three operations so that called objects may avoid recomputing the same values during each of the calls in the sequence.- Specified by:
getFrameTimeStamp
in interfaceDrawContext
- Returns:
- the frame time stamp. See
System.currentTimeMillis()
for its numerical meaning.
-
setFrameTimeStamp
public void setFrameTimeStamp(long frameTimeStamp)
Description copied from interface:DrawContext
Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence. The stamp must remain constant across these three operations so that called objects may avoid recomputing the same values during each of the calls in the sequence.- Specified by:
setFrameTimeStamp
in interfaceDrawContext
- Parameters:
frameTimeStamp
- the frame time stamp. SeeSystem.currentTimeMillis()
for its numerical meaning.
-
getVisibleSectors
public java.util.List<Sector> getVisibleSectors(double[] resolutions, long timeLimit, Sector sector)
Description copied from interface:DrawContext
Returns the visible sectors at one of several specified resolutions within a specified search sector. Several sectors resolutions may be specified along with a time limit. The best resolution that can be determined within the time limit is returned.Adherence to the time limit is not precise. The limit is checked only between full searches at each resolution. The search may take more than the specified time, but will terminate if no time is left before starting a higher-resolution search.
- Specified by:
getVisibleSectors
in interfaceDrawContext
- Parameters:
resolutions
- the resolutions of the sectors to return, in latitude.timeLimit
- the amount of time, in milliseconds, to allow for searching.sector
- the sector to decompose into visible sectors.- Returns:
- the visible sectors at the best resolution achievable given the time limit. The actual resolution can be determined by examining the delta-latitude value of any of the returned sectors.
-
setCurrentLayer
public void setCurrentLayer(Layer layer)
Description copied from interface:DrawContext
Sets the current-layer field to the specified layer or null. The field is informative only and enables layer contents to determine their containing layer.- Specified by:
setCurrentLayer
in interfaceDrawContext
- Parameters:
layer
- the current layer or null.
-
getCurrentLayer
public Layer getCurrentLayer()
Description copied from interface:DrawContext
Returns the current-layer. The field is informative only and enables layer contents to determine their containing layer.- Specified by:
getCurrentLayer
in interfaceDrawContext
- Returns:
- the current layer, or null if no layer is current.
-
addScreenCredit
public void addScreenCredit(ScreenCredit credit)
Description copied from interface:DrawContext
Adds a screen-credit icon to display.- Specified by:
addScreenCredit
in interfaceDrawContext
- Parameters:
credit
- the screen credit to display.
-
getScreenCredits
public java.util.Map<ScreenCredit,java.lang.Long> getScreenCredits()
Description copied from interface:DrawContext
Returns the screen credits currently held and displayed by this draw context.- Specified by:
getScreenCredits
in interfaceDrawContext
- Returns:
- the screen credits currently held by this draw context.
-
getRedrawRequested
public int getRedrawRequested()
Description copied from interface:DrawContext
Indicates whether a new frame should be generated by theSceneController
.- Specified by:
getRedrawRequested
in interfaceDrawContext
- Returns:
- the delay in milliseconds if a redraw has been requested, otherwise 0.
-
setRedrawRequested
public void setRedrawRequested(int redrawRequested)
Description copied from interface:DrawContext
Requests that a new frame should be generated by theSceneController
.- Specified by:
setRedrawRequested
in interfaceDrawContext
- Parameters:
redrawRequested
- a delay in milliseconds if a redraw is requested, otherwise 0.
-
getPickFrustums
public PickPointFrustumList getPickFrustums()
Description copied from interface:DrawContext
Gets the FrustumList containing all the current Pick Frustums- Specified by:
getPickFrustums
in interfaceDrawContext
- Returns:
- FrustumList of Pick Frustums
-
setPickPointFrustumDimension
public void setPickPointFrustumDimension(java.awt.Dimension dim)
Description copied from interface:DrawContext
Set the size (in pixels) of the pick point frustum at the near plane.- Specified by:
setPickPointFrustumDimension
in interfaceDrawContext
- Parameters:
dim
- dimension of pick point frustum
-
getPickPointFrustumDimension
public java.awt.Dimension getPickPointFrustumDimension()
Description copied from interface:DrawContext
Gets the dimension of the current Pick Point Frustum- Specified by:
getPickPointFrustumDimension
in interfaceDrawContext
- Returns:
- the dimension of the current Pick Point Frustum
-
addPickPointFrustum
public void addPickPointFrustum()
Description copied from interface:DrawContext
Creates a frustum around the current pick point and adds it to the current list of pick frustums. The frustum's dimension is specified by callingDrawContext.setPickPointFrustumDimension(java.awt.Dimension)
.This does nothing if the current pick point is
null
.- Specified by:
addPickPointFrustum
in interfaceDrawContext
-
addPickRectangleFrustum
public void addPickRectangleFrustum()
Description copied from interface:DrawContext
Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.This does nothing if the current pick rectangle is
null
.- Specified by:
addPickRectangleFrustum
in interfaceDrawContext
-
getRenderingExceptions
public java.util.Collection<java.lang.Throwable> getRenderingExceptions()
Description copied from interface:DrawContext
Gets the rendering exceptions associated with this DrawContext as aCollection
ofThrowable
objects. If non-null, the returned Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext inDrawContext.addRenderingException(Throwable)
. A null collection indicates this DrawContext does not accumulate rendering exceptions.- Specified by:
getRenderingExceptions
in interfaceDrawContext
- Returns:
- the Collection used to accumulate rendering exceptions, or null if this DrawContext does not accumulate rendering exceptions.
-
setRenderingExceptions
public void setRenderingExceptions(java.util.Collection<java.lang.Throwable> exceptions)
Description copied from interface:DrawContext
Sets the rendering exceptions associated with this DrawContext to the specifiedCollection
ofThrowable
objects. If non-null, the specified Collection is used as the data structure that accumulates rendering exceptions passed to this DrawContext inDrawContext.addRenderingException(Throwable)
. A null collection indicates this DrawContext should not accumulate rendering exceptions.- Specified by:
setRenderingExceptions
in interfaceDrawContext
- Parameters:
exceptions
- the Collection of exceptions to be used to accumulate rendering exceptions, or null to disable accumulation of rendering exception.
-
addRenderingException
public void addRenderingException(java.lang.Throwable t)
Description copied from interface:DrawContext
Adds the specifiedThrowable
to this DrawContext's collection of rendering exceptions. If this DrawContext's collection is null, the specified Throwable is ignored and calling this method is benign.- Specified by:
addRenderingException
in interfaceDrawContext
- Parameters:
t
- the rendering exception to add as aThrowable
.
-
pushProjectionOffest
public void pushProjectionOffest(java.lang.Double offset)
Description copied from interface:DrawContext
Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point. This gives those objects visual priority over objects at the same or nearly the same position. After the objects are drawn, callDrawContext.popProjectionOffest()
to cancel the effect for subsequently drawn objects.Note: This capability is meant to be applied only within a single Renderable. It is not intended as a means to offset a whole Renderable or collection of Renderables.
See "Mathematics for Game Programming and 3D Computer Graphics, 2 ed." by Eric Lengyel, Section 9.1, "Depth Value Offset" for a description of this technique.
- Specified by:
pushProjectionOffest
in interfaceDrawContext
- Parameters:
offset
- a reference to an offset value, typically near 1.0, or null to request use of the default value. Values less than 1.0 pull objects toward the eye point, values greater than 1.0 push objects away from the eye point. The default value is 0.99.- See Also:
DrawContext.popProjectionOffest()
-
popProjectionOffest
public void popProjectionOffest()
Description copied from interface:DrawContext
Removes the current projection matrix offset added byDrawContext.pushProjectionOffest(Double)
.- Specified by:
popProjectionOffest
in interfaceDrawContext
- See Also:
DrawContext.pushProjectionOffest(Double)
-
drawOutlinedShape
public void drawOutlinedShape(OutlinedShape renderer, java.lang.Object shape)
Description copied from interface:DrawContext
Performs a multi-pass rendering technique to ensure that outlines around filled shapes are drawn correctly when blending or ant-aliasing is performed, and that filled portions of the shape resolve depth-buffer fighting with shapes previously drawn in favor of the current shape.- Specified by:
drawOutlinedShape
in interfaceDrawContext
- Parameters:
renderer
- an object implementing theOutlinedShape
interface for the shape.shape
- the shape to render.- See Also:
OutlinedShape
-
beginStandardLighting
public void beginStandardLighting()
Description copied from interface:DrawContext
Enables the current standard lighting model.DrawContext.endStandardLighting()
must be called when rendering of the current shape is complete.- Specified by:
beginStandardLighting
in interfaceDrawContext
- See Also:
DrawContext.setStandardLightingModel(LightingModel)
,DrawContext.endStandardLighting()
-
endStandardLighting
public void endStandardLighting()
Description copied from interface:DrawContext
Pops the OpenGL state previously established byDrawContext.beginStandardLighting()
.- Specified by:
endStandardLighting
in interfaceDrawContext
-
isSmall
public boolean isSmall(Extent extent, int numPixels)
Description copied from interface:DrawContext
Indicates whether a specified extent is smaller than a specified number of pixels for the current view.- Specified by:
isSmall
in interfaceDrawContext
- Parameters:
extent
- the extent to test. May be null, in which case this method returns false.numPixels
- the number of pixels at and below which the extent is considered too small.- Returns:
- true if the projected extent is smaller than the specified number of pixels, otherwise false.
-
getTerrain
public Terrain getTerrain()
Description copied from interface:DrawContext
Returns aTerrain
object that uses the current sector geometry or the current globe to compute surface points.- Specified by:
getTerrain
in interfaceDrawContext
- Returns:
- a terrain object for computing surface points and intersections.
-
computeTerrainPoint
public Vec4 computeTerrainPoint(Angle lat, Angle lon, double offset)
Description copied from interface:DrawContext
Compute a model-coordinate point on the terrain.- Specified by:
computeTerrainPoint
in interfaceDrawContext
- Parameters:
lat
- the point's latitude.lon
- the point's longitude.offset
- an distance in meters to place the point above or below the terrain.- Returns:
- a model-coordinate point offset the specified amount from the current terrain.
-
restoreDefaultBlending
public void restoreDefaultBlending()
Description copied from interface:DrawContext
Restores the current OpenGL context's blending state to its default.- Specified by:
restoreDefaultBlending
in interfaceDrawContext
-
restoreDefaultCurrentColor
public void restoreDefaultCurrentColor()
Description copied from interface:DrawContext
Restores the current OpenGL context's current color to its default.- Specified by:
restoreDefaultCurrentColor
in interfaceDrawContext
-
restoreDefaultDepthTesting
public void restoreDefaultDepthTesting()
Description copied from interface:DrawContext
Restores the current OpenGL context's depth testing state to its default.- Specified by:
restoreDefaultDepthTesting
in interfaceDrawContext
-
computePointFromPosition
public Vec4 computePointFromPosition(Position position, int altitudeMode)
Description copied from interface:DrawContext
Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.- Specified by:
computePointFromPosition
in interfaceDrawContext
- Parameters:
position
- the position to convert.altitudeMode
- the altitude mode.- Returns:
- the Cartesian point corresponding to the specified position and this context's current globe or terrain.
-
-