diff --git a/scripts/utils/cubemap-renderer.js b/scripts/utils/cubemap-renderer.js index c97786d0f68..8db3f394d9b 100644 --- a/scripts/utils/cubemap-renderer.js +++ b/scripts/utils/cubemap-renderer.js @@ -117,7 +117,7 @@ CubemapRenderer.prototype.initialize = function () { } // Before the first camera renders, trigger onCubemapPreRender event on the entity. - this.evtPreRender = this.app.scene.on(pc.EVENT_PRERENDER, (cameraComponent) => { + this.evtPreRender = this.app.scene.on('prerender', (cameraComponent) => { if (cameraComponent === firstCamera) { this.entity.fire('onCubemapPreRender'); } @@ -125,7 +125,7 @@ CubemapRenderer.prototype.initialize = function () { // When last camera is finished rendering, trigger onCubemapPostRender event on the entity. // This can be listened to by the user, and the resulting cubemap can be further processed (e.g pre-filtering) - this.evtPostRender = this.app.scene.on(pc.EVENT_POSTRENDER, (cameraComponent) => { + this.evtPostRender = this.app.scene.on('postrender', (cameraComponent) => { if (cameraComponent === lastCamera) { this.entity.fire('onCubemapPostRender'); } diff --git a/scripts/utils/planar-renderer.js b/scripts/utils/planar-renderer.js index ee144ebb949..7c39df755c1 100644 --- a/scripts/utils/planar-renderer.js +++ b/scripts/utils/planar-renderer.js @@ -68,7 +68,7 @@ PlanarRenderer.prototype.initialize = function () { // When the camera is finished rendering, trigger onPlanarPostRender event on the entity. // This can be listened to by the user, and the resulting texture can be further processed (e.g prefiltered) - this.evtPostRender = this.app.scene.on(pc.EVENT_POSTRENDER, (cameraComponent) => { + this.evtPostRender = this.app.scene.on('postrender', (cameraComponent) => { if (planarCamera === cameraComponent) { this.entity.fire('onPlanarPostRender'); } diff --git a/src/extras/renderers/outline-renderer.js b/src/extras/renderers/outline-renderer.js index 2e452212336..3dbcdc85774 100644 --- a/src/extras/renderers/outline-renderer.js +++ b/src/extras/renderers/outline-renderer.js @@ -9,7 +9,6 @@ import { import { DepthState } from '../../platform/graphics/depth-state.js'; import { RenderTarget } from '../../platform/graphics/render-target.js'; import { Texture } from '../../platform/graphics/texture.js'; -import { EVENT_POSTRENDER, EVENT_PRERENDER_LAYER } from '../../scene/constants.js'; import { drawQuadWithShader } from '../../scene/graphics/quad-render-utils.js'; import { QuadRender } from '../../scene/graphics/quad-render.js'; import { StandardMaterialOptions } from '../../scene/materials/standard-material-options.js'; @@ -98,7 +97,7 @@ class OutlineRenderer { this.outlineShaderPass = this.outlineCameraEntity.camera.setShaderPass('OutlineShaderPass'); // function called after the camera has rendered the outline objects to the texture - app.scene.on(EVENT_POSTRENDER, (cameraComponent) => { + app.scene.on('postrender', (cameraComponent) => { if (this.outlineCameraEntity.camera === cameraComponent) { this.onPostRender(); } @@ -334,7 +333,7 @@ class OutlineRenderer { this.updateRenderTarget(sceneCamera); // function called before the scene camera renders a layer - const evt = this.app.scene.on(EVENT_PRERENDER_LAYER, (cameraComponent, layer, transparent) => { + const evt = this.app.scene.on('prerender:layer', (cameraComponent, layer, transparent) => { if (sceneCamera === cameraComponent && transparent === blendLayerTransparent && layer === blendLayer) { this.blendOutlines(); evt.off(); diff --git a/src/scene/constants.js b/src/scene/constants.js index 8cdae8e658c..b9c5c7d2609 100644 --- a/src/scene/constants.js +++ b/src/scene/constants.js @@ -1061,7 +1061,7 @@ export const DITHER_IGNNOISE = 'ignnoise'; * @type {string} * @category Graphics */ -export const EVENT_PRERENDER = 'preRender'; +export const EVENT_PRERENDER = 'prerender'; /** * Name of event fired after the camera renders the scene. @@ -1069,7 +1069,7 @@ export const EVENT_PRERENDER = 'preRender'; * @type {string} * @category Graphics */ -export const EVENT_POSTRENDER = 'postRender'; +export const EVENT_POSTRENDER = 'postrender'; /** * Name of event fired before a layer is rendered by a camera. @@ -1077,7 +1077,7 @@ export const EVENT_POSTRENDER = 'postRender'; * @type {string} * @category Graphics */ -export const EVENT_PRERENDER_LAYER = 'preRenderLayer'; +export const EVENT_PRERENDER_LAYER = 'prerender:layer'; /** * Name of event fired after a layer is rendered by a camera. @@ -1085,7 +1085,7 @@ export const EVENT_PRERENDER_LAYER = 'preRenderLayer'; * @type {string} * @category Graphics */ -export const EVENT_POSTRENDER_LAYER = 'postRenderLayer'; +export const EVENT_POSTRENDER_LAYER = 'postrender:layer'; /** * Name of event fired before visibility culling is performed for the camera @@ -1093,7 +1093,7 @@ export const EVENT_POSTRENDER_LAYER = 'postRenderLayer'; * @type {string} * @category Graphics */ -export const EVENT_PRECULL = 'preCull'; +export const EVENT_PRECULL = 'precull'; /** * Name of event after before visibility culling is performed for the camera @@ -1101,4 +1101,4 @@ export const EVENT_PRECULL = 'preCull'; * @type {string} * @category Graphics */ -export const EVENT_POSTCULL = 'postCull'; +export const EVENT_POSTCULL = 'postcull'; diff --git a/src/scene/scene.js b/src/scene/scene.js index bfe0c03e988..dea2f4a9169 100644 --- a/src/scene/scene.js +++ b/src/scene/scene.js @@ -73,11 +73,11 @@ class Scene extends EventHandler { * * @event * @example - * app.scene.on(EVENT_PRERENDER, (camera) => { + * app.scene.on('prerender', (camera) => { * console.log(`Camera ${camera.entity.name} will render the scene`); * }); */ - static EVENT_PRERENDER = 'preRender'; + static EVENT_PRERENDER = 'prerender'; /** * Fired when the camera renders the scene. The handler is passed the {@link CameraComponent} @@ -85,11 +85,11 @@ class Scene extends EventHandler { * * @event * @example - * app.scene.on(EVENT_POSTRENDER, (camera) => { + * app.scene.on('postrender', (camera) => { * console.log(`Camera ${camera.entity.name} rendered the scene`); * }); */ - static EVENT_POSTRENDER = 'postRender'; + static EVENT_POSTRENDER = 'postrender'; /** * Fired before the camera renders a layer. The handler is passed the {@link CameraComponent}, @@ -99,11 +99,11 @@ class Scene extends EventHandler { * * @event * @example - * app.scene.on(EVENT_PRERENDER_LAYER, (camera, layer, transparent) => { + * app.scene.on('prerender:layer', (camera, layer, transparent) => { * console.log(`Camera ${camera.entity.name} will render the layer ${layer.name} (transparent: ${transparent})`); * }); */ - static EVENT_PRERENDER_LAYER = 'preRenderLayer'; + static EVENT_PRERENDER_LAYER = 'prerender:layer'; /** * Fired when the camera renders a layer. The handler is passed the {@link CameraComponent}, @@ -113,33 +113,33 @@ class Scene extends EventHandler { * * @event * @example - * app.scene.on(EVENT_PRERENDER_LAYER, (camera, layer, transparent) => { + * app.scene.on('postrender:layer', (camera, layer, transparent) => { * console.log(`Camera ${camera.entity.name} rendered the layer ${layer.name} (transparent: ${transparent})`); * }); */ - static EVENT_POSTRENDER_LAYER = 'postRenderLayer'; + static EVENT_POSTRENDER_LAYER = 'postrender:layer'; /** * Fired before visibility culling is performed for the camera. * * @event * @example - * app.scene.on(EVENT_PRECULL, (camera) => { + * app.scene.on('precull', (camera) => { * console.log(`Visibility culling will be performed for camera ${camera.entity.name}`); * }); */ - static EVENT_PRECULL = 'preCull'; + static EVENT_PRECULL = 'precull'; /** * Fired after visibility culling is performed for the camera. * * @event * @example - * app.scene.on(EVENT_POSTCULL, (camera) => { + * app.scene.on('postcull', (camera) => { * console.log(`Visibility culling was performed for camera ${camera.entity.name}`); * }); */ - static EVENT_POSTCULL = 'postCull'; + static EVENT_POSTCULL = 'postcull'; /** * If enabled, the ambient lighting will be baked into lightmaps. This will be either the