Skip to content

Commit

Permalink
warning when render target is set up after render passes
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Valigursky committed Oct 1, 2024
1 parent db7308a commit 3b3fbdc
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/framework/components/camera/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ class CameraComponent extends Component {

/**
* Sets the render passes the camera uses for rendering, instead of its default rendering.
* Set this to an empty array to return to the default behavior.
* Set this to null to return to the default behavior.
*
* @type {RenderPass[]}
* @type {RenderPass[]|null}
* @ignore
*/
set renderPasses(passes) {
this._camera.renderPasses = passes;
this._camera.renderPasses = passes || [];
this.dirtyLayerCompositionCameras();
this.system.app.scene.updateShaders = true;
}
Expand Down Expand Up @@ -840,6 +840,13 @@ class CameraComponent extends Component {
* @type {RenderTarget}
*/
set renderTarget(value) {

Debug.call(() => {
if (this._camera.renderPasses.length > 0) {
Debug.warn(`Setting a render target on the camera ${this.entity.name} after the render passes is not supported, set it up first.`);
}
});

this._camera.renderTarget = value;
this.dirtyLayerCompositionCameras();
}
Expand Down

0 comments on commit 3b3fbdc

Please sign in to comment.