mirror of https://github.com/CesiumGS/cesium.git
fixing some tests, reverting some unnecessary changes, reducing diff size
This commit is contained in:
parent
6fe50a1fe2
commit
4cfef57f41
|
|
@ -1,161 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
|
||||
/>
|
||||
<meta
|
||||
name="description"
|
||||
content="A little example using heading pitch and roll"
|
||||
/>
|
||||
<meta name="cesium-sandcastle-labels" content="Development" />
|
||||
<title>Cesium Demo</title>
|
||||
<script type="text/javascript" src="../Sandcastle-header.js"></script>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="../../../Build/CesiumUnminified/Cesium.js"
|
||||
nomodule
|
||||
></script>
|
||||
<script type="module" src="../load-cesium-es6.js"></script>
|
||||
</head>
|
||||
<body
|
||||
class="sandcastle-loading"
|
||||
data-sandcastle-bucket="bucket-requirejs.html"
|
||||
>
|
||||
<style>
|
||||
@import url(../templates/bucket.css);
|
||||
</style>
|
||||
<div id="cesiumContainer" class="fullSize"></div>
|
||||
<div id="loadingOverlay"><h1>Loading...</h1></div>
|
||||
<div id="toolbar">
|
||||
<label for="heading">Heading</label>
|
||||
<input type="range" id="heading" min="0" max="360" step="0.1" />
|
||||
<label for="pitch">Pitch</label>
|
||||
<input type="range" id="pitch" min="0" max="360" step="0.1" />
|
||||
<label for="roll">Roll</label>
|
||||
<input type="range" id="roll" min="0" max="360" step="0.1" />
|
||||
</div>
|
||||
|
||||
<script id="cesium_sandcastle_script">
|
||||
function startup(Cesium) {
|
||||
"use strict";
|
||||
//Sandcastle_Begin
|
||||
const viewer = new Cesium.Viewer("cesiumContainer", {
|
||||
infoBox: false,
|
||||
selectionIndicator: false,
|
||||
});
|
||||
|
||||
const polylineCollection = new Cesium.PolylineCollection();
|
||||
viewer.scene.primitives.add(polylineCollection);
|
||||
|
||||
const axis = new Cesium.DebugModelMatrixPrimitive({
|
||||
// modelMatrix: transform,
|
||||
length: 10000000.0,
|
||||
width: 2.0,
|
||||
});
|
||||
viewer.scene.primitives.add(axis);
|
||||
|
||||
function createROIFromRotation(cartesianPosition, rotation) {
|
||||
rotation.heading = rotation.heading - Cesium.Math.toRadians(90);
|
||||
const referenceFrame1 = Cesium.Transforms.headingPitchRollQuaternion(
|
||||
cartesianPosition,
|
||||
rotation
|
||||
);
|
||||
const rotationMatrix = Cesium.Matrix3.fromQuaternion(
|
||||
referenceFrame1,
|
||||
new Cesium.Matrix3()
|
||||
);
|
||||
// Replace 1000 for changing the distance
|
||||
const rotationScaled = Cesium.Matrix3.multiplyByVector(
|
||||
rotationMatrix,
|
||||
new Cesium.Cartesian3(1000000, 0, 0),
|
||||
new Cesium.Cartesian3()
|
||||
);
|
||||
const roiPos = Cesium.Cartesian3.add(
|
||||
cartesianPosition,
|
||||
rotationScaled,
|
||||
new Cesium.Cartesian3()
|
||||
);
|
||||
return roiPos;
|
||||
}
|
||||
|
||||
const polylines = [];
|
||||
|
||||
for (let lon = -180; lon < 180; lon += 20) {
|
||||
for (let lat = -90; lat < 90; lat += 20) {
|
||||
const tail = Cesium.Cartesian3.fromDegrees(lon, lat);
|
||||
const e = viewer.entities.add({
|
||||
position: tail,
|
||||
point: {
|
||||
pixelSize: 10,
|
||||
},
|
||||
});
|
||||
|
||||
const polyline = polylineCollection.add({
|
||||
show: true,
|
||||
positions: [tail, tail],
|
||||
width: 10,
|
||||
material: Cesium.Material.fromType(
|
||||
Cesium.Material.PolylineArrowType,
|
||||
{
|
||||
color: Cesium.Color.RED,
|
||||
}
|
||||
),
|
||||
});
|
||||
polylines.push(polyline);
|
||||
}
|
||||
}
|
||||
|
||||
function watchChanges(id, onChange) {
|
||||
const el = document.getElementById(id);
|
||||
el.addEventListener("input", function (e) {
|
||||
const value = e.target.value;
|
||||
onChange(parseFloat(value));
|
||||
});
|
||||
el.value = 0;
|
||||
}
|
||||
|
||||
let heading = 0,
|
||||
pitch = 0,
|
||||
roll = 0;
|
||||
|
||||
function update(heading, pitch, roll) {
|
||||
for (let i = 0; i < polylines.length; i++) {
|
||||
const poly = polylines[i];
|
||||
const tail = poly.positions[0];
|
||||
const head = createROIFromRotation(
|
||||
tail,
|
||||
Cesium.HeadingPitchRoll.fromDegrees(heading, pitch, roll)
|
||||
);
|
||||
poly.positions = [tail, head];
|
||||
}
|
||||
}
|
||||
|
||||
watchChanges("heading", function (value) {
|
||||
heading = value;
|
||||
update(heading, pitch, roll);
|
||||
});
|
||||
watchChanges("pitch", function (value) {
|
||||
pitch = value;
|
||||
update(heading, pitch, roll);
|
||||
});
|
||||
watchChanges("roll", function (value) {
|
||||
roll = value;
|
||||
update(heading, pitch, roll);
|
||||
});
|
||||
|
||||
update(heading, pitch, roll);
|
||||
|
||||
//Sandcastle_End
|
||||
Sandcastle.finishedLoading();
|
||||
}
|
||||
if (typeof Cesium !== "undefined") {
|
||||
window.startupCalled = true;
|
||||
startup(Cesium);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import RequestScheduler from "../Source/Core/RequestScheduler.js";
|
||||
import Resource from "../Source/Core/Resource.js";
|
||||
import { defined } from "../Source/Cesium.js";
|
||||
import { RequestScheduler, Resource, defined } from "@cesium/engine";
|
||||
|
||||
export function resetXHRPatch() {
|
||||
RequestScheduler.clearForSpecs();
|
||||
|
|
@ -23,7 +21,7 @@ export function patchXHRLoad(proxySpec) {
|
|||
data,
|
||||
headers,
|
||||
deferred,
|
||||
overrideMimeType
|
||||
overrideMimeType,
|
||||
) {
|
||||
// find a key (source path) path in the spec which matches (ends with) the requested url
|
||||
const availablePaths = Object.keys(proxySpec);
|
||||
|
|
@ -41,8 +39,8 @@ export function patchXHRLoad(proxySpec) {
|
|||
if (!defined(proxiedUrl)) {
|
||||
throw new Error(
|
||||
`Unexpected XHR load to url: ${url}; spec includes: ${availablePaths.join(
|
||||
", "
|
||||
)}`
|
||||
", ",
|
||||
)}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -54,7 +52,7 @@ export function patchXHRLoad(proxySpec) {
|
|||
data,
|
||||
headers,
|
||||
deferred,
|
||||
overrideMimeType
|
||||
overrideMimeType,
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ HeightmapTerrainData.prototype.createMesh = function (options) {
|
|||
|
||||
let octreeTrianglePicker = null;
|
||||
if (encoding.exaggeration === 1 && result.octree) {
|
||||
// ahhh, sorry, the octree data structure is built off non-exaggerated triangles
|
||||
// the octree data structure is only built off non-exaggerated triangles
|
||||
octreeTrianglePicker = new OctreeTrianglePicking(
|
||||
result.octree,
|
||||
createTriangleVerticesCallback(
|
||||
|
|
|
|||
|
|
@ -65,13 +65,13 @@ function createPackedTriangles(
|
|||
// isEven: TL, BL, TR
|
||||
// isOdd: TR, BL, BR
|
||||
|
||||
Matrix4.multiplyByPointFast(
|
||||
Matrix4.multiplyByPoint(
|
||||
invTransform,
|
||||
positions[base + (isEven ? 0 : 1)],
|
||||
v0,
|
||||
);
|
||||
Matrix4.multiplyByPointFast(invTransform, positions[base + width], v1);
|
||||
Matrix4.multiplyByPointFast(
|
||||
Matrix4.multiplyByPoint(invTransform, positions[base + width], v1);
|
||||
Matrix4.multiplyByPoint(
|
||||
invTransform,
|
||||
positions[base + 1 + (isEven ? 0 : width)],
|
||||
v2,
|
||||
|
|
|
|||
|
|
@ -2302,24 +2302,6 @@ Matrix4.multiplyByPoint = function (matrix, cartesian, result) {
|
|||
return result;
|
||||
};
|
||||
|
||||
Matrix4.multiplyByPointFast = function (matrix, cartesian, result) {
|
||||
result.x =
|
||||
matrix[0] * cartesian.x +
|
||||
matrix[4] * cartesian.y +
|
||||
matrix[8] * cartesian.z +
|
||||
matrix[12];
|
||||
result.y =
|
||||
matrix[1] * cartesian.x +
|
||||
matrix[5] * cartesian.y +
|
||||
matrix[9] * cartesian.z +
|
||||
matrix[13];
|
||||
result.z =
|
||||
matrix[2] * cartesian.x +
|
||||
matrix[6] * cartesian.y +
|
||||
matrix[10] * cartesian.z +
|
||||
matrix[14];
|
||||
};
|
||||
|
||||
/**
|
||||
* Computes the product of a matrix and a scalar.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -36,14 +36,9 @@ const scratchV2 = new Cartesian3();
|
|||
* Ray intersection test
|
||||
* @param {Ray} ray
|
||||
* @param {Boolean} cullBackFaces
|
||||
* @param {Cartesian3} result
|
||||
* @returns {Cartesian3} result
|
||||
*/
|
||||
OctreeTrianglePicking.prototype.rayIntersect = function (
|
||||
ray,
|
||||
cullBackFaces,
|
||||
result,
|
||||
) {
|
||||
OctreeTrianglePicking.prototype.rayIntersect = function (ray, cullBackFaces) {
|
||||
const invTransform = this._inverseTransform;
|
||||
|
||||
const transformedRay = scratchTransformedRay;
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ Ray.clone = function (ray, result) {
|
|||
return result;
|
||||
};
|
||||
|
||||
const scratchCartesian = new Cartesian3();
|
||||
|
||||
/**
|
||||
* Computes the point along the ray given by r(t) = o + t*d,
|
||||
* where o is the origin of the ray and d is the direction.
|
||||
|
|
@ -75,11 +73,7 @@ Ray.getPoint = function (ray, t, result) {
|
|||
result = new Cartesian3();
|
||||
}
|
||||
|
||||
const offset = Cartesian3.multiplyByScalar(
|
||||
ray.direction,
|
||||
t,
|
||||
scratchCartesian,
|
||||
);
|
||||
return Cartesian3.add(ray.origin, offset, result);
|
||||
result = Cartesian3.multiplyByScalar(ray.direction, t, result);
|
||||
return Cartesian3.add(ray.origin, result, result);
|
||||
};
|
||||
export default Ray;
|
||||
|
|
|
|||
|
|
@ -179,17 +179,18 @@ TerrainMesh.prototype.pickRay = function (
|
|||
mode,
|
||||
projection,
|
||||
) {
|
||||
const hasOctree = !!this._octreeTrianglePicking;
|
||||
// check if we can use the faster octree path of if we fallback to using an iterative search
|
||||
const canUseOctree =
|
||||
hasOctree &&
|
||||
// we might not have an octree that we can use
|
||||
!!this._octreeTrianglePicking &&
|
||||
// 3d mode only
|
||||
mode === SceneMode.SCENE3D /* 3d mode only*/ &&
|
||||
// the octree is baked for default terrain exaggeration, so we can only trust its result when we're
|
||||
mode === SceneMode.SCENE3D &&
|
||||
// the octree is built for default terrain exaggeration, so we can only trust its result when we're
|
||||
// not using terrain exaggeration
|
||||
this.encoding.exaggeration === 1;
|
||||
|
||||
if (canUseOctree) {
|
||||
return this._octreeTrianglePicking.rayIntersect(ray, cullBackFaces, null);
|
||||
return this._octreeTrianglePicking.rayIntersect(ray, cullBackFaces);
|
||||
}
|
||||
|
||||
return this._defaultPickStrategy.rayIntersect(
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import Cartesian3 from "./Cartesian3.js";
|
||||
|
||||
/**
|
||||
* Small helper function
|
||||
* @param {Float32Array} vertices
|
||||
|
|
@ -19,24 +17,10 @@ export default function createTriangleVerticesCallback(
|
|||
* @param {Cartesian3} v1
|
||||
* @param {Cartesian3} v2
|
||||
*/
|
||||
function triangleVerticesCallback(triIdx, v0, v1, v2, traceDetails) {
|
||||
function triangleVerticesCallback(triIdx, v0, v1, v2) {
|
||||
encoding.decodePosition(vertices, indices[triIdx * 3], v0);
|
||||
encoding.decodePosition(vertices, indices[triIdx * 3 + 1], v1);
|
||||
encoding.decodePosition(vertices, indices[triIdx * 3 + 2], v2);
|
||||
|
||||
if (traceDetails) {
|
||||
if (!traceDetails.trianglesTested) {
|
||||
traceDetails.trianglesTested = [];
|
||||
}
|
||||
traceDetails.trianglesTested.push({
|
||||
idx: triIdx,
|
||||
positions: [
|
||||
Cartesian3.clone(v0),
|
||||
Cartesian3.clone(v1),
|
||||
Cartesian3.clone(v2),
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return triangleVerticesCallback;
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
import {
|
||||
ArcGISTiledElevationTerrainProvider,
|
||||
Cartesian3,
|
||||
Cartesian4,
|
||||
Cartographic,
|
||||
CesiumTerrainProvider,
|
||||
createWorldTerrainAsync,
|
||||
Ellipsoid,
|
||||
EllipsoidTerrainProvider,
|
||||
GeographicTilingScheme,
|
||||
Ray,
|
||||
GlobeSurfaceTile,
|
||||
ImageryLayerCollection,
|
||||
Math as CesiumMath,
|
||||
QuadtreeTile,
|
||||
QuadtreeTileLoadState,
|
||||
Ray,
|
||||
SceneMode,
|
||||
TerrainState,
|
||||
TileProviderError,
|
||||
} from "../../index.js";
|
||||
|
|
@ -18,6 +23,11 @@ import MockTerrainProvider from "../../../../Specs/MockTerrainProvider.js";
|
|||
import TerrainTileProcessor from "../../../../Specs/TerrainTileProcessor.js";
|
||||
|
||||
import createScene from "../../../../Specs/createScene.js";
|
||||
import {
|
||||
patchXHRLoad,
|
||||
patchXHRLoadForArcGISTerrainDataSet,
|
||||
resetXHRPatch,
|
||||
} from "../../../../Specs/patchXHRLoad.js";
|
||||
|
||||
describe("Scene/GlobeSurfaceTile", function () {
|
||||
let frameState;
|
||||
|
|
@ -364,7 +374,12 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
0.5517155343926082,
|
||||
),
|
||||
);
|
||||
const pickResult = tile.data.pick(ray, SceneMode.SCENE3D, undefined, true);
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
true,
|
||||
);
|
||||
const cartographic =
|
||||
Ellipsoid.WGS84.cartesianToCartographic(pickResult);
|
||||
expect(cartographic.height).toBeGreaterThan(-500.0);
|
||||
|
|
@ -560,21 +575,20 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
resetXHRPatch();
|
||||
});
|
||||
|
||||
it("should pick a few points on a CWT tile", function () {
|
||||
it("should pick a few points on a CWT tile", async function () {
|
||||
patchXHRLoad({
|
||||
"/layer.json": "Data/CesiumTerrainTileJson/9_759_335/layer.json",
|
||||
"/9/759/335.terrain?v=1.2.0":
|
||||
"Data/CesiumTerrainTileJson/9_759_335/9_759_335.terrain",
|
||||
});
|
||||
|
||||
const terrainProvider = new CesiumTerrainProvider({
|
||||
url: "made/up/url",
|
||||
});
|
||||
const terrainProvider =
|
||||
await CesiumTerrainProvider.fromUrl("made/up/url");
|
||||
|
||||
processor = new TerrainTileProcessor(
|
||||
frameState,
|
||||
terrainProvider,
|
||||
imageryLayerCollection
|
||||
imageryLayerCollection,
|
||||
);
|
||||
processor.mockWebGL();
|
||||
processor.frameState = scene.frameState;
|
||||
|
|
@ -594,7 +608,7 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
const direction = new Cartesian3(
|
||||
0.04604903643932318,
|
||||
0.8821324224085892,
|
||||
0.46874500059047475
|
||||
0.46874500059047475,
|
||||
);
|
||||
const origin = new Cartesian3(0, 0, -20029.056425910585);
|
||||
const ray = new Ray(origin, direction);
|
||||
|
|
@ -603,7 +617,7 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces
|
||||
cullBackFaces,
|
||||
);
|
||||
expect(pickResult).toBeDefined();
|
||||
expect(pickResult.x).toBeCloseTo(294215.31248307973, 10);
|
||||
|
|
@ -612,51 +626,48 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
});
|
||||
});
|
||||
|
||||
it("should pick a few points on a ArcGIS tile", function () {
|
||||
it("should pick a few points on an ArcGIS tile", async function () {
|
||||
patchXHRLoadForArcGISTerrainDataSet();
|
||||
const terrainProvider = new ArcGISTiledElevationTerrainProvider({
|
||||
url: "made/up/url",
|
||||
});
|
||||
const terrainProvider =
|
||||
await ArcGISTiledElevationTerrainProvider.fromUrl("made/up/url");
|
||||
|
||||
processor = new TerrainTileProcessor(
|
||||
frameState,
|
||||
terrainProvider,
|
||||
imageryLayerCollection
|
||||
imageryLayerCollection,
|
||||
);
|
||||
processor.mockWebGL();
|
||||
processor.frameState = scene.frameState;
|
||||
|
||||
return terrainProvider.readyPromise.then(function () {
|
||||
const tile = new QuadtreeTile({
|
||||
tilingScheme: terrainProvider.tilingScheme,
|
||||
level: 9,
|
||||
x: 379,
|
||||
y: 214,
|
||||
});
|
||||
return processor.process([tile]).then(function () {
|
||||
const direction = new Cartesian3(
|
||||
0.04604903643932318,
|
||||
0.8821324224085892,
|
||||
0.46874500059047475
|
||||
);
|
||||
const origin = new Cartesian3(0, 0, -20029.056425910585);
|
||||
const ray = new Ray(origin, direction);
|
||||
const cullBackFaces = false;
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces
|
||||
);
|
||||
const location = pickResultToLocation(pickResult);
|
||||
expect(location.latitude).toBeCloseTo(27.952862605533163, 10);
|
||||
expect(location.longitude).toBeCloseTo(87.01176072534257, 10);
|
||||
expect(location.height).toBeCloseTo(6372, 0);
|
||||
});
|
||||
const tile = new QuadtreeTile({
|
||||
tilingScheme: terrainProvider.tilingScheme,
|
||||
level: 9,
|
||||
x: 379,
|
||||
y: 214,
|
||||
});
|
||||
|
||||
await processor.process([tile]);
|
||||
const direction = new Cartesian3(
|
||||
0.04604903643932318,
|
||||
0.8821324224085892,
|
||||
0.46874500059047475,
|
||||
);
|
||||
const origin = new Cartesian3(0, 0, -20029.056425910585);
|
||||
const ray = new Ray(origin, direction);
|
||||
const cullBackFaces = false;
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces,
|
||||
);
|
||||
const location = pickResultToLocation(pickResult);
|
||||
expect(location.latitude).toBeCloseTo(27.952862605533163, 10);
|
||||
expect(location.longitude).toBeCloseTo(87.01176072534257, 10);
|
||||
expect(location.height).toBeCloseTo(6372, 0);
|
||||
});
|
||||
|
||||
it("should do a lot more points", function () {
|
||||
it("should do a lot more points", async function () {
|
||||
// pick a point 10km above sea level (~4k above the terrain at this location)
|
||||
const position = {
|
||||
longitude: 87.01176072534257,
|
||||
|
|
@ -669,7 +680,7 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
position.latitude,
|
||||
// calculating the normal requires ground level
|
||||
0.0,
|
||||
Ellipsoid.WGS84
|
||||
Ellipsoid.WGS84,
|
||||
);
|
||||
Ellipsoid.WGS84.geodeticSurfaceNormal(cartesian, ray.direction);
|
||||
// Try to find the intersection point between the surface normal and z-axis.
|
||||
|
|
@ -677,46 +688,43 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
Ellipsoid.WGS84.getSurfaceNormalIntersectionWithZAxis(
|
||||
cartesian,
|
||||
11500.0,
|
||||
ray.origin
|
||||
ray.origin,
|
||||
);
|
||||
|
||||
patchXHRLoadForArcGISTerrainDataSet();
|
||||
const terrainProvider = new ArcGISTiledElevationTerrainProvider({
|
||||
url: "made/up/url",
|
||||
});
|
||||
const terrainProvider =
|
||||
await ArcGISTiledElevationTerrainProvider.fromUrl("made/up/url");
|
||||
|
||||
processor = new TerrainTileProcessor(
|
||||
frameState,
|
||||
terrainProvider,
|
||||
imageryLayerCollection
|
||||
imageryLayerCollection,
|
||||
);
|
||||
processor.mockWebGL();
|
||||
processor.frameState = scene.frameState;
|
||||
|
||||
return terrainProvider.readyPromise.then(function () {
|
||||
const tile = new QuadtreeTile({
|
||||
tilingScheme: terrainProvider.tilingScheme,
|
||||
level: 9,
|
||||
x: 379,
|
||||
y: 214,
|
||||
});
|
||||
return processor.process([tile]).then(function () {
|
||||
const cullBackFaces = false;
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces
|
||||
);
|
||||
const location = pickResultToLocation(pickResult);
|
||||
expect(location.latitude).toBeCloseTo(27.952862605533163, 10);
|
||||
expect(location.longitude).toBeCloseTo(87.01176072534257, 10);
|
||||
expect(location.height).toBeCloseTo(6372, 0);
|
||||
});
|
||||
const tile = new QuadtreeTile({
|
||||
tilingScheme: terrainProvider.tilingScheme,
|
||||
level: 9,
|
||||
x: 379,
|
||||
y: 214,
|
||||
});
|
||||
|
||||
await processor.process([tile]);
|
||||
const cullBackFaces = false;
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces,
|
||||
);
|
||||
const location = pickResultToLocation(pickResult);
|
||||
expect(location.latitude).toBeCloseTo(27.952862605533163, 10);
|
||||
expect(location.longitude).toBeCloseTo(87.01176072534257, 10);
|
||||
expect(location.height).toBeCloseTo(6372, 0);
|
||||
});
|
||||
|
||||
it("special point that returned null", function () {
|
||||
it("special point that returned null", async function () {
|
||||
patchXHRLoadForArcGISTerrainDataSet();
|
||||
|
||||
const ray = new Ray(
|
||||
|
|
@ -724,44 +732,40 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
new Cartesian3(
|
||||
0.046566275697934596,
|
||||
0.8817741083711048,
|
||||
0.4693676637498234
|
||||
)
|
||||
0.4693676637498234,
|
||||
),
|
||||
);
|
||||
const terrainProvider = new ArcGISTiledElevationTerrainProvider({
|
||||
url: "made/up/url",
|
||||
});
|
||||
const terrainProvider =
|
||||
await ArcGISTiledElevationTerrainProvider.fromUrl("made/up/url");
|
||||
|
||||
processor = new TerrainTileProcessor(
|
||||
frameState,
|
||||
terrainProvider,
|
||||
imageryLayerCollection
|
||||
imageryLayerCollection,
|
||||
);
|
||||
processor.mockWebGL();
|
||||
processor.frameState = scene.frameState;
|
||||
|
||||
return terrainProvider.readyPromise.then(function () {
|
||||
const tile = new QuadtreeTile({
|
||||
tilingScheme: terrainProvider.tilingScheme,
|
||||
level: 9,
|
||||
x: 379,
|
||||
y: 214,
|
||||
});
|
||||
return processor.process([tile]).then(function () {
|
||||
const cullBackFaces = false;
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces
|
||||
);
|
||||
const location = pickResultToLocation(pickResult);
|
||||
expect(location.latitude).toBeCloseTo(27.993258048265453, 10);
|
||||
expect(location.longitude).toBeCloseTo(86.97703198692928, 10);
|
||||
expect(location.height).toBeCloseTo(5587.6, 0);
|
||||
});
|
||||
const tile = new QuadtreeTile({
|
||||
tilingScheme: terrainProvider.tilingScheme,
|
||||
level: 9,
|
||||
x: 379,
|
||||
y: 214,
|
||||
});
|
||||
await processor.process([tile]);
|
||||
const cullBackFaces = false;
|
||||
const pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
undefined,
|
||||
cullBackFaces,
|
||||
);
|
||||
const location = pickResultToLocation(pickResult);
|
||||
expect(location.latitude).toBeCloseTo(27.993258048265453, 10);
|
||||
expect(location.longitude).toBeCloseTo(86.97703198692928, 10);
|
||||
expect(location.height).toBeCloseTo(5587.6, 0);
|
||||
});
|
||||
},
|
||||
"WebGL"
|
||||
"WebGL",
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue