-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vector Tiles #4665
Vector Tiles #4665
Changes from 250 commits
ada9029
ba5197d
7f642b8
7e1297d
3171e6f
6f30747
c95c1f0
8420743
f4cd9db
c77406b
01323ba
fb0925c
0991919
d431a69
7021477
26bb104
22ce894
61d410b
d9b6b0d
0504033
cf61acd
a5c1fa9
b34abe3
cd25740
e3d4fc0
0080112
9a883f0
4e6dfca
66857bf
39f5098
11e2124
aeece61
bd776b9
686de4f
c76f9bd
82b7b36
f7e16f4
93dfdd8
adc73da
f5d2cae
fd23df9
5282d5d
a0bb925
ec6db3d
9ef4d23
1205e03
bba1ca7
a7509de
d31b32f
83cc174
ca14796
848eb25
f1fffb6
6f8bc61
dd6e212
e58d0b1
8805c9b
63ada00
07a2557
346ad3e
244c0cf
a3c19c4
2442aec
a379ee0
03d1a23
d209338
b409f7b
5d6bac9
5f2e46d
553affe
c1c54c3
54dd4f5
39f5672
815e648
0a96758
a17690e
5642430
2defc39
b1b8894
5257ff9
899af16
69584f0
3ac6180
7b3dfdc
6e8cb08
1e6ab0c
1dad5f3
4bc35a5
df81a03
eb1adb7
be04782
cb50ce4
8563ced
14072c5
5648f31
411b8fd
855ccd4
6478a76
40d5e4b
099abba
b5c0565
e16d16c
94fa13d
0ada825
27670f5
bcdf661
403aa24
a9529ee
81337ba
f11e6b6
852df0b
09128f9
4887528
6f75de5
bed73b9
3b05f98
7bef19c
688e705
8ef1b97
603184a
312150a
b79093f
2905c24
5602c30
3a1f7bf
7570c4c
6168e8a
0c1a85d
76b177a
a07d28c
ed55b55
9504afb
ceca0f6
38cc1ae
d3726c3
6379416
69fbd0d
cfa3e0e
46439ef
0060e18
68e52d5
5f3e665
4a168a9
13df9bb
7c1bfb8
d83392d
cc89f78
003ae7a
26a3883
d873b70
2319410
360da0a
98a1cdc
adbc8ac
ff38aff
3c3df68
fd8bd82
3f8b9fc
3393c18
89a8ef4
acd3f81
501c683
a76ae75
ce68124
0f80e6c
8b61e48
5877cef
982aed9
0de3ec4
599fda2
8f31344
155c7ea
d78d3d5
fdae6d3
f433975
d17b3ba
73d26af
27972ff
b4f367a
e7ec3be
2b0f52f
f1ab457
33ff56e
7fe3e37
b3993b5
cc7a228
fad8860
a2a1e2f
0d2f1e1
6981a68
e1218d7
9173555
c1ad375
b448116
f15d07f
1f8fb07
9c054da
db85153
124d290
1fe9fc8
8eabdad
67cdf82
15b58e4
0cefab9
3e88765
bc232cd
764267a
00f1792
7cec63d
3ffd232
d377603
eb07e44
ea49b72
12283c4
79ed093
0ab3156
5fdf1ad
772a9c3
9fbc848
612c5f5
618a892
d566de4
045e458
6e57010
15380ef
92709e8
36b2b53
a4c4506
5232f88
029abad
1fa1976
8f389cb
53ed7f2
5f4ed4c
2385d20
7d27a23
6188233
d42f320
b407913
459639a
bf9572d
0f5b30e
5587f89
695a60d
09a8fd2
fe81890
8350f31
3340438
b40c2a9
c379c63
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<!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 sample classification dataset rendered with 3D Tiles."> | ||
<meta name="cesium-sandcastle-labels" content="Showcases, 3D Tiles"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script> | ||
<script type="text/javascript"> | ||
require.config({ | ||
baseUrl : '../../../Source', | ||
waitSeconds : 60 | ||
}); | ||
</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"></div> | ||
<script id="cesium_sandcastle_script"> | ||
function startup(Cesium) { | ||
'use strict'; | ||
//Sandcastle_Begin | ||
var viewer = new Cesium.Viewer('cesiumContainer'); | ||
viewer.scene.globe.depthTestAgainstTerrain = true; | ||
|
||
var classification = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({ | ||
url : '../../../Specs/Data/Cesium3DTiles/Vector/VectorTileCombined/', | ||
classificationType : Cesium.ClassificationType.TERRAIN | ||
})); | ||
|
||
classification.readyPromise.then(function(tileset) { | ||
viewer.camera.setView({ destination : Cesium.Rectangle.fromDegrees(-0.01, -0.01, 0.01, 0.01) }); | ||
|
||
tileset.style = new Cesium.Cesium3DTileStyle({ | ||
color : "rgba(255, 255, 0, 1.0)", | ||
pointColor : "rgba(255, 255, 0, 1.0)", | ||
pointSize : 20.0 | ||
}); | ||
}).otherwise(function(error) { | ||
throw(error); | ||
}); | ||
|
||
var HIGHLIGHT_COLOR = new Cesium.Color(1.0, 1.0, 0.0, 0.4); | ||
var current = { | ||
feature : undefined, | ||
originalColor : new Cesium.Color() | ||
}; | ||
|
||
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); | ||
handler.setInputAction(function(movement) { | ||
var pickedFeature = viewer.scene.pick(movement.endPosition); | ||
|
||
if (Cesium.defined(current.feature) && (current.feature !== pickedFeature)) { | ||
// Restore original color to feature that is no longer selected | ||
|
||
// This assignment is necessary to work with the set property | ||
if (Cesium.defined(current.feature.pointColor)) { | ||
current.feature.pointColor = Cesium.Color.clone(current.originalColor, current.feature.pointColor); | ||
} else { | ||
current.feature.color = Cesium.Color.clone(current.originalColor, current.feature.color); | ||
} | ||
current.feature = undefined; | ||
} | ||
|
||
if (Cesium.defined(pickedFeature) && (pickedFeature !== current.feature)) { | ||
current.feature = pickedFeature; | ||
// Save original color and set to highlight color | ||
if (Cesium.defined(pickedFeature.pointColor)) { | ||
Cesium.Color.clone(pickedFeature.pointColor, current.originalColor); | ||
pickedFeature.pointColor = Cesium.Color.clone(HIGHLIGHT_COLOR, pickedFeature.pointColor); | ||
} else { | ||
Cesium.Color.clone(pickedFeature.color, current.originalColor); | ||
pickedFeature.color = Cesium.Color.clone(HIGHLIGHT_COLOR, pickedFeature.color); | ||
} | ||
} | ||
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); | ||
|
||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -277,5 +277,48 @@ define([ | |
return result; | ||
}; | ||
|
||
function zigZagDecode(value) { | ||
return (value >> 1) ^ (-(value & 1)); | ||
} | ||
|
||
/** | ||
* Decodes delta and ZigZag encoded vertices. This modifies the buffers in place. | ||
* | ||
* @param {Uint16Array} uBuffer The buffer or buffer view of u values. | ||
* @param {Uint16Array} vBuffer The buffer or buffer view of v values. | ||
* @param {Uint16Array} [heightBuffer] The buffer or buffer view of height values. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the description "The buffer or buffer view" imply that |
||
* | ||
* @see {@link http://cesiumjs.org/data-and-assets/terrain/formats/quantized-mesh-1.0.html|quantized-mesh-1.0 terrain format} | ||
*/ | ||
AttributeCompression.zigZagDeltaDecode = function(uBuffer, vBuffer, heightBuffer) { | ||
//>>includeStart('debug', pragmas.debug); | ||
Check.defined('uBuffer', uBuffer); | ||
Check.defined('vBuffer', vBuffer); | ||
Check.typeOf.number.equals('uBuffer.length', 'vBuffer.length', uBuffer.length, vBuffer.length); | ||
if (defined(heightBuffer)) { | ||
Check.typeOf.number.equals('uBuffer.length', 'heightBuffer.length', uBuffer.length, heightBuffer.length); | ||
} | ||
//>>includeEnd('debug'); | ||
|
||
var count = uBuffer.length; | ||
|
||
var u = 0; | ||
var v = 0; | ||
var height = 0; | ||
|
||
for (var i = 0; i < count; ++i) { | ||
u += zigZagDecode(uBuffer[i]); | ||
v += zigZagDecode(vBuffer[i]); | ||
|
||
uBuffer[i] = u; | ||
vBuffer[i] = v; | ||
|
||
if (defined(heightBuffer)) { | ||
height += zigZagDecode(heightBuffer[i]); | ||
heightBuffer[i] = height; | ||
} | ||
} | ||
}; | ||
|
||
return AttributeCompression; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ define([ | |
'./Cartesian2', | ||
'./Cartesian3', | ||
'./Cartographic', | ||
'./Check', | ||
'./defaultValue', | ||
'./defined', | ||
'./DeveloperError', | ||
|
@@ -19,6 +20,7 @@ define([ | |
Cartesian2, | ||
Cartesian3, | ||
Cartographic, | ||
Check, | ||
defaultValue, | ||
defined, | ||
DeveloperError, | ||
|
@@ -69,6 +71,59 @@ define([ | |
this.halfAxes = Matrix3.clone(defaultValue(halfAxes, Matrix3.ZERO)); | ||
} | ||
|
||
/** | ||
* The number of elements used to pack the object into an array. | ||
* @type {Number} | ||
*/ | ||
OrientedBoundingBox.packedLength = Cartesian3.packedLength + Matrix3.packedLength; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Were these added to CHANGES.md? |
||
|
||
/** | ||
* Stores the provided instance into the provided array. | ||
* | ||
* @param {OrientedBoundingBox} value The value to pack. | ||
* @param {Number[]} array The array to pack into. | ||
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements. | ||
* | ||
* @returns {Number[]} The array that was packed into | ||
*/ | ||
OrientedBoundingBox.pack = function(value, array, startingIndex) { | ||
//>>includeStart('debug', pragmas.debug); | ||
Check.typeOf.object('value', value); | ||
Check.defined('array', array); | ||
//>>includeEnd('debug'); | ||
|
||
startingIndex = defaultValue(startingIndex, 0); | ||
|
||
Cartesian3.pack(value.center, array, startingIndex); | ||
Matrix3.pack(value.halfAxes, array, startingIndex + Cartesian3.packedLength); | ||
|
||
return array; | ||
}; | ||
|
||
/** | ||
* Retrieves an instance from a packed array. | ||
* | ||
* @param {Number[]} array The packed array. | ||
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked. | ||
* @param {OrientedBoundingBox} [result] The object into which to store the result. | ||
* @returns {OrientedBoundingBox} The modified result parameter or a new OrientedBoundingBox instance if one was not provided. | ||
*/ | ||
OrientedBoundingBox.unpack = function(array, startingIndex, result) { | ||
//>>includeStart('debug', pragmas.debug); | ||
Check.defined('array', array); | ||
//>>includeEnd('debug'); | ||
|
||
startingIndex = defaultValue(startingIndex, 0); | ||
|
||
if (!defined(result)) { | ||
result = new OrientedBoundingBox(); | ||
} | ||
|
||
Cartesian3.unpack(array, startingIndex, result.center); | ||
Matrix3.unpack(array, startingIndex + Cartesian3.packedLength, result.halfAxes); | ||
return result; | ||
}; | ||
|
||
var scratchCartesian1 = new Cartesian3(); | ||
var scratchCartesian2 = new Cartesian3(); | ||
var scratchCartesian3 = new Cartesian3(); | ||
|
@@ -86,7 +141,7 @@ define([ | |
* This is an implementation of Stefan Gottschalk's Collision Queries using Oriented Bounding Boxes solution (PHD thesis). | ||
* Reference: http://gamma.cs.unc.edu/users/gottschalk/main.pdf | ||
* | ||
* @param {Cartesian3[]} positions List of {@link Cartesian3} points that the bounding box will enclose. | ||
* @param {Cartesian3[]} [positions] List of {@link Cartesian3} points that the bounding box will enclose. | ||
* @param {OrientedBoundingBox} [result] The object onto which to store the result. | ||
* @returns {OrientedBoundingBox} The modified result parameter or a new OrientedBoundingBox instance if one was not provided. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
define([ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are no tests for this file. |
||
'./Check', | ||
'./defaultValue', | ||
'./defined', | ||
'./FeatureDetection' | ||
], function( | ||
Check, | ||
defaultValue, | ||
defined, | ||
FeatureDetection) { | ||
'use strict'; | ||
|
||
var typedArrayTypes; | ||
|
||
if (FeatureDetection.supportsTypedArrays()) { | ||
typedArrayTypes = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array]; | ||
} | ||
|
||
/** | ||
* Create a shallow copy of an array from begin to end. | ||
* | ||
* @param {Array} array The array to fill. | ||
* @param {Number} [begin=0] The index to start at. | ||
* @param {Number} [end=array.length] The index to end at. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the ending index or ending index + 1? Either the documented default value or text is wrong. |
||
* | ||
* @returns {Array} The resulting array. | ||
* @private | ||
*/ | ||
function arraySlice(array, begin, end) { | ||
//>>includeStart('debug', pragmas.debug); | ||
Check.defined('array', array); | ||
if (defined(begin)) { | ||
Check.typeOf.number('begin', begin); | ||
} | ||
if (defined(end)) { | ||
Check.typeOf.number('end', end); | ||
} | ||
//>>includeEnd('debug'); | ||
|
||
if (typeof array.slice === 'function') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't this be done at load time instead of each time the function is called? Or is this done here so that the developer errors can be checked? Could also still set a function variable at load time and call it here. |
||
return array.slice(begin, end); | ||
} | ||
|
||
var copy = Array.prototype.slice.call(array, begin, end); | ||
if (FeatureDetection.supportsTypedArrays()) { | ||
var length = typedArrayTypes.length; | ||
for (var i = 0; i < length; ++i) { | ||
if (array instanceof typedArrayTypes[i]) { | ||
copy = new typedArrayTypes[i](copy); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
return copy; | ||
} | ||
|
||
return arraySlice; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see anything for this demo. The tests are also failing so maybe it has to do with something on my system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a screenshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I ran this on another computer.
A couple things: