Skip to content

Commit f6154ca

Browse files
author
Joshua Bernstein
authored
Merge branch 'master' into 5819_fix_for_empty_icon_tag
2 parents df09819 + d568775 commit f6154ca

24 files changed

+1148
-205
lines changed

Apps/Sandcastle/gallery/Classification.html

+169-130
Large diffs are not rendered by default.

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ Change Log
22
==========
33
### 1.39 - 2017-11-01
44

5+
* Added function that inserts missing namespace declarations into KML files. [#5860](https://github.com/AnalyticalGraphicsInc/cesium/pull/5860)
56
* Added support for the layer.json `parentUrl` property in `CesiumTerrainProvider` to allow for compositing of tilesets.
7+
* Fixed a bug that caused KML ground overlays to appear distorted when rotation was applied. [#5914](https://github.com/AnalyticalGraphicsInc/cesium/issues/5914)
8+
* Adds `invertClassification` and `invertClassificationColor` to `Scene`. When `invertClassification` is `true`, any 3D Tiles geometry that is not classified by a `ClassificationPrimitive` or `GroundPrimitive` will have its color multiplied by `invertClassificationColor`. [#5836](https://github.com/AnalyticalGraphicsInc/cesium/pull/5836)
69
* Fixed bug with placemarks in imported KML: placemarks with no specified icon would be displayed with default icon. [#5819](https://github.com/AnalyticalGraphicsInc/cesium/issues/5819)
710

811
### 1.38 - 2017-10-02

CONTRIBUTORS.md

+2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
9494
* [Florent Cayré](https://github.com/fcayre/)
9595
* [Novetta](http://www.novetta.com/)
9696
* [Joshua Bernstein](https://github.com/jbernstein/)
97+
* [Natanael Rivera](https://github.com/nrivera-Novetta/)
98+
* [Justin Burr](https://github.com/jburr-nc/)
9799

98100
## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt)
99101
* [Victor Berchet](https://github.com/vicb)

Source/DataSources/KmlDataSource.js

+33-1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,33 @@ define([
255255
return deferred.promise;
256256
}
257257

258+
function insertNamespaces(text) {
259+
var namespaceMap = {
260+
xsi : 'http://www.w3.org/2001/XMLSchema-instance'
261+
};
262+
var firstPart, lastPart, reg, declaration;
263+
264+
for (var key in namespaceMap) {
265+
if (namespaceMap.hasOwnProperty(key)) {
266+
reg = RegExp('[< ]' + key + ':');
267+
declaration = 'xmlns:' + key + '=';
268+
if (reg.test(text) && text.indexOf(declaration) === -1) {
269+
if (!defined(firstPart)) {
270+
firstPart = text.substr(0, text.indexOf('<kml') + 4);
271+
lastPart = text.substr(firstPart.length);
272+
}
273+
firstPart += ' ' + declaration + '"' + namespaceMap[key] + '"';
274+
}
275+
}
276+
}
277+
278+
if (defined(firstPart)) {
279+
text = firstPart + lastPart;
280+
}
281+
282+
return text;
283+
}
284+
258285
function loadXmlFromZip(reader, entry, uriResolver, deferred) {
259286
entry.getData(new zip.TextWriter(), function(text) {
260287
uriResolver.kml = parser.parseFromString(text, 'application/xml');
@@ -1842,7 +1869,9 @@ define([
18421869

18431870
var rotation = queryNumericValue(latLonBox, 'rotation', namespaces.kml);
18441871
if (defined(rotation)) {
1845-
geometry.rotation = CesiumMath.toRadians(rotation);
1872+
var rotationRadians = CesiumMath.toRadians(rotation);
1873+
geometry.rotation = rotationRadians;
1874+
geometry.stRotation = rotationRadians;
18461875
}
18471876
}
18481877
}
@@ -2322,6 +2351,9 @@ define([
23222351
//There's no official way to validate if a parse was successful.
23232352
//The following check detects the error on various browsers.
23242353

2354+
//Insert missing namespaces
2355+
text = insertNamespaces(text);
2356+
23252357
//IE raises an exception
23262358
var kml;
23272359
var error;

Source/Renderer/AutomaticUniforms.js

+14
Original file line numberDiff line numberDiff line change
@@ -1588,6 +1588,20 @@ define([
15881588
getValue : function(uniformState) {
15891589
return uniformState.minimumDisableDepthTestDistance;
15901590
}
1591+
}),
1592+
1593+
/**
1594+
* An automatic GLSL uniform that will be the highlight color of unclassified 3D Tiles.
1595+
*
1596+
* @alias czm_invertClassificationColor
1597+
* @glslUniform
1598+
*/
1599+
czm_invertClassificationColor : new AutomaticUniform({
1600+
size : 1,
1601+
datatype : WebGLConstants.FLOAT_VEC4,
1602+
getValue : function(uniformState) {
1603+
return uniformState.invertClassificationColor;
1604+
}
15911605
})
15921606
};
15931607

Source/Renderer/Pass.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ define([
2323
TERRAIN_CLASSIFICATION : 3,
2424
CESIUM_3D_TILE : 4,
2525
CESIUM_3D_TILE_CLASSIFICATION : 5,
26-
OPAQUE : 6,
27-
TRANSLUCENT : 7,
28-
OVERLAY : 8,
29-
NUMBER_OF_PASSES : 9
26+
CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW : 6,
27+
OPAQUE : 7,
28+
TRANSLUCENT : 8,
29+
OVERLAY : 9,
30+
NUMBER_OF_PASSES : 10
3031
};
3132

3233
return freezeObject(Pass);

Source/Renderer/UniformState.js

+16
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ define([
159159

160160
this._fogDensity = undefined;
161161

162+
this._invertClassificationColor = undefined;
163+
162164
this._imagerySplitPosition = 0.0;
163165
this._pixelSizePerMeter = undefined;
164166
this._geometricToleranceOverMeter = undefined;
@@ -847,6 +849,18 @@ define([
847849
get : function() {
848850
return this._minimumDisableDepthTestDistance;
849851
}
852+
},
853+
854+
/**
855+
* The highlight color of unclassified 3D Tiles.
856+
*
857+
* @memberof UniformState.prototype
858+
* @type {Color}
859+
*/
860+
invertClassificationColor : {
861+
get : function() {
862+
return this._invertClassificationColor;
863+
}
850864
}
851865
});
852866

@@ -1012,6 +1026,8 @@ define([
10121026

10131027
this._fogDensity = frameState.fog.density;
10141028

1029+
this._invertClassificationColor = frameState.invertClassificationColor;
1030+
10151031
this._frameState = frameState;
10161032
this._temeToPseudoFixed = Transforms.computeTemeToPseudoFixedMatrix(frameState.time, this._temeToPseudoFixed);
10171033

Source/Scene/Cesium3DTileBatchTable.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,12 @@ define([
13421342
// selection depth to the stencil buffer to prevent ancestor tiles from drawing on top
13431343
derivedCommand = DrawCommand.shallowClone(command);
13441344
var rs = clone(derivedCommand.renderState, true);
1345+
// Stencil test is masked to the most significant 4 bits so the reference is shifted.
1346+
// This is to prevent clearing the stencil before classification which needs the least significant
1347+
// bits for increment/decrement operations.
13451348
rs.stencilTest.enabled = true;
1346-
rs.stencilTest.reference = reference;
1349+
rs.stencilTest.mask = 0xF0;
1350+
rs.stencilTest.reference = reference << 4;
13471351
rs.stencilTest.frontFunction = StencilFunction.GREATER_OR_EQUAL;
13481352
rs.stencilTest.frontOperation.zPass = StencilOperation.REPLACE;
13491353
derivedCommand.renderState = RenderState.fromCache(rs);

Source/Scene/Cesium3DTileset.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ define([
14951495
var addedCommandsLength = (lengthAfterUpdate - lengthBeforeUpdate);
14961496
var backfaceCommandsLength = backfaceCommands.length;
14971497

1498-
commandList.length += backfaceCommands.length;
1498+
commandList.length += backfaceCommandsLength;
14991499

15001500
// copy commands to the back of the commandList
15011501
for (i = addedCommandsLength - 1; i >= 0; --i) {

Source/Scene/Cesium3DTilesetTraversal.js

+3
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ define([
167167
* NOTE: this will no longer work when there is a chain of selected tiles that is longer than the size of the
168168
* stencil buffer (usually 8 bits). In other words, the subset of the tree containing only selected tiles must be
169169
* no deeper than 255. It is very, very unlikely this will cause a problem.
170+
*
171+
* NOTE: when the scene has inverted classification enabled, the stencil buffer will be masked to 4 bits. So, the
172+
* selected tiles must be no deeper than 15. This is still very unlikely.
170173
*/
171174
function traverseAndSelect(tileset, root, frameState) {
172175
var stack = scratchStack;

0 commit comments

Comments
 (0)