-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Support for different types of bounding volumes for 3D tiles #3325
Support for different types of bounding volumes for 3D tiles #3325
Conversation
…ox (same as before) and sphere (new)
this._debugBox = undefined; | ||
this._debugcontentBox = undefined; | ||
this._debugOrientedBoundingBox = undefined; | ||
this._debugContentsOrientedBoundingBox = undefined; |
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.
I kept only one debug volume for the tile and one debug volume for the tile contents. Not sure whether there is any need to keep them separated.
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 seems like the right approach to me. We will have to modify Cities.html
to remove some of the extra buttons, but that can be a later commit.
@lilleyse can you do the initial review? @e-andersson we'll want to use |
@pjcozzi Could we call it something along the lines of |
A lot of KML use cases will be served by served by 3D Tiles. In particular, KML regions, which call this By the way, we use camel case for property names so @lilleyse is there a more precise graphics term for this that we are over looking? |
I'm not sure what the proper term is. Maybe |
BoundingSphere.distanceToCamera = function(sphere, frameState) { | ||
return Math.max(0.0, Cartesian3.distance(sphere.center, frameState.camera.positionWC) - sphere.radius); | ||
}; | ||
|
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.
Add a comment above this function, but add @private
at the end for now.
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.
Throw DeveloperError
if sphere
or frameState
is not defined, similar to what the other functions do.
@lilleyse |
0, 1, 0, 0, | ||
0, 0, 1, 0, | ||
0, 0, 0, 1 | ||
); |
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.
Cleaner to do var modelMatrix = 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.
Thanks -- I stumbled on the immutability of Matrix4.IDENTITY, didn't figure out I should clone it :)
Those are all my comments. I did a quick test and it works fine. When everything here is final, I'll update the test data sets to reflect the new When we pick a name for |
Thanks @lilleyse. I'll update the code in line with the comments tomorrow morning. |
I added a |
@lilleyse Would you mind having a look at why the |
It looks like the tests are failing because |
@lilleyse Thanks, that indeed seems to be it. |
…bounding box as the bounding volume
I added a temporary solution for creating an oriented bounding box from points representing the corners when creating a |
@pjcozzi I think this is ready. EDIT: Updating a few tests... done! |
@e-andersson can you merge the |
* | ||
* @private | ||
*/ | ||
this._orientedBoundingBox = OrientedBoundingBox.fromPoints(getBoxPoints(this.rectangle, this.minimumHeight, this.maximumHeight)); |
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.
I believe we can use OrientedBoundingBox.fromRectangle
here. For example, see https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Workers/createVerticesFromQuantizedTerrainMesh.js#L121
Also, when you merge in master, please change the new tiles.json files for the tests in Specs/Data/Cesium3DTiles so they follow the latest schema for bounding volumes |
Just those comments. Once the |
Merged in 3d-tiles into this branch. Note that I seem to have introduced two test failures, possibly due to the |
Maybe you can try |
Thanks for the pointer @lilleyse, I seem to have missed that comment. Works fine now. This is ready now @pjcozzi. EDIT: Currently there are no destroy functions for the the bounding volumes of a |
this._debugcontentBox = this._debugcontentBox && this._debugcontentBox.destroy(); | ||
this._debugOrientedBoundingBox = this._debugOrientedBoundingBox && this._debugOrientedBoundingBox.destroy(); | ||
this._debugContentsOrientedBoundingBox = this._debugContentsOrientedBoundingBox && this._debugContentsOrientedBoundingBox.destroy(); | ||
// TODO: Is there a reason to destroy the bounding volumes (and thus to implement destroy() functions for them)? The destroyObject function description says it should be used to for objects that have GL resources. |
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 is only needed for the debug
volumes since they contain Cesium primitives, which contain GL resources.
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.
Ah, got it. (Sean has fixed it.)
Thanks again @e-andersson! I'm going to merge this since we have some changes we want to make that depend on this. Can you please open a separate PR into the |
Support for different types of bounding volumes for 3D tiles
@tfili and anyone else using 3D Tiles - note that next time you update to the latest |
Bounding volume is now specified as
boundingVolume.box
orboundingVolume.sphere
where it was previously onlybox
.boundingVolume.box
is the same as the oldbox
for now.PR for issue Different bounding volumes.
Somewhat rudimentary tests are included, feedback welcome.