Skip to content

Commit

Permalink
WebGPURenderer: .render() support object3d as parameter (#26400)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Jul 12, 2023
1 parent dee718d commit 1775695
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/jsm/renderers/common/Background.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Background extends DataMap {
update( scene, renderList, renderContext ) {

const renderer = this.renderer;
const background = ( scene.isScene === true ) ? this.nodes.getBackgroundNode( scene ) || scene.background : null;
const background = this.nodes.getBackgroundNode( scene ) || scene.background;

let forceClear = false;

Expand Down
13 changes: 8 additions & 5 deletions examples/jsm/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import RenderContexts from './RenderContexts.js';
import Textures from './Textures.js';
import Background from './Background.js';
import Nodes from './nodes/Nodes.js';
import { Frustum, Matrix4, Vector2, Vector3, Vector4, Color, DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping } from 'three';
import { Scene, Frustum, Matrix4, Vector2, Vector3, Vector4, Color, DoubleSide, BackSide, FrontSide, SRGBColorSpace, NoToneMapping } from 'three';

const _scene = new Scene();
const _drawingBufferSize = new Vector2();
const _screen = new Vector4();
const _frustum = new Frustum();
Expand Down Expand Up @@ -181,6 +182,8 @@ class Renderer {

//

const sceneRef = ( scene.isScene === true ) ? scene : _scene;

const renderTarget = this._renderTarget;
const renderContext = this._renderContexts.get( scene, camera, renderTarget );
const activeCubeFace = this._activeCubeFace;
Expand Down Expand Up @@ -285,11 +288,11 @@ class Renderer {

//

this._nodes.updateScene( scene );
this._nodes.updateScene( sceneRef );

//

this._background.update( scene, renderList, renderContext );
this._background.update( sceneRef, renderList, renderContext );

//

Expand All @@ -301,8 +304,8 @@ class Renderer {
const transparentObjects = renderList.transparent;
const lightsNode = renderList.lightsNode;

if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, scene, lightsNode );
if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, scene, lightsNode );
if ( opaqueObjects.length > 0 ) this._renderObjects( opaqueObjects, camera, sceneRef, lightsNode );
if ( transparentObjects.length > 0 ) this._renderObjects( transparentObjects, camera, sceneRef, lightsNode );

// finish render pass

Expand Down

0 comments on commit 1775695

Please sign in to comment.