-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Draping Imagery on 3D Tiles #12567
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
base: main
Are you sure you want to change the base?
Draping Imagery on 3D Tiles #12567
Changes from 14 commits
af6a769
0b67e70
d9907b3
927d55d
76a4f9a
9defb46
b59b323
2bd118a
6c1791d
f1c5768
34680af
8590207
61dcb2a
6bc30cf
96a2524
a5821d6
f1034d6
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 |
---|---|---|
|
@@ -1097,6 +1097,25 @@ Object.defineProperties(Cesium3DTileset.prototype, { | |
}, | ||
}, | ||
|
||
/** | ||
* The {@link ImageryLayerCollection} that should be draped on the contents of this tileset. | ||
* | ||
* @memberof Cesium3DTileset.prototype | ||
* | ||
* @type {ImageryLayerCollection} | ||
*/ | ||
imageryLayers: { | ||
// TODO_DRAPING Attach a listener that will set some | ||
// `tileset._imageryLayersDirty` flag that is passed to the | ||
// models, so that the models can be updated for new imagery | ||
get: function () { | ||
return this._imageryLayers; | ||
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. Does it make sense to initialize value as an empty const imageryProvider = await ...;
const layer = new Cesium.ImageryLayer(imageryProvider);
tileset.imageryLayers.add(layer) 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. There could be certain patterns or "ways how things are usually done" (and maybe there are patterns and I overlooked them...). Here, I think that this could make sense. It will require some fixes, with changes from If we do this, then I'd rather mark the Maybe throwing in some |
||
}, | ||
set: function (value) { | ||
this._imageryLayers = value; | ||
}, | ||
}, | ||
|
||
/** | ||
* Gets the tileset's properties dictionary object, which contains metadata about per-feature properties. | ||
* <p> | ||
|
@@ -2811,7 +2830,8 @@ function addTileDebugLabel(tile, tileset, position) { | |
let attributes = 0; | ||
|
||
if (tileset.debugShowGeometricError) { | ||
labelString += `\nGeometric error: ${tile.geometricError}`; | ||
// XXX_DRAPING Show SSE as well.... | ||
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. Out of scope for this PR, but Would it be helpful to add this functionality to the tileset inspector? I could certainly see 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. I'll leave this open, and during a "cleanup pass" where all the |
||
labelString += `\nGeometric error: ${tile.geometricError} SSE ${tile._screenSpaceError}`; | ||
attributes++; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* A class containing a the values that affect the appearance of | ||
* an <code>ImageryLayer</code>. | ||
* | ||
* This is used in the <code>ModelImagery</code> to detect changes in | ||
* the imagery settings: The <code>ModelImagery</code> stores one | ||
* instance per imagery layer. During the <code>update</code> | ||
* call, it checks whether any of the settings was changed. | ||
* If this is the case, the draw commands of the model are reset. | ||
*/ | ||
class ImageryConfiguration { | ||
constructor(imageryLayer) { | ||
this.alpha = imageryLayer.alpha; | ||
this.brightness = imageryLayer.brightness; | ||
this.contrast = imageryLayer.contrast; | ||
this.hue = imageryLayer.hue; | ||
this.saturation = imageryLayer.saturation; | ||
this.gamma = imageryLayer.gamma; | ||
this.colorToAlpha = imageryLayer.colorToAlpha; | ||
} | ||
} | ||
|
||
export default ImageryConfiguration; |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,70 @@ | ||||
/** | ||||
* A structure containing information about a piece of imagery. | ||||
* | ||||
* This represents the result of computing the imagery tiles that | ||||
* are covered by a given <code>Rectangle</code> (and which part | ||||
* of that imagery is covered, in terms of texture coordinates). | ||||
* | ||||
* It is used by the <code>ModelPrimitiveImagery</code>, to | ||||
* represent the imagery tiles that are covered by the cartographic | ||||
* bounding rectangle of the primitive positions. | ||||
* | ||||
* TODO_DRAPING: Implementation note for ImageryCoverage: | ||||
* This roughly corresponds to the <code>TileImagery</code> that is | ||||
* created in my favorite draping-related time sink, namely in | ||||
* <code>ImageryLayer._createTileImagerySkeletons</code>. | ||||
* But in contrast to the <code>TileImagery</code>, this describes | ||||
* <i>which</i> imagery tile is used, does not store the ("loading" | ||||
* and "ready"...) imagery <i>itself</i>. | ||||
*/ | ||||
class ImageryCoverage { | ||||
/** | ||||
* Creates a new instance | ||||
* | ||||
* @param {number} x x-coordinate of the imagery tile | ||||
* @param {number} y y-coordinate of the imagery tile | ||||
* @param {number} level level of the imagery tile | ||||
* @param {Cartesian4} textureCoordinateRectangle The texture coordinate | ||||
* rectangle from the imagery tile that is covered, i.e. the | ||||
* (minU, minV, maxU, maxV) coordinate range. | ||||
*/ | ||||
constructor(x, y, level, textureCoordinateRectangle) { | ||||
/** | ||||
* The x-coordinate of the imagery tile | ||||
javagl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
* | ||||
* @type {number} | ||||
* @readonly | ||||
*/ | ||||
this.x = x; | ||||
|
||||
/** | ||||
* The x-coordinate of the imagery tile | ||||
javagl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
* | ||||
* @type {number} | ||||
* @readonly | ||||
*/ | ||||
this.y = y; | ||||
|
||||
/** | ||||
* The x-coordinate of the imagery tile | ||||
javagl marked this conversation as resolved.
Show resolved
Hide resolved
|
||||
* | ||||
* @type {number} | ||||
* @readonly | ||||
*/ | ||||
this.level = level; | ||||
|
||||
/** | ||||
* The texture coordinate range that is covered from the | ||||
* imagery tile. | ||||
* | ||||
* This is a <code>Cartesian4</code> that contains the | ||||
* (minU, minV, maxU, maxV) coordinate range. | ||||
* | ||||
* @type {Cartesian4} | ||||
* @readonly | ||||
*/ | ||||
this.textureCoordinateRectangle = textureCoordinateRectangle; | ||||
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.
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. Yes, I've occasionally been meandering between 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. The specific "source" of that was
|
||||
} | ||||
} | ||||
|
||||
export default ImageryCoverage; |
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.
Before this PR is merged, let's make sure to document any known limitations here. For example, IIUC, imagery layers will not be applied to tilesets with content other than model meshes.