Add scene options to set default layer masks#18382
Add scene options to set default layer masks#18382tholub99 wants to merge 1 commit intoBabylonJS:masterfrom
Conversation
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18382/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18382/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18382/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 18382 in repo BabylonJS/Babylon.js |
655a2eb to
d8aa11e
Compare
|
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
|
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/18382/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18382/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/18382/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
| scene: Scene | ||
| ) { | ||
| this._scene = scene || EngineStore.LastCreatedScene; | ||
| this.layerMask = scene.defaultRenderableLayerMask; |
There was a problem hiding this comment.
| this.layerMask = scene.defaultRenderableLayerMask; | |
| this.layerMask = this._scene.defaultRenderableLayerMask; |
There was a problem hiding this comment.
swapped to class field call
| * @internal | ||
| * Gets or sets the default layerMask used for cameras created in this scene. | ||
| */ | ||
| public defaultCameraLayerMask: number; |
There was a problem hiding this comment.
Warning — drop the @internal tag from both fields. These two new public fields (here and defaultRenderableLayerMask on line 1833) are the whole point of the PR — they're meant to be user-configurable defaults, both at construction (via SceneOptions) and afterwards (the doc comment correctly says "Gets or sets …"). Marking them @internal excludes them from the public typings rollup / API docs and signals to consumers that they shouldn't touch them, which contradicts the intent. Please remove the @internal line from both JSDoc blocks.
| super(name, scene, false); | ||
|
|
||
| this.layerMask = this.getScene().defaultRenderableLayerMask; | ||
| scene = this.getScene(); |
There was a problem hiding this comment.
Nit — redundant getScene() call. this.getScene() is called on line 1002 and again on line 1003. Cleaner as:
scene = this.getScene();
this.layerMask = scene.defaultRenderableLayerMask;
scene.addMesh(this);|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
This adds scene optional scene options to set default layerMask values for when the scene creates new cameras and renderable objects that use the layerMask property.
If left undefined the normal 0x0FFFFFFF layerMask is used.