-
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
3D Tiles - Support tile transform #4130
Conversation
In the context of just Cesium, this is perfect. In the broader context of 3D Tiles, are these better named |
* The local transform of this tile | ||
* @type {Matrix4} | ||
*/ | ||
this.transformLocal = defined(header.transform) ? Matrix4.unpack(header.transform, 0) : Matrix4.clone(Matrix4.IDENTITY); |
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.
0
is the default. fromArray
(which is the same as unpack
) may also be more clear in this context.
Part of #3241. |
Matrix4.clone(tile.transformGlobal, tile._transformGlobal); | ||
|
||
// Update the bounding volumes | ||
tile._boundingVolume = createBoundingVolume(tile._header.boundingVolume, tile.transformGlobal, tile._boundingVolume); |
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.
This would be cleaner with
var header = tile._header;
var content = header.content;
I think they need to match, like the other properties:
|
I guess. I'm tempted to say that the However, I think that is too limiting; the may be |
this._boundingVolume = defined(options.boundingVolume) ? options.boundingVolume : createBoundingSphere(this); | ||
this._boundingVolumeExpand = !defined(options.boundingVolume); // Expand the bounding volume by the radius of the loaded model | ||
|
||
this._center = defined(options.center) ? options.center : this._boundingVolume.center; |
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.
Use defaultValue
?
@lilleyse As I mentioned in CesiumGS/3d-tiles#98 (comment), I think it is useful for the 3D Tileset primitive to have a |
It should be easy to add a |
Closing - now included in #4183 |
For CesiumGS/3d-tiles#98
Each tile now has a
transformLocal
andtransformGlobal
property.transformLocal
is equal to the transform property that a tile can have intileset.json
, but the user can also change it on the fly.transformGlobal
is the computed transform when taking into account ancestor transforms. When the value changes, the bounding volumes and content are updated.Questions:
To do:
Points3DTileContent
to render more accurately with the tile transform. Right now it renders at the same location as the transform, but not rotated or scaled with the transform. Short term - add 3x3 transform uniform to the shader. Long term - build shader from scratch. Letting Primitive construct high/low positions buffers could be a bottleneck anyways and is probably more precision than we need considering we are already rendering relative to center. In either case, the point data is uploaded as-is and transformed in the shader.Instanced3DModel3DTileContent
more once I3dm updates #4101 is in. This will give more room for trying OOB/BoundingSphere setups.The wooden tower and the points are defined relative to (0,0,0) but are transformed to their position with the
transform
property.