Skip to content
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

Polylines and textured ground primitives on 3D Tiles #7456

Merged
merged 47 commits into from
Jan 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
06f133b
Set 3D Tiles stencil bit
lilleyse Dec 14, 2018
00e2d6a
Update ground primitive and classification primitive
lilleyse Dec 16, 2018
8171326
Fix vector tile wireframe
lilleyse Dec 17, 2018
056fa6c
Tests for Batched3DModel3DTileContentClassificationSpec
lilleyse Dec 17, 2018
3e8b578
Tests for ClassificationModelSpec
lilleyse Dec 17, 2018
4a2b0f4
Merge branch 'master' into stencil-tricks
lilleyse Dec 17, 2018
effcecd
ClassificationPrimitive and GlobePrimitive tests
lilleyse Dec 18, 2018
88b06bc
Cleanup Batch3dModel3DTileContentClassificationSpec
lilleyse Dec 19, 2018
34e66f9
Cleanup ClassificationModelSpec.js
lilleyse Dec 19, 2018
2a2cef0
Fix Geometry3DTileContent tests
lilleyse Dec 19, 2018
8163a79
Fix Vector3DTileContent tests
lilleyse Dec 19, 2018
99beaaa
Fixed Vector3DTileGeometry tests
lilleyse Dec 19, 2018
07e4093
Change default classification type of Vector3DTileGeoemtry and Vector…
lilleyse Dec 19, 2018
3f6ae77
Added tests for Vector3DTilePolygons
lilleyse Dec 19, 2018
e3a297c
Test cleanup
lilleyse Dec 19, 2018
33db32a
Updated CHANGES.md
lilleyse Dec 19, 2018
3dabb5c
Merge pull request #7422 from AnalyticalGraphicsInc/stencil-tricks
bagnell Dec 19, 2018
e610bef
Temp
lilleyse Dec 20, 2018
bb1e49c
Update GlobeDepth after 3D Tiles pass
lilleyse Dec 20, 2018
dd45faa
Support ground primitive batches for all classification types
lilleyse Dec 20, 2018
6a50bbc
Update Classification Types demo
lilleyse Dec 20, 2018
eeea2be
Change classification defaults to BOTH everywhere
lilleyse Dec 20, 2018
572102f
Fix tests
lilleyse Dec 20, 2018
adf2881
Optimization to not update depth or render CESUM_3D_TILE classificati…
lilleyse Dec 20, 2018
42cc67c
Doc updates
lilleyse Dec 20, 2018
c17cf47
Update CHANGES.md
lilleyse Dec 20, 2018
cea11ca
Fix for first frame after depthTestAgainstTerrain is disabled
lilleyse Dec 21, 2018
5e458c8
GroundPolylinePrimitive on 3D Tiles
lilleyse Dec 21, 2018
b1e01ef
Add support in entity layer
lilleyse Dec 22, 2018
3522388
Add ground polyline to clamp to 3D Tiles demo
lilleyse Dec 22, 2018
2d7f4e0
Doc fixes
lilleyse Dec 22, 2018
23a16ce
Fix 2D/CV
lilleyse Dec 22, 2018
8e94c7c
Update CHANGES.md
lilleyse Dec 22, 2018
65821fe
Fix CI
lilleyse Dec 22, 2018
8453779
Move depth update command after invert clsasification
lilleyse Jan 2, 2019
5e3a0cf
Merge branch 'polylines-3d-tiles' into polylines-on-3d-tiles
lilleyse Jan 2, 2019
9e7f30a
Move breaking changes section to the top
lilleyse Jan 2, 2019
c1000bf
Merge pull request #7434 from AnalyticalGraphicsInc/polylines-3d-tiles
bagnell Jan 2, 2019
29f5d93
Merge branch 'classification-fixes' into polylines-on-3d-tiles
lilleyse Jan 2, 2019
13b8285
Smaller polylines to speed up tests
lilleyse Jan 2, 2019
56b63d1
Wrap pollToPromise blocks
lilleyse Jan 2, 2019
2616eee
Remove unneeded shader checks
lilleyse Jan 2, 2019
3729e70
Update Sandcastle demo
lilleyse Jan 2, 2019
29e9146
Merge pull request #7437 from AnalyticalGraphicsInc/polylines-on-3d-t…
bagnell Jan 2, 2019
469ca01
Merge branch 'master' into classification-fixes
lilleyse Jan 3, 2019
4796014
Merge branch 'master' into classification-fixes
lilleyse Jan 3, 2019
290b531
Fix test
lilleyse Jan 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Apps/SampleData/ClampToGround.czml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,33 @@
0.7686388857813198
]
}
},
{
"id": "Polyline",
"polyline": {
"positions": {
"cartesian": [
1216348.1632364073,
-4736348.958775471,
4081284.5528982095,
1216369.1229444197,
-4736377.467107148,
4081240.888485707
]
},
"material": {
"polylineOutline": {
"color": {
"rgba": [255, 255, 0, 255]
},
"outlineColor": {
"rgba": [0, 0, 0, 255]
},
"outlineWidth": 2
}
},
"width": 10,
"clampToGround": true
}
}
]
Binary file modified Apps/Sandcastle/gallery/Clamp to 3D Tiles.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 48 additions & 7 deletions Apps/Sandcastle/gallery/Classification Types.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: Cesium.createWorldTerrain()
});
viewer.scene.globe.depthTestAgainstTerrain = false;

