Package gov.nasa.worldwind.render
Class RenderContext
- java.lang.Object
-
- gov.nasa.worldwind.render.RenderContext
-
public class RenderContext extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description CameracameraVec3cameraPointLayercurrentLayerDrawableQueuedrawableQueueDrawableQueuedrawableTerrainFrustumfrustumGlobeglobedoublehorizonDistanceLayerListlayersMatrix4modelviewMatrix4modelviewProjectionPickedObjectListpickedObjectsbooleanpickModeVec2pickPointLinepickRayViewportpickViewportMatrix4projectionRenderResourceCacherenderResourceCacheandroid.content.res.ResourcesresourcesTerrainterrainTessellatorterrainTessellatordoubleverticalExaggerationViewportviewport
-
Constructor Summary
Constructors Constructor Description RenderContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdrawableCount()Vec3geographicToCartesian(double latitude, double longitude, double altitude, int altitudeMode, Vec3 result)Converts a geographic position to Cartesian coordinates according to anWorldWind.AltitudeMode.BufferObjectgetBufferObject(java.lang.Object key)<T extends Drawable>
Pool<T>getDrawablePool(java.lang.Class<T> key)ShaderProgramgetShaderProgram(java.lang.Object key)GLUtessellatorgetTessellator()TexturegetText(java.lang.String text, TextAttributes attributes)TexturegetTexture(ImageSource imageSource)java.lang.ObjectgetUserProperty(java.lang.Object key)booleanhasUserProperty(java.lang.Object key)booleanisRedrawRequested()intnextPickedObjectId()voidofferDrawable(Drawable drawable, int groupId, double order)voidofferDrawableTerrain(DrawableTerrain drawable, double cameraDistance)voidofferPickedObject(PickedObject pickedObject)voidofferShapeDrawable(Drawable drawable, double cameraDistance)voidofferSurfaceDrawable(Drawable drawable, double zOrder)doublepixelSizeAtDistance(double distance)Returns the height of a pixel at a given distance from the eye point.booleanproject(Vec3 modelPoint, Vec3 result)Projects a Cartesian point to screen coordinates.booleanprojectWithDepth(Vec3 modelPoint, double depthOffset, Vec3 result)Projects a Cartesian point to screen coordinates, applying an offset to the point's projected depth value.BufferObjectputBufferObject(java.lang.Object key, BufferObject buffer)ShaderProgramputShaderProgram(java.lang.Object key, ShaderProgram program)TextureputTexture(ImageSource imageSource, Texture texture)java.lang.ObjectputUserProperty(java.lang.Object key, java.lang.Object value)java.lang.ObjectremoveUserProperty(java.lang.Object key)TexturerenderText(java.lang.String text, TextAttributes attributes)voidrequestRedraw()voidreset()TextureretrieveTexture(ImageSource imageSource, ImageOptions imageOptions)voidsortDrawables()
-
-
-
Field Detail
-
globe
public Globe globe
-
terrainTessellator
public Tessellator terrainTessellator
-
terrain
public Terrain terrain
-
layers
public LayerList layers
-
currentLayer
public Layer currentLayer
-
verticalExaggeration
public double verticalExaggeration
-
horizonDistance
public double horizonDistance
-
camera
public Camera camera
-
cameraPoint
public Vec3 cameraPoint
-
viewport
public final Viewport viewport
-
projection
public final Matrix4 projection
-
modelview
public final Matrix4 modelview
-
modelviewProjection
public final Matrix4 modelviewProjection
-
frustum
public final Frustum frustum
-
renderResourceCache
public RenderResourceCache renderResourceCache
-
resources
public android.content.res.Resources resources
-
drawableQueue
public DrawableQueue drawableQueue
-
drawableTerrain
public DrawableQueue drawableTerrain
-
pickedObjects
public PickedObjectList pickedObjects
-
pickViewport
public Viewport pickViewport
-
pickPoint
public Vec2 pickPoint
-
pickRay
public Line pickRay
-
pickMode
public boolean pickMode
-
-
Method Detail
-
reset
public void reset()
-
isRedrawRequested
public boolean isRedrawRequested()
-
requestRedraw
public void requestRedraw()
-
pixelSizeAtDistance
public double pixelSizeAtDistance(double distance)
Returns the height of a pixel at a given distance from the eye point. This method assumes the model of a screen composed of rectangular pixels, where pixel coordinates denote infinitely thin space between pixels. The units of the returned size are in meters per pixel.
The result of this method is undefined if the distance is negative.- Parameters:
distance- the distance from the eye point in meters- Returns:
- the pixel height in meters per pixel
-
project
public boolean project(Vec3 modelPoint, Vec3 result)
Projects a Cartesian point to screen coordinates. The resultant screen point is in OpenGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This stores the projected point in the result argument, and returns a boolean value indicating whether or not the projection is successful. This returns false if the Cartesian point is clipped by the near clipping plane or the far clipping plane.- Parameters:
modelPoint- the Cartesian point to projectresult- a pre-allocatedVec3in which to return the projected point- Returns:
- true if the transformation is successful, otherwise false
- Throws:
java.lang.IllegalArgumentException- If any argument is null
-
projectWithDepth
public boolean projectWithDepth(Vec3 modelPoint, double depthOffset, Vec3 result)
Projects a Cartesian point to screen coordinates, applying an offset to the point's projected depth value. The resultant screen point is in OpenGL screen coordinates, with the origin in the bottom-left corner and axes that extend up and to the right from the origin.
This stores the projected point in the result argument, and returns a boolean value indicating whether or not the projection is successful. This returns false if the Cartesian point is clipped by the near clipping plane or the far clipping plane.
The depth offset may be any real number and is typically used to move the screenPoint slightly closer to the user's eye in order to give it visual priority over nearby objects or terrain. An offset of zero has no effect. An offset less than zero brings the screenPoint closer to the eye, while an offset greater than zero pushes the projected screen point away from the eye.
Applying a non-zero depth offset has no effect on whether the model point is clipped by this method or by WebGL. Clipping is performed on the original model point, ignoring the depth offset. The final depth value after applying the offset is clamped to the range [0,1].- Parameters:
modelPoint- the Cartesian point to projectdepthOffset- the amount of depth offset to applyresult- a pre-allocatedVec3in which to return the projected point- Returns:
- true if the transformation is successful, otherwise false
- Throws:
java.lang.IllegalArgumentException- If any argument is null
-
geographicToCartesian
public Vec3 geographicToCartesian(double latitude, double longitude, double altitude, int altitudeMode, Vec3 result)
Converts a geographic position to Cartesian coordinates according to anWorldWind.AltitudeMode. The Cartesian coordinate system is a function of this render context's current globe and its the terrain surface, depending on the altitude mode. In general, it is not safe to cache the Cartesian coordinates, as many factors contribute to the value returned, and may change from one frame to the next.- Parameters:
latitude- the position's latitude in degreeslongitude- the position's longitude in degreesaltitude- the position's altitude in metersaltitudeMode- an altitude mode indicating how to interpret the position's altitude componentresult- a pre-allocatedVec3in which to store the computed X, Y and Z Cartesian coordinates- Returns:
- the result argument, set to the computed Cartesian coordinates
- Throws:
java.lang.IllegalArgumentException- if the result is null
-
getShaderProgram
public ShaderProgram getShaderProgram(java.lang.Object key)
-
putShaderProgram
public ShaderProgram putShaderProgram(java.lang.Object key, ShaderProgram program)
-
getTexture
public Texture getTexture(ImageSource imageSource)
-
putTexture
public Texture putTexture(ImageSource imageSource, Texture texture)
-
retrieveTexture
public Texture retrieveTexture(ImageSource imageSource, ImageOptions imageOptions)
-
getBufferObject
public BufferObject getBufferObject(java.lang.Object key)
-
putBufferObject
public BufferObject putBufferObject(java.lang.Object key, BufferObject buffer)
-
getText
public Texture getText(java.lang.String text, TextAttributes attributes)
-
renderText
public Texture renderText(java.lang.String text, TextAttributes attributes)
-
offerDrawable
public void offerDrawable(Drawable drawable, int groupId, double order)
-
offerSurfaceDrawable
public void offerSurfaceDrawable(Drawable drawable, double zOrder)
-
offerShapeDrawable
public void offerShapeDrawable(Drawable drawable, double cameraDistance)
-
offerDrawableTerrain
public void offerDrawableTerrain(DrawableTerrain drawable, double cameraDistance)
-
sortDrawables
public void sortDrawables()
-
drawableCount
public int drawableCount()
-
offerPickedObject
public void offerPickedObject(PickedObject pickedObject)
-
nextPickedObjectId
public int nextPickedObjectId()
-
getTessellator
public GLUtessellator getTessellator()
-
getUserProperty
public java.lang.Object getUserProperty(java.lang.Object key)
-
putUserProperty
public java.lang.Object putUserProperty(java.lang.Object key, java.lang.Object value)
-
removeUserProperty
public java.lang.Object removeUserProperty(java.lang.Object key)
-
hasUserProperty
public boolean hasUserProperty(java.lang.Object key)
-
-