ExtentTessellator
Contains class functions to create a mesh or vertex array from a cartographic extent.
Methods
- 
    <static> compute
- 
    
    
    Creates a mesh from a cartographic extent. Parameters:Name Type Argument Default Description description.extentExtent A cartographic extent with north, south, east and west properties in radians. description.ellipsoidEllipsoid <optional> 
 Ellipsoid.WGS84 The ellipsoid on which the extent lies. description.granularityNumber <optional> 
 0.1 The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer. description.surfaceHeightNumber <optional> 
 0.0 The height from the surface of the ellipsoid. description.relativetoCenterCartesian3 <optional> 
 Cartesian3.ZERO The positions will be computed as worldPosition.subtract(relativeToCenter).description.generateTextureCoordinatesBoolean <optional> 
 false Whether to generate texture coordinates. Throws:- 
DeveloperError :description.extentis required and must have north, south, east and west attributes.
- 
DeveloperError :description.contextis required.
 Returns:Object A mesh containing attributes for positions, possibly texture coordinates and indices from the extent for creating a vertex array.Example// Create a vertex array for rendering a wireframe extent. var mesh = ExtentTessellator.compute({ ellipsoid : Ellipsoid.WGS84, extent : new Extent( CesiumMath.toRadians(-80.0), CesiumMath.toRadians(39.0), CesiumMath.toRadians(-74.0), CesiumMath.toRadians(42.0) ), granularity : 0.01, surfaceHeight : 10000.0 }); mesh = MeshFilters.toWireframeInPlace(mesh); var va = context.createVertexArrayFromMesh({ mesh : mesh, attributeIndices : MeshFilters.createAttributeIndices(mesh) });
- 
- 
    <static> computeBuffers
- 
    
    
    Creates arrays of vertex attributes and indices from a cartographic extent. Parameters:Name Type Argument Default Description description.extentExtent A cartographic extent with north, south, east and west properties in radians. description.ellipsoidEllipsoid <optional> 
 Ellipsoid.WGS84 The ellipsoid on which the extent lies. description.granularityNumber <optional> 
 0.1 The distance, in radians, between each latitude and longitude. Determines the number of positions in the buffer. description.surfaceHeightNumber <optional> 
 0.0 The height from the surface of the ellipsoid. description.relativetoCenterCartesian3 <optional> 
 Cartesian3.ZERO The positions will be computed as worldPosition.subtract(relativeToCenter).description.generateTextureCoordinatesBoolean <optional> 
 false Whether to generate texture coordinates. description.interleaveTextureCoordinatesBoolean <optional> 
 false If texture coordinates are generated, whether to interleave the positions and texture coordinates in a single buffer. Throws:- 
DeveloperError :description.extentis required and must have north, south, east and west attributes.
 Returns:Object An object with flattened arrays for vertex attributes and indices.Examples// Example 1: // Create a vertex array for a solid extent, with separate positions and texture coordinates. var buffers = ExtentTessellator.computeBuffers({ ellipsoid : ellipsoid, extent : extent, generateTextureCoordinates : true }); var datatype = ComponentDatatype.FLOAT; var usage = BufferUsage.STATIC_DRAW; var positionBuffer = context.createVertexBuffer(datatype.toTypedArray(buffers.positions), usage); var textureCoordinateBuffer = context.createVertexBuffer(datatype.toTypedArray(buffers.textureCoordinates), usage); attributes = [{ index : attributeIndices.position, vertexBuffer : positionBuffer, componentDatatype : datatype, componentsPerAttribute : 3 }, { index : attributeIndices.textureCoordinates, vertexBuffer : textureCoordinateBuffer, componentDatatype : datatype, componentsPerAttribute : 2 }]; var indexBuffer = context.createIndexBuffer(new Uint16Array(buffers.indices), usage, IndexDatatype.UNSIGNED_SHORT); var va = context.createVertexArray(attributes, indexBuffer);// Example 2: // Create a vertex array for a solid extent, with interleaved positions and texture coordinates. var buffers = ExtentTessellator.computeBuffers({ ellipsoid : ellipsoid, extent : extent, generateTextureCoordinates : true, interleaveTextureCoordinates : true }); var datatype = ComponentDatatype.FLOAT; var usage = BufferUsage.STATIC_DRAW; var typedArray = datatype.toTypedArray(buffers.vertices); var buffer = context.createVertexBuffer(typedArray, usage); var stride = 5 * datatype.sizeInBytes; var attributes = [{ index : attributeIndices.position3D, vertexBuffer : buffer, componentDatatype : datatype, componentsPerAttribute : 3, normalize : false, offsetInBytes : 0, strideInBytes : stride }, { index : attributeIndices.textureCoordinates, vertexBuffer : buffer, componentDatatype : datatype, componentsPerAttribute : 2, normalize : false, offsetInBytes : 3 * datatype.sizeInBytes, strideInBytes : stride }]; var indexBuffer = context.createIndexBuffer(new Uint16Array(buffers.indices), usage, IndexDatatype.UNSIGNED_SHORT); var vacontext.createVertexArray(attributes, indexBuffer);
- 
- 
    <static> computeVertices
- 
    
    
    Compute vertices from a cartographic extent. This function is different from ExtentTessellator#compute and ExtentTessellator#computeBuffers in that it assumes that you have already allocated output arrays of the correct size. Parameters:Name Type Argument Description description.extentExtent A cartographic extent with north, south, east and west properties in radians. description.widthNumber The number of vertices in the longitude direction. description.heightNumber The number of vertices in the latitude direction. description.granularityXNumber The distance, in radians, between each longitude. description.granularityYNumber The distance, in radians, between each latitude. description.surfaceHeightNumber The height from the surface of the ellipsoid. description.generateTextureCoordinatesBoolean Whether to generate texture coordinates. description.interleaveTextureCoordinatesBoolean Whether to interleave the texture coordinates into the vertex array. description.relativetoCenterCartesian3 The positions will be computed as worldPosition.subtract(relativeToCenter).description.radiiSquaredCartesian3 The radii squared of the ellipsoid to use. description.verticesArray | Float32Array The array to use to store computed vertices. description.textureCoordinatesArray | Float32Array The array to use to store computed texture coordinates, unless interleaved. description.indicesArray | Float32Array <optional> 
 The array to use to store computed indices. If undefined, indices will be not computed. 
