createVerticesFromGoogleEarthEnterpriseBuffer.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /* This file is automatically rebuilt by the Cesium build process. */
  2. define(['./when-e6985d2a', './Check-24cae389', './Math-392d0035', './Cartesian2-a5d6dde9', './Transforms-81680c41', './RuntimeError-61701d3e', './WebGLConstants-34c08bc0', './ComponentDatatype-cb08e294', './AttributeCompression-114c6354', './IntersectionTests-f17c84f0', './Plane-ac6a1d3e', './WebMercatorProjection-a06fbf17', './createTaskProcessorWorker', './EllipsoidTangentPlane-85280670', './OrientedBoundingBox-d8219c10', './TerrainEncoding-a793a9ee'], function (when, Check, _Math, Cartesian2, Transforms, RuntimeError, WebGLConstants, ComponentDatatype, AttributeCompression, IntersectionTests, Plane, WebMercatorProjection, createTaskProcessorWorker, EllipsoidTangentPlane, OrientedBoundingBox, TerrainEncoding) { 'use strict';
  3. var sizeOfUint16 = Uint16Array.BYTES_PER_ELEMENT;
  4. var sizeOfInt32 = Int32Array.BYTES_PER_ELEMENT;
  5. var sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;
  6. var sizeOfFloat = Float32Array.BYTES_PER_ELEMENT;
  7. var sizeOfDouble = Float64Array.BYTES_PER_ELEMENT;
  8. function indexOfEpsilon(arr, elem, elemType) {
  9. elemType = when.defaultValue(elemType, _Math.CesiumMath);
  10. var count = arr.length;
  11. for (var i = 0; i < count; ++i) {
  12. if (elemType.equalsEpsilon(arr[i], elem, _Math.CesiumMath.EPSILON12)) {
  13. return i;
  14. }
  15. }
  16. return -1;
  17. }
  18. function createVerticesFromGoogleEarthEnterpriseBuffer(
  19. parameters,
  20. transferableObjects
  21. ) {
  22. parameters.ellipsoid = Cartesian2.Ellipsoid.clone(parameters.ellipsoid);
  23. parameters.rectangle = Cartesian2.Rectangle.clone(parameters.rectangle);
  24. var statistics = processBuffer(
  25. parameters.buffer,
  26. parameters.relativeToCenter,
  27. parameters.ellipsoid,
  28. parameters.rectangle,
  29. parameters.nativeRectangle,
  30. parameters.exaggeration,
  31. parameters.skirtHeight,
  32. parameters.includeWebMercatorT,
  33. parameters.negativeAltitudeExponentBias,
  34. parameters.negativeElevationThreshold
  35. );
  36. var vertices = statistics.vertices;
  37. transferableObjects.push(vertices.buffer);
  38. var indices = statistics.indices;
  39. transferableObjects.push(indices.buffer);
  40. return {
  41. vertices: vertices.buffer,
  42. indices: indices.buffer,
  43. numberOfAttributes: statistics.encoding.getStride(),
  44. minimumHeight: statistics.minimumHeight,
  45. maximumHeight: statistics.maximumHeight,
  46. boundingSphere3D: statistics.boundingSphere3D,
  47. orientedBoundingBox: statistics.orientedBoundingBox,
  48. occludeePointInScaledSpace: statistics.occludeePointInScaledSpace,
  49. encoding: statistics.encoding,
  50. vertexCountWithoutSkirts: statistics.vertexCountWithoutSkirts,
  51. indexCountWithoutSkirts: statistics.indexCountWithoutSkirts,
  52. westIndicesSouthToNorth: statistics.westIndicesSouthToNorth,
  53. southIndicesEastToWest: statistics.southIndicesEastToWest,
  54. eastIndicesNorthToSouth: statistics.eastIndicesNorthToSouth,
  55. northIndicesWestToEast: statistics.northIndicesWestToEast,
  56. };
  57. }
  58. var scratchCartographic = new Cartesian2.Cartographic();
  59. var scratchCartesian = new Cartesian2.Cartesian3();
  60. var minimumScratch = new Cartesian2.Cartesian3();
  61. var maximumScratch = new Cartesian2.Cartesian3();
  62. var matrix4Scratch = new Transforms.Matrix4();
  63. function processBuffer(
  64. buffer,
  65. relativeToCenter,
  66. ellipsoid,
  67. rectangle,
  68. nativeRectangle,
  69. exaggeration,
  70. skirtHeight,
  71. includeWebMercatorT,
  72. negativeAltitudeExponentBias,
  73. negativeElevationThreshold
  74. ) {
  75. var geographicWest;
  76. var geographicSouth;
  77. var geographicEast;
  78. var geographicNorth;
  79. var rectangleWidth, rectangleHeight;
  80. if (!when.defined(rectangle)) {
  81. geographicWest = _Math.CesiumMath.toRadians(nativeRectangle.west);
  82. geographicSouth = _Math.CesiumMath.toRadians(nativeRectangle.south);
  83. geographicEast = _Math.CesiumMath.toRadians(nativeRectangle.east);
  84. geographicNorth = _Math.CesiumMath.toRadians(nativeRectangle.north);
  85. rectangleWidth = _Math.CesiumMath.toRadians(rectangle.width);
  86. rectangleHeight = _Math.CesiumMath.toRadians(rectangle.height);
  87. } else {
  88. geographicWest = rectangle.west;
  89. geographicSouth = rectangle.south;
  90. geographicEast = rectangle.east;
  91. geographicNorth = rectangle.north;
  92. rectangleWidth = rectangle.width;
  93. rectangleHeight = rectangle.height;
  94. }
  95. // Keep track of quad borders so we can remove duplicates around the borders
  96. var quadBorderLatitudes = [geographicSouth, geographicNorth];
  97. var quadBorderLongitudes = [geographicWest, geographicEast];
  98. var fromENU = Transforms.Transforms.eastNorthUpToFixedFrame(relativeToCenter, ellipsoid);
  99. var toENU = Transforms.Matrix4.inverseTransformation(fromENU, matrix4Scratch);
  100. var southMercatorY;
  101. var oneOverMercatorHeight;
  102. if (includeWebMercatorT) {
  103. southMercatorY = WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(
  104. geographicSouth
  105. );
  106. oneOverMercatorHeight =
  107. 1.0 /
  108. (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(geographicNorth) -
  109. southMercatorY);
  110. }
  111. var dv = new DataView(buffer);
  112. var minHeight = Number.POSITIVE_INFINITY;
  113. var maxHeight = Number.NEGATIVE_INFINITY;
  114. var minimum = minimumScratch;
  115. minimum.x = Number.POSITIVE_INFINITY;
  116. minimum.y = Number.POSITIVE_INFINITY;
  117. minimum.z = Number.POSITIVE_INFINITY;
  118. var maximum = maximumScratch;
  119. maximum.x = Number.NEGATIVE_INFINITY;
  120. maximum.y = Number.NEGATIVE_INFINITY;
  121. maximum.z = Number.NEGATIVE_INFINITY;
  122. // Compute sizes
  123. var offset = 0;
  124. var size = 0;
  125. var indicesSize = 0;
  126. var quadSize;
  127. var quad;
  128. for (quad = 0; quad < 4; ++quad) {
  129. var o = offset;
  130. quadSize = dv.getUint32(o, true);
  131. o += sizeOfUint32;
  132. var x = _Math.CesiumMath.toRadians(dv.getFloat64(o, true) * 180.0);
  133. o += sizeOfDouble;
  134. if (indexOfEpsilon(quadBorderLongitudes, x) === -1) {
  135. quadBorderLongitudes.push(x);
  136. }
  137. var y = _Math.CesiumMath.toRadians(dv.getFloat64(o, true) * 180.0);
  138. o += sizeOfDouble;
  139. if (indexOfEpsilon(quadBorderLatitudes, y) === -1) {
  140. quadBorderLatitudes.push(y);
  141. }
  142. o += 2 * sizeOfDouble; // stepX + stepY
  143. var c = dv.getInt32(o, true); // Read point count
  144. o += sizeOfInt32;
  145. size += c;
  146. c = dv.getInt32(o, true); // Read index count
  147. indicesSize += c * 3;
  148. offset += quadSize + sizeOfUint32; // Jump to next quad
  149. }
  150. // Quad Border points to remove duplicates
  151. var quadBorderPoints = [];
  152. var quadBorderIndices = [];
  153. // Create arrays
  154. var positions = new Array(size);
  155. var uvs = new Array(size);
  156. var heights = new Array(size);
  157. var webMercatorTs = includeWebMercatorT ? new Array(size) : [];
  158. var indices = new Array(indicesSize);
  159. // Points are laid out in rows starting at SW, so storing border points as we
  160. // come across them all points will be adjacent.
  161. var westBorder = [];
  162. var southBorder = [];
  163. var eastBorder = [];
  164. var northBorder = [];
  165. // Each tile is split into 4 parts
  166. var pointOffset = 0;
  167. var indicesOffset = 0;
  168. offset = 0;
  169. for (quad = 0; quad < 4; ++quad) {
  170. quadSize = dv.getUint32(offset, true);
  171. offset += sizeOfUint32;
  172. var startQuad = offset;
  173. var originX = _Math.CesiumMath.toRadians(dv.getFloat64(offset, true) * 180.0);
  174. offset += sizeOfDouble;
  175. var originY = _Math.CesiumMath.toRadians(dv.getFloat64(offset, true) * 180.0);
  176. offset += sizeOfDouble;
  177. var stepX = _Math.CesiumMath.toRadians(dv.getFloat64(offset, true) * 180.0);
  178. var halfStepX = stepX * 0.5;
  179. offset += sizeOfDouble;
  180. var stepY = _Math.CesiumMath.toRadians(dv.getFloat64(offset, true) * 180.0);
  181. var halfStepY = stepY * 0.5;
  182. offset += sizeOfDouble;
  183. var numPoints = dv.getInt32(offset, true);
  184. offset += sizeOfInt32;
  185. var numFaces = dv.getInt32(offset, true);
  186. offset += sizeOfInt32;
  187. //var level = dv.getInt32(offset, true);
  188. offset += sizeOfInt32;
  189. // Keep track of quad indices to overall tile indices
  190. var indicesMapping = new Array(numPoints);
  191. for (var i = 0; i < numPoints; ++i) {
  192. var longitude = originX + dv.getUint8(offset++) * stepX;
  193. scratchCartographic.longitude = longitude;
  194. var latitude = originY + dv.getUint8(offset++) * stepY;
  195. scratchCartographic.latitude = latitude;
  196. var height = dv.getFloat32(offset, true);
  197. offset += sizeOfFloat;
  198. // In order to support old clients, negative altitude values are stored as
  199. // height/-2^32. Old clients see the value as really close to 0 but new clients multiply
  200. // by -2^32 to get the real negative altitude value.
  201. if (height !== 0 && height < negativeElevationThreshold) {
  202. height *= -Math.pow(2, negativeAltitudeExponentBias);
  203. }
  204. // Height is stored in units of (1/EarthRadius) or (1/6371010.0)
  205. height *= 6371010.0 * exaggeration;
  206. scratchCartographic.height = height;
  207. // Is it along a quad border - if so check if already exists and use that index
  208. if (
  209. indexOfEpsilon(quadBorderLongitudes, longitude) !== -1 ||
  210. indexOfEpsilon(quadBorderLatitudes, latitude) !== -1
  211. ) {
  212. var index = indexOfEpsilon(
  213. quadBorderPoints,
  214. scratchCartographic,
  215. Cartesian2.Cartographic
  216. );
  217. if (index === -1) {
  218. quadBorderPoints.push(Cartesian2.Cartographic.clone(scratchCartographic));
  219. quadBorderIndices.push(pointOffset);
  220. } else {
  221. indicesMapping[i] = quadBorderIndices[index];
  222. continue;
  223. }
  224. }
  225. indicesMapping[i] = pointOffset;
  226. if (Math.abs(longitude - geographicWest) < halfStepX) {
  227. westBorder.push({
  228. index: pointOffset,
  229. cartographic: Cartesian2.Cartographic.clone(scratchCartographic),
  230. });
  231. } else if (Math.abs(longitude - geographicEast) < halfStepX) {
  232. eastBorder.push({
  233. index: pointOffset,
  234. cartographic: Cartesian2.Cartographic.clone(scratchCartographic),
  235. });
  236. } else if (Math.abs(latitude - geographicSouth) < halfStepY) {
  237. southBorder.push({
  238. index: pointOffset,
  239. cartographic: Cartesian2.Cartographic.clone(scratchCartographic),
  240. });
  241. } else if (Math.abs(latitude - geographicNorth) < halfStepY) {
  242. northBorder.push({
  243. index: pointOffset,
  244. cartographic: Cartesian2.Cartographic.clone(scratchCartographic),
  245. });
  246. }
  247. minHeight = Math.min(height, minHeight);
  248. maxHeight = Math.max(height, maxHeight);
  249. heights[pointOffset] = height;
  250. var pos = ellipsoid.cartographicToCartesian(scratchCartographic);
  251. positions[pointOffset] = pos;
  252. if (includeWebMercatorT) {
  253. webMercatorTs[pointOffset] =
  254. (WebMercatorProjection.WebMercatorProjection.geodeticLatitudeToMercatorAngle(latitude) -
  255. southMercatorY) *
  256. oneOverMercatorHeight;
  257. }
  258. Transforms.Matrix4.multiplyByPoint(toENU, pos, scratchCartesian);
  259. Cartesian2.Cartesian3.minimumByComponent(scratchCartesian, minimum, minimum);
  260. Cartesian2.Cartesian3.maximumByComponent(scratchCartesian, maximum, maximum);
  261. var u = (longitude - geographicWest) / (geographicEast - geographicWest);
  262. u = _Math.CesiumMath.clamp(u, 0.0, 1.0);
  263. var v =
  264. (latitude - geographicSouth) / (geographicNorth - geographicSouth);
  265. v = _Math.CesiumMath.clamp(v, 0.0, 1.0);
  266. uvs[pointOffset] = new Cartesian2.Cartesian2(u, v);
  267. ++pointOffset;
  268. }
  269. var facesElementCount = numFaces * 3;
  270. for (var j = 0; j < facesElementCount; ++j, ++indicesOffset) {
  271. indices[indicesOffset] = indicesMapping[dv.getUint16(offset, true)];
  272. offset += sizeOfUint16;
  273. }
  274. if (quadSize !== offset - startQuad) {
  275. throw new RuntimeError.RuntimeError("Invalid terrain tile.");
  276. }
  277. }
  278. positions.length = pointOffset;
  279. uvs.length = pointOffset;
  280. heights.length = pointOffset;
  281. if (includeWebMercatorT) {
  282. webMercatorTs.length = pointOffset;
  283. }
  284. var vertexCountWithoutSkirts = pointOffset;
  285. var indexCountWithoutSkirts = indicesOffset;
  286. // Add skirt points
  287. var skirtOptions = {
  288. hMin: minHeight,
  289. lastBorderPoint: undefined,
  290. skirtHeight: skirtHeight,
  291. toENU: toENU,
  292. ellipsoid: ellipsoid,
  293. minimum: minimum,
  294. maximum: maximum,
  295. };
  296. // Sort counter clockwise from NW corner
  297. // Corner points are in the east/west arrays
  298. westBorder.sort(function (a, b) {
  299. return b.cartographic.latitude - a.cartographic.latitude;
  300. });
  301. southBorder.sort(function (a, b) {
  302. return a.cartographic.longitude - b.cartographic.longitude;
  303. });
  304. eastBorder.sort(function (a, b) {
  305. return a.cartographic.latitude - b.cartographic.latitude;
  306. });
  307. northBorder.sort(function (a, b) {
  308. return b.cartographic.longitude - a.cartographic.longitude;
  309. });
  310. var percentage = 0.00001;
  311. addSkirt(
  312. positions,
  313. heights,
  314. uvs,
  315. webMercatorTs,
  316. indices,
  317. skirtOptions,
  318. westBorder,
  319. -percentage * rectangleWidth,
  320. true,
  321. -percentage * rectangleHeight
  322. );
  323. addSkirt(
  324. positions,
  325. heights,
  326. uvs,
  327. webMercatorTs,
  328. indices,
  329. skirtOptions,
  330. southBorder,
  331. -percentage * rectangleHeight,
  332. false
  333. );
  334. addSkirt(
  335. positions,
  336. heights,
  337. uvs,
  338. webMercatorTs,
  339. indices,
  340. skirtOptions,
  341. eastBorder,
  342. percentage * rectangleWidth,
  343. true,
  344. percentage * rectangleHeight
  345. );
  346. addSkirt(
  347. positions,
  348. heights,
  349. uvs,
  350. webMercatorTs,
  351. indices,
  352. skirtOptions,
  353. northBorder,
  354. percentage * rectangleHeight,
  355. false
  356. );
  357. // Since the corner between the north and west sides is in the west array, generate the last
  358. // two triangles between the last north vertex and the first west vertex
  359. if (westBorder.length > 0 && northBorder.length > 0) {
  360. var firstBorderIndex = westBorder[0].index;
  361. var firstSkirtIndex = vertexCountWithoutSkirts;
  362. var lastBorderIndex = northBorder[northBorder.length - 1].index;
  363. var lastSkirtIndex = positions.length - 1;
  364. indices.push(
  365. lastBorderIndex,
  366. lastSkirtIndex,
  367. firstSkirtIndex,
  368. firstSkirtIndex,
  369. firstBorderIndex,
  370. lastBorderIndex
  371. );
  372. }
  373. size = positions.length; // Get new size with skirt vertices
  374. var boundingSphere3D = Transforms.BoundingSphere.fromPoints(positions);
  375. var orientedBoundingBox;
  376. if (when.defined(rectangle)) {
  377. orientedBoundingBox = OrientedBoundingBox.OrientedBoundingBox.fromRectangle(
  378. rectangle,
  379. minHeight,
  380. maxHeight,
  381. ellipsoid
  382. );
  383. }
  384. var occluder = new TerrainEncoding.EllipsoidalOccluder(ellipsoid);
  385. var occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
  386. relativeToCenter,
  387. positions,
  388. minHeight
  389. );
  390. var aaBox = new EllipsoidTangentPlane.AxisAlignedBoundingBox(minimum, maximum, relativeToCenter);
  391. var encoding = new TerrainEncoding.TerrainEncoding(
  392. aaBox,
  393. skirtOptions.hMin,
  394. maxHeight,
  395. fromENU,
  396. false,
  397. includeWebMercatorT
  398. );
  399. var vertices = new Float32Array(size * encoding.getStride());
  400. var bufferIndex = 0;
  401. for (var k = 0; k < size; ++k) {
  402. bufferIndex = encoding.encode(
  403. vertices,
  404. bufferIndex,
  405. positions[k],
  406. uvs[k],
  407. heights[k],
  408. undefined,
  409. webMercatorTs[k]
  410. );
  411. }
  412. var westIndicesSouthToNorth = westBorder
  413. .map(function (vertex) {
  414. return vertex.index;
  415. })
  416. .reverse();
  417. var southIndicesEastToWest = southBorder
  418. .map(function (vertex) {
  419. return vertex.index;
  420. })
  421. .reverse();
  422. var eastIndicesNorthToSouth = eastBorder
  423. .map(function (vertex) {
  424. return vertex.index;
  425. })
  426. .reverse();
  427. var northIndicesWestToEast = northBorder
  428. .map(function (vertex) {
  429. return vertex.index;
  430. })
  431. .reverse();
  432. southIndicesEastToWest.unshift(
  433. eastIndicesNorthToSouth[eastIndicesNorthToSouth.length - 1]
  434. );
  435. southIndicesEastToWest.push(westIndicesSouthToNorth[0]);
  436. northIndicesWestToEast.unshift(
  437. westIndicesSouthToNorth[westIndicesSouthToNorth.length - 1]
  438. );
  439. northIndicesWestToEast.push(eastIndicesNorthToSouth[0]);
  440. return {
  441. vertices: vertices,
  442. indices: new Uint16Array(indices),
  443. maximumHeight: maxHeight,
  444. minimumHeight: minHeight,
  445. encoding: encoding,
  446. boundingSphere3D: boundingSphere3D,
  447. orientedBoundingBox: orientedBoundingBox,
  448. occludeePointInScaledSpace: occludeePointInScaledSpace,
  449. vertexCountWithoutSkirts: vertexCountWithoutSkirts,
  450. indexCountWithoutSkirts: indexCountWithoutSkirts,
  451. westIndicesSouthToNorth: westIndicesSouthToNorth,
  452. southIndicesEastToWest: southIndicesEastToWest,
  453. eastIndicesNorthToSouth: eastIndicesNorthToSouth,
  454. northIndicesWestToEast: northIndicesWestToEast,
  455. };
  456. }
  457. function addSkirt(
  458. positions,
  459. heights,
  460. uvs,
  461. webMercatorTs,
  462. indices,
  463. skirtOptions,
  464. borderPoints,
  465. fudgeFactor,
  466. eastOrWest,
  467. cornerFudge
  468. ) {
  469. var count = borderPoints.length;
  470. for (var j = 0; j < count; ++j) {
  471. var borderPoint = borderPoints[j];
  472. var borderCartographic = borderPoint.cartographic;
  473. var borderIndex = borderPoint.index;
  474. var currentIndex = positions.length;
  475. var longitude = borderCartographic.longitude;
  476. var latitude = borderCartographic.latitude;
  477. latitude = _Math.CesiumMath.clamp(
  478. latitude,
  479. -_Math.CesiumMath.PI_OVER_TWO,
  480. _Math.CesiumMath.PI_OVER_TWO
  481. ); // Don't go over the poles
  482. var height = borderCartographic.height - skirtOptions.skirtHeight;
  483. skirtOptions.hMin = Math.min(skirtOptions.hMin, height);
  484. Cartesian2.Cartographic.fromRadians(longitude, latitude, height, scratchCartographic);
  485. // Adjust sides to angle out
  486. if (eastOrWest) {
  487. scratchCartographic.longitude += fudgeFactor;
  488. }
  489. // Adjust top or bottom to angle out
  490. // Since corners are in the east/west arrays angle the first and last points as well
  491. if (!eastOrWest) {
  492. scratchCartographic.latitude += fudgeFactor;
  493. } else if (j === count - 1) {
  494. scratchCartographic.latitude += cornerFudge;
  495. } else if (j === 0) {
  496. scratchCartographic.latitude -= cornerFudge;
  497. }
  498. var pos = skirtOptions.ellipsoid.cartographicToCartesian(
  499. scratchCartographic
  500. );
  501. positions.push(pos);
  502. heights.push(height);
  503. uvs.push(Cartesian2.Cartesian2.clone(uvs[borderIndex])); // Copy UVs from border point
  504. if (webMercatorTs.length > 0) {
  505. webMercatorTs.push(webMercatorTs[borderIndex]);
  506. }
  507. Transforms.Matrix4.multiplyByPoint(skirtOptions.toENU, pos, scratchCartesian);
  508. var minimum = skirtOptions.minimum;
  509. var maximum = skirtOptions.maximum;
  510. Cartesian2.Cartesian3.minimumByComponent(scratchCartesian, minimum, minimum);
  511. Cartesian2.Cartesian3.maximumByComponent(scratchCartesian, maximum, maximum);
  512. var lastBorderPoint = skirtOptions.lastBorderPoint;
  513. if (when.defined(lastBorderPoint)) {
  514. var lastBorderIndex = lastBorderPoint.index;
  515. indices.push(
  516. lastBorderIndex,
  517. currentIndex - 1,
  518. currentIndex,
  519. currentIndex,
  520. borderIndex,
  521. lastBorderIndex
  522. );
  523. }
  524. skirtOptions.lastBorderPoint = borderPoint;
  525. }
  526. }
  527. var createVerticesFromGoogleEarthEnterpriseBuffer$1 = createTaskProcessorWorker(
  528. createVerticesFromGoogleEarthEnterpriseBuffer
  529. );
  530. return createVerticesFromGoogleEarthEnterpriseBuffer$1;
  531. });