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

WebGPURenderer: Fix group draw range #28163

Merged
merged 1 commit into from Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions examples/jsm/renderers/common/RenderObject.js
Expand Up @@ -56,6 +56,8 @@ export default class RenderObject {
this.geometry = object.geometry;
this.version = material.version;

this.drawRange = null;

this.attributes = null;
this.pipeline = null;
this.vertexBuffers = null;
Expand Down
9 changes: 5 additions & 4 deletions examples/jsm/renderers/common/Renderer.js
Expand Up @@ -1325,16 +1325,16 @@ class Renderer {
if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {

material.side = BackSide;
this._handleObjectFunction( object, material, scene, camera, lightsNode, 'backSide' ); // create backSide pass id
this._handleObjectFunction( object, material, scene, camera, lightsNode, group, 'backSide' ); // create backSide pass id

material.side = FrontSide;
this._handleObjectFunction( object, material, scene, camera, lightsNode ); // use default pass id
this._handleObjectFunction( object, material, scene, camera, lightsNode, group ); // use default pass id

material.side = DoubleSide;

} else {

this._handleObjectFunction( object, material, scene, camera, lightsNode );
this._handleObjectFunction( object, material, scene, camera, lightsNode, group );

}

Expand Down Expand Up @@ -1364,9 +1364,10 @@ class Renderer {

}

_renderObjectDirect( object, material, scene, camera, lightsNode, passId ) {
_renderObjectDirect( object, material, scene, camera, lightsNode, group, passId ) {

const renderObject = this._objects.get( object, material, scene, camera, lightsNode, this._currentRenderContext, passId );
renderObject.drawRange = group || object.geometry.drawRange;

//

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgl/WebGLBackend.js
Expand Up @@ -615,7 +615,7 @@ class WebGLBackend extends Backend {
const index = renderObject.getIndex();

const geometry = renderObject.geometry;
const drawRange = geometry.drawRange;
const drawRange = renderObject.drawRange;
const firstVertex = drawRange.start;

//
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/webgpu/WebGPUBackend.js
Expand Up @@ -871,7 +871,7 @@ class WebGPUBackend extends Backend {

// draw

const drawRange = geometry.drawRange;
const drawRange = renderObject.drawRange;
const firstVertex = drawRange.start;

const instanceCount = this.getInstanceCount( renderObject );
Expand Down