Skip to content
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

Batch table #4328

Merged
merged 14 commits into from
Sep 21, 2016
Merged

Batch table #4328

merged 14 commits into from
Sep 21, 2016

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Sep 16, 2016

Adds a batch table similar to what is used by 3D tiles, but can also be used for batched polylines and geometry. Currently only hooked up to the PolylineCollection. It can replace the implementation of per-instance attributes for Primitive, but that won't happen for this PR.

This needs to be merged before #4309.

@bagnell bagnell mentioned this pull request Sep 19, 2016
7 tasks
@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 20, 2016

It can replace the implementation of per-instance attributes for Primitive, but that won't happen for this PR.

Submit an issue or update the appropriate roadmap.

* @example
* // create the batch table
* var attributes = [{
* functionName : 'getShow()',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

() here, but not with getPickColor. Which is it?

* // ...
* }
*/
function BatchTable(attributes, numberOfInstances) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be @private, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although a good bit of this code is clearly from the 3D Tiles batch table, it doesn't look realistic that 3D Tiles and Cesium primitives could share a common class. Do you agree?

If so, is there significant helper functions that are worth sharing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is @private.

I don't see why 3D Tiles wouldn't use this as a helper class. Unless you want to keep the option of not having to require VTF, then we could separate this out into helper functions.

BatchTable.prototype.update = function(frameState) {
var context = frameState.context;
if (this._pixelDatatype === PixelDatatype.FLOAT && !context.floatingPointTexture) {
// TODO: We could probably pack the floats to RGBA unsigned bytes but that would add a lot CPU and memory overhead.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leave the comment, but drop the TODO; I don't expect that we would implement this fallback given how rare it should be.

Copy link
Contributor

@pjcozzi pjcozzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just those comments.

* @exception {DeveloperError} instanceIndex is out of range.
* @exception {DeveloperError} attributeIndex is out of range.
*/
BatchTable.prototype.getEntry = function(instanceIndex, attributeIndex, result) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout is Entry the best term? Seems like we just introduced it. What is this called in Cesium primitives, an attribute, right? Perhaps getBatchedAttribute and friends?

}
}

// TODO: add support for color from the batch table?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the plan?

@bagnell
Copy link
Contributor Author

bagnell commented Sep 20, 2016

@pjcozzi This is ready for another look.

@pjcozzi pjcozzi mentioned this pull request Sep 21, 2016
@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 21, 2016

Even though this doesn't change the Cesium API, can you update CHANGES.md to say that the extension is now required?

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 21, 2016

The following test passes in master and fails in this branch:

Scene/PolylineCollection does not render with width 0.0
Expected [ 0, 0, 0, 255 ] not to equal [ 0, 0, 0, 255 ].

var length = attributes.length;
for (var i = 0; i < length; ++i) {
if (attributes[i].componentDatatype !== ComponentDatatype.UNSIGNED_BYTE) {
foundFloatDatatype = true;
Copy link
Contributor

@pjcozzi pjcozzi Sep 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a break?

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 21, 2016

Just those comments.

@bagnell
Copy link
Contributor Author

bagnell commented Sep 21, 2016

@pjcozzi This is ready.

@pjcozzi pjcozzi merged commit e700c60 into master Sep 21, 2016
@pjcozzi pjcozzi deleted the batch-table branch September 21, 2016 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants