-
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
Add Extras to 3DTile and 3DTileset #6974
Changes from 6 commits
722701d
9badee4
0c3d711
1e73469
0a0af0f
e434db4
25c8623
8a24922
468a1fb
5de6c3f
4f0d17c
90ee7cf
d4c90e3
e88a6c8
e683221
e4d20f1
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 |
---|---|---|
|
@@ -88,7 +88,7 @@ define([ | |
var contentHeader = header.content; | ||
|
||
/** | ||
* The local transform of this tile | ||
* The local transform of this tile. | ||
* @type {Matrix4} | ||
*/ | ||
this.transform = defined(header.transform) ? Matrix4.unpack(header.transform) : Matrix4.clone(Matrix4.IDENTITY); | ||
|
@@ -99,8 +99,10 @@ define([ | |
var parentInitialTransform = defined(parent) ? parent._initialTransform : Matrix4.IDENTITY; | ||
this._initialTransform = Matrix4.multiply(parentInitialTransform, this.transform, new Matrix4()); | ||
|
||
this._extras = header.extras; | ||
|
||
/** | ||
* The final computed transform of this tile | ||
* The final computed transform of this tile. | ||
* @type {Matrix4} | ||
* @readonly | ||
*/ | ||
|
@@ -429,6 +431,21 @@ define([ | |
} | ||
}, | ||
|
||
/** | ||
* Application specific metadata. | ||
* | ||
* @memberof Cesium3DTile.prototype | ||
* | ||
* @type {Object} | ||
* @readonly | ||
* @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#specifying-extensions-and-application-specific-extras|Extras in the 3D Tiles specification.} | ||
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. Same comments here. |
||
*/ | ||
extras : { | ||
get : function() { | ||
return this._extras; | ||
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. Instead of storing |
||
} | ||
}, | ||
|
||
/** | ||
* Gets or sets the tile's highlight color. | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -181,6 +181,7 @@ define([ | |
this._selectedTilesToStyle = []; | ||
this._loadTimestamp = undefined; | ||
this._timeSinceLoad = 0.0; | ||
this._extras = undefined; | ||
|
||
this._cullWithChildrenBounds = defaultValue(options.cullWithChildrenBounds, true); | ||
this._allTilesAdditive = true; | ||
|
@@ -710,6 +711,7 @@ define([ | |
that._geometricError = tilesetJson.geometricError; | ||
that._extensionsUsed = tilesetJson.extensionsUsed; | ||
that._gltfUpAxis = gltfUpAxis; | ||
that._extras = tilesetJson.extras; | ||
that._readyPromise.resolve(that); | ||
}).otherwise(function(error) { | ||
that._readyPromise.reject(error); | ||
|
@@ -1237,6 +1239,22 @@ define([ | |
get : function() { | ||
return this._ellipsoid; | ||
} | ||
}, | ||
|
||
/** | ||
* Application specific metadata. | ||
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. Expand on the description some more. Something like:
|
||
* | ||
* @memberof Cesium3DTileset.prototype | ||
* | ||
* @type {Object} | ||
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. Change to |
||
* @readonly | ||
* | ||
* @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#specifying-extensions-and-application-specific-extras|Extras in the 3D Tiles specification.} | ||
*/ | ||
extras : { | ||
get : function() { | ||
return this._extras; | ||
} | ||
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. It might be a good idea to check if the tileset is ready before accessing
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. Only needed for the |
||
} | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{ | ||
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. I don't think it's necessary to create a new tileset After that, make sure to keep
Open a PR with any modifications to 3D Tiles sample data to https://github.com/AnalyticalGraphicsInc/3d-tiles-tools/tree/master/samples-generator. Then regenerate |
||
"asset": { | ||
"version": "1.0", | ||
"tilesetVersion": "1.2.3" | ||
}, | ||
"properties": { | ||
"id": { | ||
"minimum": 0, | ||
"maximum": 9 | ||
}, | ||
"Longitude": { | ||
"minimum": -1.3197192952275933, | ||
"maximum": -1.319644104024109 | ||
}, | ||
"Latitude": { | ||
"minimum": 0.698848878034009, | ||
"maximum": 0.6989046192460953 | ||
}, | ||
"Height": { | ||
"minimum": 6.161747192963958, | ||
"maximum": 85.41026367992163 | ||
} | ||
}, | ||
"geometricError": 240, | ||
"extras": { | ||
"key": "value" | ||
}, | ||
"root": { | ||
"boundingVolume": { | ||
"region": [ | ||
-1.3197209591796106, | ||
0.6988424218, | ||
-1.3196390408203893, | ||
0.6989055782, | ||
0, | ||
88 | ||
] | ||
}, | ||
"geometricError": 70, | ||
"extras": { | ||
"key": "value" | ||
}, | ||
"refine": "ADD", | ||
"content": { | ||
"uri": "parent.b3dm", | ||
"boundingVolume": { | ||
"region": [ | ||
-1.3197004795898053, | ||
0.6988582109, | ||
-1.3196595204101946, | ||
0.6988897891, | ||
0, | ||
88 | ||
] | ||
} | ||
}, | ||
"children": [ | ||
{ | ||
"boundingVolume": { | ||
"region": [ | ||
-1.3197209591796106, | ||
0.6988424218, | ||
-1.31968, | ||
0.698874, | ||
0, | ||
20 | ||
] | ||
}, | ||
"geometricError": 0, | ||
"content": { | ||
"uri": "ll.b3dm" | ||
} | ||
}, | ||
{ | ||
"boundingVolume": { | ||
"region": [ | ||
-1.31968, | ||
0.6988424218, | ||
-1.3196390408203893, | ||
0.698874, | ||
0, | ||
20 | ||
] | ||
}, | ||
"geometricError": 0, | ||
"content": { | ||
"uri": "lr.b3dm" | ||
} | ||
}, | ||
{ | ||
"boundingVolume": { | ||
"region": [ | ||
-1.31968, | ||
0.698874, | ||
-1.3196390408203893, | ||
0.6989055782, | ||
0, | ||
20 | ||
] | ||
}, | ||
"geometricError": 0, | ||
"content": { | ||
"uri": "ur.b3dm" | ||
} | ||
}, | ||
{ | ||
"boundingVolume": { | ||
"region": [ | ||
-1.3197209591796106, | ||
0.698874, | ||
-1.31968, | ||
0.6989055782, | ||
0, | ||
20 | ||
] | ||
}, | ||
"geometricError": 0, | ||
"content": { | ||
"uri": "ul.b3dm" | ||
} | ||
} | ||
] | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,8 @@ defineSuite([ | |
var pointCloudUrl = 'Data/Cesium3DTiles/PointCloud/PointCloudRGB/tileset.json'; | ||
var pointCloudBatchedUrl = 'Data/Cesium3DTiles/PointCloud/PointCloudBatched/tileset.json'; | ||
|
||
var tilesetWithExtras = 'Data/Cesium3DTiles/Tilesets/TilesetWithExtras/tileset.json'; | ||
|
||
beforeAll(function() { | ||
scene = createScene(); | ||
}); | ||
|
@@ -356,6 +358,16 @@ defineSuite([ | |
}); | ||
}); | ||
|
||
fit('loads tileset with extras', 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. Change |
||
return Cesium3DTilesTester.loadTileset(scene, tilesetWithExtras).then(function(tileset) { | ||
expect(tileset.extras).toBeDefined(); | ||
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. Checking that the extras is what we expect is still worthwhile:
And remove the |
||
expect(tileset.extras).toEqual({'key': 'value'}); | ||
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. Remove |
||
|
||
expect(tileset.root.extras).toBeDefined(); | ||
expect(tileset.root.extras).toEqual({'key': 'value'}); | ||
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. Same comment. 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. Since you mentioned it in the PR description, it might be worthwhile to add a test that checks that extras is undefined for some other tile in the tree that doesn't have extras. |
||
}); | ||
}); | ||
|
||
it('gets root tile', function() { | ||
var tileset = scene.primitives.add(new Cesium3DTileset({ | ||
url : tilesetUrl | ||
|
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.
Thanks for fixing these!