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

Ground primitives and textured entities on 3D Tiles #7434

Merged
merged 12 commits into from
Jan 2, 2019
18 changes: 16 additions & 2 deletions Apps/Sandcastle/gallery/Classification Types.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
}
});

var options = [{
var classificationOptions = [{
text : 'Classify Both',
onselect : function() {
entity.polygon.classificationType = Cesium.ClassificationType.BOTH;
Expand All @@ -64,7 +64,21 @@
entity.polygon.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
}
}];
Sandcastle.addToolbarMenu(options);

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

Sandcastle.addToolbarMenu(classificationOptions);
Sandcastle.addToolbarMenu(materialOptions);
//Sandcastle_End
Sandcastle.finishedLoading();
}
Expand Down
14 changes: 11 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
Change Log
==========

### 1.45 - 2019-02-01
### 1.54 - 2019-02-01

##### Breaking Changes :mega:
* Billboards with `HeightReference.CLAMP_TO_GROUND` are now clamped to both terrain and 3D Tiles.
* The default `classificationType` for `GroundPrimitive`, `CorridorGraphics`, `EllipseGraphics`, `PolygonGraphics` and `RectangleGraphics` is now `ClassificationType.BOTH`.

##### Additions :tada:

* Added support for textured ground entities (entities with unspecified `height`) and `GroundPrimitives` on 3D Tiles.

##### Fixes :wrench:
* Fixed an issue where classification primitives with the `CESIUM_3D_TILE` classification type would render on terrain. [#6568](https://github.com/AnalyticalGraphicsInc/cesium/issues/6568)
* Fixed an issue where 3D Tiles would show through the globe. [#6867](https://github.com/AnalyticalGraphicsInc/cesium/issues/6867)
* Fixed an issue where classification primitives with the `CESIUM_3D_TILE` classification type would render on terrain.
* Fixed an issue where 3D Tiles would show through the globe.

### 1.53 - 2019-01-02

Expand Down
2 changes: 1 addition & 1 deletion 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 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
10 changes: 6 additions & 4 deletions Source/DataSources/StaticGroundGeometryPerMaterialBatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ define([
var defaultDistanceDisplayCondition = new DistanceDisplayCondition();

// Encapsulates a Primitive and all the entities that it represents.
function Batch(primitives, appearanceType, materialProperty, usingSphericalTextureCoordinates, zIndex) {
function Batch(primitives, classificationType, appearanceType, materialProperty, usingSphericalTextureCoordinates, zIndex) {
this.primitives = primitives; // scene level primitive collection
this.classificationType = classificationType;
this.appearanceType = appearanceType;
this.materialProperty = materialProperty;
this.updaters = new AssociativeArray();
Expand Down Expand Up @@ -142,7 +143,7 @@ define([
material : this.material
// translucent and closed properties overridden
}),
classificationType : ClassificationType.TERRAIN
classificationType : this.classificationType
});

primitives.add(primitive, this.zIndex);
Expand Down Expand Up @@ -266,9 +267,10 @@ define([
/**
* @private
*/
function StaticGroundGeometryPerMaterialBatch(primitives, appearanceType) {
function StaticGroundGeometryPerMaterialBatch(primitives, classificationType, appearanceType) {
this._items = [];
this._primitives = primitives;
this._classificationType = classificationType;
this._appearanceType = appearanceType;
}

Expand All @@ -293,7 +295,7 @@ define([
}
}
// If a compatible batch wasn't found, create a new batch.
var batch = new Batch(this._primitives, this._appearanceType, updater.fillMaterialProperty, usingSphericalTextureCoordinates, zIndex);
var batch = new Batch(this._primitives, this._classificationType, this._appearanceType, updater.fillMaterialProperty, usingSphericalTextureCoordinates, zIndex);
batch.add(time, updater, geometryInstance);
items.push(batch);
};
Expand Down
5 changes: 3 additions & 2 deletions Source/Renderer/AutomaticUniforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ define([
}),

/**
* An automatic GLSL uniform representing the depth after
* only the globe has been rendered and packed into an RGBA texture.
* An automatic GLSL uniform representing the depth of the scene
* after the globe pass and then updated after the 3D Tiles pass.
* The depth is packed into an RGBA texture.
*
* @private
*
Expand Down
3 changes: 1 addition & 2 deletions Source/Scene/ClassificationPrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ define([
* and match most of them and add a new geometry or appearance independently of each other.
* Only {@link PerInstanceColorAppearance} with the same color across all instances is supported at this time when using
* ClassificationPrimitive directly.
* For full {@link Appearance} support when classifying terrain use {@link GroundPrimitive} instead.
*
* For full {@link Appearance} support when classifying terrain or 3D Tiles use {@link GroundPrimitive} instead.
* </p>
* <p>
* For correct rendering, this feature requires the EXT_frag_depth WebGL extension. For hardware that do not support this extension, there
Expand Down
Loading