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

[Fix] Fixed calling CameraComponent.onPostRender #5763

Merged
merged 1 commit into from Oct 18, 2023
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: 1 addition & 1 deletion scripts/utils/cubemap-renderer.js
Expand Up @@ -109,7 +109,7 @@ CubemapRenderer.prototype.initialize = function () {
// set up its rotation
e.setRotation(cameraRotations[i]);

// Before the first camera renders, trigger onCubemapPostRender event on the entity.
// Before the first camera renders, trigger onCubemapPreRender event on the entity.
if (i === 0) {
e.camera.onPreRender = () => {
this.entity.fire('onCubemapPreRender');
Expand Down
7 changes: 3 additions & 4 deletions src/scene/renderer/render-pass-render-actions.js
Expand Up @@ -94,7 +94,7 @@ class RenderPassRenderActions extends RenderPass {

// callback on the camera component before rendering with this camera for the first time
const ra = renderActions[0];
if (ra.firstCameraUse && ra.camera.onPreRender) {
if (ra.camera.onPreRender && ra.firstCameraUse) {
ra.camera.onPreRender();
}
}
Expand All @@ -113,10 +113,9 @@ class RenderPassRenderActions extends RenderPass {
after() {
const { renderActions } = this;
if (renderActions.length) {

// callback on the camera component when we're done rendering with this camera
const ra = renderActions[0];
if (ra.lastCameraUse && ra.camera.onPostRender) {
const ra = renderActions[renderActions.length - 1];
if (ra.camera.onPostRender && ra.lastCameraUse) {
ra.camera.onPostRender();
}
}
Expand Down