Skip to content

Commit

Permalink
Merge pull request #7454 from AnalyticalGraphicsInc/tile-credits
Browse files Browse the repository at this point in the history
Credit support for 3D Tiles tileset.json
  • Loading branch information
mramato authored Jan 18, 2019
2 parents 38efff5 + d80e7ef commit c430e8f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ define([
'../Core/Cartesian3',
'../Core/Cartographic',
'../Core/Check',
'../Core/Credit',
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
Expand Down Expand Up @@ -51,6 +52,7 @@ define([
Cartesian3,
Cartographic,
Check,
Credit,
defaultValue,
defined,
defineProperties,
Expand Down Expand Up @@ -196,6 +198,7 @@ define([
this._timeSinceLoad = 0.0;
this._updatedVisibilityFrame = 0;
this._extras = undefined;
this._credits = undefined;

this._cullWithChildrenBounds = defaultValue(options.cullWithChildrenBounds, true);
this._allTilesAdditive = true;
Expand Down Expand Up @@ -760,7 +763,6 @@ define([
* @default false
*/
this.debugShowUrl = defaultValue(options.debugShowUrl, false);
this._credits = undefined;

var that = this;
var resource;
Expand All @@ -786,12 +788,28 @@ define([
.then(function(tilesetJson) {
that._root = that.loadTileset(resource, tilesetJson);
var gltfUpAxis = defined(tilesetJson.asset.gltfUpAxis) ? Axis.fromName(tilesetJson.asset.gltfUpAxis) : Axis.Y;
that._asset = tilesetJson.asset;
var asset = tilesetJson.asset;
that._asset = asset;
that._properties = tilesetJson.properties;
that._geometricError = tilesetJson.geometricError;
that._extensionsUsed = tilesetJson.extensionsUsed;
that._gltfUpAxis = gltfUpAxis;
that._extras = tilesetJson.extras;

var extras = asset.extras;
if (defined(extras) && defined(extras.cesium) && defined(extras.cesium.credits)) {
var extraCredits = extras.cesium.credits;
var credits = that._credits;
if (!defined(credits)) {
credits = [];
that._credits = credits;
}
for (var i = 0; i < extraCredits.length; i++) {
var credit = extraCredits[i];
credits.push(new Credit(credit.html, credit.showOnScreen));
}
}

// Save the original, untransformed bounding volume position so we can apply
// the tile transform and model matrix at run time
var boundingVolume = that._root.createBoundingVolume(tilesetJson.root.boundingVolume, Matrix4.IDENTITY);
Expand Down

0 comments on commit c430e8f

Please sign in to comment.