mirror of https://github.com/CesiumGS/cesium.git
lots of reverts - still a failing test
This commit is contained in:
parent
3c3756b2d9
commit
6cfefad2f3
|
|
@ -39,22 +39,13 @@
|
|||
function startup(Cesium) {
|
||||
"use strict";
|
||||
//Sandcastle_Begin
|
||||
var viewer = new Cesium.Viewer("cesiumContainer", {
|
||||
terrainProvider: new Cesium.EllipsoidTerrainProvider({}),
|
||||
});
|
||||
|
||||
var worldTerrain = Cesium.createWorldTerrain({
|
||||
requestWaterMask: true,
|
||||
requestVertexNormals: true,
|
||||
viewer: viewer,
|
||||
});
|
||||
|
||||
viewer.terrainProvider = worldTerrain;
|
||||
|
||||
var terrainProvider = new Cesium.ArcGISTiledElevationTerrainProvider({
|
||||
url:
|
||||
"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer",
|
||||
viewer: viewer,
|
||||
var viewer = new Cesium.Viewer("cesiumContainer", {
|
||||
terrainProvider: worldTerrain,
|
||||
});
|
||||
|
||||
// set lighting to true
|
||||
|
|
@ -77,12 +68,6 @@
|
|||
viewer.scene.globe.enableLighting = true;
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "ArcGIS",
|
||||
onselect: function () {
|
||||
viewer.terrainProvider = terrainProvider;
|
||||
},
|
||||
},
|
||||
{
|
||||
text: "CesiumTerrainProvider - Cesium World Terrain - no effects",
|
||||
onselect: function () {
|
||||
|
|
@ -222,9 +207,9 @@
|
|||
viewer.entities.resumeEvents();
|
||||
}
|
||||
|
||||
function createGrid(rectangleHalfSize, gridWidth, gridHeight) {
|
||||
gridWidth = gridWidth || 41;
|
||||
gridHeight = gridHeight || 41;
|
||||
function createGrid(rectangleHalfSize) {
|
||||
var gridWidth = 41;
|
||||
var gridHeight = 41;
|
||||
var everestLatitude = Cesium.Math.toRadians(27.988257);
|
||||
var everestLongitude = Cesium.Math.toRadians(86.925145);
|
||||
var e = new Cesium.Rectangle(
|
||||
|
|
@ -308,61 +293,6 @@
|
|||
"sampleButtons"
|
||||
);
|
||||
|
||||
// Sandcastle.addToolbarButton(
|
||||
// "Pick all the things",
|
||||
// function () {
|
||||
// var terrainSamplePositions = createGrid(0.0005);
|
||||
// for (var i = 0; i < terrainSamplePositions.length; i++) {
|
||||
// var position = terrainSamplePositions[i];
|
||||
// Cesium.Math.toRadians();
|
||||
// }
|
||||
// Cesium.when(
|
||||
// Cesium.sampleTerrain(
|
||||
// viewer.terrainProvider,
|
||||
// terrainSamplePositions
|
||||
// ),
|
||||
// sampleTerrainSuccess
|
||||
// );
|
||||
// },
|
||||
// "sampleButtons"
|
||||
// );
|
||||
|
||||
function singlePick(mousePosition) {
|
||||
var scene = viewer.scene;
|
||||
var camera = scene.camera;
|
||||
|
||||
var ray = camera.getPickRay(mousePosition);
|
||||
|
||||
var before = performance.now();
|
||||
var pickPosition = scene.globe.pick(ray, scene, null, true);
|
||||
var after = performance.now();
|
||||
|
||||
var foundPick = Cesium.defined(pickPosition);
|
||||
console.log("Single pick at " + mousePosition);
|
||||
console.log("Found: " + foundPick);
|
||||
console.log("Time: " + (after - before));
|
||||
|
||||
viewer.entities.removeAll();
|
||||
|
||||
// if (foundPick) {
|
||||
// viewer.entities.add({
|
||||
// position: pickPosition,
|
||||
// ellipsoid: {
|
||||
// radii: new Cesium.Cartesian3(100.0, 100.0, 100.0),
|
||||
// material: Cesium.Color.RED,
|
||||
// },
|
||||
// });
|
||||
// }
|
||||
}
|
||||
|
||||
Sandcastle.addToolbarButton("Pick Center", function () {
|
||||
var x = viewer.canvas.clientWidth / 2.0;
|
||||
var y = viewer.canvas.clientHeight / 2.0;
|
||||
|
||||
var position = Cesium.Cartesian2.fromElements(x, y);
|
||||
singlePick(position);
|
||||
});
|
||||
|
||||
//Sandcastle_End
|
||||
Sandcastle.finishedLoading();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ function ArcGISTiledElevationTerrainProvider(options) {
|
|||
this._width = undefined;
|
||||
this._height = undefined;
|
||||
this._encoding = undefined;
|
||||
this._viewer = options.viewer;
|
||||
var token = options.token;
|
||||
|
||||
this._hasAvailability = false;
|
||||
|
|
@ -382,7 +381,6 @@ ArcGISTiledElevationTerrainProvider.prototype.requestTileGeometry = function (
|
|||
: ALL_CHILDREN,
|
||||
structure: that._terrainDataStructure,
|
||||
encoding: that._encoding,
|
||||
viewer: that._viewer,
|
||||
});
|
||||
})
|
||||
.otherwise(function (error) {
|
||||
|
|
|
|||
|
|
@ -77,8 +77,6 @@ function CesiumTerrainProvider(options) {
|
|||
this._hasVertexNormals = false;
|
||||
this._ellipsoid = options.ellipsoid;
|
||||
|
||||
this._viewer = options.viewer;
|
||||
|
||||
/**
|
||||
* Boolean flag that indicates if the client should request vertex normals from the server.
|
||||
* @type {Boolean}
|
||||
|
|
@ -794,7 +792,6 @@ function createQuantizedMeshTerrainData(provider, buffer, level, x, y, layer) {
|
|||
childTileMask: provider.availability.computeChildMaskForTile(level, x, y),
|
||||
waterMask: waterMaskBuffer,
|
||||
credits: provider._tileCredits,
|
||||
viewer: provider._viewer,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import Cartesian3 from "./Cartesian3.js";
|
||||
import Check from "./Check.js";
|
||||
import defined from "./defined.js";
|
||||
import IntersectionTests from "./IntersectionTests.js";
|
||||
import Matrix4 from "./Matrix4.js";
|
||||
import Ray from "./Ray.js";
|
||||
|
||||
function Rect() {
|
||||
this.min = new Cartesian2(0, 0);
|
||||
this.max = new Cartesian2(0, 0);
|
||||
}
|
||||
|
||||
function QuadtreeNode() {
|
||||
// by nature of the height map structure - we just know which
|
||||
// height map points (and therefore triangles) belong in each quadtree node
|
||||
// because a height map is a fixed grid.
|
||||
this.rect = new Rect();
|
||||
this.heightMax = 0;
|
||||
this.heightMin = 0;
|
||||
}
|
||||
|
||||
function HeightmapQuadtree(heightmapIndicies, transform) {
|
||||
//
|
||||
}
|
||||
|
||||
export default HeightmapQuadtree;
|
||||
|
|
@ -153,8 +153,6 @@ function HeightmapTerrainData(options) {
|
|||
? Float32Array
|
||||
: this._buffer.constructor;
|
||||
this._mesh = undefined;
|
||||
|
||||
this._viewer = options.viewer;
|
||||
}
|
||||
|
||||
Object.defineProperties(HeightmapTerrainData.prototype, {
|
||||
|
|
@ -317,9 +315,7 @@ HeightmapTerrainData.prototype.createMesh = function (options) {
|
|||
indicesAndEdges.southIndicesEastToWest,
|
||||
indicesAndEdges.eastIndicesNorthToSouth,
|
||||
indicesAndEdges.northIndicesWestToEast,
|
||||
trianglePicking,
|
||||
null,
|
||||
that._viewer
|
||||
trianglePicking
|
||||
);
|
||||
|
||||
// Free memory received from server after mesh is created.
|
||||
|
|
|
|||
|
|
@ -90,54 +90,6 @@ function createPackedTriangles(
|
|||
return triangles;
|
||||
}
|
||||
|
||||
function createTrianglesFromHeightmap(
|
||||
positions,
|
||||
invTransform,
|
||||
width,
|
||||
triangleIndexEnd
|
||||
) {
|
||||
var v0 = new Cartesian3();
|
||||
var v1 = new Cartesian3();
|
||||
var v2 = new Cartesian3();
|
||||
var idx0;
|
||||
var idx1;
|
||||
var idx2;
|
||||
var trianglesPerRow;
|
||||
var base;
|
||||
var isEven;
|
||||
var triIdx;
|
||||
|
||||
var triangles = [];
|
||||
for (triIdx = 0; triIdx < triangleIndexEnd; triIdx++) {
|
||||
trianglesPerRow = (width - 1) * 2;
|
||||
base =
|
||||
width * Math.floor(triIdx / trianglesPerRow) +
|
||||
Math.floor((triIdx % trianglesPerRow) / 2);
|
||||
isEven = triIdx % 2 === 0;
|
||||
// isEven: TL, BL, TR
|
||||
// isOdd: TR, BL, BR
|
||||
idx0 = base + (isEven ? 0 : 1);
|
||||
idx1 = base + width;
|
||||
idx2 = base + 1 + (isEven ? 0 : width);
|
||||
|
||||
Matrix4.multiplyByPoint(invTransform, positions[idx0], v0);
|
||||
Matrix4.multiplyByPoint(invTransform, positions[idx1], v1);
|
||||
Matrix4.multiplyByPoint(invTransform, positions[idx2], v2);
|
||||
|
||||
// Get local space AABBs for triangle
|
||||
triangles.push({
|
||||
index: triIdx,
|
||||
aabbMinX: Math.min(v0.x, v1.x, v2.x),
|
||||
aabbMaxX: Math.max(v0.x, v1.x, v2.x),
|
||||
aabbMinY: Math.min(v0.y, v1.y, v2.y),
|
||||
aabbMaxY: Math.max(v0.y, v1.y, v2.y),
|
||||
aabbMinZ: Math.min(v0.z, v1.z, v2.z),
|
||||
aabbMaxZ: Math.max(v0.z, v1.z, v2.z),
|
||||
});
|
||||
}
|
||||
return triangles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills an array of vertices from a heightmap image.
|
||||
*
|
||||
|
|
@ -559,7 +511,6 @@ HeightmapTessellator.computeVertices = function (options) {
|
|||
console.timeEnd("creating bounding sphere");
|
||||
|
||||
var orientedBoundingBox;
|
||||
// var trianglePicking;
|
||||
var packedOctree;
|
||||
|
||||
if (defined(rectangle)) {
|
||||
|
|
@ -576,16 +527,6 @@ HeightmapTessellator.computeVertices = function (options) {
|
|||
var inverseTransform = Matrix4.inverse(transform, new Matrix4());
|
||||
|
||||
console.timeEnd("creating oriented bounding box");
|
||||
// console.time("making triangles");
|
||||
//
|
||||
// var triangles = createTrianglesFromHeightmap(
|
||||
// positions,
|
||||
// inverseTransform,
|
||||
// width,
|
||||
// gridTriangleCount
|
||||
// );
|
||||
// console.timeEnd("making triangles");
|
||||
|
||||
console.time("making packed triangles");
|
||||
|
||||
var packedTriangles = createPackedTriangles(
|
||||
|
|
|
|||
|
|
@ -143,8 +143,6 @@ function QuantizedMeshTerrainData(options) {
|
|||
}
|
||||
//>>includeEnd('debug');
|
||||
|
||||
this._viewer = options.viewer;
|
||||
|
||||
this._quantizedVertices = options.quantizedVertices;
|
||||
this._encodedNormals = options.encodedNormals;
|
||||
this._indices = options.indices;
|
||||
|
|
@ -382,7 +380,6 @@ QuantizedMeshTerrainData.prototype.createMesh = function (options) {
|
|||
terrainEncoding
|
||||
)
|
||||
);
|
||||
var url = level + "_" + x + "_" + y;
|
||||
|
||||
// Clone complex result objects because the transfer from the web worker
|
||||
// has stripped them down to JSON-style objects.
|
||||
|
|
@ -404,9 +401,7 @@ QuantizedMeshTerrainData.prototype.createMesh = function (options) {
|
|||
result.southIndicesEastToWest,
|
||||
result.eastIndicesNorthToSouth,
|
||||
result.northIndicesWestToEast,
|
||||
trianglePicking,
|
||||
url,
|
||||
that._viewer
|
||||
trianglePicking
|
||||
);
|
||||
|
||||
// Free memory received from server after mesh is created.
|
||||
|
|
@ -539,8 +534,6 @@ QuantizedMeshTerrainData.prototype.upsample = function (
|
|||
: shortestSkirt * 0.5;
|
||||
var credits = this._credits;
|
||||
|
||||
var viewer = this._viewer;
|
||||
|
||||
return when(upsamplePromise).then(function (result) {
|
||||
var quantizedVertices = new Uint16Array(result.vertices);
|
||||
var indicesTypedArray = IndexDatatype.createTypedArray(
|
||||
|
|
@ -574,7 +567,6 @@ QuantizedMeshTerrainData.prototype.upsample = function (
|
|||
childTileMask: 0,
|
||||
credits: credits,
|
||||
createdByUpsampling: true,
|
||||
viewer: viewer,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,11 +11,6 @@ import GeometryInstance from "./GeometryInstance.js";
|
|||
import PolylineColorAppearance from "../Scene/PolylineColorAppearance.js";
|
||||
import ColorGeometryInstanceAttribute from "./ColorGeometryInstanceAttribute.js";
|
||||
import Color from "./Color.js";
|
||||
import PolygonGeometry from "./PolygonGeometry.js";
|
||||
import PolygonHierarchy from "./PolygonHierarchy.js";
|
||||
import CesiumMath from "./Math.js";
|
||||
import BoxGeometry from "./BoxGeometry.js";
|
||||
import VertexFormat from "./VertexFormat.js";
|
||||
|
||||
/**
|
||||
* A mesh plus related metadata for a single tile of terrain. Instances of this type are
|
||||
|
|
@ -68,9 +63,7 @@ function TerrainMesh(
|
|||
southIndicesEastToWest,
|
||||
eastIndicesNorthToSouth,
|
||||
northIndicesWestToEast,
|
||||
trianglePicking,
|
||||
url,
|
||||
viewer
|
||||
trianglePicking
|
||||
) {
|
||||
/**
|
||||
* The center of the tile. Vertex positions are specified relative to this center.
|
||||
|
|
@ -188,8 +181,6 @@ function TerrainMesh(
|
|||
* @private
|
||||
*/
|
||||
this._trianglePicking = trianglePicking;
|
||||
this._url = url;
|
||||
this._viewer = viewer;
|
||||
}
|
||||
|
||||
var scratchCartographic = new Cartographic();
|
||||
|
|
@ -221,90 +212,6 @@ function getPosition(encoding, mode, projection, vertices, index, result) {
|
|||
return result;
|
||||
}
|
||||
|
||||
function addLine(viewer, ray, color) {
|
||||
if (!viewer || !ray) {
|
||||
return;
|
||||
}
|
||||
var primitive = new Primitive({
|
||||
geometryInstances: new GeometryInstance({
|
||||
geometry: new PolylineGeometry({
|
||||
positions: [ray.origin, Ray.getPoint(ray, 100000)],
|
||||
width: 2,
|
||||
vertexFormat: PolylineColorAppearance.VERTEX_FORMAT,
|
||||
}),
|
||||
attributes: {
|
||||
color: ColorGeometryInstanceAttribute.fromColor(color),
|
||||
},
|
||||
}),
|
||||
appearance: new PolylineColorAppearance({
|
||||
translucent: false,
|
||||
}),
|
||||
});
|
||||
viewer.scene.primitives.add(primitive);
|
||||
}
|
||||
|
||||
function addTriangle(viewer, v0, v1, v2) {
|
||||
if (!viewer || !v0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var pointA = Cartographic.fromCartesian(v0);
|
||||
|
||||
viewer.entities.add({
|
||||
position: pointA,
|
||||
ellipsoid: {
|
||||
radii: new Cartesian3(100.0, 100.0, 100.0),
|
||||
material: Color.RED,
|
||||
},
|
||||
});
|
||||
|
||||
// // 1. create a polygon from points
|
||||
// var polygon = new PolygonGeometry({
|
||||
// polygonHierarchy: new PolygonHierarchy(
|
||||
// [v0, v1, v2]
|
||||
// // Cartesian3.fromDegreesArray([
|
||||
// // -72.0, 40.0,
|
||||
// // -70.0, 35.0,
|
||||
// // -75.0, 30.0,
|
||||
// // -70.0, 30.0,
|
||||
// // -68.0, 40.0
|
||||
// // ])
|
||||
// ),
|
||||
// });
|
||||
// var geometry = PolygonGeometry.createGeometry(polygon);
|
||||
//
|
||||
// // var box = new BoxGeometry({
|
||||
// // vertexFormat: VertexFormat.POSITION_ONLY,
|
||||
// // maximum: new Cartesian3(minX, minY, minZ),
|
||||
// // minimum: new Cartesian3(maxX, maxY, maxZ),
|
||||
// // });
|
||||
// // var geometry = BoxGeometry.createGeometry(box);
|
||||
//
|
||||
// var primitive = new Primitive({
|
||||
// geometryInstances: new GeometryInstance({
|
||||
// geometry: geometry,
|
||||
// attributes: {
|
||||
// color: ColorGeometryInstanceAttribute.fromColor(Color.GREEN),
|
||||
// },
|
||||
// }),
|
||||
// // appearance: new PolylineColorAppearance({
|
||||
// // translucent: false,
|
||||
// // }),
|
||||
// });
|
||||
// viewer.scene.primitives.add(primitive);
|
||||
|
||||
// viewer.entities.add({
|
||||
// name: "Red box with black outline",
|
||||
// position: Cartesian3.fromDegrees(-107.0, 40.0, 300000.0),
|
||||
// box: {
|
||||
// dimensions: new Cartesian3(400000.0, 300000.0, 500000.0),
|
||||
// material: Color.RED.withAlpha(0.5),
|
||||
// outline: true,
|
||||
// outlineColor: Color.BLACK,
|
||||
// },
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives the point on the mesh where the give ray intersects
|
||||
* @param ray
|
||||
|
|
@ -317,48 +224,18 @@ TerrainMesh.prototype.pickRay = function (
|
|||
ray,
|
||||
cullBackFaces,
|
||||
mode,
|
||||
projection,
|
||||
showDeails
|
||||
projection
|
||||
) {
|
||||
var canNewPick = mode === SceneMode.SCENE3D && defined(this._trianglePicking);
|
||||
var newPickValue = undefined;
|
||||
var newPickValue;
|
||||
if (canNewPick) {
|
||||
// console.time("new pick");
|
||||
var details = this._trianglePicking.rayIntersect(
|
||||
console.time("new pick");
|
||||
newPickValue = this._trianglePicking.rayIntersect(
|
||||
ray,
|
||||
cullBackFaces,
|
||||
newPickValue,
|
||||
showDeails
|
||||
newPickValue
|
||||
);
|
||||
if (details) {
|
||||
newPickValue = details.result;
|
||||
}
|
||||
// console.timeEnd("new pick");
|
||||
|
||||
if (showDeails) {
|
||||
addLine(this._viewer, ray, Color.RED);
|
||||
|
||||
if (details) {
|
||||
addLine(this._viewer, details.transformedRay, Color.GREEN);
|
||||
|
||||
if (details && details.traversalResult) {
|
||||
var v0 = new Cartesian3();
|
||||
var v1 = new Cartesian3();
|
||||
var v2 = new Cartesian3();
|
||||
this._trianglePicking._triangleVerticesCallback(
|
||||
details.traversalResult.triangleIndex,
|
||||
v0,
|
||||
v1,
|
||||
v2
|
||||
);
|
||||
// var triangle = this._trianglePicking._triangles.slice(
|
||||
// details.traversalResult.triangleIndex,
|
||||
// details.traversalResult.triangleIndex + 6
|
||||
// );
|
||||
addTriangle(this._viewer, v0, v1, v2);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.timeEnd("new pick");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -405,9 +282,9 @@ TerrainMesh.prototype.pickRay = function (
|
|||
|
||||
var oldPickValue;
|
||||
if (doOldPick) {
|
||||
// console.time("old pick");
|
||||
console.time("old pick");
|
||||
oldPickValue = oldPick(this);
|
||||
// console.timeEnd("old pick");
|
||||
console.timeEnd("old pick");
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -769,12 +769,7 @@ var scratchTransformedRay = new Ray();
|
|||
* @param {Cartesian3} result
|
||||
* @returns {Cartesian3} result
|
||||
*/
|
||||
TrianglePicking.prototype.rayIntersect = function (
|
||||
ray,
|
||||
cullBackFaces,
|
||||
result,
|
||||
showDetails
|
||||
) {
|
||||
TrianglePicking.prototype.rayIntersect = function (ray, cullBackFaces, result) {
|
||||
if (!defined(result)) {
|
||||
result = new Cartesian3();
|
||||
}
|
||||
|
|
@ -823,11 +818,7 @@ TrianglePicking.prototype.rayIntersect = function (
|
|||
}
|
||||
|
||||
result = Ray.getPoint(ray, traversalResult.t, result);
|
||||
return {
|
||||
result: result,
|
||||
transformedRay: transformedRay,
|
||||
traversalResult: traversalResult,
|
||||
};
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -848,10 +839,10 @@ TrianglePicking.createPackedOctree = function (triangles, inverseTransform) {
|
|||
|
||||
// we can build a more spread out octree
|
||||
// for smaller tiles because it'll be quicker
|
||||
var maxLevels = 8;
|
||||
var maxLevels = 10;
|
||||
var maxTrianglesPerNode = 50;
|
||||
if (triangleCount > 5000) {
|
||||
// for very large tiles, build a small octree because it's faster
|
||||
// for very large tiles, build a small octree because it's faster and won't bottleneck this worker thread;
|
||||
// and just eat the CPU time on the main thread
|
||||
maxLevels = 5;
|
||||
maxTrianglesPerNode = 100;
|
||||
|
|
|
|||
|
|
@ -52,8 +52,6 @@ function Globe(ellipsoid) {
|
|||
this._surfaceShaderSet = new GlobeSurfaceShaderSet();
|
||||
this._material = undefined;
|
||||
|
||||
this.useNewPicking = true;
|
||||
|
||||
this._surface = new QuadtreePrimitive({
|
||||
tileProvider: new GlobeSurfaceTileProvider({
|
||||
terrainProvider: terrainProvider,
|
||||
|
|
@ -624,8 +622,7 @@ Globe.prototype.pickWorldCoordinates = function (
|
|||
ray,
|
||||
scene,
|
||||
cullBackFaces,
|
||||
result,
|
||||
showDetails
|
||||
result
|
||||
) {
|
||||
//>>includeStart('debug', pragmas.debug);
|
||||
if (!defined(ray)) {
|
||||
|
|
@ -703,8 +700,7 @@ Globe.prototype.pickWorldCoordinates = function (
|
|||
scene.mode,
|
||||
scene.mapProjection,
|
||||
cullBackFaces,
|
||||
result,
|
||||
showDetails
|
||||
result
|
||||
);
|
||||
if (defined(intersection)) {
|
||||
break;
|
||||
|
|
@ -728,8 +724,8 @@ var cartoScratch = new Cartographic();
|
|||
* var ray = viewer.camera.getPickRay(windowCoordinates);
|
||||
* var intersection = globe.pick(ray, scene);
|
||||
*/
|
||||
Globe.prototype.pick = function (ray, scene, result, showDetails) {
|
||||
result = this.pickWorldCoordinates(ray, scene, true, result, showDetails);
|
||||
Globe.prototype.pick = function (ray, scene, result) {
|
||||
result = this.pickWorldCoordinates(ray, scene, true, result);
|
||||
if (defined(result) && scene.mode !== SceneMode.SCENE3D) {
|
||||
result = Cartesian3.fromElements(result.y, result.z, result.x, result);
|
||||
var carto = scene.mapProjection.unproject(result, cartoScratch);
|
||||
|
|
@ -757,7 +753,7 @@ function tileIfContainsCartographic(tile, cartographic) {
|
|||
* @param {SceneMode} mode the SceneMode in use
|
||||
* @returns {Number|undefined} The height of the cartographic or undefined if it could not be found.
|
||||
*/
|
||||
Globe.prototype.getHeight = function (cartographic, mode, showDetails) {
|
||||
Globe.prototype.getHeight = function (cartographic, mode) {
|
||||
//>>includeStart('debug', pragmas.debug);
|
||||
if (!defined(cartographic)) {
|
||||
throw new DeveloperError("cartographic is required");
|
||||
|
|
@ -864,8 +860,7 @@ Globe.prototype.getHeight = function (cartographic, mode, showDetails) {
|
|||
mode,
|
||||
undefined,
|
||||
false,
|
||||
scratchGetHeightIntersection,
|
||||
showDetails
|
||||
scratchGetHeightIntersection
|
||||
);
|
||||
if (!defined(intersection)) {
|
||||
return undefined;
|
||||
|
|
|
|||
|
|
@ -129,19 +129,12 @@ GlobeSurfaceTile.prototype.pick = function (
|
|||
mode,
|
||||
projection,
|
||||
cullBackFaces,
|
||||
result,
|
||||
showDetails
|
||||
result
|
||||
) {
|
||||
if (!defined(this.renderedMesh)) {
|
||||
return undefined;
|
||||
}
|
||||
var value = this.renderedMesh.pickRay(
|
||||
ray,
|
||||
cullBackFaces,
|
||||
mode,
|
||||
projection,
|
||||
showDetails
|
||||
);
|
||||
var value = this.renderedMesh.pickRay(ray, cullBackFaces, mode, projection);
|
||||
return Cartesian3.clone(value, result);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1272,11 +1272,7 @@ function createFillMesh(tileProvider, frameState, tile, vertexArraysToDestroy) {
|
|||
westIndicesSouthToNorth,
|
||||
southIndicesEastToWest,
|
||||
eastIndicesNorthToSouth,
|
||||
northIndicesWestToEast,
|
||||
null,
|
||||
tileProvider &&
|
||||
tileProvider.terrainProvider &&
|
||||
tileProvider.terrainProvider._viewer
|
||||
northIndicesWestToEast
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,53 +30,6 @@ var scratchNormal = new Cartesian3();
|
|||
var scratchToENU = new Matrix4();
|
||||
var scratchFromENU = new Matrix4();
|
||||
|
||||
function createTrianglesFromIndices(indices, positions, inverseTransform) {
|
||||
var scratchV0 = new Cartesian3();
|
||||
var scratchV1 = new Cartesian3();
|
||||
var scratchV2 = new Cartesian3();
|
||||
var triangleCount = indices.length / 3;
|
||||
var triangles = [];
|
||||
for (var i = 0; i < triangleCount; i++) {
|
||||
var idx0 = indices[i * 3 + 0];
|
||||
var idx1 = indices[i * 3 + 1];
|
||||
var idx2 = indices[i * 3 + 2];
|
||||
|
||||
var v0Local2 = Matrix4.multiplyByPoint(
|
||||
inverseTransform,
|
||||
positions[idx0],
|
||||
scratchV0
|
||||
);
|
||||
var v1Local2 = Matrix4.multiplyByPoint(
|
||||
inverseTransform,
|
||||
positions[idx1],
|
||||
scratchV1
|
||||
);
|
||||
var v2Local2 = Matrix4.multiplyByPoint(
|
||||
inverseTransform,
|
||||
positions[idx2],
|
||||
scratchV2
|
||||
);
|
||||
|
||||
// Get local space AABBs for triangle
|
||||
var triAabbMinX2 = Math.min(v0Local2.x, v1Local2.x, v2Local2.x);
|
||||
var triAabbMaxX2 = Math.max(v0Local2.x, v1Local2.x, v2Local2.x);
|
||||
var triAabbMinY2 = Math.min(v0Local2.y, v1Local2.y, v2Local2.y);
|
||||
var triAabbMaxY2 = Math.max(v0Local2.y, v1Local2.y, v2Local2.y);
|
||||
var triAabbMinZ2 = Math.min(v0Local2.z, v1Local2.z, v2Local2.z);
|
||||
var triAabbMaxZ2 = Math.max(v0Local2.z, v1Local2.z, v2Local2.z);
|
||||
triangles.push({
|
||||
index: i,
|
||||
aabbMinX: triAabbMinX2,
|
||||
aabbMaxX: triAabbMaxX2,
|
||||
aabbMinY: triAabbMinY2,
|
||||
aabbMaxY: triAabbMaxY2,
|
||||
aabbMinZ: triAabbMinZ2,
|
||||
aabbMaxZ: triAabbMaxZ2,
|
||||
});
|
||||
}
|
||||
return triangles;
|
||||
}
|
||||
|
||||
function createPackedTrianglesFromIndices(indices, positions, invTrans) {
|
||||
var v0 = new Cartesian3();
|
||||
var v1 = new Cartesian3();
|
||||
|
|
@ -270,11 +223,6 @@ function createVerticesFromQuantizedTerrainMesh(
|
|||
var transform = OrientedBoundingBox.toTransformation(orientedBoundingBox);
|
||||
var inverseTransform = Matrix4.inverse(transform, new Matrix4());
|
||||
console.timeEnd("setup stuff");
|
||||
// var triangles = createTrianglesFromIndices(
|
||||
// parameters.indices,
|
||||
// positions,
|
||||
// inverseTransform
|
||||
// );
|
||||
console.time("making packed triangles");
|
||||
var packedTriangles = createPackedTrianglesFromIndices(
|
||||
parameters.indices,
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ describe("Scene/GlobeSurfaceTile", function () {
|
|||
y: 214,
|
||||
});
|
||||
return processor.process([tile]).then(function () {
|
||||
var cullBackFaces = false;
|
||||
var cullBackFaces = true;
|
||||
var pickResult = tile.data.pick(
|
||||
ray,
|
||||
SceneMode.SCENE3D,
|
||||
|
|
|
|||
|
|
@ -131,8 +131,5 @@
|
|||
"prettier": "prettier --write \"**/*\"",
|
||||
"prettier-check": "prettier --check \"**/*\"",
|
||||
"pretty-quick": "pretty-quick"
|
||||
},
|
||||
"dependencies": {
|
||||
"puppeteer": "5.5.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue