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 classDrawContextImpl.OrderedRenderableEntry
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationRendererannotationRendererprotected java.awt.ColorclearColorprotected ClutterFilterclutterFilterprotected java.util.LinkedHashMap<ScreenCredit,java.lang.Long>creditsprotected LayercurrentLayerprotected DeclutteringTextRendererdeclutteringTextRendererprotected booleandeepPickingModestatic floatDEFAULT_DEPTH_OFFSET_FACTORstatic floatDEFAULT_DEPTH_OFFSET_UNITSprotected longframeTimestampprotected SurfaceTileRenderergeographicSurfaceTileRendererprotected com.jogamp.opengl.GLContextglContextprotected Globeglobeprotected GLRuntimeCapabilitiesglRuntimeCapsprotected com.jogamp.opengl.glu.GLUgluprotected GpuResourceCachegpuResourceCacheprotected booleanisOrderedRenderingModeprotected Modelmodelprotected PickedObjectListobjectsInPickRectThe list of objects intersecting the pick rectangle during the most recent pick traversal.protected java.util.PriorityQueue<DrawContextImpl.OrderedRenderableEntry>orderedRenderablesprotected java.util.Queue<OrderedRenderable>orderedSurfaceRenderablesprotected java.util.Collection<PerformanceStatistic>perFrameStatisticsprotected java.util.Set<java.lang.String>perFrameStatisticsKeysprotected PickedObjectListpickedObjectsThe list of objects at the pick point during the most recent pick traversal.protected PickPointFrustumListpickFrustumListprotected booleanpickingModeprotected java.awt.PointpickPointIndicates the current pick point in AWT screen coordinates, ornullto indicate that there is no pick point.protected java.awt.DimensionpickPointFrustumDimensionprotected java.awt.RectanglepickRectIndicates the current pick rectangle in AWT screen coordinates, ornullto indicate that there is no pick rectangle.protected java.nio.ByteBufferpixelColorsBuffer of RGB colors used to read back the framebuffer's colors and store them in client memory.protected booleanpreRenderModeprotected intredrawRequestedprotected java.util.Collection<java.lang.Throwable>renderingExceptionsprotected LightingModelstandardLightingprotected SectorGeometryListsurfaceGeometryprotected Terrainterrainprotected TextRendererCachetextRendererCacheprotected intuniquePickNumberprotected IntSetuniquePixelColorsSet of ints used bygetPickColorsInRectangle(java.awt.Rectangle, int[])to identify the unique color codes in the specified rectangle.protected doubleverticalExaggerationprotected Viewviewprotected PositionviewportCenterPositionprotected java.awt.PointviewportCenterScreenPointprotected SectorvisibleSectorprotected SectorVisibilityTreevisibleSectors
-
Constructor Summary
Constructors Constructor Description DrawContextImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddObjectInPickRectangle(PickedObject pickedObject)Adds the specified picked object to the current list of objects intersecting the pick rectangle.voidaddOrderedRenderable(OrderedRenderable orderedRenderable)Adds anOrderedRenderableto the draw context's ordered renderable list.voidaddOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)Adds anOrderedRenderableto the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables.voidaddOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)Adds anOrderedRenderableto the draw context's ordered surface renderable queue.voidaddPickedObject(PickedObject pickedObject)Adds the specified picked object to the list of objects at the pick point.voidaddPickedObjects(PickedObjectList pickedObjects)Adds a list of picked objects to the current list of objects at the pick point.voidaddPickPointFrustum()Creates a frustum around the current pick point and adds it to the current list of pick frustums.voidaddPickRectangleFrustum()Creates a frustum containing the current pick rectangle and adds it to the current list of pick frustums.voidaddRenderingException(java.lang.Throwable t)Adds the specifiedThrowableto this DrawContext's collection of rendering exceptions.voidaddScreenCredit(ScreenCredit credit)Adds a screen-credit icon to display.voidapplyClutterFilter()Filter overlapping text from the ordered renderable list.voidbeginStandardLighting()Enables the current standard lighting model.Vec4computePointFromPosition(Position position, int altitudeMode)Computes a Cartesian point from a specified geographic position, applying a specified altitude mode.Vec4computeTerrainPoint(Angle lat, Angle lon, double offset)Compute a model-coordinate point on the terrain.voiddisablePickingMode()Specifies that the scene controller has ended its pick traversal.voiddispose()Free internal resources held by this draw context.voiddrawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.FloatBuffer nBuf)This is a diagnostic method to display normal vectors.voiddrawOutlinedShape(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.voiddrawUnitQuad()Draws a quadrilateral using the current OpenGL state.voiddrawUnitQuad(com.jogamp.opengl.util.texture.TextureCoords texCoords)Draws a quadrilateral using the current OpenGL state and specified texture coordinates.voiddrawUnitQuadOutline()Draws a quadrilateral outline using the current OpenGL state.voidenablePickingMode()Specifies that the scene controller is beginning its pick traversal.voidendStandardLighting()Pops the OpenGL state previously established byDrawContext.beginStandardLighting().AnnotationRenderergetAnnotationRenderer()Returns the draw context's annotation renderer, typically used by annotations that are not contained in anAnnotationLayer.java.awt.ColorgetClearColor()Returns the WorldWindow's background color.ClutterFiltergetClutterFilter()Returns the current clutter filter.LayergetCurrentLayer()Returns the current-layer.DeclutteringTextRenderergetDeclutteringTextRenderer()Returns the draw context's decluttering text renderer.intgetDrawableHeight()Indicates the height in pixels of the drawing target associated with thisDrawContext.intgetDrawableWidth()Indicates the width in pixels of the drawing target associated with thisDrawContext.longgetFrameTimeStamp()Returns the time stamp corresponding to the beginning of a pre-render, pick, render sequence.SurfaceTileRenderergetGeographicSurfaceTileRenderer()Returns this draw context's surface tile renderer.com.jogamp.opengl.GLgetGL()Retrieves the currentcom.jogamp.opengl.GL.com.jogamp.opengl.GLContextgetGLContext()Retrieves thisDrawContextscom.jogamp.opengl.GLContext.com.jogamp.opengl.GLDrawablegetGLDrawable()Retrieves the currentcom.jogamp.opengl.GLDrawable.GlobegetGlobe()Retrieves the currentGlobe, which may be null.GLRuntimeCapabilitiesgetGLRuntimeCapabilities()Returns theGLRuntimeCapabilitiesassociated with this DrawContext.com.jogamp.opengl.glu.GLUgetGLU()Retrieves the currentcom.jogamp.opengl.glu.GLU.GpuResourceCachegetGpuResourceCache()Returns the GPU resource cache used by this draw context.LayerListgetLayers()Retrieves a list containing all the current layers.ModelgetModel()Retrieves the currentModel, which may be null.PickedObjectListgetObjectsInPickRectangle()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.intgetPickColorAtPoint(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.PickedObjectListgetPickedObjects()Returns the list of objects at the pick point during the most recent pick traversal.PickPointFrustumListgetPickFrustums()Gets the FrustumList containing all the current Pick Frustumsjava.awt.PointgetPickPoint()Returns the current pick point in AWT screen coordinates.java.awt.DimensiongetPickPointFrustumDimension()Gets the dimension of the current Pick Point Frustumjava.awt.RectanglegetPickRectangle()Returns the current pick rectangle in AWT screen coordinates.Vec4getPointOnTerrain(Angle latitude, Angle longitude)Computes a location's Cartesian point on the currently visible terrain.intgetRedrawRequested()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 aCollectionofThrowableobjects.java.util.Map<ScreenCredit,java.lang.Long>getScreenCredits()Returns the screen credits currently held and displayed by this draw context.LightingModelgetStandardLightingModel()Returns the current model used for standard lighting.SectorGeometryListgetSurfaceGeometry()Retrieves a list of all the sectors rendered so far this frame.TerraingetTerrain()Returns aTerrainobject that uses the current sector geometry or the current globe to compute surface points.TextRendererCachegetTextRendererCache()Returns this draw context's text-renderer cache.GpuResourceCachegetTextureCache()Returns the GPU resource cache for this draw context.java.awt.ColorgetUniquePickColor()Returns a unique color to serve as a pick identifier during picking.java.awt.ColorgetUniquePickColorRange(int count)Returns a range of unique colors to serve as pick identifiers during picking.doublegetVerticalExaggeration()Retrieves the current vertical exaggeration.ViewgetView()Retrieves the currentView, which may be null.PositiongetViewportCenterPosition()Indicates the geographic coordinates of the point on the terrain at the current viewport's center.java.awt.PointgetViewportCenterScreenPoint()Indicates the screen-coordinate point of the current viewport's center.SectorgetVisibleSector()Retrieves aSectorwhich 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.voidinitialize(com.jogamp.opengl.GLContext glContext)Initializes thisDrawContext.booleanis2DGlobe()booleanisContinuous2DGlobe()booleanisDeepPickingEnabled()Indicates whether all items under cursor are picked.booleanisOrderedRenderingMode()Indicates whether theSceneControlleris currently rendering the draw context'sOrderedRenderables.booleanisPickingMode()Indicates whether the scene controller is currently picking.booleanisPreRenderMode()Indicates whether the scene controller is currently pre-rendering.booleanisSmall(Extent extent, int numPixels)Indicates whether a specified extent is smaller than a specified number of pixels for the current view.OrderedRenderablepeekOrderedRenderables()Returns the nextOrderedRenderableon the ordered-renderable priority queue but does not remove it from the queue.OrderedRenderablepollOrderedRenderables()Returns the nextOrderedRenderableon the ordered-renderable priority queue and removes it from the queue.voidpopProjectionOffest()Removes the current projection matrix offset added byDrawContext.pushProjectionOffest(Double).voidpushProjectionOffest(java.lang.Double offset)Modifies the current projection matrix to slightly offset subsequently drawn objects toward or away from the eye point.voidrestoreDefaultBlending()Restores the current OpenGL context's blending state to its default.voidrestoreDefaultCurrentColor()Restores the current OpenGL context's current color to its default.voidrestoreDefaultDepthTesting()Restores the current OpenGL context's depth testing state to its default.voidsetAnnotationRenderer(AnnotationRenderer ar)SinceAnnotations areRenderables, they can be exist outside anAnnotationLayer, in which case they are responsible for rendering themselves.voidsetClutterFilter(ClutterFilter filter)Specifies the clutter filter to use.voidsetCurrentLayer(Layer layer)Sets the current-layer field to the specified layer or null.voidsetDeepPickingEnabled(boolean tf)Specifies whether all items under the cursor are picked.voidsetFrameTimeStamp(long frameTimeStamp)Specifies the time stamp corresponding to the beginning of a pre-render, pick, render sequence.voidsetGLContext(com.jogamp.opengl.GLContext glContext)Assigns thisDrawContexta newcom.jogamp.opengl.GLContext.voidsetGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)Sets theGLRuntimeCapabilitiesassociated with this DrawContext to the specified parameter.voidsetGpuResourceCache(GpuResourceCache gpuResourceCache)Specifies the GPU resource cache for this draw context.voidsetModel(Model model)Assign a newModel.voidsetOrderedRenderingMode(boolean tf)Called by theSceneControllerto indicate whether it is currently drawing the draw context'sOrderedRenderables.voidsetPerFrameStatistic(java.lang.String key, java.lang.String displayName, java.lang.Object value)Specifies a performance statistic that's assigned for each frame.voidsetPerFrameStatistics(java.util.Collection<PerformanceStatistic> stats)Specifies a collection of per-frame performance statistics.voidsetPerFrameStatisticsKeys(java.util.Set<java.lang.String> statKeys, java.util.Collection<PerformanceStatistic> stats)Specifies the performance statistics that are monitored during each frame.voidsetPickPoint(java.awt.Point pickPoint)Specifies the current pick point in AWT screen coordinates, ornullto indicate that there is no pick point.voidsetPickPointFrustumDimension(java.awt.Dimension dim)Set the size (in pixels) of the pick point frustum at the near plane.voidsetPickRectangle(java.awt.Rectangle pickRect)Specifies the current pick rectangle in AWT screen coordinates, ornullto indicate that there is no pick rectangle.voidsetPreRenderMode(boolean preRenderMode)Specifies whether the scene controller is pre-rendering.voidsetRedrawRequested(int redrawRequested)Requests that a new frame should be generated by theSceneController.voidsetRenderingExceptions(java.util.Collection<java.lang.Throwable> exceptions)Sets the rendering exceptions associated with this DrawContext to the specifiedCollectionofThrowableobjects.voidsetStandardLightingModel(LightingModel standardLighting)Specifies the lighting model used for standard lighting.voidsetSurfaceGeometry(SectorGeometryList surfaceGeometry)Specifies the current surface geometry.voidsetTextRendererCache(TextRendererCache textRendererCache)Specifies this context's text renderer cache.voidsetVerticalExaggeration(double verticalExaggeration)Sets the vertical exaggeration.voidsetView(View view)Assigns a newView.voidsetViewportCenterPosition(Position viewportCenterPosition)Specifies the geographic coordinates of the point on the terrain at the current viewport's center.voidsetViewportCenterScreenPoint(java.awt.Point viewportCenterScreenPoint)Specifies the screen-coordinate point of the current viewport's center.voidsetVisibleSector(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, ornullto indicate that there is no pick point. Initiallynull.
-
pickRect
protected java.awt.Rectangle pickRect
Indicates the current pick rectangle in AWT screen coordinates, ornullto 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:
disposein 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:DrawContextRetrieves the currentcom.jogamp.opengl.GL. AGLorGLUis required for all graphical rendering in WorldWind.- Specified by:
getGLin interfaceDrawContext- Returns:
- the current
GLif available, null otherwise
-
getGLU
public final com.jogamp.opengl.glu.GLU getGLU()
Description copied from interface:DrawContextRetrieves the currentcom.jogamp.opengl.glu.GLU. AGLUorGLis required for all graphical rendering in WorldWind.- Specified by:
getGLUin interfaceDrawContext- Returns:
- the current
GLUif available, null otherwise
-
getGLContext
public final com.jogamp.opengl.GLContext getGLContext()
Description copied from interface:DrawContextRetrieves thisDrawContextscom.jogamp.opengl.GLContext. If this method returns null, then there are potentially no activeGLContexts and rendering should be aborted.- Specified by:
getGLContextin interfaceDrawContext- Returns:
- this
DrawContextscom.jogamp.opengl.GLContext.
-
getDrawableHeight
public final int getDrawableHeight()
Description copied from interface:DrawContextIndicates 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:
getDrawableHeightin interfaceDrawContext- Returns:
- the height of the drawing target associated with this
DrawContext, in pixels.
-
getDrawableWidth
public final int getDrawableWidth()
Description copied from interface:DrawContextIndicates 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:
getDrawableWidthin 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:DrawContextRetrieves the currentcom.jogamp.opengl.GLDrawable. AGLDrawablecan be used to create aGLContext, which can then be used for rendering.- Specified by:
getGLDrawablein interfaceDrawContext- Returns:
- the current
GLDrawable, null if none available
-
getGLRuntimeCapabilities
public GLRuntimeCapabilities getGLRuntimeCapabilities()
Description copied from interface:DrawContextReturns theGLRuntimeCapabilitiesassociated with this DrawContext.- Specified by:
getGLRuntimeCapabilitiesin interfaceDrawContext- Returns:
- this DrawContext's associated GLRuntimeCapabilities.
-
setGLRuntimeCapabilities
public void setGLRuntimeCapabilities(GLRuntimeCapabilities capabilities)
Description copied from interface:DrawContextSets theGLRuntimeCapabilitiesassociated with this DrawContext to the specified parameter.- Specified by:
setGLRuntimeCapabilitiesin 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:DrawContextInitializes thisDrawContext. This method should be called at the beginning of each frame to prepare theDrawContextfor the coming render pass.- Specified by:
initializein interfaceDrawContext- Parameters:
glContext- thecom.jogamp.opengl.GLContextto use for this render pass
-
setModel
public final void setModel(Model model)
Description copied from interface:DrawContextAssign a newModel. Some layers cannot function properly with a nullModel. It is recommended that theModelis never set to null during a normal render pass.- Specified by:
setModelin interfaceDrawContext- Parameters:
model- the newModel
-
getModel
public final Model getModel()
Description copied from interface:DrawContextRetrieves the currentModel, which may be null.- Specified by:
getModelin interfaceDrawContext- Returns:
- the current
Model, which may be null
-
getLayers
public final LayerList getLayers()
Description copied from interface:DrawContextRetrieves a list containing all the current layers. No guarantee is made about the order of the layers.- Specified by:
getLayersin interfaceDrawContext- Returns:
- a
LayerListcontaining all the current layers
-
getVisibleSector
public final Sector getVisibleSector()
Description copied from interface:DrawContextRetrieves aSectorwhich 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:
getVisibleSectorin interfaceDrawContext- Returns:
- a
Sectorat least the size of the current visible sector, null if unavailable
-
setVisibleSector
public final void setVisibleSector(Sector s)
Description copied from interface:DrawContextSets the visibleSector. The new visible sector must completely encompass the Sector which is visible on the display.- Specified by:
setVisibleSectorin interfaceDrawContext- Parameters:
s- the new visibleSector
-
setSurfaceGeometry
public void setSurfaceGeometry(SectorGeometryList surfaceGeometry)
Description copied from interface:DrawContextSpecifies the current surface geometry.- Specified by:
setSurfaceGeometryin interfaceDrawContext- Parameters:
surfaceGeometry- the surface geometry to make current. May be null, indicating no surface geometry.
-
getSurfaceGeometry
public SectorGeometryList getSurfaceGeometry()
Description copied from interface:DrawContextRetrieves a list of all the sectors rendered so far this frame.- Specified by:
getSurfaceGeometryin interfaceDrawContext- Returns:
- a
SectorGeometryListcontaining everySectorGeometryrendered so far this render pass.
-
getGlobe
public final Globe getGlobe()
Description copied from interface:DrawContextRetrieves the currentGlobe, which may be null.- Specified by:
getGlobein interfaceDrawContext- Returns:
- the current
Globe, which may be null
-
setView
public final void setView(View view)
Description copied from interface:DrawContextAssigns a newView. Some layers cannot function properly with a nullView. It is recommended that theViewis never set to null during a normal render pass.- Specified by:
setViewin interfaceDrawContext- Parameters:
view- the enwView
-
getView
public final View getView()
Description copied from interface:DrawContextRetrieves the currentView, which may be null.- Specified by:
getViewin interfaceDrawContext- Returns:
- the current
View, which may be null
-
setGLContext
public final void setGLContext(com.jogamp.opengl.GLContext glContext)
Description copied from interface:DrawContextAssigns thisDrawContexta newcom.jogamp.opengl.GLContext. May throw aNullPointerExceptionifglContextis null.- Specified by:
setGLContextin interfaceDrawContext- Parameters:
glContext- the newcom.jogamp.opengl.GLContext
-
getVerticalExaggeration
public final double getVerticalExaggeration()
Description copied from interface:DrawContextRetrieves 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:
getVerticalExaggerationin interfaceDrawContext- Returns:
- the current vertical exaggeration
-
setVerticalExaggeration
public final void setVerticalExaggeration(double verticalExaggeration)
Description copied from interface:DrawContextSets 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:
setVerticalExaggerationin interfaceDrawContext- Parameters:
verticalExaggeration- the new vertical exaggeration.
-
getTextureCache
public GpuResourceCache getTextureCache()
Description copied from interface:DrawContextReturns the GPU resource cache for this draw context. This method returns the same value asDrawContext.getGpuResourceCache().- Specified by:
getTextureCachein interfaceDrawContext- Returns:
- the GPU resource cache for this draw context.
- See Also:
DrawContext.getGpuResourceCache()
-
getGpuResourceCache
public GpuResourceCache getGpuResourceCache()
Description copied from interface:DrawContextReturns the GPU resource cache used by this draw context.- Specified by:
getGpuResourceCachein interfaceDrawContext- Returns:
- the GPU resource cache used by this draw context.
-
setGpuResourceCache
public void setGpuResourceCache(GpuResourceCache gpuResourceCache)
Description copied from interface:DrawContextSpecifies the GPU resource cache for this draw context.- Specified by:
setGpuResourceCachein interfaceDrawContext- Parameters:
gpuResourceCache- the GPU resource cache for this draw context.
-
getTextRendererCache
public TextRendererCache getTextRendererCache()
Description copied from interface:DrawContextReturns this draw context's text-renderer cache.- Specified by:
getTextRendererCachein interfaceDrawContext- Returns:
- this context's text renderer cache.
-
setTextRendererCache
public void setTextRendererCache(TextRendererCache textRendererCache)
Description copied from interface:DrawContextSpecifies this context's text renderer cache.- Specified by:
setTextRendererCachein interfaceDrawContext- Parameters:
textRendererCache- the context's text renderer cache.
-
getAnnotationRenderer
public AnnotationRenderer getAnnotationRenderer()
Description copied from interface:DrawContextReturns the draw context's annotation renderer, typically used by annotations that are not contained in anAnnotationLayer.- Specified by:
getAnnotationRendererin interfaceDrawContext- Returns:
- the annotation renderer.
-
setAnnotationRenderer
public void setAnnotationRenderer(AnnotationRenderer ar)
Description copied from interface:DrawContextSinceAnnotations areRenderables, 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:
setAnnotationRendererin interfaceDrawContext- Parameters:
ar- the new annotation renderer for the draw context.
-
getStandardLightingModel
public LightingModel getStandardLightingModel()
Description copied from interface:DrawContextReturns the current model used for standard lighting.- Specified by:
getStandardLightingModelin interfaceDrawContext- Returns:
- the current standard lighting model, or null if no model is defined.
-
setStandardLightingModel
public void setStandardLightingModel(LightingModel standardLighting)
Description copied from interface:DrawContextSpecifies the lighting model used for standard lighting.- Specified by:
setStandardLightingModelin 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:DrawContextReturns the current pick point in AWT screen coordinates.- Specified by:
getPickPointin interfaceDrawContext- Returns:
- the current pick point, or
nullif no pick point is available. - See Also:
DrawContext.setPickPoint(java.awt.Point)
-
setPickPoint
public void setPickPoint(java.awt.Point pickPoint)
Description copied from interface:DrawContextSpecifies the current pick point in AWT screen coordinates, ornullto 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:
setPickPointin interfaceDrawContext- Parameters:
pickPoint- the current pick point, ornullto specify that there is no pick point.
-
getPickRectangle
public java.awt.Rectangle getPickRectangle()
Description copied from interface:DrawContextReturns the current pick rectangle in AWT screen coordinates.- Specified by:
getPickRectanglein interfaceDrawContext- Returns:
- the current pick rectangle, or
nullif no pick rectangle is current. - See Also:
DrawContext.setPickRectangle(java.awt.Rectangle)
-
setPickRectangle
public void setPickRectangle(java.awt.Rectangle pickRect)
Description copied from interface:DrawContextSpecifies the current pick rectangle in AWT screen coordinates, ornullto 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:
setPickRectanglein interfaceDrawContext- Parameters:
pickRect- the current pick rectangle, ornullto specify that there is no pick rectangle.
-
getViewportCenterScreenPoint
public java.awt.Point getViewportCenterScreenPoint()
Description copied from interface:DrawContextIndicates the screen-coordinate point of the current viewport's center.- Specified by:
getViewportCenterScreenPointin interfaceDrawContext- Returns:
- the screen-coordinate point of the current viewport's center.
-
setViewportCenterScreenPoint
public void setViewportCenterScreenPoint(java.awt.Point viewportCenterScreenPoint)
Description copied from interface:DrawContextSpecifies the screen-coordinate point of the current viewport's center.- Specified by:
setViewportCenterScreenPointin interfaceDrawContext- Parameters:
viewportCenterScreenPoint- the screen-coordinate point of the current viewport's center.
-
getViewportCenterPosition
public Position getViewportCenterPosition()
Description copied from interface:DrawContextIndicates the geographic coordinates of the point on the terrain at the current viewport's center.- Specified by:
getViewportCenterPositionin 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:DrawContextSpecifies the geographic coordinates of the point on the terrain at the current viewport's center.- Specified by:
setViewportCenterPositionin 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:DrawContextAdds 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:
addPickedObjectsin interfaceDrawContext- Parameters:
pickedObjects- the list to add.
-
addPickedObject
public void addPickedObject(PickedObject pickedObject)
Description copied from interface:DrawContextAdds the specified picked object to the list of objects at the pick point. This list can be accessed by callingDrawContext.getPickedObjects().- Specified by:
addPickedObjectin interfaceDrawContext- Parameters:
pickedObject- the object to add.
-
getPickedObjects
public PickedObjectList getPickedObjects()
Description copied from interface:DrawContextReturns 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:
getPickedObjectsin interfaceDrawContext- Returns:
- the list of picked objects.
-
getObjectsInPickRectangle
public PickedObjectList getObjectsInPickRectangle()
Description copied from interface:DrawContextReturns 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:
getObjectsInPickRectanglein interfaceDrawContext- Returns:
- the list of picked objects.
-
addObjectInPickRectangle
public void addObjectInPickRectangle(PickedObject pickedObject)
Description copied from interface:DrawContextAdds the specified picked object to the current list of objects intersecting the pick rectangle. This list can be accessed by callingDrawContext.getObjectsInPickRectangle().- Specified by:
addObjectInPickRectanglein interfaceDrawContext- Parameters:
pickedObject- the object to add.
-
getUniquePickColor
public java.awt.Color getUniquePickColor()
Description copied from interface:DrawContextReturns 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:
getUniquePickColorin interfaceDrawContext- Returns:
- a unique pick color.
-
getUniquePickColorRange
public java.awt.Color getUniquePickColorRange(int count)
Description copied from interface:DrawContextReturns a range of unique colors to serve as pick identifiers during picking. This allocatescountunique 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()counttimes, but guarantees a contiguous range of color codes and is more efficient whencountis large.The number of pick colors is limited to a finite address space. This method returns null when there are fewer than
countremaining unique colors in the pick color address space, or whencountis less than 1.- Specified by:
getUniquePickColorRangein interfaceDrawContext- Parameters:
count- the number of unique colors to allocate.- Returns:
- the first unique pick color if there are sufficient unique colors remaining and
countis greater than 0, otherwise null.
-
getClearColor
public java.awt.Color getClearColor()
Description copied from interface:DrawContextReturns the WorldWindow's background color.- Specified by:
getClearColorin 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:
getPickColorAtPointin 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
nullif 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:
getPickColorsInRectanglein 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 benullto specify that all color codes must be returned.- Returns:
- the unique RGB colors corresponding to the specified rectangle, or
nullif the rectangle is empty or the rectangle contains only the clear color.
-
isPickingMode
public boolean isPickingMode()
Description copied from interface:DrawContextIndicates whether the scene controller is currently picking.- Specified by:
isPickingModein interfaceDrawContext- Returns:
- true if the scene controller is picking, otherwise false
-
enablePickingMode
public void enablePickingMode()
Description copied from interface:DrawContextSpecifies that the scene controller is beginning its pick traversal.- Specified by:
enablePickingModein interfaceDrawContext
-
disablePickingMode
public void disablePickingMode()
Description copied from interface:DrawContextSpecifies that the scene controller has ended its pick traversal.- Specified by:
disablePickingModein interfaceDrawContext
-
isDeepPickingEnabled
public boolean isDeepPickingEnabled()
Description copied from interface:DrawContextIndicates whether all items under cursor are picked.- Specified by:
isDeepPickingEnabledin interfaceDrawContext- Returns:
- true if all items under the cursor are picked, otherwise false
-
setDeepPickingEnabled
public void setDeepPickingEnabled(boolean tf)
Description copied from interface:DrawContextSpecifies whether all items under the cursor are picked.- Specified by:
setDeepPickingEnabledin interfaceDrawContext- Parameters:
tf- true to pick all objects under the cursor
-
isPreRenderMode
public boolean isPreRenderMode()
Description copied from interface:DrawContextIndicates whether the scene controller is currently pre-rendering.- Specified by:
isPreRenderModein interfaceDrawContext- Returns:
- true if pre-rendering, otherwise false.
- See Also:
PreRenderable
-
setPreRenderMode
public void setPreRenderMode(boolean preRenderMode)
Description copied from interface:DrawContextSpecifies whether the scene controller is pre-rendering.- Specified by:
setPreRenderModein interfaceDrawContext- Parameters:
preRenderMode- true to indicate pre-rendering, otherwise false.- See Also:
PreRenderable
-
isOrderedRenderingMode
public boolean isOrderedRenderingMode()
Description copied from interface:DrawContextIndicates whether theSceneControlleris currently rendering the draw context'sOrderedRenderables. 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:
isOrderedRenderingModein 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:DrawContextCalled by theSceneControllerto indicate whether it is currently drawing the draw context'sOrderedRenderables. SeeDrawContext.isOrderedRenderingMode()for more information.- Specified by:
setOrderedRenderingModein 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:DrawContextReturns the draw context's decluttering text renderer.- Specified by:
getDeclutteringTextRendererin interfaceDrawContext- Returns:
- the decluttering text renderer.
-
is2DGlobe
public boolean is2DGlobe()
- Specified by:
is2DGlobein interfaceDrawContext
-
isContinuous2DGlobe
public boolean isContinuous2DGlobe()
- Specified by:
isContinuous2DGlobein interfaceDrawContext
-
addOrderedRenderable
public void addOrderedRenderable(OrderedRenderable orderedRenderable)
Description copied from interface:DrawContextAdds anOrderedRenderableto the draw context's ordered renderable list.- Specified by:
addOrderedRenderablein interfaceDrawContext- Parameters:
orderedRenderable- the ordered renderable to add.
-
addOrderedRenderable
public void addOrderedRenderable(OrderedRenderable orderedRenderable, boolean isBehind)
Adds anOrderedRenderableto the draw context's ordered renderable list, optionally indicating that the draw context should treat the specified ordered renderable as behind other ordered renderables. IfisBehindistrue, 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 withisBehindspecified astrue, those ordered renderables are drawn according to the order in which they are added.- Specified by:
addOrderedRenderablein interfaceDrawContext- Parameters:
orderedRenderable- the ordered renderable to add.isBehind-trueto specify that the ordered renderable is behind all other ordered renderables, orfalseto interpret the ordered renderable according to its eye distance.
-
peekOrderedRenderables
public OrderedRenderable peekOrderedRenderables()
Description copied from interface:DrawContextReturns the nextOrderedRenderableon the ordered-renderable priority queue but does not remove it from the queue.- Specified by:
peekOrderedRenderablesin 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:DrawContextReturns the nextOrderedRenderableon the ordered-renderable priority queue and removes it from the queue.- Specified by:
pollOrderedRenderablesin 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:DrawContextSpecifies the clutter filter to use. May be null to indicate no decluttering.- Specified by:
setClutterFilterin interfaceDrawContext- Parameters:
filter- the clutter filter.
-
getClutterFilter
public ClutterFilter getClutterFilter()
Description copied from interface:DrawContextReturns the current clutter filter.- Specified by:
getClutterFilterin interfaceDrawContext- Returns:
- the current clutter filter.
-
applyClutterFilter
public void applyClutterFilter()
Description copied from interface:DrawContextFilter overlapping text from the ordered renderable list.- Specified by:
applyClutterFilterin interfaceDrawContext
-
addOrderedSurfaceRenderable
public void addOrderedSurfaceRenderable(OrderedRenderable orderedRenderable)
Adds anOrderedRenderableto 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:
addOrderedSurfaceRenderablein 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:
getOrderedSurfaceRenderablesin interfaceDrawContext- Returns:
- the draw context's ordered surface renderable queue.
-
drawUnitQuad
public void drawUnitQuad()
Description copied from interface:DrawContextDraws a quadrilateral using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).- Specified by:
drawUnitQuadin interfaceDrawContext
-
drawUnitQuad
public void drawUnitQuad(com.jogamp.opengl.util.texture.TextureCoords texCoords)
Description copied from interface:DrawContextDraws 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:
drawUnitQuadin interfaceDrawContext- Parameters:
texCoords- texture coordinates to assign to each quadrilateral vertex.
-
drawUnitQuadOutline
public void drawUnitQuadOutline()
Description copied from interface:DrawContextDraws a quadrilateral outline using the current OpenGL state. The quadrilateral points are (0, 0), (1, 0), (1, 1), (0, 1).- Specified by:
drawUnitQuadOutlinein interfaceDrawContext
-
drawNormals
public void drawNormals(float length, java.nio.FloatBuffer vBuf, java.nio.FloatBuffer nBuf)Description copied from interface:DrawContextThis is a diagnostic method to display normal vectors.- Specified by:
drawNormalsin 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:DrawContextComputes a location's Cartesian point on the currently visible terrain.- Specified by:
getPointOnTerrainin 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:DrawContextReturns this draw context's surface tile renderer.- Specified by:
getGeographicSurfaceTileRendererin interfaceDrawContext- Returns:
- this draw context's surface tile renderer.s
-
getPerFrameStatistics
public java.util.Collection<PerformanceStatistic> getPerFrameStatistics()
Description copied from interface:DrawContextReturns the performance statistics that are gathered during each frame.- Specified by:
getPerFrameStatisticsin 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:DrawContextSpecifies 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:
setPerFrameStatisticsKeysin 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:DrawContextIndicates the statistics that are monitored for each frame.- Specified by:
getPerFrameStatisticsKeysin 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:DrawContextSpecifies a performance statistic that's assigned for each frame. Use this method to update the value of a specific statistic.- Specified by:
setPerFrameStatisticin 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:DrawContextSpecifies a collection of per-frame performance statistics. Use this method to update a group of statistics.- Specified by:
setPerFrameStatisticsin 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:DrawContextReturns 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:
getFrameTimeStampin interfaceDrawContext- Returns:
- the frame time stamp. See
System.currentTimeMillis()for its numerical meaning.
-
setFrameTimeStamp
public void setFrameTimeStamp(long frameTimeStamp)
Description copied from interface:DrawContextSpecifies 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:
setFrameTimeStampin 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:DrawContextReturns 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:
getVisibleSectorsin 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:DrawContextSets 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:
setCurrentLayerin interfaceDrawContext- Parameters:
layer- the current layer or null.
-
getCurrentLayer
public Layer getCurrentLayer()
Description copied from interface:DrawContextReturns the current-layer. The field is informative only and enables layer contents to determine their containing layer.- Specified by:
getCurrentLayerin interfaceDrawContext- Returns:
- the current layer, or null if no layer is current.
-
addScreenCredit
public void addScreenCredit(ScreenCredit credit)
Description copied from interface:DrawContextAdds a screen-credit icon to display.- Specified by:
addScreenCreditin interfaceDrawContext- Parameters:
credit- the screen credit to display.
-
getScreenCredits
public java.util.Map<ScreenCredit,java.lang.Long> getScreenCredits()
Description copied from interface:DrawContextReturns the screen credits currently held and displayed by this draw context.- Specified by:
getScreenCreditsin interfaceDrawContext- Returns:
- the screen credits currently held by this draw context.
-
getRedrawRequested
public int getRedrawRequested()
Description copied from interface:DrawContextIndicates whether a new frame should be generated by theSceneController.- Specified by:
getRedrawRequestedin interfaceDrawContext- Returns:
- the delay in milliseconds if a redraw has been requested, otherwise 0.
-
setRedrawRequested
public void setRedrawRequested(int redrawRequested)
Description copied from interface:DrawContextRequests that a new frame should be generated by theSceneController.- Specified by:
setRedrawRequestedin interfaceDrawContext- Parameters:
redrawRequested- a delay in milliseconds if a redraw is requested, otherwise 0.
-
getPickFrustums
public PickPointFrustumList getPickFrustums()
Description copied from interface:DrawContextGets the FrustumList containing all the current Pick Frustums- Specified by:
getPickFrustumsin interfaceDrawContext- Returns:
- FrustumList of Pick Frustums
-
setPickPointFrustumDimension
public void setPickPointFrustumDimension(java.awt.Dimension dim)
Description copied from interface:DrawContextSet the size (in pixels) of the pick point frustum at the near plane.- Specified by:
setPickPointFrustumDimensionin interfaceDrawContext- Parameters:
dim- dimension of pick point frustum
-
getPickPointFrustumDimension
public java.awt.Dimension getPickPointFrustumDimension()
Description copied from interface:DrawContextGets the dimension of the current Pick Point Frustum- Specified by:
getPickPointFrustumDimensionin interfaceDrawContext- Returns:
- the dimension of the current Pick Point Frustum
-
addPickPointFrustum
public void addPickPointFrustum()
Description copied from interface:DrawContextCreates 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:
addPickPointFrustumin interfaceDrawContext
-
addPickRectangleFrustum
public void addPickRectangleFrustum()
Description copied from interface:DrawContextCreates 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:
addPickRectangleFrustumin interfaceDrawContext
-
getRenderingExceptions
public java.util.Collection<java.lang.Throwable> getRenderingExceptions()
Description copied from interface:DrawContextGets the rendering exceptions associated with this DrawContext as aCollectionofThrowableobjects. 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:
getRenderingExceptionsin 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:DrawContextSets the rendering exceptions associated with this DrawContext to the specifiedCollectionofThrowableobjects. 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:
setRenderingExceptionsin 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:DrawContextAdds the specifiedThrowableto 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:
addRenderingExceptionin interfaceDrawContext- Parameters:
t- the rendering exception to add as aThrowable.
-
pushProjectionOffest
public void pushProjectionOffest(java.lang.Double offset)
Description copied from interface:DrawContextModifies 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:
pushProjectionOffestin 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:DrawContextRemoves the current projection matrix offset added byDrawContext.pushProjectionOffest(Double).- Specified by:
popProjectionOffestin interfaceDrawContext- See Also:
DrawContext.pushProjectionOffest(Double)
-
drawOutlinedShape
public void drawOutlinedShape(OutlinedShape renderer, java.lang.Object shape)
Description copied from interface:DrawContextPerforms 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:
drawOutlinedShapein interfaceDrawContext- Parameters:
renderer- an object implementing theOutlinedShapeinterface for the shape.shape- the shape to render.- See Also:
OutlinedShape
-
beginStandardLighting
public void beginStandardLighting()
Description copied from interface:DrawContextEnables the current standard lighting model.DrawContext.endStandardLighting()must be called when rendering of the current shape is complete.- Specified by:
beginStandardLightingin interfaceDrawContext- See Also:
DrawContext.setStandardLightingModel(LightingModel),DrawContext.endStandardLighting()
-
endStandardLighting
public void endStandardLighting()
Description copied from interface:DrawContextPops the OpenGL state previously established byDrawContext.beginStandardLighting().- Specified by:
endStandardLightingin interfaceDrawContext
-
isSmall
public boolean isSmall(Extent extent, int numPixels)
Description copied from interface:DrawContextIndicates whether a specified extent is smaller than a specified number of pixels for the current view.- Specified by:
isSmallin 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:DrawContextReturns aTerrainobject that uses the current sector geometry or the current globe to compute surface points.- Specified by:
getTerrainin 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:DrawContextCompute a model-coordinate point on the terrain.- Specified by:
computeTerrainPointin 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:DrawContextRestores the current OpenGL context's blending state to its default.- Specified by:
restoreDefaultBlendingin interfaceDrawContext
-
restoreDefaultCurrentColor
public void restoreDefaultCurrentColor()
Description copied from interface:DrawContextRestores the current OpenGL context's current color to its default.- Specified by:
restoreDefaultCurrentColorin interfaceDrawContext
-
restoreDefaultDepthTesting
public void restoreDefaultDepthTesting()
Description copied from interface:DrawContextRestores the current OpenGL context's depth testing state to its default.- Specified by:
restoreDefaultDepthTestingin interfaceDrawContext
-
computePointFromPosition
public Vec4 computePointFromPosition(Position position, int altitudeMode)
Description copied from interface:DrawContextComputes a Cartesian point from a specified geographic position, applying a specified altitude mode.- Specified by:
computePointFromPositionin 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.
-
-