var tileset = new Cesium.Cesium3DTileset({ url: Cesium.IonResource.fromAssetId(6074) });
viewer.scene.primitives.add(tileset);
Expand All @@ -41,31 +40,73 @@
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
});

var entity = viewer.entities.add({
var polygon = viewer.entities.add({
polygon : {
hierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromRadiansArray([-1.3194369277314022, 0.6988062530900625, -1.3193955980204217, 0.6988091578771254, -1.3193931220959367, 0.698743632490865, -1.3194358224045408, 0.6987471965556998])),
material : Cesium.Color.RED.withAlpha(0.5),
classificationType : Cesium.ClassificationType.BOTH
}
});

var options = [{
var polyline = viewer.entities.add({
polyline : {
positions : Cesium.Cartesian3.fromDegreesArray([
-75.60217330403601, 40.04102882709425,
-75.59968252414251, 40.04093615560871,
-75.59802015382800, 40.04079437042357,
-75.59674934074435, 40.040816173283304,
-75.59630042791713, 40.03986900370842,
-75.59563636849978, 40.03930996506271,
-75.59492397899098, 40.03873932846581,
-75.59457991226778, 40.038392701955786,
-75.59424838652453, 40.03775403572295,
-75.59387104290336, 40.03677022167725,
-75.59355000490342, 40.03588760913535
]),
width : 8,
material : new Cesium.PolylineOutlineMaterialProperty({
color : Cesium.Color.YELLOW,
outlineWidth : 2,
outlineColor : Cesium.Color.BLACK
}),
clampToGround : true
}
});

var classificationOptions = [{
text : 'Classify Both',
onselect : function() {
entity.polygon.classificationType = Cesium.ClassificationType.BOTH;
polygon.polygon.classificationType = Cesium.ClassificationType.BOTH;
polyline.polyline.classificationType = Cesium.ClassificationType.BOTH;
}
}, {
text : 'Classify Terrain',
onselect : function() {
entity.polygon.classificationType = Cesium.ClassificationType.TERRAIN;
polygon.polygon.classificationType = Cesium.ClassificationType.TERRAIN;
polyline.polyline.classificationType = Cesium.ClassificationType.TERRAIN;
}
}, {
text : 'Classify 3D Tiles',
onselect : function() {
entity.polygon.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
polygon.polygon.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
polyline.polyline.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
}
}];
Sandcastle.addToolbarMenu(options);

var materialOptions = [{
text : 'Red Material',
onselect : function() {
polygon.polygon.material = Cesium.Color.RED.withAlpha(0.5);
}
}, {
text : 'Textured Material',
onselect : function() {
polygon.polygon.material = '../images/Cesium_Logo_Color.jpg';
}
}];

Sandcastle.addToolbarMenu(classificationOptions);
Sandcastle.addToolbarMenu(materialOptions);
//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,22 @@ Change Log

### 1.54 - 2019-02-01

##### Breaking Changes :mega:
* Billboards with `HeightReference.CLAMP_TO_GROUND` are now clamped to both terrain and 3D Tiles. [#7434](https://github.com/AnalyticalGraphicsInc/cesium/pull/7434)
* The default `classificationType` for `GroundPrimitive`, `CorridorGraphics`, `EllipseGraphics`, `PolygonGraphics` and `RectangleGraphics` is now `ClassificationType.BOTH`. [#7434](https://github.com/AnalyticalGraphicsInc/cesium/pull/7434)

##### Deprecated :hourglass_flowing_sand:
* `Scene.clampToHeight` now takes an optional `width` argument before the `result` argument. The previous function definition will no longer work in 1.56. [#7287](https://github.com/AnalyticalGraphicsInc/cesium/pull/7287)

##### Additions :tada:
* Added support for textured ground entities (entities with unspecified `height`) and `GroundPrimitives` on 3D Tiles. [#7434](https://github.com/AnalyticalGraphicsInc/cesium/pull/7434)
* Added support for polylines on 3D Tiles. [#7437](https://github.com/AnalyticalGraphicsInc/cesium/pull/7437)
* Added `classificationType` property to `PolylineGraphics` and `GroundPolylinePrimitive` which specifies whether a polyline clamped to ground should be clamped to terrain, 3D Tiles, or both. [#7437](https://github.com/AnalyticalGraphicsInc/cesium/pull/7437)
* Added the ability to specify the width of the intersection volume for `Scene.sampleHeight`, `Scene.clampToHeight`, `Scene.sampleHeightMostDetailed`, and `Scene.clampToHeightMostDetailed`. [#7287](https://github.com/AnalyticalGraphicsInc/cesium/pull/7287)

##### Fixes :wrench:
* Fixed an issue where classification primitives with the `CESIUM_3D_TILE` classification type would render on terrain. [#7422](https://github.com/AnalyticalGraphicsInc/cesium/pull/7422)
* Fixed an issue where 3D Tiles would show through the globe. [#7422](https://github.com/AnalyticalGraphicsInc/cesium/pull/7422)
* Fixed crash when entity geometry show value is an interval that only covered part of the entity availability range [#7458](https://github.com/AnalyticalGraphicsInc/cesium/pull/7458)
* Fixed image size issue when using multiple particle systems [#7412](https://github.com/AnalyticalGraphicsInc/cesium/pull/7412)

Expand Down
6 changes: 3 additions & 3 deletions Source/Core/GroundPolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ define([
var WALL_INITIAL_MAX_HEIGHT = 1000.0;

/**
* A description of a polyline on terrain. Only to be used with {@link GroundPolylinePrimitive}.
* A description of a polyline on terrain or 3D Tiles. Only to be used with {@link GroundPolylinePrimitive}.
*
* @alias GroundPolylineGeometry
* @constructor
Expand Down Expand Up @@ -159,7 +159,7 @@ define([
* Set the GroundPolylineGeometry's projection and ellipsoid.
* Used by GroundPolylinePrimitive to signal scene information to the geometry for generating 2D attributes.
*
* @param {GroundPolylineGeometry} groundPolylineGeometry GroundPolylinGeometry describing a polyline on terrain.
* @param {GroundPolylineGeometry} groundPolylineGeometry GroundPolylinGeometry describing a polyline on terrain or 3D Tiles.
* @param {Projection} mapProjection A MapProjection used for projecting cartographic coordinates to 2D.
* @private
*/
Expand Down Expand Up @@ -386,7 +386,7 @@ define([
var intersectionScratch = new Cartesian3();
/**
* Computes shadow volumes for the ground polyline, consisting of its vertices, indices, and a bounding sphere.
* Vertices are "fat," packing all the data needed in each volume to describe a line on terrain.
* Vertices are "fat," packing all the data needed in each volume to describe a line on terrain or 3D Tiles.
* Should not be called independent of {@link GroundPolylinePrimitive}.
*
* @param {GroundPolylineGeometry} groundPolylineGeometry
Expand Down
3 changes: 2 additions & 1 deletion Source/DataSources/CorridorGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ define([
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from each light source.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed.
* @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground.
* @param {ConstantProperty} [options.zIndex] A Property specifying the zIndex of the corridor, used for ordering. Only has an effect if height and extrudedHeight are undefined, and if the corridor is static.
*
* @see Entity
Expand Down Expand Up @@ -232,7 +233,7 @@ define([
* Gets or sets the {@link ClassificationType} Property specifying whether this corridor will classify terrain, 3D Tiles, or both when on the ground.
* @memberof CorridorGraphics.prototype
* @type {Property}
* @default ClassificationType.TERRAIN
* @default ClassificationType.BOTH
*/
classificationType : createPropertyDescriptor('classificationType'),

Expand Down
3 changes: 2 additions & 1 deletion Source/DataSources/EllipseGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ define([
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between points on the ellipse.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the ellipse casts or receives shadows from each light source.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this ellipse will be displayed.
* @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this ellipse will classify terrain, 3D Tiles, or both when on the ground.
* @param {ConstantProperty} [options.zIndex=0] A property specifying the zIndex of the Ellipse. Used for ordering ground geometry. Only has an effect if the ellipse is constant and neither height or exturdedHeight are specified.
*
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Circles and Ellipses.html|Cesium Sandcastle Circles and Ellipses Demo}
Expand Down Expand Up @@ -254,7 +255,7 @@ define([
* Gets or sets the {@link ClassificationType} Property specifying whether this ellipse will classify terrain, 3D Tiles, or both when on the ground.
* @memberof EllipseGraphics.prototype
* @type {Property}
* @default ClassificationType.TERRAIN
* @default ClassificationType.BOTH
*/
classificationType : createPropertyDescriptor('classificationType'),

Expand Down
6 changes: 3 additions & 3 deletions Source/DataSources/Entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ define([
};

/**
* Checks if the given Scene supports materials besides Color on Entities draped on terrain.
* Checks if the given Scene supports materials besides Color on Entities draped on terrain or 3D Tiles.
* If this feature is not supported, Entities with non-color materials but no `height` will
* instead be rendered as if height is 0.
*
Expand All @@ -676,12 +676,12 @@ define([
};

/**
* Checks if the given Scene supports polylines clamped to the ground..
* Checks if the given Scene supports polylines clamped to terrain or 3D Tiles.
* If this feature is not supported, Entities with PolylineGraphics will be rendered with vertices at
* the provided heights and using the `followSurface` parameter instead of clamped to the ground.
*
* @param {Scene} scene The current scene.
* @returns {Boolean} Whether or not the current scene supports Polylines on Terrain.
* @returns {Boolean} Whether or not the current scene supports polylines on terrain or 3D TIles.
*/
Entity.supportsPolylinesOnTerrain = function(scene) {
return GroundPolylinePrimitive.isSupported(scene);
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/GeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define([
var defaultOutlineColor = new ConstantProperty(Color.BLACK);
var defaultShadows = new ConstantProperty(ShadowMode.DISABLED);
var defaultDistanceDisplayCondition = new ConstantProperty(new DistanceDisplayCondition());
var defaultClassificationType = new ConstantProperty(ClassificationType.TERRAIN);
var defaultClassificationType = new ConstantProperty(ClassificationType.BOTH);

/**
* An abstract class for updating geometry entites.
Expand Down
18 changes: 5 additions & 13 deletions Source/DataSources/GeometryVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,27 +173,22 @@ define([
var groundColorBatches = new Array(numberOfClassificationTypes);
var groundMaterialBatches = [];
if (supportsMaterialsforEntitiesOnTerrain) {
// Culling, phong shading only supported for ClassificationType.TERRAIN at the moment because
// tileset depth information not yet available.
groundColorBatches[ClassificationType.TERRAIN] = new StaticGroundGeometryPerMaterialBatch(groundPrimitives, PerInstanceColorAppearance);
for (i = 0; i < numberOfClassificationTypes; ++i) {
if (i !== ClassificationType.TERRAIN) {
groundColorBatches[i] = new StaticGroundGeometryColorBatch(groundPrimitives, i);
}
groundMaterialBatches.push(new StaticGroundGeometryPerMaterialBatch(groundPrimitives, i, MaterialAppearance));
groundColorBatches[i] = new StaticGroundGeometryPerMaterialBatch(groundPrimitives, i, PerInstanceColorAppearance);
}
groundMaterialBatches[0] = new StaticGroundGeometryPerMaterialBatch(groundPrimitives, MaterialAppearance);
this._groundTerrainMaterialBatch = groundMaterialBatches[0];
} else {
for (i = 0; i < numberOfClassificationTypes; ++i) {
groundColorBatches[i] = new StaticGroundGeometryColorBatch(groundPrimitives, i);
}
}

this._groundColorBatches = groundColorBatches;
this._groundMaterialBatches = groundMaterialBatches;

this._dynamicBatch = new DynamicGeometryBatch(primitives, groundPrimitives);

this._batches = this._outlineBatches.concat(this._closedColorBatches, this._closedMaterialBatches, this._openColorBatches, this._openMaterialBatches, this._groundColorBatches, groundMaterialBatches, this._dynamicBatch);
this._batches = this._outlineBatches.concat(this._closedColorBatches, this._closedMaterialBatches, this._openColorBatches, this._openMaterialBatches, this._groundColorBatches, this._groundMaterialBatches, this._dynamicBatch);

this._subscriptions = new AssociativeArray();
this._updaterSets = new AssociativeArray();
Expand Down Expand Up @@ -414,10 +409,7 @@ define([
this._groundColorBatches[classificationType].add(time, updater);
} else {
// If unsupported, updater will not be on terrain.
// If the updater has a material, ignore input ClassificationType for now and only classify terrain.
// Culling, phong shading only supported for ClassificationType.TERRAIN at the moment because
// tileset depth information not yet available.
this._groundTerrainMaterialBatch.add(time, updater);
this._groundMaterialBatches[classificationType].add(time, updater);
}
} else if (updater.isClosed) {
if (updater.fillMaterialProperty instanceof ColorMaterialProperty) {
Expand Down
70 changes: 35 additions & 35 deletions Source/DataSources/GroundGeometryUpdater.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
define([
'../Core/ApproximateTerrainHeights',
'../Core/Cartesian3',
'../Core/Check',
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/GeometryOffsetAttribute',
'../Core/Iso8601',
'../Core/oneTimeWarning',
'../Scene/GroundPrimitive',
'../Scene/HeightReference',
'./CallbackProperty',
'./ConstantProperty',
'./GeometryUpdater',
'./Property',
'./TerrainOffsetProperty'
], function(
ApproximateTerrainHeights,
Cartesian3,
Check,
defaultValue,
defined,
defineProperties,
DeveloperError,
GeometryOffsetAttribute,
Iso8601,
oneTimeWarning,
GroundPrimitive,
HeightReference,
CallbackProperty,
ConstantProperty,
GeometryUpdater,
Property,
TerrainOffsetProperty) {
'../Core/ApproximateTerrainHeights',
'../Core/Cartesian3',
'../Core/Check',
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/GeometryOffsetAttribute',
'../Core/Iso8601',
'../Core/oneTimeWarning',
'../Scene/GroundPrimitive',
'../Scene/HeightReference',
'./CallbackProperty',
'./ConstantProperty',
'./GeometryUpdater',
'./Property',
'./TerrainOffsetProperty'
], function(
ApproximateTerrainHeights,
Cartesian3,
Check,
defaultValue,
defined,
defineProperties,
DeveloperError,
GeometryOffsetAttribute,
Iso8601,
oneTimeWarning,
GroundPrimitive,
HeightReference,
CallbackProperty,
ConstantProperty,
GeometryUpdater,
Property,
TerrainOffsetProperty) {
'use strict';

var defaultZIndex = new ConstantProperty(0);
Expand Down
3 changes: 2 additions & 1 deletion Source/DataSources/PolygonGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ define([
* @param {Boolean} [options.closeBottom=true] When false, leaves off the bottom of an extruded polygon open.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the polygon casts or receives shadows from each light source.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this polygon will be displayed.
* @param {Property} [options.classificationType=ClassificationType.BOTH] An enum Property specifying whether this polygon will classify terrain, 3D Tiles, or both when on the ground.
* @param {ConstantProperty} [options.zIndex=0] A property specifying the zIndex used for ordering ground geometry. Only has an effect if the polygon is constant and neither height or extrudedHeight are specified.
*
* @see Entity
Expand Down Expand Up @@ -255,7 +256,7 @@ define([
* Gets or sets the {@link ClassificationType} Property specifying whether this polygon will classify terrain, 3D Tiles, or both when on the ground.
* @memberof PolygonGraphics.prototype
* @type {Property}
* @default ClassificationType.TERRAIN
* @default ClassificationType.BOTH
*/
classificationType : createPropertyDescriptor('classificationType'),

Expand Down
Loading