/
TerrainMesh.js
88 lines (79 loc) · 3.88 KB
/
TerrainMesh.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*global define*/
define([
'../Core/defaultValue'
], function(
defaultValue) {
"use strict";
/**
* A mesh plus related metadata for a single tile of terrain. Instances of this type are
* usually created from raw {@link TerrainData}.
*
* @alias TerrainMesh
* @constructor
*
* @param {Cartesian3} center The center of the tile. Vertex positions are specified relative to this center.
* @param {Float32Array} vertices The vertex data, including positions, texture coordinates, and heights.
* The vertex data is in the order [X, Y, Z, H, U, V], where X, Y, and Z represent
* the Cartesian position of the vertex, H is the height above the ellipsoid, and
* U and V are the texture coordinates.
* @param {Uint16Array|Uint32Array} indices The indices describing how the vertices are connected to form triangles.
* @param {Number} minimumHeight The lowest height in the tile, in meters above the ellipsoid.
* @param {Number} maximumHeight The highest height in the tile, in meters above the ellipsoid.
* @param {BoundingSphere} boundingSphere3D A bounding sphere that completely contains the tile.
* @param {Cartesian3} occludeePointInScaledSpace The occludee point of the tile, represented in ellipsoid-
* scaled space, and used for horizon culling. If this point is below the horizon,
* the tile is considered to be entirely below the horizon.
* @param {Number} [vertexStride=6] The number of components in each vertex.
*/
var TerrainMesh = function TerrainMesh(center, vertices, indices, minimumHeight, maximumHeight, boundingSphere3D, occludeePointInScaledSpace, vertexStride) {
/**
* The center of the tile. Vertex positions are specified relative to this center.
* @type {Cartesian3}
*/
this.center = center;
/**
* The vertex data, including positions, texture coordinates, and heights.
* The vertex data is in the order [X, Y, Z, H, U, V], where X, Y, and Z represent
* the Cartesian position of the vertex, H is the height above the ellipsoid, and
* U and V are the texture coordinates. The vertex data may have additional attributes after those
* mentioned above when the {@link TerrainMesh#stride} is greater than 6.
* @type {Float32Array}
*/
this.vertices = vertices;
/**
* The number of components in each vertex. Typically this is 6 for the 6 components
* [X, Y, Z, H, U, V], but if each vertex has additional data (such as a vertex normal), this value
* may be higher.
* @type {Number}
*/
this.stride = defaultValue(vertexStride, 6);
/**
* The indices describing how the vertices are connected to form triangles.
* @type {Uint16Array|Uint32Array}
*/
this.indices = indices;
/**
* The lowest height in the tile, in meters above the ellipsoid.
* @type {Number}
*/
this.minimumHeight = minimumHeight;
/**
* The highest height in the tile, in meters above the ellipsoid.
* @type {Number}
*/
this.maximumHeight = maximumHeight;
/**
* A bounding sphere that completely contains the tile.
* @type {BoundingSphere}
*/
this.boundingSphere3D = boundingSphere3D;
/**
* The occludee point of the tile, represented in ellipsoid-
* scaled space, and used for horizon culling. If this point is below the horizon,
* the tile is considered to be entirely below the horizon.
* @type {Cartesian3}
*/
this.occludeePointInScaledSpace = occludeePointInScaledSpace;
};
return TerrainMesh;
});