-
Notifications
You must be signed in to change notification settings - Fork 211
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
fix(webgl): Support instanceCount=0 in draw() #2070
Conversation
I am starting to think that the current API that detects instancing by checking whether instanceCount is a number is perhaps too subtle. |
@@ -489,9 +497,22 @@ export class Model { | |||
*/ | |||
setInstanceCount(instanceCount: number): void { | |||
this.instanceCount = instanceCount; | |||
if (instanceCount > 0) { | |||
this.isInstanced = true; | |||
} |
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 would expect this to work the other way, i.e.
if (this.isInstanced) {
this.instanceCount = instanceCount;
}
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 was added as I didn't wan't to break existing luma.gl examples.
modules/engine/src/model/model.ts
Outdated
this.vertexCount = vertexCount; | ||
this.setNeedsRedraw('vertexCount'); | ||
/** Specify whether instanced rendering should be used */ | ||
setInstanced(isInstanced: boolean = true): void { |
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.
Do we need this? Is there a realistic scenario that switches between instanced/non-instance without changing the attribute layout?
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.
Good point. In fact, I believe that whether the model is instanced should be detectable from the attribute layout, (stepMode: 'instance'
). I should to dig into that before landing this.
For #visgl/deck.gl#8776
Background
Change List