Class RectangularTessellator

    • Field Detail

      • DEFAULT_LOG10_RESOLUTION_TARGET

        protected static final double DEFAULT_LOG10_RESOLUTION_TARGET
        See Also:
        Constant Field Values
      • DEFAULT_NUM_LAT_SUBDIVISIONS

        protected static final int DEFAULT_NUM_LAT_SUBDIVISIONS
        See Also:
        Constant Field Values
      • DEFAULT_NUM_LON_SUBDIVISIONS

        protected static final int DEFAULT_NUM_LON_SUBDIVISIONS
        See Also:
        Constant Field Values
      • CACHE_ID

        protected static final java.lang.String CACHE_ID
      • textureCoords

        protected static final java.util.HashMap<java.lang.Integer,​java.nio.FloatBuffer> textureCoords
      • indexLists

        protected static final java.util.HashMap<java.lang.Integer,​java.nio.IntBuffer> indexLists
      • oddRowColorList

        protected static final java.util.HashMap<java.lang.Integer,​java.nio.ByteBuffer> oddRowColorList
      • evenRowColorList

        protected static final java.util.HashMap<java.lang.Integer,​java.nio.ByteBuffer> evenRowColorList
      • textureCoordVboCacheKeys

        protected static final java.util.HashMap<java.lang.Integer,​java.lang.Object> textureCoordVboCacheKeys
      • indexListsVboCacheKeys

        protected static final java.util.HashMap<java.lang.Integer,​java.lang.Object> indexListsVboCacheKeys
      • numLevel0LatSubdivisions

        protected int numLevel0LatSubdivisions
      • numLevel0LonSubdivisions

        protected int numLevel0LonSubdivisions
      • topLevelTilesCache

        protected SessionCache topLevelTilesCache
      • currentFrustum

        protected Frustum currentFrustum
      • currentCoverage

        protected Sector currentCoverage
      • makeTileSkirts

        protected boolean makeTileSkirts
      • currentLevel

        protected int currentLevel
      • maxLevel

        protected int maxLevel
      • globe

        protected Globe globe
      • density

        protected int density
      • updateFrequency

        protected long updateFrequency
    • Constructor Detail

      • RectangularTessellator

        public RectangularTessellator()
    • Method Detail

      • tessellate

        public SectorGeometryList tessellate​(DrawContext dc)
        Description copied from interface: Tessellator
        Tessellate a globe for the currently visible region.
        Specified by:
        tessellate in interface Tessellator
        Parameters:
        dc - the current draw context.
        Returns:
        the tessellation, or null if the tessellation failed or the draw context identifies no visible region.
      • skipTile

        protected boolean skipTile​(DrawContext dc,
                                   Sector sector)
        Determines whether a tile is within a 2D globe's projection limits.
        Parameters:
        dc - the current draw context. The globe contained in the context must be a Globe2D.
        sector - the tile's sector.
        Returns:
        true if the tile should be skipped -- it's outside the globe's projection limits -- otherwise false.
      • isMakeTileSkirts

        public boolean isMakeTileSkirts()
        Description copied from interface: Tessellator
        Indicates whether the tessellator creates "skirts" around the tiles in order to hide gaps between adjacent tiles with differing tessellations.
        Specified by:
        isMakeTileSkirts in interface Tessellator
        Returns:
        true if skirts are created, otherwise false.
      • setMakeTileSkirts

        public void setMakeTileSkirts​(boolean makeTileSkirts)
        Description copied from interface: Tessellator
        Specifies whether the tessellator creates "skirts" around the tiles in order to hide gaps between adjacent tiles with differing tessellations.
        Specified by:
        setMakeTileSkirts in interface Tessellator
        Parameters:
        makeTileSkirts - true if skirts are created, otherwise false.
      • getUpdateFrequency

        public long getUpdateFrequency()
        Description copied from interface: Tessellator
        Indicates the maximum amount of time that may elapse between re-tessellation. Re-tessellation is performed to synchronize the terrain's resolution into with the current viewing state and availability of elevations.
        Specified by:
        getUpdateFrequency in interface Tessellator
        Returns:
        the update frequency, in milliseconds.
      • setUpdateFrequency

        public void setUpdateFrequency​(long updateFrequency)
        Description copied from interface: Tessellator
        Indicates the maximum amount of time that may elapse between re-tessellation. Re-tessellation is performed to synchronize the terrain's resolution into with the current viewing state and availability of elevations.
        Specified by:
        setUpdateFrequency in interface Tessellator
        Parameters:
        updateFrequency - the update frequency, in milliseconds.
      • beginRendering

        public void beginRendering​(DrawContext dc)
      • endRendering

        public void endRendering​(DrawContext dc)
      • fillIndexListVbo

        protected int[] fillIndexListVbo​(DrawContext dc,
                                         int density,
                                         java.nio.IntBuffer indices)
      • fillTextureCoordsVbo

        protected int[] fillTextureCoordsVbo​(DrawContext dc,
                                             int density,
                                             java.nio.FloatBuffer texCoords)
      • renderTrianglesWithUniqueColors

        protected void renderTrianglesWithUniqueColors​(DrawContext dc,
                                                       RectangularTessellator.RectTile tile)
        Render each triangle of a tile in a unique color. Used during picking to identify triangles at the pick points.

        Note: This method modifies the GL_VERTEX_ARRAY and GL_COLOR_ARRAY state and does not restore it. Callers should ensure that GL_CLIENT_VERTEX_ARRAY_BIT has been pushed, and eventually pop it when done using this method.

        Parameters:
        dc - the current draw context.
        tile - the tile to render.
      • intersect

        protected Intersection[] intersect​(RectangularTessellator.RectTile tile,
                                           Line line)
        Determines if and where a ray intersects a RectTile geometry.
        Parameters:
        tile - the RectTile which geometry is to be tested for intersection.
        line - the ray for which an intersection is to be found.
        Returns:
        an array of Intersection sorted by increasing distance from the line origin, or null if no intersection was found.
      • applyOffset

        protected static Vec4 applyOffset​(Globe globe,
                                          Vec4 point,
                                          double metersOffset)
        Offsets point by metersOffset meters.
        Parameters:
        globe - the Globe from which to offset
        point - the Vec4 to offset
        metersOffset - the magnitude of the offset
        Returns:
        point offset along its surface normal as if it were on globe
      • createPosition

        protected static double createPosition​(int start,
                                               double decimal,
                                               int density)
        Computes from a column (or row) number, and a given offset ranged [0,1] corresponding to the distance along the edge of this sector, where between this column and the next column the corresponding position will fall, in the range [0,1].
        Parameters:
        start - the number of the column or row to the left, below or on this position
        decimal - the distance from the left or bottom of the current sector that this position falls
        density - the number of intervals along the sector's side
        Returns:
        a decimal ranged [0,1] representing the position between two columns or rows, rather than between two edges of the sector
      • interpolate

        protected static Vec4 interpolate​(int row,
                                          int column,
                                          double xDec,
                                          double yDec,
                                          RectangularTessellator.RenderInfo ri)
        Calculates a Point that sits at xDec offset from column to column + 1 and at yDec offset from row to row + 1. Accounts for the diagonals.
        Parameters:
        row - represents the row which corresponds to a yDec value of 0
        column - represents the column which corresponds to an xDec value of 0
        xDec - constrained to [0,1]
        yDec - constrained to [0,1]
        ri - the render info holding the vertices, etc.
        Returns:
        a Point geometrically within or on the boundary of the quadrilateral whose bottom left corner is indexed by (row, column)
      • interpolate

        protected static Vec4 interpolate​(Vec4 bL,
                                          Vec4 bR,
                                          Vec4 tR,
                                          Vec4 tL,
                                          double xDec,
                                          double yDec)
        Calculates the point at (xDec, yDec) in the two triangles defined by {bL, bR, tL} and {bR, tR, tL}. If thought of as a quadrilateral, the diagonal runs from tL to bR. Of course, this isn't a quad, it's two triangles.
        Parameters:
        bL - the bottom left corner
        bR - the bottom right corner
        tR - the top right corner
        tL - the top left corner
        xDec - how far along, [0,1] 0 = left edge, 1 = right edge
        yDec - how far along, [0,1] 0 = bottom edge, 1 = top edge
        Returns:
        the point xDec, yDec in the co-ordinate system defined by bL, bR, tR, tL
      • baryCentricCoordsRequireInside

        protected static double[] baryCentricCoordsRequireInside​(Vec4 pnt,
                                                                 Vec4[] V)
      • distanceFromLine

        protected static double distanceFromLine​(Vec4 pnt,
                                                 Vec4 P,
                                                 Vec4 u)
      • createTextureCoordinates

        protected static void createTextureCoordinates​(int density)
      • createIndices

        protected static void createIndices​(int density)