Skip to content

Commit

Permalink
WebGPURenderer: Fix Node.updateBefore() sequence call (#26391)
Browse files Browse the repository at this point in the history
* Geometries: Follows the adopted name pattern

* Renderer: Fix Node.updateBefore() sequence
  • Loading branch information
sunag committed Jul 8, 2023
1 parent 366d701 commit 3e0a573
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/Geometries.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Geometries extends DataMap {

}

update( renderObject ) {
updateForRender( renderObject ) {

if ( this.has( renderObject ) === false ) this.initGeometry( renderObject );

Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/RenderObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export default class RenderObject {
this.scene = scene;
this.camera = camera;
this.lightsNode = lightsNode;
this.context = renderContext;

this.geometry = object.geometry;

this.attributes = null;
this.context = renderContext;
this.pipeline = null;
this.vertexBuffers = null;

Expand Down
3 changes: 2 additions & 1 deletion examples/jsm/renderers/common/RenderObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RenderObjects {

renderObject.dispose();

renderObject = this.get( object, material, scene, camera, lightsNode, renderContext );
renderObject = this.get( object, material, scene, camera, lightsNode, renderContext, passId );

}

Expand All @@ -66,6 +66,7 @@ class RenderObjects {

const chainMap = this.getChainMap( passId );
const dataMap = this.dataMap;

const renderObject = new RenderObject( nodes, geometries, renderer, object, material, scene, camera, lightsNode, renderContext );

const data = dataMap.get( renderObject );
Expand Down
12 changes: 7 additions & 5 deletions examples/jsm/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,12 @@ class Renderer {

//

const renderObject = this._objects.get( object, material, scene, camera, lightsNode, this._currentRenderContext );

this._nodes.updateBefore( renderObject );

//

object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );

Expand Down Expand Up @@ -844,12 +850,8 @@ class Renderer {

//

this._nodes.updateBefore( renderObject );

//

this._nodes.updateForRender( renderObject );
this._geometries.update( renderObject );
this._geometries.updateForRender( renderObject );
this._bindings.updateForRender( renderObject );

//
Expand Down

0 comments on commit 3e0a573

Please sign in to comment.