-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
feat: add range option to MeshBVH #660
base: master
Are you sure you want to change the base?
Conversation
664a351
to
4913b32
Compare
4913b32
to
510e99a
Compare
Will the index rearrangement only occur for the given range ? Or do I need to put restriction there as well ? |
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.
Great, thanks! Can we update the README, as well?
Will the index rearrangement only occur for the given range ? Or do I need to put restriction there as well ?
Yeah the indices are only arranged within the necessary range.
One memory issue currently, though, is that the "indirect" buffer is created for the full length of the geometry buffers even if a small subset is needed. But we can track that in another issue.
Another thing we may want to consider for the future is keeping an "offset" field on the BVH so that it can be retained if the subgeometry in the BatchedMesh is moved (ie when "optimizing" or repacking the BatchedMesh).
// If given, the MeshBVH will be computed for the given range on the geometry. | ||
// Default range is { start: 0, count: Infinity } | ||
range: { start: number, count: number } | ||
|
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.
nit: Can we fix the indentation here
let workingRange = geo.drawRange; | ||
if ( range ) { | ||
|
||
workingRange = getRangesIntersection( workingRange, range ); |
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 think it's okay if we just use the passed in "range" here instead of trying to find the intersection of drawRange and the passed in range. It's simpler and in this way a user can override the use of draw range if needed, as well.
That means we'd also have to default the "range" option to null. Or we could default "range" to the geometries draw range to be more clear. What do you think?
|
||
} ); | ||
|
||
it( 'should respect the range option without groups.', () => { |
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 think we'll want to make sure this works with the indirect
argument, as well. Do you mind adding another test or two for that case?
Closes #513