Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/renderers/common/RenderContexts.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,24 @@ class RenderContexts {
* @param {Scene} scene - The scene.
* @param {Camera} camera - The camera that is used to render the scene.
* @param {?RenderTarget} [renderTarget=null] - The active render target.
* @param {?MRT} [mrt=null] - The active multiple render target.
* @return {RenderContext} The render context.
*/
get( scene, camera, renderTarget = null ) {
get( scene, camera, renderTarget = null, mrt = null ) {

_chainKeys[ 0 ] = scene;
_chainKeys[ 1 ] = camera;
let index = 0;

if ( mrt !== null ) {

// TODO: Improve ChainMap so that it only matches submaps corresponding to the key lengths.
// For we use: if ( mrt !== null ) _chainKeys[ 2 ] = mrt;

_chainKeys[ index ++ ] = mrt;

}

_chainKeys[ index ++ ] = scene;
_chainKeys[ index ++ ] = camera;

let attachmentState;

Expand Down
2 changes: 2 additions & 0 deletions src/renderers/common/RenderObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ class RenderObject {

}

cacheKey += this.context.id + ',';

cacheKey += object.receiveShadow + ',';

return hashString( cacheKey );
Expand Down
6 changes: 3 additions & 3 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class Renderer {
await this.compileAsync( scene, camera );

const renderList = this._renderLists.get( scene, camera );
const renderContext = this._renderContexts.get( scene, camera, this._renderTarget );
const renderContext = this._renderContexts.get( scene, camera, this._renderTarget, this._mrt );

const material = scene.overrideMaterial || object.material;

Expand Down Expand Up @@ -859,7 +859,7 @@ class Renderer {
if ( targetScene === null ) targetScene = scene;

const renderTarget = this._renderTarget;
const renderContext = this._renderContexts.get( targetScene, camera, renderTarget );
const renderContext = this._renderContexts.get( targetScene, camera, renderTarget, this._mrt );
const activeMipmapLevel = this._activeMipmapLevel;

const compilationPromises = [];
Expand Down Expand Up @@ -1361,7 +1361,7 @@ class Renderer {

//

const renderContext = this._renderContexts.get( scene, camera, renderTarget );
const renderContext = this._renderContexts.get( scene, camera, renderTarget, this._mrt );

this._currentRenderContext = renderContext;
this._currentRenderObjectFunction = this._renderObjectFunction || this.renderObject;
Expand Down