From 73383402d7e0b80681b330d40d7085e199de1cf8 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Fri, 20 Mar 2026 13:54:55 +0100 Subject: [PATCH 1/5] feat: migrate from experimental decorators to TC39 Stage 3 decorators - Rewrite all decorator definitions for TC39 (decorators.ts, decorators.functions.ts, nodeDecorator.ts) - Use Symbol.metadata for per-class metadata storage - Add 'accessor' keyword to all @expandToProperty and @addAccessorsForMaterialProperty properties - Flip addAccessorsForMaterialProperty pattern: decorator on public accessor - Rewrite 3MF XML decorators and Smart Filters decorators for TC39 - Update Lit viewer components with accessor keyword for @property/@state/@query - Remove experimentalDecorators from all tsconfig files - Add esnext.decorators and es2022.object to lib - Bump UMD build targets from ES5 to ES2015 (accessor requires it) - Replace _propStore access with getEditableProperties() helper - Add unit tests for decorator metadata and expandToProperty - Fix class self-references in decorator arguments (TS2449) - Remove experimentalDecorators from Playground/Snippet Loader compiler options --- .../bakedVertexAnimationManager.ts | 4 +- .../dev/core/src/Decorators/nodeDecorator.ts | 43 ++- packages/dev/core/src/Lights/light.ts | 2 +- .../Background/backgroundMaterial.ts | 45 ++- ...ussianSplattingSolidColorMaterialPlugin.ts | 2 +- .../Materials/Node/Blocks/Dual/lightBlock.ts | 2 +- .../Blocks/Dual/reflectionTextureBaseBlock.ts | 2 +- .../Blocks/PBR/pbrMetallicRoughnessBlock.ts | 2 +- .../core/src/Materials/PBR/openpbrMaterial.ts | 318 +++++++++--------- .../PBR/pbrAnisotropicConfiguration.ts | 6 +- .../src/Materials/PBR/pbrBRDFConfiguration.ts | 18 +- .../core/src/Materials/PBR/pbrBaseMaterial.ts | 2 +- .../Materials/PBR/pbrBaseSimpleMaterial.ts | 26 +- .../PBR/pbrClearCoatConfiguration.ts | 18 +- .../PBR/pbrIridescenceConfiguration.ts | 6 +- .../dev/core/src/Materials/PBR/pbrMaterial.ts | 132 ++++---- .../PBR/pbrMetallicRoughnessMaterial.ts | 10 +- .../Materials/PBR/pbrSheenConfiguration.ts | 14 +- .../PBR/pbrSpecularGlossinessMaterial.ts | 10 +- .../PBR/pbrSubSurfaceConfiguration.ts | 47 +-- .../dev/core/src/Materials/imageProcessing.ts | 16 +- .../material.decalMapConfiguration.ts | 4 +- .../material.detailMapConfiguration.ts | 6 +- .../src/Materials/meshDebugPluginMaterial.ts | 4 +- .../core/src/Materials/standardMaterial.ts | 64 ++-- .../dev/core/src/Misc/decorators.functions.ts | 86 ++--- packages/dev/core/src/Misc/decorators.ts | 127 +++---- .../GlobalIllumination/giRSMManager.ts | 2 +- .../IBLShadows/iblShadowsPluginMaterial.ts | 2 +- .../core/src/Rendering/reflectiveShadowMap.ts | 2 +- .../unit/Decorators/decorators.inline-test.ts | 68 ++++ .../test/unit/Decorators/decorators.test.ts | 79 +++++ .../src/3D/materials/fluent/fluentMaterial.ts | 8 +- .../dev/materials/src/cell/cellMaterial.ts | 8 +- .../dev/materials/src/fire/fireMaterial.ts | 6 +- packages/dev/materials/src/fur/furMaterial.ts | 8 +- .../src/gradient/gradientMaterial.ts | 4 +- .../dev/materials/src/grid/gridMaterial.ts | 2 +- .../dev/materials/src/lava/lavaMaterial.ts | 8 +- packages/dev/materials/src/mix/mixMaterial.ts | 24 +- .../materials/src/normal/normalMaterial.ts | 6 +- .../materials/src/simple/simpleMaterial.ts | 6 +- .../materials/src/terrain/terrainMaterial.ts | 18 +- .../src/triPlanar/triPlanarMaterial.ts | 16 +- .../dev/materials/src/water/waterMaterial.ts | 14 +- .../src/3MF/core/xml/xml.interfaces.ts | 31 +- .../src/nodeGraphSystem/graphNode.ts | 17 +- .../src/blockFoundation/customShaderBlock.ts | 3 +- .../src/editorUtils/editableInPropertyPage.ts | 45 ++- .../src/utils/buildTools/convertShaders.ts | 20 +- .../test/unit/customShaderBlock.test.ts | 4 +- .../umd/babylonjs-addons/tsconfig.build.json | 2 +- .../umd/babylonjs-gui/tsconfig.build.json | 2 +- .../umd/babylonjs-loaders/tsconfig.build.json | 2 +- .../babylonjs-materials/tsconfig.build.json | 2 +- .../tsconfig.build.json | 2 +- .../tsconfig.build.json | 2 +- .../babylonjs-serializers/tsconfig.build.json | 2 +- .../public/umd/babylonjs/tsconfig.build.json | 2 +- .../gui/gridPropertyGridComponent.tsx | 3 +- .../genericNodePropertyComponent.tsx | 20 +- .../genericNodePropertyComponent.tsx | 20 +- .../genericNodePropertyComponent.tsx | 20 +- .../genericNodePropertyComponent.tsx | 20 +- .../src/tools/monaco/ts/tsPipeline.ts | 2 - .../webCamInputBlock/webCamInputBlock.ts | 4 +- .../genericNodePropertyComponent.tsx | 23 +- .../properties/inputNodePropertyComponent.tsx | 6 +- .../tools/snippetLoader/src/snippetLoader.ts | 4 - .../viewer/src/viewerAnnotationElement.ts | 2 +- packages/tools/viewer/src/viewerElement.ts | 72 ++-- tsconfig.build.json | 7 +- tsconfig.json | 1 - tsconfig.test.json | 4 +- 74 files changed, 895 insertions(+), 746 deletions(-) create mode 100644 packages/dev/core/test/unit/Decorators/decorators.inline-test.ts create mode 100644 packages/dev/core/test/unit/Decorators/decorators.test.ts diff --git a/packages/dev/core/src/BakedVertexAnimation/bakedVertexAnimationManager.ts b/packages/dev/core/src/BakedVertexAnimation/bakedVertexAnimationManager.ts index f51f2bf2d598..30f2c125ebd8 100644 --- a/packages/dev/core/src/BakedVertexAnimation/bakedVertexAnimationManager.ts +++ b/packages/dev/core/src/BakedVertexAnimation/bakedVertexAnimationManager.ts @@ -75,7 +75,7 @@ export class BakedVertexAnimationManager implements IBakedVertexAnimationManager */ @serializeAsTexture() @expandToProperty("_markSubMeshesAsAttributesDirty") - public texture: Nullable; + public accessor texture: Nullable; private _isEnabled = true; /** @@ -83,7 +83,7 @@ export class BakedVertexAnimationManager implements IBakedVertexAnimationManager */ @serialize() @expandToProperty("_markSubMeshesAsAttributesDirty") - public isEnabled = true; + public accessor isEnabled = true; /** * The animation parameters for the mesh. See setAnimationParameters() diff --git a/packages/dev/core/src/Decorators/nodeDecorator.ts b/packages/dev/core/src/Decorators/nodeDecorator.ts index b0ad690caca6..ca18c89bddf0 100644 --- a/packages/dev/core/src/Decorators/nodeDecorator.ts +++ b/packages/dev/core/src/Decorators/nodeDecorator.ts @@ -107,19 +107,50 @@ export function editableInPropertyPage( groupName: string = "PROPERTIES", options?: IEditablePropertyOption ) { - return (target: any, propertyKey: string) => { - let propStore: IPropertyDescriptionForEdition[] = target._propStore; - if (!propStore) { + return (_value: unknown, context: { name: string | symbol; metadata: DecoratorMetadataObject }) => { + const meta = context.metadata; + let propStore: IPropertyDescriptionForEdition[]; + if (Object.hasOwn(meta, __bjsPropStoreKey)) { + propStore = meta[__bjsPropStoreKey] as IPropertyDescriptionForEdition[]; + } else { propStore = []; - target._propStore = propStore; + meta[__bjsPropStoreKey] = propStore; } propStore.push({ - propertyName: propertyKey, + propertyName: String(context.name), displayName: displayName, type: propertyType, groupName: groupName, options: options ?? {}, - className: target.getClassName(), + className: "", }); }; } + +/** @internal */ +export const __bjsPropStoreKey = "__bjs_prop_store__"; + +/** + * Gets the editable properties for a given target using TC39 decorator metadata. + * Walks the metadata prototype chain to include properties from parent classes. + * @param target - the target object (instance or constructor) + * @returns array of property descriptions + */ +export function getEditableProperties(target: any): IPropertyDescriptionForEdition[] { + const ctor = typeof target === "function" ? target : target?.constructor; + const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; + if (!metadata) { + return []; + } + + const result: IPropertyDescriptionForEdition[] = []; + let currentMeta: any = metadata; + while (currentMeta) { + if (Object.hasOwn(currentMeta, __bjsPropStoreKey)) { + const store = currentMeta[__bjsPropStoreKey] as IPropertyDescriptionForEdition[]; + result.push(...store); + } + currentMeta = Object.getPrototypeOf(currentMeta); + } + return result; +} diff --git a/packages/dev/core/src/Lights/light.ts b/packages/dev/core/src/Lights/light.ts index dc7267eed483..c98ee228c1a7 100644 --- a/packages/dev/core/src/Lights/light.ts +++ b/packages/dev/core/src/Lights/light.ts @@ -211,7 +211,7 @@ export abstract class Light extends Node implements ISortableLight { * exceeding the number allowed of the materials. */ @expandToProperty("_reorderLightsInScene") - public renderPriority: number = 0; + public accessor renderPriority: number = 0; @serialize("shadowEnabled") private _shadowEnabled: boolean = true; diff --git a/packages/dev/core/src/Materials/Background/backgroundMaterial.ts b/packages/dev/core/src/Materials/Background/backgroundMaterial.ts index aa4908fa1526..ac7b86788599 100644 --- a/packages/dev/core/src/Materials/Background/backgroundMaterial.ts +++ b/packages/dev/core/src/Materials/Background/backgroundMaterial.ts @@ -247,7 +247,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * Key light Color (multiply against the environment texture) */ @expandToProperty("_markAllSubMeshesAsLightsDirty") - public primaryColor = Color3.White(); + public accessor primaryColor = Color3.White(); @serializeAsColor3() protected __perceptualColor: Nullable; @@ -292,14 +292,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * The primary color is used at the level chosen to define what the white area would look. */ @expandToProperty("_markAllSubMeshesAsLightsDirty") - public get primaryColorHighlightLevel(): float { - return this._primaryColorHighlightLevel; - } - public set primaryColorHighlightLevel(value: float) { - this._primaryColorHighlightLevel = value; - this._computePrimaryColors(); - this._markAllSubMeshesAsLightsDirty(); - } + public accessor primaryColorHighlightLevel: float; @serializeAsTexture() protected _reflectionTexture: Nullable; @@ -308,7 +301,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * Should be author in a specific way for the best result (refer to the documentation). */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionTexture: Nullable = null; + public accessor reflectionTexture: Nullable = null; @serialize() protected _reflectionBlur: float; @@ -319,7 +312,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * texture twice. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionBlur: float = 0; + public accessor reflectionBlur: float = 0; @serializeAsTexture() protected _diffuseTexture: Nullable; @@ -328,7 +321,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * Should be author in a specific way for the best result (refer to the documentation). */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: Nullable = null; + public accessor diffuseTexture: Nullable = null; protected _shadowLights: Nullable = null; /** @@ -336,7 +329,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * All scene shadow lights will be included if null. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public shadowLights: Nullable = null; + public accessor shadowLights: Nullable = null; @serialize() protected _shadowLevel: float; @@ -345,7 +338,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * 0 means black shadows and 1 means no shadows. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public shadowLevel: float = 0; + public accessor shadowLevel: float = 0; @serializeAsVector3() protected _sceneCenter: Vector3; @@ -354,7 +347,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * It is usually zero but might be interesting to modify according to your setup. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public sceneCenter: Vector3 = Vector3.Zero(); + public accessor sceneCenter: Vector3 = Vector3.Zero(); @serialize() protected _opacityFresnel: boolean; @@ -363,7 +356,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This helps ensuring a nice transition when the camera goes under the ground. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public opacityFresnel: boolean = true; + public accessor opacityFresnel: boolean = true; @serialize() protected _reflectionFresnel: boolean; @@ -372,7 +365,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This helps adding a mirror texture on the ground. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionFresnel: boolean = false; + public accessor reflectionFresnel: boolean = false; @serialize() protected _reflectionFalloffDistance: number; @@ -381,7 +374,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This helps adding a nice falloff effect to the reflection if used as a mirror for instance. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionFalloffDistance: number = 0.0; + public accessor reflectionFalloffDistance: number = 0.0; @serialize() protected _reflectionAmount: number; @@ -389,7 +382,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This specifies the weight of the reflection against the background in case of reflection Fresnel. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionAmount: number = 1.0; + public accessor reflectionAmount: number = 1.0; @serialize() protected _reflectionReflectance0: number; @@ -397,7 +390,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This specifies the weight of the reflection at grazing angle. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionReflectance0: number = 0.05; + public accessor reflectionReflectance0: number = 0.05; @serialize() protected _reflectionReflectance90: number; @@ -405,7 +398,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This specifies the weight of the reflection at a perpendicular point of view. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionReflectance90: number = 0.5; + public accessor reflectionReflectance90: number = 0.5; /** * Sets the reflection reflectance fresnel values according to the default standard @@ -431,7 +424,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * Helps to directly use the maps channels instead of their level. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRGBColor: boolean = true; + public accessor useRGBColor: boolean = true; @serialize() protected _enableNoise: boolean; @@ -439,7 +432,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * This helps reducing the banding effect that could occur on the background. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public enableNoise: boolean = false; + public accessor enableNoise: boolean = false; /** * The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values "zoom in" and higher values "zoom out". @@ -468,7 +461,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * Number of Simultaneous lights allowed on the material. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public maxSimultaneousLights: int = 4; + public accessor maxSimultaneousLights: int = 4; @serialize() private _shadowOnly: boolean = false; @@ -476,7 +469,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { * Make the material only render shadows */ @expandToProperty("_markAllSubMeshesAsLightsDirty") - public shadowOnly: boolean = false; + public accessor shadowOnly: boolean = false; /** * Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB. @@ -491,7 +484,7 @@ export class BackgroundMaterial extends BackgroundMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public enableGroundProjection: boolean = false; + public accessor enableGroundProjection: boolean = false; /** * Defines the radius of the projected ground if enableGroundProjection is true. diff --git a/packages/dev/core/src/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.ts b/packages/dev/core/src/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.ts index d5fc34f90762..9fbc790a38a5 100644 --- a/packages/dev/core/src/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.ts +++ b/packages/dev/core/src/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.ts @@ -28,7 +28,7 @@ export class GaussianSplattingSolidColorMaterialPlugin extends MaterialPluginBas */ @serialize() @expandToProperty("_onIsEnabledChanged") - public isEnabled = true; + public accessor isEnabled = true; /** @internal */ public _onIsEnabledChanged(): void { diff --git a/packages/dev/core/src/Materials/Node/Blocks/Dual/lightBlock.ts b/packages/dev/core/src/Materials/Node/Blocks/Dual/lightBlock.ts index 3eac754a86a2..36a7da7537fb 100644 --- a/packages/dev/core/src/Materials/Node/Blocks/Dual/lightBlock.ts +++ b/packages/dev/core/src/Materials/Node/Blocks/Dual/lightBlock.ts @@ -31,7 +31,7 @@ export class LightBlock extends NodeMaterialBlock { /** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */ @editableInPropertyPage("Generate only fragment code", PropertyTypeForEdition.Boolean, "ADVANCED", { - notifiers: { rebuild: true, update: true, onValidation: LightBlock._OnGenerateOnlyFragmentCodeChanged }, + notifiers: { rebuild: true, update: true, onValidation: (block, prop) => LightBlock._OnGenerateOnlyFragmentCodeChanged(block, prop) }, }) public generateOnlyFragmentCode = false; diff --git a/packages/dev/core/src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts b/packages/dev/core/src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts index 7333e7f2f9bc..cc4638bfef64 100644 --- a/packages/dev/core/src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts +++ b/packages/dev/core/src/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.ts @@ -101,7 +101,7 @@ export abstract class ReflectionTextureBaseBlock extends NodeMaterialBlock { /** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */ @editableInPropertyPage("Generate only fragment code", PropertyTypeForEdition.Boolean, "ADVANCED", { - notifiers: { rebuild: true, update: true, onValidation: ReflectionTextureBaseBlock._OnGenerateOnlyFragmentCodeChanged }, + notifiers: { rebuild: true, update: true, onValidation: (block, prop) => ReflectionTextureBaseBlock._OnGenerateOnlyFragmentCodeChanged(block, prop) }, }) public generateOnlyFragmentCode = false; diff --git a/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts b/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts index 41922c5b8bef..7fe6b59fd51d 100644 --- a/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts +++ b/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts @@ -320,7 +320,7 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock { /** Indicates that no code should be generated in the vertex shader. Can be useful in some specific circumstances (like when doing ray marching for eg) */ @editableInPropertyPage("Generate only fragment code", PropertyTypeForEdition.Boolean, "ADVANCED", { - notifiers: { rebuild: true, update: true, onValidation: PBRMetallicRoughnessBlock._OnGenerateOnlyFragmentCodeChanged }, + notifiers: { rebuild: true, update: true, onValidation: (block, prop) => PBRMetallicRoughnessBlock._OnGenerateOnlyFragmentCodeChanged(block, prop) }, }) public generateOnlyFragmentCode = false; diff --git a/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts b/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts index 0b70a8586a7a..dc593e409280 100644 --- a/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts @@ -469,8 +469,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Base Weight is a multiplier on the diffuse and metal lobes. * See OpenPBR's specs for base_weight */ - public baseWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseWeight: Property = new Property("base_weight", 1, "vBaseWeight", 1); @@ -478,8 +478,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Base Weight is a multiplier on the diffuse and metal lobes. * See OpenPBR's specs for base_weight */ - public baseWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseWeightTexture: Sampler = new Sampler("base_weight", "baseWeight", "BASE_WEIGHT"); @@ -487,8 +487,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Color of the base diffuse lobe. * See OpenPBR's specs for base_color */ - public baseColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseColor: Property = new Property("base_color", Color3.White(), "vBaseColor", 4); @@ -496,8 +496,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Base Color Texture property. * See OpenPBR's specs for base_color */ - public baseColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseColorTexture: Sampler = new Sampler("base_color", "baseColor", "BASE_COLOR"); @@ -505,8 +505,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Roughness of the diffuse lobe. * See OpenPBR's specs for base_diffuse_roughness */ - public baseDiffuseRoughness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseDiffuseRoughness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseDiffuseRoughness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseDiffuseRoughness: Property = new Property("base_diffuse_roughness", 0, "vBaseDiffuseRoughness", 1); @@ -514,8 +514,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Roughness texture of the diffuse lobe. * See OpenPBR's specs for base_diffuse_roughness */ - public baseDiffuseRoughnessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseDiffuseRoughnessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseDiffuseRoughnessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseDiffuseRoughnessTexture: Sampler = new Sampler("base_diffuse_roughness", "baseDiffuseRoughness", "BASE_DIFFUSE_ROUGHNESS"); @@ -523,8 +523,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Metalness of the base lobe. * See OpenPBR's specs for base_metalness */ - public baseMetalness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseMetalness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseMetalness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseMetalness: Property = new Property("base_metalness", 0, "vReflectanceInfo", 4, 0); @@ -532,8 +532,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Metalness texture. * See OpenPBR's specs for base_metalness */ - public baseMetalnessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "baseMetalnessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor baseMetalnessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _baseMetalnessTexture: Sampler = new Sampler("base_metalness", "baseMetalness", "BASE_METALNESS"); @@ -541,8 +541,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Weight of the specular lobe. * See OpenPBR's specs for specular_weight */ - public specularWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularWeight: Property = new Property("specular_weight", 1, "vReflectanceInfo", 4, 3); @@ -550,8 +550,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Weight texture of the specular lobe. * See OpenPBR's specs for specular_weight */ - public specularWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularWeightTexture: Sampler = new Sampler("specular_weight", "specularWeight", "SPECULAR_WEIGHT"); @@ -559,8 +559,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Color of the specular lobe. * See OpenPBR's specs for specular_color */ - public specularColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularColor: Property = new Property("specular_color", Color3.White(), "vSpecularColor", 4); @@ -568,8 +568,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Specular Color Texture property. * See OpenPBR's specs for specular_color */ - public specularColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularColorTexture: Sampler = new Sampler("specular_color", "specularColor", "SPECULAR_COLOR"); @@ -577,8 +577,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Roughness of the specular lobe. * See OpenPBR's specs for specular_roughness */ - public specularRoughness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularRoughness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularRoughness: Property = new Property("specular_roughness", 0.3, "vReflectanceInfo", 4, 1); @@ -586,8 +586,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Roughness texture of the specular lobe. * See OpenPBR's specs for specular_roughness */ - public specularRoughnessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughnessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularRoughnessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularRoughnessTexture: Sampler = new Sampler("specular_roughness", "specularRoughness", "SPECULAR_ROUGHNESS"); @@ -595,8 +595,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Anisotropic roughness of the specular lobe. * See OpenPBR's specs for specular_roughness_anisotropy */ - public specularRoughnessAnisotropy: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughnessAnisotropy") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularRoughnessAnisotropy: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularRoughnessAnisotropy: Property = new Property("specular_roughness_anisotropy", 0, "vSpecularAnisotropy", 3, 2); @@ -604,8 +604,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Anisotropic Roughness texture. * See OpenPBR's specs for specular_roughness */ - public specularRoughnessAnisotropyTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularRoughnessAnisotropyTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularRoughnessAnisotropyTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularRoughnessAnisotropyTexture: Sampler = new Sampler("specular_roughness_anisotropy", "specularRoughnessAnisotropy", "SPECULAR_ROUGHNESS_ANISOTROPY"); @@ -613,8 +613,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * IOR of the specular lobe. * See OpenPBR's specs for specular_ior */ - public specularIor: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "specularIor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor specularIor: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _specularIor: Property = new Property("specular_ior", 1.5, "vReflectanceInfo", 4, 2); @@ -622,8 +622,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission weight of the surface. * See OpenPBR's specs for transmission_weight */ - public transmissionWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionWeight: Property = new Property("transmission_weight", 0.0, "vTransmissionWeight", 1); @@ -631,8 +631,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission weight texture. * See OpenPBR's specs for transmission_weight */ - public transmissionWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionWeightTexture: Sampler = new Sampler("transmission_weight", "transmissionWeight", "TRANSMISSION_WEIGHT"); @@ -640,8 +640,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission color of the surface. * See OpenPBR's specs for transmission_color */ - public transmissionColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionColor: Property = new Property("transmission_color", Color3.White(), "vTransmissionColor", 3, 0); @@ -649,8 +649,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission color texture. * See OpenPBR's specs for transmission_color */ - public transmissionColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionColorTexture: Sampler = new Sampler("transmission_color", "transmissionColor", "TRANSMISSION_COLOR"); @@ -658,8 +658,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission depth of the volume * See OpenPBR's specs for transmission_depth */ - public transmissionDepth: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionDepth") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionDepth: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionDepth: Property = new Property("transmission_depth", 0.0, "vTransmissionDepth", 1, 0); @@ -667,8 +667,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission depth texture. * See OpenPBR's specs for transmission_depth */ - public transmissionDepthTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionDepthTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionDepthTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionDepthTexture: Sampler = new Sampler("transmission_depth", "transmissionDepth", "TRANSMISSION_DEPTH"); @@ -676,8 +676,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission scatter of the surface. * See OpenPBR's specs for transmission_scatter */ - public transmissionScatter: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionScatter") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionScatter: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionScatter: Property = new Property("transmission_scatter", Color3.Black(), "vTransmissionScatter", 3, 0); @@ -685,8 +685,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission scatter texture. * See OpenPBR's specs for transmission_scatter */ - public transmissionScatterTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionScatterTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionScatterTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionScatterTexture: Sampler = new Sampler("transmission_scatter", "transmissionScatter", "TRANSMISSION_SCATTER"); @@ -694,8 +694,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission scatter anisotropy * See OpenPBR's specs for transmission_scatter_anisotropy */ - public transmissionScatterAnisotropy: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionScatterAnisotropy") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionScatterAnisotropy: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionScatterAnisotropy: Property = new Property("transmission_scatter_anisotropy", 0.0, "vTransmissionScatterAnisotropy", 1, 0); @@ -703,8 +703,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission Dispersion Scale factor. * See OpenPBR's specs for transmission_dispersion_scale */ - public transmissionDispersionScale: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionDispersionScale") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionDispersionScale: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionDispersionScale: Property = new Property("transmission_dispersion_scale", 0.0, "vTransmissionDispersionScale", 1, 0); @@ -712,8 +712,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission Dispersion Scale texture. * See OpenPBR's specs for transmission_dispersion_scale */ - public transmissionDispersionScaleTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionDispersionScaleTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionDispersionScaleTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionDispersionScaleTexture: Sampler = new Sampler("transmission_dispersion_scale", "transmissionDispersionScale", "TRANSMISSION_DISPERSION_SCALE"); @@ -721,8 +721,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Transmission Dispersion Abbe number. * See OpenPBR's specs for transmission_dispersion_abbe_number */ - public transmissionDispersionAbbeNumber: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "transmissionDispersionAbbeNumber") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor transmissionDispersionAbbeNumber: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _transmissionDispersionAbbeNumber: Property = new Property("transmission_dispersion_abbe_number", 20.0, "vTransmissionDispersionAbbeNumber", 1, 0); @@ -730,8 +730,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the amount of clear coat on the surface. * See OpenPBR's specs for coat_weight */ - public coatWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatWeight: Property = new Property("coat_weight", 0.0, "vCoatWeight", 1, 0); @@ -739,8 +739,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Coat weight texture. * See OpenPBR's specs for coat_weight */ - public coatWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatWeightTexture: Sampler = new Sampler("coat_weight", "coatWeight", "COAT_WEIGHT"); @@ -748,8 +748,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the color of the clear coat on the surface. * See OpenPBR's specs for coat_color */ - public coatColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatColor: Property = new Property("coat_color", Color3.White(), "vCoatColor", 3, 0); @@ -757,8 +757,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Color texture of the clear coat. * See OpenPBR's specs for coat_color */ - public coatColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatColorTexture: Sampler = new Sampler("coat_color", "coatColor", "COAT_COLOR"); @@ -766,8 +766,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the roughness of the clear coat on the surface. * See OpenPBR's specs for coat_roughness */ - public coatRoughness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatRoughness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatRoughness: Property = new Property("coat_roughness", 0.0, "vCoatRoughness", 1, 0); @@ -775,8 +775,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Roughness texture of the clear coat. * See OpenPBR's specs for coat_roughness */ - public coatRoughnessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughnessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatRoughnessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatRoughnessTexture: Sampler = new Sampler("coat_roughness", "coatRoughness", "COAT_ROUGHNESS"); @@ -784,8 +784,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the anisotropy of the clear coat on the surface. * See OpenPBR's specs for coat_roughness_anisotropy */ - public coatRoughnessAnisotropy: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughnessAnisotropy") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatRoughnessAnisotropy: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatRoughnessAnisotropy: Property = new Property("coat_roughness_anisotropy", 0, "vCoatRoughnessAnisotropy", 1); @@ -793,8 +793,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Anisotropic Roughness texture of the clear coat. * See OpenPBR's specs for coat_roughness_anisotropy */ - public coatRoughnessAnisotropyTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatRoughnessAnisotropyTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatRoughnessAnisotropyTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatRoughnessAnisotropyTexture: Sampler = new Sampler("coat_roughness_anisotropy", "coatRoughnessAnisotropy", "COAT_ROUGHNESS_ANISOTROPY"); @@ -802,8 +802,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the IOR of the clear coat on the surface. * See OpenPBR's specs for coat_ior */ - public coatIor: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatIor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatIor: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatIor: Property = new Property("coat_ior", 1.5, "vCoatIor", 1, 0); @@ -813,8 +813,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * is applied, while a value of 0.0 means that no darkening is applied. * See OpenPBR's specs for coat_darkening */ - public coatDarkening: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatDarkening") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatDarkening: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatDarkening: Property = new Property("coat_darkening", 1.0, "vCoatDarkening", 1, 0); @@ -824,8 +824,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * is applied, while a value of 0.0 means that no darkening is applied. * See OpenPBR's specs for coat_darkening */ - public coatDarkeningTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "coatDarkeningTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor coatDarkeningTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _coatDarkeningTexture: Sampler = new Sampler("coat_darkening", "coatDarkening", "COAT_DARKENING"); @@ -839,8 +839,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the weight of the fuzz layer on the surface. * See OpenPBR's specs for fuzz_weight */ - public fuzzWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor fuzzWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _fuzzWeight: Property = new Property("fuzz_weight", 0.0, "vFuzzWeight", 1, 0); @@ -848,8 +848,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Weight texture of the fuzz layer. * See OpenPBR's specs for fuzz_weight */ - public fuzzWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor fuzzWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _fuzzWeightTexture: Sampler = new Sampler("fuzz_weight", "fuzzWeight", "FUZZ_WEIGHT"); @@ -857,8 +857,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the color of the fuzz layer on the surface. * See OpenPBR's specs for fuzz_color */ - public fuzzColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor fuzzColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _fuzzColor: Property = new Property("fuzz_color", Color3.White(), "vFuzzColor", 3, 0); @@ -866,8 +866,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Color texture of the fuzz layer. * See OpenPBR's specs for fuzz_color */ - public fuzzColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor fuzzColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _fuzzColorTexture: Sampler = new Sampler("fuzz_color", "fuzzColor", "FUZZ_COLOR"); @@ -875,8 +875,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the roughness of the fuzz layer on the surface. * See OpenPBR's specs for fuzz_roughness */ - public fuzzRoughness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzRoughness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor fuzzRoughness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _fuzzRoughness: Property = new Property("fuzz_roughness", 0.5, "vFuzzRoughness", 1, 0); @@ -884,8 +884,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Roughness texture of the fuzz layer. * See OpenPBR's specs for fuzz_roughness */ - public fuzzRoughnessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "fuzzRoughnessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor fuzzRoughnessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _fuzzRoughnessTexture: Sampler = new Sampler("fuzz_roughness", "fuzzRoughness", "FUZZ_ROUGHNESS"); @@ -893,8 +893,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the normal of the material's geometry. * See OpenPBR's specs for geometry_normal */ - public geometryNormalTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryNormalTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryNormalTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryNormalTexture: Sampler = new Sampler("geometry_normal", "geometryNormal", "GEOMETRY_NORMAL"); @@ -902,8 +902,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the tangent of the material's geometry. Used only for anisotropic reflections. * See OpenPBR's specs for geometry_tangent */ - public geometryTangent: Vector2; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryTangent") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryTangent: Vector2; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryTangent: Property = new Property("geometry_tangent", new Vector2(1, 0), "vSpecularAnisotropy", 3, 0); @@ -923,8 +923,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the tangent of the material's geometry. Used only for anisotropic reflections. * See OpenPBR's specs for geometry_tangent */ - public geometryTangentTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryTangentTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryTangentTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryTangentTexture: Sampler = new Sampler("geometry_tangent", "geometryTangent", "GEOMETRY_TANGENT"); @@ -932,8 +932,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the normal of the material's coat layer. * See OpenPBR's specs for geometry_coat_normal */ - public geometryCoatNormalTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryCoatNormalTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryCoatNormalTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryCoatNormalTexture: Sampler = new Sampler("geometry_coat_normal", "geometryCoatNormal", "GEOMETRY_COAT_NORMAL"); @@ -941,8 +941,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the tangent of the material's coat layer. Used only for anisotropic reflections. * See OpenPBR's specs for geometry_coat_tangent */ - public geometryCoatTangent: Vector2; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryCoatTangent") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryCoatTangent: Vector2; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryCoatTangent: Property = new Property("geometry_coat_tangent", new Vector2(1, 0), "vGeometryCoatTangent", 2, 0); @@ -964,8 +964,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the tangent of the material's coat layer. Used only for anisotropic reflections. * See OpenPBR's specs for geometry_coat_tangent */ - public geometryCoatTangentTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryCoatTangentTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryCoatTangentTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryCoatTangentTexture: Sampler = new Sampler("geometry_coat_tangent", "geometryCoatTangent", "GEOMETRY_COAT_TANGENT"); @@ -973,8 +973,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the opacity of the material's geometry. * See OpenPBR's specs for geometry_opacity */ - public geometryOpacity: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryOpacity") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryOpacity: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryOpacity: Property = new Property("geometry_opacity", 1.0, "vBaseColor", 4, 3); @@ -982,8 +982,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the opacity texture of the material's geometry. * See OpenPBR's specs for geometry_opacity */ - public geometryOpacityTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryOpacityTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryOpacityTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryOpacityTexture: Sampler = new Sampler("geometry_opacity", "geometryOpacity", "GEOMETRY_OPACITY"); @@ -991,8 +991,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the thickness of the material's geometry. * Not part of OpenPBR's specs but useful for rasterization approximations of volume. */ - public geometryThickness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryThickness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryThickness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryThickness: Property = new Property("geometry_thickness", 0.0, "vGeometryThickness", 1, 0); @@ -1000,8 +1000,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the thickness of the material's geometry. * Not part of OpenPBR's specs but useful for rasterization approximations of volume. */ - public geometryThicknessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryThicknessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryThicknessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryThicknessTexture: Sampler = new Sampler("geometry_thickness", "geometryThickness", "GEOMETRY_THICKNESS"); @@ -1009,8 +1009,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the luminance of the material's emission. * See OpenPBR's specs for emission_luminance */ - public emissionLuminance: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "emissionLuminance") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor emissionLuminance: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _emissionLuminance: Property = new Property("emission_luminance", 1.0, "vLightingIntensity", 4, 1); @@ -1018,8 +1018,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the color of the material's emission. * See OpenPBR's specs for emission_color */ - public emissionColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "emissionColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor emissionColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _emissionColor: Property = new Property("emission_color", Color3.Black(), "vEmissionColor", 3); @@ -1027,24 +1027,24 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the texture of the material's emission color. * See OpenPBR's specs for emission_color */ - public emissionColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "emissionColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor emissionColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _emissionColorTexture: Sampler = new Sampler("emission_color", "emissionColor", "EMISSION_COLOR"); /** * Defines the weight of the thin film layer on top of the base layer for iridescent effects. */ - public thinFilmWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "thinFilmWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor thinFilmWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _thinFilmWeight: Property = new Property("thin_film_weight", 0.0, "vThinFilmWeight", 1, 0); /** * Thin film weight texture. */ - public thinFilmWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "thinFilmWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor thinFilmWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _thinFilmWeightTexture: Sampler = new Sampler("thin_film_weight", "thinFilmWeight", "THIN_FILM_WEIGHT"); @@ -1053,40 +1053,40 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * this value will act as a multiplier to the texture values. * See OpenPBR's specs for thin_film_thickness */ - public thinFilmThickness: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "thinFilmThickness") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor thinFilmThickness: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _thinFilmThickness: Property = new Property("thin_film_thickness", 0.5, "vThinFilmThickness", 2, 0); /** * Defines the minimum thickness of the thin film layer in μm. */ - public thinFilmThicknessMin: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "thinFilmThicknessMin") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor thinFilmThicknessMin: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _thinFilmThicknessMin: Property = new Property("thin_film_thickness_min", 0.0, "vThinFilmThickness", 2, 1); /** * Defines the maximum thickness of the thin film layer in μm. */ - public thinFilmThicknessTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "thinFilmThicknessTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor thinFilmThicknessTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _thinFilmThicknessTexture: Sampler = new Sampler("thin_film_thickness", "thinFilmThickness", "THIN_FILM_THICKNESS"); /** * Defines the index of refraction of the thin film layer. */ - public thinFilmIor: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "thinFilmIor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor thinFilmIor: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _thinFilmIor: Property = new Property("thin_film_ior", 1.4, "vThinFilmIor", 1, 0); /** * Defines the ambient occlusion texture. */ - public ambientOcclusionTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "ambientOcclusionTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor ambientOcclusionTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _ambientOcclusionTexture: Sampler = new Sampler("ambient_occlusion", "ambientOcclusion", "AMBIENT_OCCLUSION"); @@ -1103,7 +1103,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public directIntensity: number = 1.0; + public accessor directIntensity: number = 1.0; /** * Intensity of the environment e.g. how much the environment will light the object @@ -1111,42 +1111,42 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public environmentIntensity: number = 1.0; + public accessor environmentIntensity: number = 1.0; /** * Specifies that the specular weight is stored in the alpha channel of the specular weight texture. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useSpecularWeightFromTextureAlpha = false; + public accessor useSpecularWeightFromTextureAlpha = false; /** * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public forceAlphaTest = false; + public accessor forceAlphaTest = false; /** * Defines the alpha limits in alpha test mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public alphaCutOff = 0.4; + public accessor alphaCutOff = 0.4; /** * Specifies if the metallic texture contains the ambient occlusion information in its red channel. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAmbientOcclusionFromMetallicTextureRed = false; + public accessor useAmbientOcclusionFromMetallicTextureRed = false; /** * Specifies if the ambient texture contains the ambient occlusion information in its red channel only. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAmbientInGrayScale = false; + public accessor useAmbientInGrayScale = false; /** * BJS is using an hardcoded light falloff based on a manually sets up range. @@ -1207,70 +1207,70 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useObjectSpaceNormalMap = false; + public accessor useObjectSpaceNormalMap = false; /** * Allows using the normal map in parallax mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useParallax = false; + public accessor useParallax = false; /** * Allows using the normal map in parallax occlusion mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useParallaxOcclusion = false; + public accessor useParallaxOcclusion = false; /** * Controls the scale bias of the parallax mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public parallaxScaleBias = 0.05; + public accessor parallaxScaleBias = 0.05; /** * If sets to true, disables all the lights affecting the material. */ @serialize() @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting = false; + public accessor disableLighting = false; /** * Force the shader to compute irradiance in the fragment shader in order to take normal mapping into account. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public forceIrradianceInFragment = false; + public accessor forceIrradianceInFragment = false; /** * Number of Simultaneous lights allowed on the material. */ @serialize() @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights = 4; + public accessor maxSimultaneousLights = 4; /** * If sets to true, x component of normal map value will invert (x = 1.0 - x). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapX = false; + public accessor invertNormalMapX = false; /** * If sets to true, y component of normal map value will invert (y = 1.0 - y). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapY = false; + public accessor invertNormalMapY = false; /** * If sets to true and backfaceCulling is false, normals will be flipped on the backside. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public twoSidedLighting = false; + public accessor twoSidedLighting = false; /** * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested. @@ -1278,7 +1278,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAlphaFresnel = false; + public accessor useAlphaFresnel = false; /** * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested. @@ -1286,7 +1286,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useLinearAlphaFresnel = false; + public accessor useLinearAlphaFresnel = false; /** * Let user defines the brdf lookup texture used for IBL. @@ -1297,14 +1297,14 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public environmentBRDFTexture: Nullable = null; + public accessor environmentBRDFTexture: Nullable = null; /** * Force normal to face away from face. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public forceNormalForward = false; + public accessor forceNormalForward = false; /** * Enables specular anti aliasing in the PBR shader. @@ -1313,7 +1313,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public enableSpecularAntiAliasing = false; + public accessor enableSpecularAntiAliasing = false; /** * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal @@ -1321,7 +1321,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useHorizonOcclusion = true; + public accessor useHorizonOcclusion = true; /** * This parameters will enable/disable radiance occlusion by preventing the radiance to lit @@ -1329,21 +1329,21 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRadianceOcclusion = true; + public accessor useRadianceOcclusion = true; /** * If set to true, no lighting calculations will be applied. */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public unlit = false; + public accessor unlit = false; /** * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false) */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public applyDecalMapAfterDetailMap = false; + public accessor applyDecalMapAfterDetailMap = false; /** * Force all the PBR materials to compile to glsl even on WebGPU engines. @@ -1668,7 +1668,7 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * It helps seeing only some components of the material while troubleshooting. */ @expandToProperty("_markAllSubMeshesAsMiscDirty") - public debugMode = 0; + public accessor debugMode = 0; /** * @internal diff --git a/packages/dev/core/src/Materials/PBR/pbrAnisotropicConfiguration.ts b/packages/dev/core/src/Materials/PBR/pbrAnisotropicConfiguration.ts index c254a4beff15..cd3587cc8be8 100644 --- a/packages/dev/core/src/Materials/PBR/pbrAnisotropicConfiguration.ts +++ b/packages/dev/core/src/Materials/PBR/pbrAnisotropicConfiguration.ts @@ -38,7 +38,7 @@ export class PBRAnisotropicConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; /** * Defines the anisotropy strength (between 0 and 1) it defaults to 1. @@ -77,7 +77,7 @@ export class PBRAnisotropicConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public texture: Nullable = null; + public accessor texture: Nullable = null; private _legacy = false; /** @@ -85,7 +85,7 @@ export class PBRAnisotropicConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public legacy: boolean = false; + public accessor legacy: boolean = false; /** @internal */ private _internalMarkAllSubMeshesAsTexturesDirty: () => void; diff --git a/packages/dev/core/src/Materials/PBR/pbrBRDFConfiguration.ts b/packages/dev/core/src/Materials/PBR/pbrBRDFConfiguration.ts index cb42dedf0cac..484d7c997e37 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBRDFConfiguration.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBRDFConfiguration.ts @@ -83,7 +83,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION; + public accessor useEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_ENERGY_CONSERVATION; private _useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED; /** @@ -96,7 +96,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED; + public accessor useSmithVisibilityHeightCorrelated = PBRBRDFConfiguration.DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED; private _useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS; /** @@ -108,7 +108,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS; + public accessor useSphericalHarmonics = PBRBRDFConfiguration.DEFAULT_USE_SPHERICAL_HARMONICS; private _useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION; /** @@ -119,7 +119,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION; + public accessor useSpecularGlossinessInputEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION; private _mixIblRadianceWithIrradiance = PBRBRDFConfiguration.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE; /** @@ -129,7 +129,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public mixIblRadianceWithIrradiance = PBRBRDFConfiguration.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE; + public accessor mixIblRadianceWithIrradiance = PBRBRDFConfiguration.DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE; private _useLegacySpecularEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION; /** @@ -138,7 +138,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public useLegacySpecularEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION; + public accessor useLegacySpecularEnergyConservation = PBRBRDFConfiguration.DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION; private _baseDiffuseModel: number = PBRBRDFConfiguration.DEFAULT_DIFFUSE_MODEL; /** @@ -146,7 +146,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize("baseDiffuseModel") @expandToProperty("_markAllSubMeshesAsMiscDirty") - public baseDiffuseModel: number = PBRBRDFConfiguration.DEFAULT_DIFFUSE_MODEL; + public accessor baseDiffuseModel: number = PBRBRDFConfiguration.DEFAULT_DIFFUSE_MODEL; private _dielectricSpecularModel: number = PBRBRDFConfiguration.DEFAULT_DIELECTRIC_SPECULAR_MODEL; /** @@ -154,7 +154,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize("dielectricSpecularModel") @expandToProperty("_markAllSubMeshesAsMiscDirty") - public dielectricSpecularModel: number = PBRBRDFConfiguration.DEFAULT_DIELECTRIC_SPECULAR_MODEL; + public accessor dielectricSpecularModel: number = PBRBRDFConfiguration.DEFAULT_DIELECTRIC_SPECULAR_MODEL; private _conductorSpecularModel: number = PBRBRDFConfiguration.DEFAULT_CONDUCTOR_SPECULAR_MODEL; /** @@ -162,7 +162,7 @@ export class PBRBRDFConfiguration extends MaterialPluginBase { */ @serialize("conductorSpecularModel") @expandToProperty("_markAllSubMeshesAsMiscDirty") - public conductorSpecularModel: number = PBRBRDFConfiguration.DEFAULT_CONDUCTOR_SPECULAR_MODEL; + public accessor conductorSpecularModel: number = PBRBRDFConfiguration.DEFAULT_CONDUCTOR_SPECULAR_MODEL; /** @internal */ private _internalMarkAllSubMeshesAsMiscDirty: () => void; diff --git a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts index 09b67108eb8c..456b858c17d2 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts @@ -860,7 +860,7 @@ export abstract class PBRBaseMaterial extends PBRBaseMaterialBase { * It helps seeing only some components of the material while troubleshooting. */ @expandToProperty("_markAllSubMeshesAsMiscDirty") - public debugMode = 0; + public accessor debugMode = 0; /** * @internal diff --git a/packages/dev/core/src/Materials/PBR/pbrBaseSimpleMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrBaseSimpleMaterial.ts index 121cd05247f2..9c61a7becd82 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBaseSimpleMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBaseSimpleMaterial.ts @@ -17,77 +17,77 @@ export abstract class PBRBaseSimpleMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights = 4; + public accessor maxSimultaneousLights = 4; /** * If sets to true, disables all the lights affecting the material. */ @serialize() @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting = false; + public accessor disableLighting = false; /** * Environment Texture used in the material (this is use for both reflection and environment lighting). */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_reflectionTexture") - public environmentTexture: Nullable; + public accessor environmentTexture: Nullable; /** * If sets to true, x component of normal map value will invert (x = 1.0 - x). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapX = false; + public accessor invertNormalMapX = false; /** * If sets to true, y component of normal map value will invert (y = 1.0 - y). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapY = false; + public accessor invertNormalMapY = false; /** * Normal map used in the model. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_bumpTexture") - public normalTexture: Nullable; + public accessor normalTexture: Nullable; /** * Emissivie color used to self-illuminate the model. */ @serializeAsColor3("emissive") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public emissiveColor = new Color3(0, 0, 0); + public accessor emissiveColor = new Color3(0, 0, 0); /** * Emissivie texture used to self-illuminate the model. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public emissiveTexture: Nullable; + public accessor emissiveTexture: Nullable; /** * Occlusion Channel Strength. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_ambientTextureStrength") - public occlusionStrength: number = 1.0; + public accessor occlusionStrength: number = 1.0; /** * Occlusion Texture of the material (adding extra occlusion effects). */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_ambientTexture") - public occlusionTexture: Nullable; + public accessor occlusionTexture: Nullable; /** * Defines the alpha limits in alpha test mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_alphaCutOff") - public alphaCutOff: number; + public accessor alphaCutOff: number; /** * Gets the current double sided mode. @@ -113,14 +113,14 @@ export abstract class PBRBaseSimpleMaterial extends PBRBaseMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", null) - public lightmapTexture: Nullable; + public accessor lightmapTexture: Nullable; /** * If true, the light map contains occlusion information instead of lighting info. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useLightmapAsShadowmap = false; + public accessor useLightmapAsShadowmap = false; /** * Instantiates a new PBRMaterial instance. diff --git a/packages/dev/core/src/Materials/PBR/pbrClearCoatConfiguration.ts b/packages/dev/core/src/Materials/PBR/pbrClearCoatConfiguration.ts index b6eb5b13a69e..29daf3df3a27 100644 --- a/packages/dev/core/src/Materials/PBR/pbrClearCoatConfiguration.ts +++ b/packages/dev/core/src/Materials/PBR/pbrClearCoatConfiguration.ts @@ -57,7 +57,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; /** * Defines the clear coat layer strength (between 0 and 1) it defaults to 1. @@ -80,7 +80,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction; + public accessor indexOfRefraction = PBRClearCoatConfiguration._DefaultIndexOfRefraction; private _texture: Nullable = null; /** @@ -90,7 +90,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public texture: Nullable = null; + public accessor texture: Nullable = null; private _useRoughnessFromMainTexture = true; /** @@ -99,7 +99,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRoughnessFromMainTexture = true; + public accessor useRoughnessFromMainTexture = true; private _textureRoughness: Nullable = null; /** @@ -108,7 +108,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public textureRoughness: Nullable = null; + public accessor textureRoughness: Nullable = null; private _remapF0OnInterfaceChange = true; /** @@ -116,7 +116,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public remapF0OnInterfaceChange = true; + public accessor remapF0OnInterfaceChange = true; private _bumpTexture: Nullable = null; /** @@ -124,7 +124,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture: Nullable = null; + public accessor bumpTexture: Nullable = null; private _isTintEnabled = false; /** @@ -132,7 +132,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isTintEnabled = false; + public accessor isTintEnabled = false; /** * Defines the clear coat tint of the material. @@ -164,7 +164,7 @@ export class PBRClearCoatConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public tintTexture: Nullable = null; + public accessor tintTexture: Nullable = null; /** @internal */ private _internalMarkAllSubMeshesAsTexturesDirty: () => void; diff --git a/packages/dev/core/src/Materials/PBR/pbrIridescenceConfiguration.ts b/packages/dev/core/src/Materials/PBR/pbrIridescenceConfiguration.ts index 63a688536c5b..311e9c625f9a 100644 --- a/packages/dev/core/src/Materials/PBR/pbrIridescenceConfiguration.ts +++ b/packages/dev/core/src/Materials/PBR/pbrIridescenceConfiguration.ts @@ -58,7 +58,7 @@ export class PBRIridescenceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; /** * Defines the iridescence layer strength (between 0 and 1) it defaults to 1. @@ -90,7 +90,7 @@ export class PBRIridescenceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public texture: Nullable = null; + public accessor texture: Nullable = null; private _thicknessTexture: Nullable = null; /** @@ -98,7 +98,7 @@ export class PBRIridescenceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public thicknessTexture: Nullable = null; + public accessor thicknessTexture: Nullable = null; /** @internal */ private _internalMarkAllSubMeshesAsTexturesDirty: () => void; diff --git a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts index 366acf92344b..1a00f6808152 100644 --- a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts @@ -50,7 +50,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public directIntensity: number = 1.0; + public accessor directIntensity: number = 1.0; /** * Intensity of the emissive part of the material. @@ -58,7 +58,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public emissiveIntensity: number = 1.0; + public accessor emissiveIntensity: number = 1.0; /** * Intensity of the environment e.g. how much the environment will light the object @@ -66,7 +66,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public environmentIntensity: number = 1.0; + public accessor environmentIntensity: number = 1.0; /** * This is a special control allowing the reduction of the specular highlights coming from the @@ -74,49 +74,49 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public specularIntensity: number = 1.0; + public accessor specularIntensity: number = 1.0; /** * Debug Control allowing disabling the bump map on this material. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public disableBumpMap: boolean = false; + public accessor disableBumpMap: boolean = false; /** * AKA Diffuse Texture in standard nomenclature. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public albedoTexture: Nullable; + public accessor albedoTexture: Nullable; /** * OpenPBR Base Weight texture (multiplier to the diffuse and metal lobes). */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public baseWeightTexture: Nullable; + public accessor baseWeightTexture: Nullable; /** * OpenPBR Base Diffuse Roughness texture (roughness of the diffuse lobe). */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public baseDiffuseRoughnessTexture: Nullable; + public accessor baseDiffuseRoughnessTexture: Nullable; /** * AKA Occlusion Texture in other nomenclature. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public ambientTexture: Nullable; + public accessor ambientTexture: Nullable; /** * AKA Occlusion Texture Intensity in other nomenclature. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public ambientTextureStrength: number = 1.0; + public accessor ambientTextureStrength: number = 1.0; /** * Defines how much the AO map is occluding the analytical lights (point spot...). @@ -125,42 +125,42 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public ambientTextureImpactOnAnalyticalLights: number = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS; + public accessor ambientTextureImpactOnAnalyticalLights: number = PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS; /** * Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public opacityTexture: Nullable; + public accessor opacityTexture: Nullable; /** * Stores the reflection values in a texture. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionTexture: Nullable; + public accessor reflectionTexture: Nullable; /** * Stores the emissive values in a texture. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public emissiveTexture: Nullable; + public accessor emissiveTexture: Nullable; /** * AKA Specular texture in other nomenclature. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectivityTexture: Nullable; + public accessor reflectivityTexture: Nullable; /** * Used to switch from specular/glossiness to metallic/roughness workflow. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public metallicTexture: Nullable; + public accessor metallicTexture: Nullable; /** * Specifies the metallic scalar of the metallic/roughness workflow. @@ -168,7 +168,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public metallic: Nullable; + public accessor metallic: Nullable; /** * Specifies the roughness scalar of the metallic/roughness workflow. @@ -176,7 +176,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public roughness: Nullable; + public accessor roughness: Nullable; /** * In metallic workflow, specifies an F0 factor to help configuring the material F0. @@ -189,7 +189,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public metallicF0Factor = 1; + public accessor metallicF0Factor = 1; /** * In metallic workflow, specifies an F0 color. @@ -202,7 +202,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serializeAsColor3() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public metallicReflectanceColor = Color3.White(); + public accessor metallicReflectanceColor = Color3.White(); /** * Specifies that only the A channel from metallicReflectanceTexture should be used. @@ -210,7 +210,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useOnlyMetallicFromMetallicReflectanceTexture = false; + public accessor useOnlyMetallicFromMetallicReflectanceTexture = false; /** * Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A @@ -219,7 +219,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public metallicReflectanceTexture: Nullable; + public accessor metallicReflectanceTexture: Nullable; /** * Defines to store reflectanceColor in RGB @@ -229,7 +229,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectanceTexture: Nullable; + public accessor reflectanceTexture: Nullable; /** * Used to enable roughness/glossiness fetch from a separate channel depending on the current mode. @@ -237,21 +237,21 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public microSurfaceTexture: Nullable; + public accessor microSurfaceTexture: Nullable; /** * Stores surface normal data used to displace a mesh in a texture. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture: Nullable; + public accessor bumpTexture: Nullable; /** * Stores the pre-calculated light information of a mesh in a texture. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", null) - public lightmapTexture: Nullable; + public accessor lightmapTexture: Nullable; /** * Stores the refracted light information in a texture. @@ -273,56 +273,56 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serializeAsColor3("ambient") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public ambientColor = new Color3(0, 0, 0); + public accessor ambientColor = new Color3(0, 0, 0); /** * AKA Diffuse Color in other nomenclature. */ @serializeAsColor3("albedo") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public albedoColor = new Color3(1, 1, 1); + public accessor albedoColor = new Color3(1, 1, 1); /** * OpenPBR Base Weight (multiplier to the diffuse and metal lobes). */ @serialize("baseWeight") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public baseWeight = 1; + public accessor baseWeight = 1; /** * OpenPBR Base Diffuse Roughness (roughness of the diffuse lobe). */ @serialize("baseDiffuseRoughness") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public baseDiffuseRoughness: Nullable; + public accessor baseDiffuseRoughness: Nullable; /** * AKA Specular Color in other nomenclature. */ @serializeAsColor3("reflectivity") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectivityColor = new Color3(1, 1, 1); + public accessor reflectivityColor = new Color3(1, 1, 1); /** * The color reflected from the material. */ @serializeAsColor3("reflection") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionColor = new Color3(1.0, 1.0, 1.0); + public accessor reflectionColor = new Color3(1.0, 1.0, 1.0); /** * The color emitted from the material. */ @serializeAsColor3("emissive") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public emissiveColor = new Color3(0, 0, 0); + public accessor emissiveColor = new Color3(0, 0, 0); /** * AKA Glossiness in other nomenclature. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public microSurface = 1.0; + public accessor microSurface = 1.0; /** * Index of refraction of the material base layer. @@ -368,28 +368,28 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useLightmapAsShadowmap = false; + public accessor useLightmapAsShadowmap = false; /** * Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public useAlphaFromAlbedoTexture = false; + public accessor useAlphaFromAlbedoTexture = false; /** * Enforces alpha test in opaque or blend mode in order to improve the performances of some situations. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public forceAlphaTest = false; + public accessor forceAlphaTest = false; /** * Defines the alpha limits in alpha test mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public alphaCutOff = 0.4; + public accessor alphaCutOff = 0.4; /** * Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones). @@ -397,21 +397,21 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useSpecularOverAlpha = true; + public accessor useSpecularOverAlpha = true; /** * Specifies if the reflectivity texture contains the glossiness information in its alpha channel. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useMicroSurfaceFromReflectivityMapAlpha = false; + public accessor useMicroSurfaceFromReflectivityMapAlpha = false; /** * Specifies if the metallic texture contains the roughness information in its alpha channel. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRoughnessFromMetallicTextureAlpha = true; + public accessor useRoughnessFromMetallicTextureAlpha = true; /** * Specifies if the metallic texture contains the roughness information in its green channel. @@ -419,28 +419,28 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRoughnessFromMetallicTextureGreen = false; + public accessor useRoughnessFromMetallicTextureGreen = false; /** * Specifies if the metallic texture contains the metallness information in its blue channel. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useMetallnessFromMetallicTextureBlue = false; + public accessor useMetallnessFromMetallicTextureBlue = false; /** * Specifies if the metallic texture contains the ambient occlusion information in its red channel. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAmbientOcclusionFromMetallicTextureRed = false; + public accessor useAmbientOcclusionFromMetallicTextureRed = false; /** * Specifies if the ambient texture contains the ambient occlusion information in its red channel only. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAmbientInGrayScale = false; + public accessor useAmbientInGrayScale = false; /** * In case the reflectivity map does not contain the microsurface information in its alpha channel, @@ -448,7 +448,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAutoMicroSurfaceFromReflectivityMap = false; + public accessor useAutoMicroSurfaceFromReflectivityMap = false; /** * BJS is using an hardcoded light falloff based on a manually sets up range. @@ -510,77 +510,77 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRadianceOverAlpha = true; + public accessor useRadianceOverAlpha = true; /** * Allows using an object space normal map (instead of tangent space). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useObjectSpaceNormalMap = false; + public accessor useObjectSpaceNormalMap = false; /** * Allows using the bump map in parallax mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useParallax = false; + public accessor useParallax = false; /** * Allows using the bump map in parallax occlusion mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useParallaxOcclusion = false; + public accessor useParallaxOcclusion = false; /** * Controls the scale bias of the parallax mode. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public parallaxScaleBias = 0.05; + public accessor parallaxScaleBias = 0.05; /** * If sets to true, disables all the lights affecting the material. */ @serialize() @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting = false; + public accessor disableLighting = false; /** * Force the shader to compute irradiance in the fragment shader in order to take bump in account. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public forceIrradianceInFragment = false; + public accessor forceIrradianceInFragment = false; /** * Number of Simultaneous lights allowed on the material. */ @serialize() @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights = 4; + public accessor maxSimultaneousLights = 4; /** * If sets to true, x component of normal map value will invert (x = 1.0 - x). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapX = false; + public accessor invertNormalMapX = false; /** * If sets to true, y component of normal map value will invert (y = 1.0 - y). */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapY = false; + public accessor invertNormalMapY = false; /** * If sets to true and backfaceCulling is false, normals will be flipped on the backside. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public twoSidedLighting = false; + public accessor twoSidedLighting = false; /** * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested. @@ -588,7 +588,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAlphaFresnel = false; + public accessor useAlphaFresnel = false; /** * A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested. @@ -596,7 +596,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useLinearAlphaFresnel = false; + public accessor useLinearAlphaFresnel = false; /** * Let user defines the brdf lookup texture used for IBL. @@ -607,14 +607,14 @@ export class PBRMaterial extends PBRBaseMaterial { * * LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public environmentBRDFTexture: Nullable = null; + public accessor environmentBRDFTexture: Nullable = null; /** * Force normal to face away from face. */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public forceNormalForward = false; + public accessor forceNormalForward = false; /** * Enables specular anti aliasing in the PBR shader. @@ -623,7 +623,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public enableSpecularAntiAliasing = false; + public accessor enableSpecularAntiAliasing = false; /** * This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal @@ -631,7 +631,7 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useHorizonOcclusion = true; + public accessor useHorizonOcclusion = true; /** * This parameters will enable/disable radiance occlusion by preventing the radiance to lit @@ -639,21 +639,21 @@ export class PBRMaterial extends PBRBaseMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRadianceOcclusion = true; + public accessor useRadianceOcclusion = true; /** * If set to true, no lighting calculations will be applied. */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public unlit = false; + public accessor unlit = false; /** * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false) */ @serialize() @expandToProperty("_markAllSubMeshesAsMiscDirty") - public applyDecalMapAfterDetailMap = false; + public accessor applyDecalMapAfterDetailMap = false; /** * Instantiates a new PBRMaterial instance. diff --git a/packages/dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts index 85e1f23973af..0d8e7e6482b2 100644 --- a/packages/dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrMetallicRoughnessMaterial.ts @@ -22,7 +22,7 @@ export class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial { */ @serializeAsColor3() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoColor") - public baseColor: Color3; + public accessor baseColor: Color3; /** * Base texture of the metallic workflow. It contains both the baseColor information in RGB as @@ -30,7 +30,7 @@ export class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoTexture") - public baseTexture: Nullable; + public accessor baseTexture: Nullable; /** * Specifies the metallic scalar value of the material. @@ -38,7 +38,7 @@ export class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public metallic: number; + public accessor metallic: number; /** * Specifies the roughness scalar value of the material. @@ -46,7 +46,7 @@ export class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public roughness: number; + public accessor roughness: number; /** * Texture containing both the metallic value in the B channel and the @@ -54,7 +54,7 @@ export class PBRMetallicRoughnessMaterial extends PBRBaseSimpleMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_metallicTexture") - public metallicRoughnessTexture: Nullable; + public accessor metallicRoughnessTexture: Nullable; /** * Instantiates a new PBRMetalRoughnessMaterial instance. diff --git a/packages/dev/core/src/Materials/PBR/pbrSheenConfiguration.ts b/packages/dev/core/src/Materials/PBR/pbrSheenConfiguration.ts index 85083a9d6cc7..7097539a8340 100644 --- a/packages/dev/core/src/Materials/PBR/pbrSheenConfiguration.ts +++ b/packages/dev/core/src/Materials/PBR/pbrSheenConfiguration.ts @@ -43,7 +43,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; private _linkSheenWithAlbedo = false; /** @@ -51,7 +51,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public linkSheenWithAlbedo = false; + public accessor linkSheenWithAlbedo = false; /** * Defines the sheen intensity. @@ -74,7 +74,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public texture: Nullable = null; + public accessor texture: Nullable = null; private _useRoughnessFromMainTexture = true; /** @@ -83,7 +83,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useRoughnessFromMainTexture = true; + public accessor useRoughnessFromMainTexture = true; private _roughness: Nullable = null; /** @@ -93,7 +93,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public roughness: Nullable = null; + public accessor roughness: Nullable = null; private _textureRoughness: Nullable = null; /** @@ -102,7 +102,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public textureRoughness: Nullable = null; + public accessor textureRoughness: Nullable = null; private _albedoScaling = false; /** @@ -112,7 +112,7 @@ export class PBRSheenConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public albedoScaling = false; + public accessor albedoScaling = false; /** @internal */ private _internalMarkAllSubMeshesAsTexturesDirty: () => void; diff --git a/packages/dev/core/src/Materials/PBR/pbrSpecularGlossinessMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrSpecularGlossinessMaterial.ts index e2d95421e36f..e31bdf574a31 100644 --- a/packages/dev/core/src/Materials/PBR/pbrSpecularGlossinessMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrSpecularGlossinessMaterial.ts @@ -19,7 +19,7 @@ export class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial { */ @serializeAsColor3("diffuse") @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoColor") - public diffuseColor: Color3; + public accessor diffuseColor: Color3; /** * Specifies the diffuse texture of the material. This can also contains the opacity value in its alpha @@ -27,28 +27,28 @@ export class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_albedoTexture") - public diffuseTexture: Nullable; + public accessor diffuseTexture: Nullable; /** * Specifies the specular color of the material. This indicates how reflective is the material (none to mirror). */ @serializeAsColor3("specular") @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_reflectivityColor") - public specularColor: Color3; + public accessor specularColor: Color3; /** * Specifies the glossiness of the material. This indicates "how sharp is the reflection". */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_microSurface") - public glossiness: number; + public accessor glossiness: number; /** * Specifies both the specular color RGB and the glossiness A of the material per pixels. */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty", "_reflectivityTexture") - public specularGlossinessTexture: Nullable; + public accessor specularGlossinessTexture: Nullable; /** * Specifies if the reflectivity texture contains the glossiness information in its alpha channel. diff --git a/packages/dev/core/src/Materials/PBR/pbrSubSurfaceConfiguration.ts b/packages/dev/core/src/Materials/PBR/pbrSubSurfaceConfiguration.ts index 77f8b09eeffc..873c4a8bc0c2 100644 --- a/packages/dev/core/src/Materials/PBR/pbrSubSurfaceConfiguration.ts +++ b/packages/dev/core/src/Materials/PBR/pbrSubSurfaceConfiguration.ts @@ -91,7 +91,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isRefractionEnabled = false; + public accessor isRefractionEnabled = false; private _isTranslucencyEnabled = false; /** @@ -99,7 +99,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isTranslucencyEnabled = false; + public accessor isTranslucencyEnabled = false; private _isDispersionEnabled = false; /** @@ -107,7 +107,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isDispersionEnabled = false; + public accessor isDispersionEnabled = false; private _isScatteringEnabled = false; /** @@ -115,7 +115,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markScenePrePassDirty") - public isScatteringEnabled = false; + public accessor isScatteringEnabled = false; @serialize() private _scatteringDiffusionProfileIndex = 0; @@ -166,7 +166,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAlbedoToTintRefraction: boolean = false; + public accessor useAlbedoToTintRefraction: boolean = false; private _useAlbedoToTintTranslucency = false; /** @@ -174,7 +174,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useAlbedoToTintTranslucency: boolean = false; + public accessor useAlbedoToTintTranslucency: boolean = false; private _thicknessTexture: Nullable = null; /** @@ -186,7 +186,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public thicknessTexture: Nullable = null; + public accessor thicknessTexture: Nullable = null; private _refractionTexture: Nullable = null; /** @@ -194,7 +194,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public refractionTexture: Nullable = null; + public accessor refractionTexture: Nullable = null; /** @internal */ public _indexOfRefraction = 1.5; @@ -208,9 +208,10 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public indexOfRefraction = 1.5; + public accessor indexOfRefraction = 1.5; @serialize() + // @ts-expect-error Backing field accessed dynamically by the expandToProperty accessor decorator private _volumeIndexOfRefraction = -1.0; /** @@ -221,19 +222,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { * the volume will use the same IOR as the surface. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public get volumeIndexOfRefraction(): number { - if (this._volumeIndexOfRefraction >= 1.0) { - return this._volumeIndexOfRefraction; - } - return this._indexOfRefraction; - } - public set volumeIndexOfRefraction(value: number) { - if (value >= 1.0) { - this._volumeIndexOfRefraction = value; - } else { - this._volumeIndexOfRefraction = -1.0; - } - } + public accessor volumeIndexOfRefraction: number; private _invertRefractionY = false; /** @@ -241,7 +230,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertRefractionY = false; + public accessor invertRefractionY = false; /** @internal */ public _linkRefractionWithTransparency = false; @@ -251,7 +240,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public linkRefractionWithTransparency = false; + public accessor linkRefractionWithTransparency = false; /** * Defines the minimum thickness stored in the thickness map. @@ -308,7 +297,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useMaskFromThicknessTexture: boolean = false; + public accessor useMaskFromThicknessTexture: boolean = false; private _refractionIntensityTexture: Nullable = null; /** @@ -317,7 +306,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public refractionIntensityTexture: Nullable = null; + public accessor refractionIntensityTexture: Nullable = null; private _translucencyIntensityTexture: Nullable = null; /** @@ -326,7 +315,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public translucencyIntensityTexture: Nullable = null; + public accessor translucencyIntensityTexture: Nullable = null; /** * Defines the translucency tint of the material. @@ -343,7 +332,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public translucencyColorTexture: Nullable = null; + public accessor translucencyColorTexture: Nullable = null; private _useGltfStyleTextures = true; /** @@ -354,7 +343,7 @@ export class PBRSubSurfaceConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useGltfStyleTextures: boolean = true; + public accessor useGltfStyleTextures: boolean = true; /** * This property only exists for backward compatibility reasons. diff --git a/packages/dev/core/src/Materials/imageProcessing.ts b/packages/dev/core/src/Materials/imageProcessing.ts index 5d62e42dd849..4aa024e4b5e8 100644 --- a/packages/dev/core/src/Materials/imageProcessing.ts +++ b/packages/dev/core/src/Materials/imageProcessing.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { serializeAsImageProcessingConfiguration } from "../Misc/decorators"; +import { GetDirectStoreFromMetadata } from "../Misc/decorators.functions"; import type { Nullable } from "../types"; import type { ImageProcessingConfiguration } from "./imageProcessingConfiguration"; import type { Observer } from "../Misc/observable"; @@ -20,9 +20,17 @@ export function ImageProcessingMixin void; diff --git a/packages/dev/core/src/Materials/material.detailMapConfiguration.ts b/packages/dev/core/src/Materials/material.detailMapConfiguration.ts index e9bc496bf9e9..4cc8519d9e2f 100644 --- a/packages/dev/core/src/Materials/material.detailMapConfiguration.ts +++ b/packages/dev/core/src/Materials/material.detailMapConfiguration.ts @@ -40,7 +40,7 @@ export class DetailMapConfiguration extends MaterialPluginBase { */ @serializeAsTexture("detailTexture") @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public texture: Nullable; + public accessor texture: Nullable; /** * Defines how strongly the detail diffuse/albedo channel is blended with the regular diffuse/albedo texture @@ -69,7 +69,7 @@ export class DetailMapConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public normalBlendMethod: number; + public accessor normalBlendMethod: number; private _isEnabled = false; /** @@ -77,7 +77,7 @@ export class DetailMapConfiguration extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; /** @internal */ private _internalMarkAllSubMeshesAsTexturesDirty: () => void; diff --git a/packages/dev/core/src/Materials/meshDebugPluginMaterial.ts b/packages/dev/core/src/Materials/meshDebugPluginMaterial.ts index 00a0ad8f3688..0d82468d2ef2 100644 --- a/packages/dev/core/src/Materials/meshDebugPluginMaterial.ts +++ b/packages/dev/core/src/Materials/meshDebugPluginMaterial.ts @@ -462,7 +462,7 @@ export class MeshDebugPluginMaterial extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllDefinesAsDirty") - public mode: MeshDebugMode; + public accessor mode: MeshDebugMode; private _multiply: boolean; /** @@ -471,7 +471,7 @@ export class MeshDebugPluginMaterial extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllDefinesAsDirty") - public multiply: boolean; + public accessor multiply: boolean; /** * Diffuse color used to shade the mesh. diff --git a/packages/dev/core/src/Materials/standardMaterial.ts b/packages/dev/core/src/Materials/standardMaterial.ts index 44092bc569f9..4bd01e885ac6 100644 --- a/packages/dev/core/src/Materials/standardMaterial.ts +++ b/packages/dev/core/src/Materials/standardMaterial.ts @@ -257,7 +257,7 @@ export class StandardMaterial extends StandardMaterialBase { * The basic texture of the material as viewed under a light. */ @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public diffuseTexture: Nullable; + public accessor diffuseTexture: Nullable; @serializeAsTexture("ambientTexture") private _ambientTexture: Nullable = null; @@ -265,7 +265,7 @@ export class StandardMaterial extends StandardMaterialBase { * AKA Occlusion Texture in other nomenclature, it helps adding baked shadows into your material. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public ambientTexture: Nullable; + public accessor ambientTexture: Nullable; @serializeAsTexture("opacityTexture") private _opacityTexture: Nullable = null; @@ -275,7 +275,7 @@ export class StandardMaterial extends StandardMaterialBase { * or from the luminance or the current texel (if texture.getAlphaFromRGB is true) */ @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public opacityTexture: Nullable; + public accessor opacityTexture: Nullable; @serializeAsTexture("reflectionTexture") private _reflectionTexture: Nullable = null; @@ -284,7 +284,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#how-to-obtain-reflections-and-refractions */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public reflectionTexture: Nullable; + public accessor reflectionTexture: Nullable; @serializeAsTexture("emissiveTexture") private _emissiveTexture: Nullable = null; @@ -293,7 +293,7 @@ export class StandardMaterial extends StandardMaterialBase { * This will be mixed in the final result even in the absence of light. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public emissiveTexture: Nullable; + public accessor emissiveTexture: Nullable; @serializeAsTexture("specularTexture") private _specularTexture: Nullable = null; @@ -301,7 +301,7 @@ export class StandardMaterial extends StandardMaterialBase { * Define how the color and intensity of the highlight given by the light in the material. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public specularTexture: Nullable; + public accessor specularTexture: Nullable; @serializeAsTexture("bumpTexture") private _bumpTexture: Nullable = null; @@ -311,7 +311,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#bump-map */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture: Nullable; + public accessor bumpTexture: Nullable; @serializeAsTexture("lightmapTexture") private _lightmapTexture: Nullable = null; @@ -321,7 +321,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction#lightmaps */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public lightmapTexture: Nullable; + public accessor lightmapTexture: Nullable; @serializeAsTexture("refractionTexture") private _refractionTexture: Nullable = null; @@ -330,7 +330,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/reflectionTexture#how-to-obtain-reflections-and-refractions */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public refractionTexture: Nullable; + public accessor refractionTexture: Nullable; /** * The color of the material lit by the environmental background lighting. @@ -372,7 +372,7 @@ export class StandardMaterial extends StandardMaterialBase { * Does the transparency come from the diffuse texture alpha channel. */ @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public useAlphaFromDiffuseTexture: boolean; + public accessor useAlphaFromDiffuseTexture: boolean; @serialize("useEmissiveAsIllumination") private _useEmissiveAsIllumination = false; @@ -380,7 +380,7 @@ export class StandardMaterial extends StandardMaterialBase { * If true, the emissive value is added into the end result, otherwise it is multiplied in. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useEmissiveAsIllumination: boolean; + public accessor useEmissiveAsIllumination: boolean; @serialize("linkEmissiveWithDiffuse") private _linkEmissiveWithDiffuse = false; @@ -389,7 +389,7 @@ export class StandardMaterial extends StandardMaterialBase { * the emissive level when the final color is close to one. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public linkEmissiveWithDiffuse: boolean; + public accessor linkEmissiveWithDiffuse: boolean; @serialize("useSpecularOverAlpha") private _useSpecularOverAlpha = false; @@ -398,7 +398,7 @@ export class StandardMaterial extends StandardMaterialBase { * A car glass is a good exemple of that. When sun reflects on it you can not see what is behind. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useSpecularOverAlpha: boolean; + public accessor useSpecularOverAlpha: boolean; @serialize("useReflectionOverAlpha") private _useReflectionOverAlpha = false; @@ -407,7 +407,7 @@ export class StandardMaterial extends StandardMaterialBase { * A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useReflectionOverAlpha: boolean; + public accessor useReflectionOverAlpha: boolean; @serialize("disableLighting") private _disableLighting = false; @@ -416,7 +416,7 @@ export class StandardMaterial extends StandardMaterialBase { * It can be a nice trick for performance to disable lighting on a fully emissive material. */ @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("useObjectSpaceNormalMap") private _useObjectSpaceNormalMap = false; @@ -424,7 +424,7 @@ export class StandardMaterial extends StandardMaterialBase { * Allows using an object space normal map (instead of tangent space). */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useObjectSpaceNormalMap: boolean; + public accessor useObjectSpaceNormalMap: boolean; @serialize("useParallax") private _useParallax = false; @@ -433,7 +433,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/parallaxMapping */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useParallax: boolean; + public accessor useParallax: boolean; @serialize("useParallaxOcclusion") private _useParallaxOcclusion = false; @@ -443,7 +443,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/parallaxMapping */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useParallaxOcclusion: boolean; + public accessor useParallaxOcclusion: boolean; /** * Apply a scaling factor that determine which "depth" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion. @@ -457,7 +457,7 @@ export class StandardMaterial extends StandardMaterialBase { * Helps to define how blurry the reflections should appears in the material. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public roughness: number; + public accessor roughness: number; /** * In case of refraction, define the value of the index of refraction. @@ -486,7 +486,7 @@ export class StandardMaterial extends StandardMaterialBase { * In case of light mapping, define whether the map contains light or shadow informations. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useLightmapAsShadowmap: boolean; + public accessor useLightmapAsShadowmap: boolean; // Fresnel @serializeAsFresnelParameters("diffuseFresnelParameters") @@ -496,7 +496,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters */ @expandToProperty("_markAllSubMeshesAsFresnelDirty") - public diffuseFresnelParameters: FresnelParameters; + public accessor diffuseFresnelParameters: FresnelParameters; @serializeAsFresnelParameters("opacityFresnelParameters") private _opacityFresnelParameters: FresnelParameters; @@ -505,7 +505,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters */ @expandToProperty("_markAllSubMeshesAsFresnelAndMiscDirty") - public opacityFresnelParameters: FresnelParameters; + public accessor opacityFresnelParameters: FresnelParameters; @serializeAsFresnelParameters("reflectionFresnelParameters") private _reflectionFresnelParameters: FresnelParameters; @@ -514,7 +514,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters */ @expandToProperty("_markAllSubMeshesAsFresnelDirty") - public reflectionFresnelParameters: FresnelParameters; + public accessor reflectionFresnelParameters: FresnelParameters; @serializeAsFresnelParameters("refractionFresnelParameters") private _refractionFresnelParameters: FresnelParameters; @@ -523,7 +523,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters */ @expandToProperty("_markAllSubMeshesAsFresnelDirty") - public refractionFresnelParameters: FresnelParameters; + public accessor refractionFresnelParameters: FresnelParameters; @serializeAsFresnelParameters("emissiveFresnelParameters") private _emissiveFresnelParameters: FresnelParameters; @@ -532,7 +532,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters */ @expandToProperty("_markAllSubMeshesAsFresnelDirty") - public emissiveFresnelParameters: FresnelParameters; + public accessor emissiveFresnelParameters: FresnelParameters; @serialize("useReflectionFresnelFromSpecular") private _useReflectionFresnelFromSpecular = false; @@ -541,7 +541,7 @@ export class StandardMaterial extends StandardMaterialBase { * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters */ @expandToProperty("_markAllSubMeshesAsFresnelDirty") - public useReflectionFresnelFromSpecular: boolean; + public accessor useReflectionFresnelFromSpecular: boolean; @serialize("useGlossinessFromSpecularMapAlpha") private _useGlossinessFromSpecularMapAlpha = false; @@ -549,7 +549,7 @@ export class StandardMaterial extends StandardMaterialBase { * Defines if the glossiness/roughness of the material should be read from the specular map alpha channel */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public useGlossinessFromSpecularMapAlpha: boolean; + public accessor useGlossinessFromSpecularMapAlpha: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @@ -557,7 +557,7 @@ export class StandardMaterial extends StandardMaterialBase { * Defines the maximum number of lights that can be used in the material */ @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; @serialize("invertNormalMapX") private _invertNormalMapX = false; @@ -565,7 +565,7 @@ export class StandardMaterial extends StandardMaterialBase { * If sets to true, x component of normal map value will invert (x = 1.0 - x). */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapX: boolean; + public accessor invertNormalMapX: boolean; @serialize("invertNormalMapY") private _invertNormalMapY = false; @@ -573,7 +573,7 @@ export class StandardMaterial extends StandardMaterialBase { * If sets to true, y component of normal map value will invert (y = 1.0 - y). */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public invertNormalMapY: boolean; + public accessor invertNormalMapY: boolean; @serialize("twoSidedLighting") private _twoSidedLighting = false; @@ -581,7 +581,7 @@ export class StandardMaterial extends StandardMaterialBase { * If sets to true and backfaceCulling is false, normals will be flipped on the backside. */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public twoSidedLighting: boolean; + public accessor twoSidedLighting: boolean; @serialize("applyDecalMapAfterDetailMap") private _applyDecalMapAfterDetailMap = false; @@ -589,7 +589,7 @@ export class StandardMaterial extends StandardMaterialBase { * If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false) */ @expandToProperty("_markAllSubMeshesAsMiscDirty") - public applyDecalMapAfterDetailMap: boolean; + public accessor applyDecalMapAfterDetailMap: boolean; private _shadersLoaded = false; diff --git a/packages/dev/core/src/Misc/decorators.functions.ts b/packages/dev/core/src/Misc/decorators.functions.ts index fefc5ec2bba3..0e329e513ce0 100644 --- a/packages/dev/core/src/Misc/decorators.functions.ts +++ b/packages/dev/core/src/Misc/decorators.functions.ts @@ -1,16 +1,30 @@ -const MergedStore = {}; +/** @internal */ +export const __bjsSerializableKey = "__bjs_serializable__"; -const DecoratorInitialStore = {}; +const _mergedStoreCache = new WeakMap>(); + +/** + * Returns the metadata object for the decorator context. + * Used internally by decorator functions to store serialization info. + * @internal + */ +export function GetDirectStoreFromMetadata(metadata: DecoratorMetadataObject): Record { + let ownStore = Object.hasOwn(metadata, __bjsSerializableKey) ? (metadata[__bjsSerializableKey] as Record) : undefined; + if (!ownStore) { + ownStore = {}; + metadata[__bjsSerializableKey] = ownStore; + } + return ownStore; +} /** @internal */ export function GetDirectStore(target: any): any { - const classKey = target.getClassName(); - - if (!(DecoratorInitialStore)[classKey]) { - (DecoratorInitialStore)[classKey] = {}; + const ctor = typeof target === "function" ? target : target?.constructor; + const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; + if (!metadata) { + return {}; } - - return (DecoratorInitialStore)[classKey]; + return Object.hasOwn(metadata, __bjsSerializableKey) ? (metadata[__bjsSerializableKey] as Record) : {}; } /** @@ -18,47 +32,33 @@ export function GetDirectStore(target: any): any { * @param target host object */ export function GetMergedStore(target: any): any { - const classKey = target.getClassName(); - - if ((MergedStore)[classKey]) { - return (MergedStore)[classKey]; + const ctor = typeof target === "function" ? target : target?.constructor; + const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; + if (!metadata) { + return {}; } - (MergedStore)[classKey] = {}; - - const store = (MergedStore)[classKey]; - let currentTarget = target; - let currentKey = classKey; - while (currentKey) { - const initialStore = (DecoratorInitialStore)[currentKey]; - for (const property in initialStore) { - store[property] = initialStore[property]; - } - - let parent: any; - let done = false; - - do { - parent = Object.getPrototypeOf(currentTarget); - if (!parent.getClassName) { - done = true; - break; - } + // Check cache + const cached = _mergedStoreCache.get(metadata); + if (cached) { + return cached; + } - if (parent.getClassName() !== currentKey) { - break; + // Walk the metadata prototype chain and merge all serializable stores + const store: Record = {}; + let currentMeta: any = metadata; + while (currentMeta) { + if (Object.hasOwn(currentMeta, __bjsSerializableKey)) { + const classStore = currentMeta[__bjsSerializableKey] as Record; + for (const property in classStore) { + if (Object.hasOwn(classStore, property) && !(property in store)) { + store[property] = classStore[property]; + } } - - currentTarget = parent; - } while (parent); - - if (done) { - break; } - - currentKey = parent.getClassName(); - currentTarget = parent; + currentMeta = Object.getPrototypeOf(currentMeta); } + _mergedStoreCache.set(metadata, store); return store; } diff --git a/packages/dev/core/src/Misc/decorators.ts b/packages/dev/core/src/Misc/decorators.ts index 4869fa300575..767ecc2ac23b 100644 --- a/packages/dev/core/src/Misc/decorators.ts +++ b/packages/dev/core/src/Misc/decorators.ts @@ -1,28 +1,35 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ /* eslint-disable @typescript-eslint/naming-convention */ import type { Nullable } from "../types"; -import { GetDirectStore } from "./decorators.functions"; +import { GetDirectStoreFromMetadata } from "./decorators.functions"; import { _WarnImport } from "./devTools"; +/** + * TC39 decorator context types that serialization decorators can be applied to. + * Serialization decorators can be applied to fields, getters, setters, and auto-accessors. + */ +type SerializableContext = { name: string | symbol; metadata: DecoratorMetadataObject }; + function generateSerializableMember(type: number, sourceName?: string) { - return (target: any, propertyKey: string | symbol) => { - const classStore = GetDirectStore(target); + return (_value: unknown, context: SerializableContext) => { + const propertyKey = String(context.name); + const store = GetDirectStoreFromMetadata(context.metadata); - if (!classStore[propertyKey]) { - classStore[propertyKey] = { type: type, sourceName: sourceName }; + if (!store[propertyKey]) { + store[propertyKey] = { type: type, sourceName: sourceName }; } }; } function generateExpandMember(setCallback: string, targetKey: Nullable = null) { - return (target: any, propertyKey: string) => { - const key = targetKey || "_" + propertyKey; - Object.defineProperty(target, propertyKey, { - get: function (this: any) { + return (_value: ClassAccessorDecoratorTarget, context: ClassAccessorDecoratorContext): ClassAccessorDecoratorResult => { + const key = targetKey || "_" + String(context.name); + return { + get(this: any) { // eslint-disable-next-line @typescript-eslint/no-unsafe-return return this[key]; }, - set: function (this: any, value) { + set(this: any, value: V) { // does this object (i.e. vector3) has an equals function? use it! // Note - not using "with epsilon" here, it is expected te behave like the internal cache does. if (typeof this[key]?.equals === "function") { @@ -35,11 +42,9 @@ function generateExpandMember(setCallback: string, targetKey: Nullable = } this[key] = value; - target[setCallback].apply(this); + this[setCallback](); }, - enumerable: true, - configurable: true, - }); + }; }; } @@ -111,39 +116,25 @@ declare const _native: any; * Decorator used to redirect a function to a native implementation if available. * @internal */ -export function nativeOverride boolean>( - target: any, - propertyKey: string, - descriptor: TypedPropertyDescriptor<(...params: Parameters) => any>, - predicate?: T -) { - // Cache the original JS function for later. - const jsFunc = descriptor.value!; - - // Override the JS function to check for a native override on first invocation. Setting descriptor.value overrides the function at the early stage of code being loaded/imported. - descriptor.value = (...params: Parameters): unknown => { - // Assume the resolved function will be the original JS function, then we will check for the Babylon Native context. - let func = jsFunc; - - // Check if we are executing in a Babylon Native context (e.g. check the presence of the _native global property) and if so also check if a function override is available. - if (typeof _native !== "undefined" && _native[propertyKey]) { - const nativeFunc = _native[propertyKey] as (...params: Parameters) => unknown; - // If a predicate was provided, then we'll need to invoke the predicate on each invocation of the underlying function to determine whether to call the native function or the JS function. - if (predicate) { - // The resolved function will execute the predicate and then either execute the native function or the JS function. - func = (...params: Parameters) => (predicate(...params) ? nativeFunc(...params) : jsFunc(...params)); - } else { - // The resolved function will directly execute the native function. - func = nativeFunc; +export function nativeOverride( + originalMethod: (this: This, ...args: Args) => Return, + _context: ClassMethodDecoratorContext Return> +): (this: This, ...args: Args) => Return { + const propertyKey = String(_context.name); + let resolvedFunc: ((this: This, ...args: Args) => Return) | null = null; + + return function (this: This, ...params: Args): Return { + if (resolvedFunc === null) { + // Default to the original JS function. + resolvedFunc = originalMethod; + + // Check if we are executing in a Babylon Native context and if so, check for a function override. + if (typeof _native !== "undefined" && _native[propertyKey]) { + resolvedFunc = _native[propertyKey] as (this: This, ...args: Args) => Return; } } - // Override the JS function again with the final resolved target function. - target[propertyKey] = func; - - // The JS function has now been overridden based on whether we're executing in the context of Babylon Native, but we still need to invoke that function. - // Future invocations of the function will just directly invoke the final overridden function, not any of the decorator setup logic above. - return func(...params); + return resolvedFunc.apply(this, params); }; } @@ -155,26 +146,44 @@ export function nativeOverride boolean>( * @internal */ nativeOverride.filter = function boolean>(predicate: T) { - return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor<(...params: Parameters) => unknown>) => - nativeOverride(target, propertyKey, descriptor, predicate); + return (originalMethod: (...args: any[]) => any, _context: ClassMethodDecoratorContext): ((...args: any[]) => any) => { + const propertyKey = String(_context.name); + let nativeFunc: ((...args: any[]) => any) | undefined; + let resolved = false; + + return function (this: any, ...params: any[]): unknown { + if (!resolved) { + resolved = true; + if (typeof _native !== "undefined" && _native[propertyKey]) { + nativeFunc = _native[propertyKey] as (...args: any[]) => any; + } + } + + if (nativeFunc && predicate(...(params as Parameters))) { + return nativeFunc(...params); + } + return originalMethod.apply(this, params); + }; + }; }; /** * Adds accessors for a material property. + * Applied to an auto-accessor field. Reads/writes from a private backing field named by sourceKey (default: "_" + property name). + * The backing field is expected to have a `.value` property. * @param setCallback - The name of the callback function to call when the property is set. - * @param targetKey - The key to use for the target property (defaults to the original property key). - * @returns A property decorator. + * @param sourceKey - The name of the private field that stores the value (defaults to "_" + accessor name). + * @returns An accessor decorator. */ -export function addAccessorsForMaterialProperty(setCallback: string, targetKey: Nullable = null) { - return (target: any, propertyKey: string) => { - const key = propertyKey; - const newKey = targetKey || ""; - Object.defineProperty(target, newKey, { - get: function (this: any) { +export function addAccessorsForMaterialProperty(setCallback: string, sourceKey: Nullable = null) { + return (_value: ClassAccessorDecoratorTarget, context: ClassAccessorDecoratorContext): ClassAccessorDecoratorResult => { + const key = sourceKey || "_" + String(context.name); + return { + get(this: any) { // eslint-disable-next-line @typescript-eslint/no-unsafe-return - return this[key].value; + return this[key]?.value; }, - set: function (this: any, value) { + set(this: any, value: V) { // does this object (i.e. vector3) has an equals function? use it! // Note - not using "with epsilon" here, it is expected te behave like the internal cache does. if (typeof this[key]?.value?.equals === "function") { @@ -187,10 +196,8 @@ export function addAccessorsForMaterialProperty(setCallback: string, targetKey: } this[key].value = value; - target[setCallback].apply(this); + this[setCallback](); }, - enumerable: true, - configurable: true, - }); + }; }; } diff --git a/packages/dev/core/src/Rendering/GlobalIllumination/giRSMManager.ts b/packages/dev/core/src/Rendering/GlobalIllumination/giRSMManager.ts index dbf0e778db37..683787b617db 100644 --- a/packages/dev/core/src/Rendering/GlobalIllumination/giRSMManager.ts +++ b/packages/dev/core/src/Rendering/GlobalIllumination/giRSMManager.ts @@ -932,7 +932,7 @@ export class GIRSMRenderPluginMaterial extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; protected _markAllSubMeshesAsTexturesDirty(): void { this._enable(this._isEnabled); diff --git a/packages/dev/core/src/Rendering/IBLShadows/iblShadowsPluginMaterial.ts b/packages/dev/core/src/Rendering/IBLShadows/iblShadowsPluginMaterial.ts index e2ca69f35289..494a35ae7505 100644 --- a/packages/dev/core/src/Rendering/IBLShadows/iblShadowsPluginMaterial.ts +++ b/packages/dev/core/src/Rendering/IBLShadows/iblShadowsPluginMaterial.ts @@ -56,7 +56,7 @@ export class IBLShadowsPluginMaterial extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; protected _markAllSubMeshesAsTexturesDirty(): void { this._enable(this._isEnabled); diff --git a/packages/dev/core/src/Rendering/reflectiveShadowMap.ts b/packages/dev/core/src/Rendering/reflectiveShadowMap.ts index d8c5c9027683..9af45d32c8f1 100644 --- a/packages/dev/core/src/Rendering/reflectiveShadowMap.ts +++ b/packages/dev/core/src/Rendering/reflectiveShadowMap.ts @@ -346,7 +346,7 @@ export class RSMCreatePluginMaterial extends MaterialPluginBase { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public isEnabled = false; + public accessor isEnabled = false; protected _markAllSubMeshesAsTexturesDirty(): void { this._enable(this._isEnabled); diff --git a/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts b/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts new file mode 100644 index 000000000000..8e14cc2e2d5f --- /dev/null +++ b/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts @@ -0,0 +1,68 @@ +/** + * Quick inline test to verify TC39 decorators work correctly. + * Run with: npx ts-node --esm --project tsconfig.test.json packages/dev/core/test/unit/Decorators/decorators.inline-test.ts + */ + +// Test 1: Symbol.metadata polyfill +(Symbol as any).metadata ??= Symbol.for("Symbol.metadata"); + +// Test 2: A simple TC39 class field decorator +function trackField(displayName: string) { + return function (_value: undefined, context: ClassFieldDecoratorContext) { + const key = `__tracked_${String(context.name)}`; + if (!Object.hasOwn(context.metadata, key)) { + (context.metadata as any)[key] = displayName; + } + }; +} + +// Test 3: A TC39 accessor decorator (like expandToProperty) +function doubleAccessor( + _value: ClassAccessorDecoratorTarget, + _context: ClassAccessorDecoratorContext +): ClassAccessorDecoratorResult { + return { + get(this: This): V { + return (_value.get.call(this) * 2) as V; + }, + set(this: This, value: V) { + _value.set.call(this, value); + }, + }; +} + +class TestClass { + @trackField("My Number") + myNum: number = 42; + + @doubleAccessor + accessor doubled: number = 5; +} + +// Verify metadata +const metadata = (TestClass as any)[Symbol.metadata]; +console.assert(metadata !== undefined, "Symbol.metadata should be set on class"); +console.assert((metadata as any).__tracked_myNum === "My Number", "Field decorator should store metadata"); + +// Verify accessor +const instance = new TestClass(); +console.assert(instance.doubled === 10, `Accessor should return doubled value, got ${instance.doubled}`); +instance.doubled = 7; +console.assert(instance.doubled === 14, `After setting 7, accessor should return 14, got ${instance.doubled}`); + +// Test 4: Inheritance +class ChildClass extends TestClass { + @trackField("Child Prop") + childProp: string = "hello"; +} + +const childMeta = (ChildClass as any)[Symbol.metadata]; +console.assert(childMeta !== undefined, "Child should have metadata"); +console.assert((childMeta as any).__tracked_childProp === "Child Prop", "Child metadata should have its own properties"); + +// Walk the prototype chain +const parentMeta = Object.getPrototypeOf(childMeta); +console.assert(parentMeta !== null, "Child metadata prototype should be parent metadata"); +console.assert((parentMeta as any).__tracked_myNum === "My Number", "Parent metadata should be accessible via prototype chain"); + +console.log("All decorator tests passed!"); diff --git a/packages/dev/core/test/unit/Decorators/decorators.test.ts b/packages/dev/core/test/unit/Decorators/decorators.test.ts new file mode 100644 index 000000000000..022550007be3 --- /dev/null +++ b/packages/dev/core/test/unit/Decorators/decorators.test.ts @@ -0,0 +1,79 @@ +/** + * Quick sanity test for TC39 decorator migration. + * Tests the core decorator functions work correctly with Symbol.metadata. + */ +import { serialize, serializeAsColor3, expandToProperty } from "core/Misc/decorators"; +import { GetDirectStore, GetMergedStore } from "core/Misc/decorators.functions"; +import { Color3 } from "core/Maths/math.color"; + +describe("TC39 Decorator Migration", () => { + describe("serialize decorator", () => { + it("should store serialization metadata via Symbol.metadata", () => { + class TestClass { + @serialize() + public myProp: number = 42; + + @serialize("renamedProp") + public anotherProp: string = "hello"; + } + + const store = GetDirectStore(new TestClass()); + expect(store).toBeDefined(); + expect(store["myProp"]).toBeDefined(); + expect(store["myProp"].type).toBe(0); // default type + expect(store["renamedProp"]).toBeDefined(); + }); + + it("should merge stores from parent and child classes", () => { + class Parent { + @serialize() + public parentProp: number = 1; + } + + class Child extends Parent { + @serialize() + public childProp: number = 2; + } + + const child = new Child(); + const merged = GetMergedStore(child); + expect(merged["parentProp"]).toBeDefined(); + expect(merged["childProp"]).toBeDefined(); + }); + }); + + describe("serializeAsColor3 decorator", () => { + it("should serialize color3 properties", () => { + class ColorClass { + @serializeAsColor3() + public color: Color3 = new Color3(1, 0, 0); + } + + const store = GetDirectStore(new ColorClass()); + expect(store["color"]).toBeDefined(); + }); + }); + + describe("expandToProperty decorator", () => { + it("should create getter/setter that reads from backing field", () => { + class ExpandClass { + // @ts-expect-error Accessed dynamically by expandToProperty decorator + private _myCallback() { + // no-op + } + + @expandToProperty("_myCallback") + public accessor myExpanded: number; + + // @ts-expect-error Backing field accessed dynamically by expandToProperty + private _myExpanded: number = 10; + } + + const instance = new ExpandClass(); + expect(instance.myExpanded).toBe(10); + + instance.myExpanded = 20; + expect(instance.myExpanded).toBe(20); + }); + }); +}); diff --git a/packages/dev/gui/src/3D/materials/fluent/fluentMaterial.ts b/packages/dev/gui/src/3D/materials/fluent/fluentMaterial.ts index 42e6a7dee636..6a39b0586af8 100644 --- a/packages/dev/gui/src/3D/materials/fluent/fluentMaterial.ts +++ b/packages/dev/gui/src/3D/materials/fluent/fluentMaterial.ts @@ -42,7 +42,7 @@ export class FluentMaterial extends PushMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public innerGlowColorIntensity = 0.5; + public accessor innerGlowColorIntensity = 0.5; /** * Gets or sets the inner glow color (white by default) @@ -61,7 +61,7 @@ export class FluentMaterial extends PushMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public renderBorders = false; + public accessor renderBorders = false; /** * Gets or sets border width (default is 0.5) @@ -86,7 +86,7 @@ export class FluentMaterial extends PushMaterial { */ @serialize() @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public renderHoverLight = false; + public accessor renderHoverLight = false; /** * Gets or sets the radius used to render the hover light (default is 0.01) @@ -111,7 +111,7 @@ export class FluentMaterial extends PushMaterial { /** Gets or sets the texture to use for albedo color */ @expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty") - public albedoTexture: Nullable; + public accessor albedoTexture: Nullable; /** * Creates a new Fluent material diff --git a/packages/dev/materials/src/cell/cellMaterial.ts b/packages/dev/materials/src/cell/cellMaterial.ts index 09ab96ee58ad..c480b874f9f8 100644 --- a/packages/dev/materials/src/cell/cellMaterial.ts +++ b/packages/dev/materials/src/cell/cellMaterial.ts @@ -76,7 +76,7 @@ export class CellMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: BaseTexture; + public accessor diffuseTexture: BaseTexture; @serializeAsColor3("diffuse") public diffuseColor = new Color3(1, 1, 1); @@ -84,17 +84,17 @@ export class CellMaterial extends PushMaterial { @serialize("computeHighLevel") public _computeHighLevel: boolean = false; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public computeHighLevel: boolean; + public accessor computeHighLevel: boolean; @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/fire/fireMaterial.ts b/packages/dev/materials/src/fire/fireMaterial.ts index c8d08e104684..a35a304dfafe 100644 --- a/packages/dev/materials/src/fire/fireMaterial.ts +++ b/packages/dev/materials/src/fire/fireMaterial.ts @@ -65,17 +65,17 @@ export class FireMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: Nullable; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: Nullable; + public accessor diffuseTexture: Nullable; @serializeAsTexture("distortionTexture") private _distortionTexture: Nullable; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public distortionTexture: Nullable; + public accessor distortionTexture: Nullable; @serializeAsTexture("opacityTexture") private _opacityTexture: Nullable; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public opacityTexture: Nullable; + public accessor opacityTexture: Nullable; @serializeAsColor3("diffuse") public diffuseColor = new Color3(1, 1, 1); diff --git a/packages/dev/materials/src/fur/furMaterial.ts b/packages/dev/materials/src/fur/furMaterial.ts index 789ef550a491..5352825bfa19 100644 --- a/packages/dev/materials/src/fur/furMaterial.ts +++ b/packages/dev/materials/src/fur/furMaterial.ts @@ -79,12 +79,12 @@ export class FurMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: BaseTexture; + public accessor diffuseTexture: BaseTexture; @serializeAsTexture("heightTexture") private _heightTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public heightTexture: BaseTexture; + public accessor heightTexture: BaseTexture; @serializeAsColor3() public diffuseColor = new Color3(1, 1, 1); @@ -121,12 +121,12 @@ export class FurMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; @serialize() public highLevelFur: boolean = true; diff --git a/packages/dev/materials/src/gradient/gradientMaterial.ts b/packages/dev/materials/src/gradient/gradientMaterial.ts index 1b4af2ece2a8..6eb47bb8336d 100644 --- a/packages/dev/materials/src/gradient/gradientMaterial.ts +++ b/packages/dev/materials/src/gradient/gradientMaterial.ts @@ -72,7 +72,7 @@ export class GradientMaterial extends PushMaterial { @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; // The gradient top color, red by default @serializeAsColor3() @@ -101,7 +101,7 @@ export class GradientMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/grid/gridMaterial.ts b/packages/dev/materials/src/grid/gridMaterial.ts index 77670e1d8523..43cf29c08d1e 100644 --- a/packages/dev/materials/src/grid/gridMaterial.ts +++ b/packages/dev/materials/src/grid/gridMaterial.ts @@ -125,7 +125,7 @@ export class GridMaterial extends PushMaterial { * Texture to define opacity of the grid */ @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public opacityTexture: BaseTexture; + public accessor opacityTexture: BaseTexture; private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity); diff --git a/packages/dev/materials/src/lava/lavaMaterial.ts b/packages/dev/materials/src/lava/lavaMaterial.ts index 3b7d17cf30ff..ce6139211fb9 100644 --- a/packages/dev/materials/src/lava/lavaMaterial.ts +++ b/packages/dev/materials/src/lava/lavaMaterial.ts @@ -115,7 +115,7 @@ export class LavaMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: BaseTexture; + public accessor diffuseTexture: BaseTexture; @serializeAsTexture() public noiseTexture: BaseTexture; @@ -143,17 +143,17 @@ export class LavaMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("unlit") private _unlit = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public unlit: boolean; + public accessor unlit: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; private _scaledDiffuse = new Color3(); diff --git a/packages/dev/materials/src/mix/mixMaterial.ts b/packages/dev/materials/src/mix/mixMaterial.ts index 161d4f531438..4459501d7e04 100644 --- a/packages/dev/materials/src/mix/mixMaterial.ts +++ b/packages/dev/materials/src/mix/mixMaterial.ts @@ -78,12 +78,12 @@ export class MixMaterial extends PushMaterial { @serializeAsTexture("mixTexture1") private _mixTexture1: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public mixTexture1: BaseTexture; + public accessor mixTexture1: BaseTexture; @serializeAsTexture("mixTexture2") private _mixTexture2: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public mixTexture2: BaseTexture; + public accessor mixTexture2: BaseTexture; /** * Diffuse textures @@ -92,42 +92,42 @@ export class MixMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture1") private _diffuseTexture1: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture1: Texture; + public accessor diffuseTexture1: Texture; @serializeAsTexture("diffuseTexture2") private _diffuseTexture2: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture2: Texture; + public accessor diffuseTexture2: Texture; @serializeAsTexture("diffuseTexture3") private _diffuseTexture3: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture3: Texture; + public accessor diffuseTexture3: Texture; @serializeAsTexture("diffuseTexture4") private _diffuseTexture4: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture4: Texture; + public accessor diffuseTexture4: Texture; @serializeAsTexture("diffuseTexture1") private _diffuseTexture5: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture5: Texture; + public accessor diffuseTexture5: Texture; @serializeAsTexture("diffuseTexture2") private _diffuseTexture6: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture6: Texture; + public accessor diffuseTexture6: Texture; @serializeAsTexture("diffuseTexture3") private _diffuseTexture7: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture7: Texture; + public accessor diffuseTexture7: Texture; @serializeAsTexture("diffuseTexture4") private _diffuseTexture8: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture8: Texture; + public accessor diffuseTexture8: Texture; /** * Uniforms @@ -145,12 +145,12 @@ export class MixMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/normal/normalMaterial.ts b/packages/dev/materials/src/normal/normalMaterial.ts index 46e7b7d9ab80..eb24c406a6a2 100644 --- a/packages/dev/materials/src/normal/normalMaterial.ts +++ b/packages/dev/materials/src/normal/normalMaterial.ts @@ -113,7 +113,7 @@ export class NormalMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: BaseTexture; + public accessor diffuseTexture: BaseTexture; @serializeAsColor3() public diffuseColor = new Color3(1, 1, 1); @@ -121,12 +121,12 @@ export class NormalMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/simple/simpleMaterial.ts b/packages/dev/materials/src/simple/simpleMaterial.ts index 3e9750edba04..2b29c4f4c300 100644 --- a/packages/dev/materials/src/simple/simpleMaterial.ts +++ b/packages/dev/materials/src/simple/simpleMaterial.ts @@ -73,7 +73,7 @@ export class SimpleMaterial extends PushMaterial { @serializeAsTexture("diffuseTexture") private _diffuseTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture: BaseTexture; + public accessor diffuseTexture: BaseTexture; @serializeAsColor3("diffuse") public diffuseColor = new Color3(1, 1, 1); @@ -81,12 +81,12 @@ export class SimpleMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/terrain/terrainMaterial.ts b/packages/dev/materials/src/terrain/terrainMaterial.ts index 6d6e3b4cbaa0..48fcebc2ba31 100644 --- a/packages/dev/materials/src/terrain/terrainMaterial.ts +++ b/packages/dev/materials/src/terrain/terrainMaterial.ts @@ -76,37 +76,37 @@ export class TerrainMaterial extends PushMaterial { @serializeAsTexture("mixTexture") private _mixTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public mixTexture: BaseTexture; + public accessor mixTexture: BaseTexture; @serializeAsTexture("diffuseTexture1") private _diffuseTexture1: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture1: Texture; + public accessor diffuseTexture1: Texture; @serializeAsTexture("diffuseTexture2") private _diffuseTexture2: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture2: Texture; + public accessor diffuseTexture2: Texture; @serializeAsTexture("diffuseTexture3") private _diffuseTexture3: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTexture3: Texture; + public accessor diffuseTexture3: Texture; @serializeAsTexture("bumpTexture1") private _bumpTexture1: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture1: Texture; + public accessor bumpTexture1: Texture; @serializeAsTexture("bumpTexture2") private _bumpTexture2: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture2: Texture; + public accessor bumpTexture2: Texture; @serializeAsTexture("bumpTexture3") private _bumpTexture3: Texture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture3: Texture; + public accessor bumpTexture3: Texture; @serializeAsColor3() public diffuseColor = new Color3(1, 1, 1); @@ -120,12 +120,12 @@ export class TerrainMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/triPlanar/triPlanarMaterial.ts b/packages/dev/materials/src/triPlanar/triPlanarMaterial.ts index 5b5e4cee40f9..9688d5a46aeb 100644 --- a/packages/dev/materials/src/triPlanar/triPlanarMaterial.ts +++ b/packages/dev/materials/src/triPlanar/triPlanarMaterial.ts @@ -84,32 +84,32 @@ export class TriPlanarMaterial extends PushMaterial { @serializeAsTexture("diffuseTextureX") private _diffuseTextureX: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTextureX: BaseTexture; + public accessor diffuseTextureX: BaseTexture; @serializeAsTexture("diffuseTexturY") private _diffuseTextureY: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTextureY: BaseTexture; + public accessor diffuseTextureY: BaseTexture; @serializeAsTexture("diffuseTextureZ") private _diffuseTextureZ: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public diffuseTextureZ: BaseTexture; + public accessor diffuseTextureZ: BaseTexture; @serializeAsTexture("normalTextureX") private _normalTextureX: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public normalTextureX: BaseTexture; + public accessor normalTextureX: BaseTexture; @serializeAsTexture("normalTextureY") private _normalTextureY: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public normalTextureY: BaseTexture; + public accessor normalTextureY: BaseTexture; @serializeAsTexture("normalTextureZ") private _normalTextureZ: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public normalTextureZ: BaseTexture; + public accessor normalTextureZ: BaseTexture; @serialize() public tileSize: number = 1; @@ -126,12 +126,12 @@ export class TriPlanarMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; constructor(name: string, scene?: Scene) { super(name, scene); diff --git a/packages/dev/materials/src/water/waterMaterial.ts b/packages/dev/materials/src/water/waterMaterial.ts index 9c04c46e8ec3..e761d37c2109 100644 --- a/packages/dev/materials/src/water/waterMaterial.ts +++ b/packages/dev/materials/src/water/waterMaterial.ts @@ -108,7 +108,7 @@ export class WaterMaterial extends PushMaterial { @serializeAsTexture("bumpTexture") private _bumpTexture: BaseTexture; @expandToProperty("_markAllSubMeshesAsTexturesDirty") - public bumpTexture: BaseTexture; + public accessor bumpTexture: BaseTexture; @serializeAsColor3() public diffuseColor = new Color3(1, 1, 1); @@ -122,12 +122,12 @@ export class WaterMaterial extends PushMaterial { @serialize("disableLighting") private _disableLighting = false; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public disableLighting: boolean; + public accessor disableLighting: boolean; @serialize("maxSimultaneousLights") private _maxSimultaneousLights = 4; @expandToProperty("_markAllSubMeshesAsLightsDirty") - public maxSimultaneousLights: number; + public accessor maxSimultaneousLights: number; /** * Defines the wind force. @@ -155,7 +155,7 @@ export class WaterMaterial extends PushMaterial { @serialize("bumpSuperimpose") private _bumpSuperimpose = false; @expandToProperty("_markAllSubMeshesAsMiscDirty") - public bumpSuperimpose: boolean; + public accessor bumpSuperimpose: boolean; /** * Defines wether or not color refraction and reflection differently with .waterColor2 and .colorBlendFactor2. Non-linear (physically correct) fresnel. @@ -163,7 +163,7 @@ export class WaterMaterial extends PushMaterial { @serialize("fresnelSeparate") private _fresnelSeparate = false; @expandToProperty("_markAllSubMeshesAsMiscDirty") - public fresnelSeparate: boolean; + public accessor fresnelSeparate: boolean; /** * Defines wether or not bump Wwves modify the reflection. @@ -171,7 +171,7 @@ export class WaterMaterial extends PushMaterial { @serialize("bumpAffectsReflection") private _bumpAffectsReflection = false; @expandToProperty("_markAllSubMeshesAsMiscDirty") - public bumpAffectsReflection: boolean; + public accessor bumpAffectsReflection: boolean; /** * Defines the water color blended with the refraction (near). @@ -225,7 +225,7 @@ export class WaterMaterial extends PushMaterial { @serialize("useWorldCoordinatesForWaveDeformation") private _useWorldCoordinatesForWaveDeformation = false; @expandToProperty("_markAllSubMeshesAsMiscDirty") - public useWorldCoordinatesForWaveDeformation: boolean; + public accessor useWorldCoordinatesForWaveDeformation: boolean; protected _renderTargets = new SmartArray(16); diff --git a/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts b/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts index 70f640e5bdf2..1d7b0cd3bc1d 100644 --- a/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts +++ b/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts @@ -49,9 +49,11 @@ type FieldMeta = { const XML_CLASS_META = Symbol("__xml:meta$__"); const XML_CLASS_NAME = Symbol("__xml:name$__"); -function AddXmlMeta(target: any, meta: FieldMeta) { - const ctor = target.constructor; - (ctor[XML_CLASS_META] ??= []).push(meta); +function AddXmlMeta(context: { metadata: DecoratorMetadataObject }, meta: FieldMeta) { + if (!Object.hasOwn(context.metadata, XML_CLASS_META)) { + context.metadata[XML_CLASS_META] = []; + } + (context.metadata[XML_CLASS_META] as FieldMeta[]).push(meta); } /** @@ -59,7 +61,7 @@ function AddXmlMeta(target: any, meta: FieldMeta) { * @returns */ export function XmlName(name: XmlName) { - return (ctor: Function) => { + return (ctor: Function, _context: ClassDecoratorContext) => { (ctor as any)[XML_CLASS_NAME] = name; }; } @@ -69,7 +71,8 @@ export function XmlName(name: XmlName) { * @returns */ export function XmlIgnore() { - return (target: any, prop: string) => AddXmlMeta(target, { kind: "none", prop, ignore: true }); + return (_value: unknown, context: { name: string | symbol; metadata: DecoratorMetadataObject }) => + AddXmlMeta(context, { kind: "none", prop: String(context.name), ignore: true }); } /** @@ -77,7 +80,7 @@ export function XmlIgnore() { * @returns */ export function XmlAttr(opts?: { name: XmlName; formatter?: FormatterCtor }) { - return (target: any, prop: string) => AddXmlMeta(target, { kind: "attr", prop, ...opts }); + return (_value: unknown, context: { name: string | symbol; metadata: DecoratorMetadataObject }) => AddXmlMeta(context, { kind: "attr", prop: String(context.name), ...opts }); } /** @@ -86,7 +89,7 @@ export function XmlAttr(opts?: { name: XmlName; formatter?: FormatterCtor } * @returns */ export function XmlElem(opts?: { name: XmlName }) { - return (target: any, prop: string) => AddXmlMeta(target, { kind: "elem", prop, ...opts }); + return (_value: unknown, context: { name: string | symbol; metadata: DecoratorMetadataObject }) => AddXmlMeta(context, { kind: "elem", prop: String(context.name), ...opts }); } /** @@ -95,7 +98,19 @@ export function XmlElem(opts?: { name: XmlName }) { * @returns */ export function GetXmlFieldMeta(obj: any): FieldMeta[] { - return (obj?.constructor?.[XML_CLASS_META] ?? []) as FieldMeta[]; + const ctor = typeof obj === "function" ? obj : obj?.constructor; + const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; + if (!metadata) return []; + // Walk metadata chain to collect all field metadata + const result: FieldMeta[] = []; + let currentMeta: any = metadata; + while (currentMeta) { + if (Object.hasOwn(currentMeta, XML_CLASS_META)) { + result.push(...(currentMeta[XML_CLASS_META] as FieldMeta[])); + } + currentMeta = Object.getPrototypeOf(currentMeta); + } + return result; } /** diff --git a/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts b/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts index 3272a7463c35..164736355f43 100644 --- a/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts +++ b/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts @@ -15,6 +15,7 @@ import type { IPortData } from "./interfaces/portData"; import * as localStyles from "./graphNode.module.scss"; import * as commonStyles from "./common.module.scss"; import type { IEditablePropertyListOption, IEditablePropertyOption, IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; +import { getEditableProperties } from "core/Decorators/nodeDecorator"; import { PropertyTypeForEdition } from "core/Decorators/nodeDecorator"; import { ForceRebuild } from "./automaticProperties"; import dropdownArrowIcon from "../imgs/dropdownArrowIcon_white.svg"; @@ -905,20 +906,12 @@ export class GraphNode { } // Options - const propStore: IPropertyDescriptionForEdition[] = this.content.data._propStore; - if (propStore) { + const propStore: IPropertyDescriptionForEdition[] = getEditableProperties(this.content.data); + if (propStore.length) { const source = this.content.data; - const classes: string[] = []; - - let proto = Object.getPrototypeOf(source); - while (proto && proto.getClassName) { - classes.push(proto.getClassName()); - proto = Object.getPrototypeOf(proto); - } - - for (const { propertyName, displayName, type, options, className } of propStore) { - if (!options || !options.embedded || classes.indexOf(className) === -1) { + for (const { propertyName, displayName, type, options } of propStore) { + if (!options || !options.embedded) { continue; } diff --git a/packages/dev/smartFilters/src/blockFoundation/customShaderBlock.ts b/packages/dev/smartFilters/src/blockFoundation/customShaderBlock.ts index 9d5adacd5273..f14864d3542f 100644 --- a/packages/dev/smartFilters/src/blockFoundation/customShaderBlock.ts +++ b/packages/dev/smartFilters/src/blockFoundation/customShaderBlock.ts @@ -245,7 +245,8 @@ export class CustomShaderBlock extends ShaderBlock { const propertyType: PropertyTypeForEdition = constProperty.options ? PropertyTypeForEdition.List : PropertyTypeForEdition.Float; const decoratorApplier = EditableInPropertyPage(constProperty.friendlyName, propertyType, "PROPERTIES", editablePropertyOptions); - decoratorApplier(this, constProperty.friendlyName); + const metadata = (this.constructor as any)[Symbol.metadata] ?? ((this.constructor as any)[Symbol.metadata] = Object.create(null)); + decoratorApplier(undefined, { name: constProperty.friendlyName, metadata }); } /** diff --git a/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts b/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts index 7b5cf9380ee7..6d513d3246f5 100644 --- a/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts +++ b/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts @@ -78,6 +78,9 @@ export interface IPropertyDescriptionForEdition { className: string; } +/** @internal */ +const __bjsSmartFilterPropStoreKey = "__bjs_sf_prop_store__"; + /** * Decorator that flags a property in a node block as being editable * @param displayName - the display name of the property @@ -92,25 +95,30 @@ export function EditableInPropertyPage( groupName: string = "PROPERTIES", options?: IEditablePropertyOption ) { - return (target: any, propertyKey: string) => { - let propStore: IPropertyDescriptionForEdition[] = target._propStore; - if (!propStore) { + return (_value: unknown, context: { name: string | symbol; metadata: DecoratorMetadataObject }) => { + const meta = context.metadata; + let propStore: IPropertyDescriptionForEdition[]; + if (Object.hasOwn(meta, __bjsSmartFilterPropStoreKey)) { + propStore = meta[__bjsSmartFilterPropStoreKey] as IPropertyDescriptionForEdition[]; + } else { propStore = []; - target._propStore = propStore; + meta[__bjsSmartFilterPropStoreKey] = propStore; } + const propertyKey = String(context.name); + const propToAdd: IPropertyDescriptionForEdition = { propertyName: propertyKey, displayName: displayName, type: propertyType, groupName: groupName, options: options ?? {}, - className: target.constructor.name, + className: "", }; // If the property already exists, overwrite it, otherwise add it // Note: It may have been redefined since the application started - const existingIndex = propStore.findIndex((p) => p.propertyName === propertyKey && p.className === target.constructor.name && options?.blockType === p.options?.blockType); + const existingIndex = propStore.findIndex((p) => p.propertyName === propertyKey && options?.blockType === p.options?.blockType); if (existingIndex !== -1) { propStore[existingIndex] = propToAdd; } else { @@ -118,3 +126,28 @@ export function EditableInPropertyPage( } }; } + +/** + * Gets the editable properties for a given target using TC39 decorator metadata. + * Walks the metadata prototype chain to include properties from parent classes. + * @param target - the target object (instance or constructor) + * @returns array of property descriptions + */ +export function getSmartFilterEditableProperties(target: any): IPropertyDescriptionForEdition[] { + const ctor = typeof target === "function" ? target : target?.constructor; + const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; + if (!metadata) { + return []; + } + + const result: IPropertyDescriptionForEdition[] = []; + let currentMeta: any = metadata; + while (currentMeta) { + if (Object.hasOwn(currentMeta, __bjsSmartFilterPropStoreKey)) { + const store = currentMeta[__bjsSmartFilterPropStoreKey] as IPropertyDescriptionForEdition[]; + result.push(...store); + } + currentMeta = Object.getPrototypeOf(currentMeta); + } + return result; +} diff --git a/packages/dev/smartFilters/src/utils/buildTools/convertShaders.ts b/packages/dev/smartFilters/src/utils/buildTools/convertShaders.ts index cbfd80b50267..3e7d39bdd202 100644 --- a/packages/dev/smartFilters/src/utils/buildTools/convertShaders.ts +++ b/packages/dev/smartFilters/src/utils/buildTools/convertShaders.ts @@ -14,26 +14,18 @@ import { log, error } from "./buildToolsLogger.js"; export function ConvertShaders(shaderPath: string, smartFiltersCorePath: string, babylonCorePath?: string) { const stats = fs.statSync(shaderPath); - let shaderFiles: fs.Dirent[]; + let shaderFiles: { name: string; dir: string }[]; if (stats.isFile()) { - // If it's a file, create a Dirent-like object for consistency - const fileName = path.basename(shaderPath); - const dirPath = path.dirname(shaderPath); - shaderFiles = [ - { - name: fileName, - parentPath: dirPath, - isFile: () => true, - isDirectory: () => false, - } as unknown as fs.Dirent, - ]; + shaderFiles = [{ name: path.basename(shaderPath), dir: path.dirname(shaderPath) }]; } else if (stats.isDirectory()) { // Get all files in the directory const allFiles = fs.readdirSync(shaderPath, { withFileTypes: true, recursive: true }); // Find all shaders (files with .fragment.glsl or .block.glsl extensions) - shaderFiles = allFiles.filter((file) => file.isFile() && (file.name.endsWith(".fragment.glsl") || file.name.endsWith(".block.glsl"))); + shaderFiles = allFiles + .filter((file) => file.isFile() && (file.name.endsWith(".fragment.glsl") || file.name.endsWith(".block.glsl"))) + .map((file) => ({ name: file.name, dir: file.parentPath })); } else { error(`Error: ${shaderPath} is neither a file nor a directory.`); return; @@ -41,7 +33,7 @@ export function ConvertShaders(shaderPath: string, smartFiltersCorePath: string, // Convert all shaders for (const shaderFile of shaderFiles) { - const fullPathAndFileName = path.join(shaderFile.parentPath, shaderFile.name); + const fullPathAndFileName = path.join(shaderFile.dir, shaderFile.name); ConvertShader(fullPathAndFileName, smartFiltersCorePath, babylonCorePath); } } diff --git a/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts b/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts index 07902fabc812..9112fb58e6dd 100644 --- a/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts +++ b/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts @@ -4,7 +4,7 @@ import { SmartFilter } from "../../src/smartFilter.js"; import { ImportCustomBlockDefinition } from "../../src/serialization/importCustomBlockDefinition.js"; import { CustomShaderBlock } from "../../src/blockFoundation/customShaderBlock.js"; import { SerializedShaderBlockDefinitionV1 } from "../../src/serialization/v1/shaderBlockSerialization.types"; -import { IPropertyDescriptionForEdition, PropertyTypeForEdition } from "../../src/editorUtils/editableInPropertyPage.js"; +import { PropertyTypeForEdition, getSmartFilterEditableProperties } from "../../src/editorUtils/editableInPropertyPage.js"; const glslValidFloatDefaultValue = ` // { "smartFilterBlockType": "TestBlock", "namespace": "Bug.Repro" } @@ -245,7 +245,7 @@ vec4 test(vec2 vUV) { // main const customShaderBlock = CustomShaderBlock.Create(smartFilter, "TestBlock", blockDefinition); // Assert - expect((customShaderBlock as any)._propStore as IPropertyDescriptionForEdition[]).toContainEqual({ + expect(getSmartFilterEditableProperties(customShaderBlock)).toContainEqual({ propertyName: "cp", displayName: "cp", type: PropertyTypeForEdition.List, diff --git a/packages/public/umd/babylonjs-addons/tsconfig.build.json b/packages/public/umd/babylonjs-addons/tsconfig.build.json index 073298a9ddb3..966c0fb2101e 100644 --- a/packages/public/umd/babylonjs-addons/tsconfig.build.json +++ b/packages/public/umd/babylonjs-addons/tsconfig.build.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "./dist", - "target": "ES5", + "target": "es2015", "rootDir": "../../../", "declaration": false, "importHelpers": true, diff --git a/packages/public/umd/babylonjs-gui/tsconfig.build.json b/packages/public/umd/babylonjs-gui/tsconfig.build.json index ec3ecdb8c467..56c6550c8c56 100644 --- a/packages/public/umd/babylonjs-gui/tsconfig.build.json +++ b/packages/public/umd/babylonjs-gui/tsconfig.build.json @@ -4,7 +4,7 @@ "compilerOptions": { "outDir": "./dist", "rootDir": "../../../", - "target": "ES5", + "target": "es2015", "declaration": false, "importHelpers": true, "paths": { diff --git a/packages/public/umd/babylonjs-loaders/tsconfig.build.json b/packages/public/umd/babylonjs-loaders/tsconfig.build.json index 0ff8dec65554..0c69d353d25b 100644 --- a/packages/public/umd/babylonjs-loaders/tsconfig.build.json +++ b/packages/public/umd/babylonjs-loaders/tsconfig.build.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "./dist", - "target": "ES5", + "target": "es2015", "rootDir": "../../../", "declaration": false, "importHelpers": true, diff --git a/packages/public/umd/babylonjs-materials/tsconfig.build.json b/packages/public/umd/babylonjs-materials/tsconfig.build.json index dc1d5158cda5..3d81444d3308 100644 --- a/packages/public/umd/babylonjs-materials/tsconfig.build.json +++ b/packages/public/umd/babylonjs-materials/tsconfig.build.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "./dist", - "target": "ES5", + "target": "es2015", "rootDir": "../../../", "declaration": false, "importHelpers": true, diff --git a/packages/public/umd/babylonjs-post-process/tsconfig.build.json b/packages/public/umd/babylonjs-post-process/tsconfig.build.json index 40f779101889..6fd1c2389d66 100644 --- a/packages/public/umd/babylonjs-post-process/tsconfig.build.json +++ b/packages/public/umd/babylonjs-post-process/tsconfig.build.json @@ -4,7 +4,7 @@ "compilerOptions": { "outDir": "./dist", "rootDir": "../../../", - "target": "ES5", + "target": "es2015", "declaration": false, "importHelpers": true, "paths": { diff --git a/packages/public/umd/babylonjs-procedural-textures/tsconfig.build.json b/packages/public/umd/babylonjs-procedural-textures/tsconfig.build.json index ca9d3cea0deb..95cb02e403bf 100644 --- a/packages/public/umd/babylonjs-procedural-textures/tsconfig.build.json +++ b/packages/public/umd/babylonjs-procedural-textures/tsconfig.build.json @@ -4,7 +4,7 @@ "compilerOptions": { "outDir": "./dist", "rootDir": "../../../", - "target": "ES5", + "target": "es2015", "declaration": false, "importHelpers": true, "paths": { diff --git a/packages/public/umd/babylonjs-serializers/tsconfig.build.json b/packages/public/umd/babylonjs-serializers/tsconfig.build.json index b721f456230a..e32bbda6fa1e 100644 --- a/packages/public/umd/babylonjs-serializers/tsconfig.build.json +++ b/packages/public/umd/babylonjs-serializers/tsconfig.build.json @@ -4,7 +4,7 @@ "compilerOptions": { "outDir": "./dist", "rootDir": "../../../", - "target": "ES5", + "target": "es2015", "declaration": false, "importHelpers": true, "paths": { diff --git a/packages/public/umd/babylonjs/tsconfig.build.json b/packages/public/umd/babylonjs/tsconfig.build.json index 1aa3d1b18a02..6bdb2e19398e 100644 --- a/packages/public/umd/babylonjs/tsconfig.build.json +++ b/packages/public/umd/babylonjs/tsconfig.build.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "./dist", - "target": "ES5", + "target": "es2015", "rootDir": "../../../", "declaration": false, "importHelpers": true, diff --git a/packages/tools/guiEditor/src/components/propertyTab/propertyGrids/gui/gridPropertyGridComponent.tsx b/packages/tools/guiEditor/src/components/propertyTab/propertyGrids/gui/gridPropertyGridComponent.tsx index 4c09eaaad1db..fc2b8ff5aa30 100644 --- a/packages/tools/guiEditor/src/components/propertyTab/propertyGrids/gui/gridPropertyGridComponent.tsx +++ b/packages/tools/guiEditor/src/components/propertyTab/propertyGrids/gui/gridPropertyGridComponent.tsx @@ -158,7 +158,8 @@ export class GridPropertyGridComponent extends React.Component { @@ -146,30 +146,18 @@ export class GenericPropertyTabComponent extends React.Component; } const componentList: { [groupName: string]: JSX.Element[] } = {}, groups: string[] = []; - const classes: string[] = []; - - let proto = Object.getPrototypeOf(block); - while (proto && proto.getClassName) { - classes.push(proto.getClassName()); - proto = Object.getPrototypeOf(proto); - } - - for (const { propertyName, displayName, type, groupName, options, className } of propStore) { + for (const { propertyName, displayName, type, groupName, options } of propStore) { let components = componentList[groupName]; - if (classes.indexOf(className) === -1) { - continue; - } - if (!components) { components = []; componentList[groupName] = components; diff --git a/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx index 84eef5925c9e..dd3bedfd2523 100644 --- a/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -10,7 +10,7 @@ import { FloatLineComponent } from "shared-ui-components/lines/floatLineComponen import { SliderLineComponent } from "shared-ui-components/lines/sliderLineComponent"; import { Vector3LineComponent } from "shared-ui-components/lines/vector3LineComponent"; import type { IEditablePropertyListOption } from "core/Decorators/nodeDecorator"; -import { PropertyTypeForEdition, type IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; +import { PropertyTypeForEdition, getEditableProperties, type IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; import { ForceRebuild } from "shared-ui-components/nodeGraphSystem/automaticProperties"; import { NodeParticleBlockConnectionPointTypes } from "core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes"; import type { NodeParticleConnectionPoint } from "core/Particles/Node/nodeParticleBlockConnectionPoint"; @@ -143,30 +143,18 @@ export class GenericPropertyTabComponent extends React.Component; } const componentList: { [groupName: string]: JSX.Element[] } = {}, groups: string[] = []; - const classes: string[] = []; - - let proto = Object.getPrototypeOf(block); - while (proto && proto.getClassName) { - classes.push(proto.getClassName()); - proto = Object.getPrototypeOf(proto); - } - - for (const { propertyName, displayName, type, groupName, options, className } of propStore) { + for (const { propertyName, displayName, type, groupName, options } of propStore) { let components = componentList[groupName]; - if (classes.indexOf(className) === -1) { - continue; - } - if (!components) { components = []; componentList[groupName] = components; diff --git a/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx index cff8fe4bcee5..3596e9f3f84c 100644 --- a/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -13,7 +13,7 @@ import { Color4LineComponent } from "shared-ui-components/lines/color4LineCompon import { MatrixLineComponent } from "shared-ui-components/lines/matrixLineComponent"; import type { NodeRenderGraphBlock } from "core/FrameGraph/Node/nodeRenderGraphBlock"; import type { IEditablePropertyListOption, IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; -import { PropertyTypeForEdition } from "core/Decorators/nodeDecorator"; +import { PropertyTypeForEdition, getEditableProperties } from "core/Decorators/nodeDecorator"; import { Constants } from "core/Engines/constants"; import { ForceRebuild } from "shared-ui-components/nodeGraphSystem/automaticProperties"; import { Color3LineComponent } from "shared-ui-components/lines/color3LineComponent"; @@ -145,30 +145,18 @@ export class GenericPropertyTabComponent extends React.Component; } const componentList: { [groupName: string]: JSX.Element[] } = {}, groups: string[] = []; - const classes: string[] = []; - - let proto = Object.getPrototypeOf(block); - while (proto && proto.getClassName) { - classes.push(proto.getClassName()); - proto = Object.getPrototypeOf(proto); - } - - for (const { propertyName, displayName, type, groupName, options, className } of propStore) { + for (const { propertyName, displayName, type, groupName, options } of propStore) { let components = componentList[groupName]; - if (classes.indexOf(className) === -1) { - continue; - } - if (!components) { components = []; componentList[groupName] = components; diff --git a/packages/tools/playground/src/tools/monaco/ts/tsPipeline.ts b/packages/tools/playground/src/tools/monaco/ts/tsPipeline.ts index 49b790bbe2a3..dc6dbab25e02 100644 --- a/packages/tools/playground/src/tools/monaco/ts/tsPipeline.ts +++ b/packages/tools/playground/src/tools/monaco/ts/tsPipeline.ts @@ -22,8 +22,6 @@ const TsOptions = { baseUrl: "file:///pg/", typeRoots: [], isolatedModules: true, - experimentalDecorators: true, - emitDecoratorMetadata: false, allowUmdGlobalAccess: true, inlineSourceMap: true, inlineSources: true, diff --git a/packages/tools/smartFiltersEditorControl/src/configuration/editorBlocks/webCamInputBlock/webCamInputBlock.ts b/packages/tools/smartFiltersEditorControl/src/configuration/editorBlocks/webCamInputBlock/webCamInputBlock.ts index 5a36846e120b..02bc88928f8f 100644 --- a/packages/tools/smartFiltersEditorControl/src/configuration/editorBlocks/webCamInputBlock/webCamInputBlock.ts +++ b/packages/tools/smartFiltersEditorControl/src/configuration/editorBlocks/webCamInputBlock/webCamInputBlock.ts @@ -125,7 +125,9 @@ export class WebCamInputBlock extends InputBlock { */ @editableInPropertyPage("Source", PropertyTypeForEdition.List, "PROPERTIES", { notifiers: { update: true }, - options: WebCamInputBlock._WebCamSourceManager.onSourcesLoaded as Observable, + get options() { + return WebCamInputBlock._WebCamSourceManager.onSourcesLoaded as Observable; + }, valuesAreStrings: true, }) public set webcamSourceId(id: string) { diff --git a/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx index e129085a25a6..c13cce810b43 100644 --- a/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -3,7 +3,7 @@ import { LineContainerComponent } from "../../sharedComponents/lineContainerComp import { TextInputLineComponent } from "shared-ui-components/lines/textInputLineComponent.js"; import { TextLineComponent } from "shared-ui-components/lines/textLineComponent.js"; import type { IPropertyComponentProps } from "shared-ui-components/nodeGraphSystem/interfaces/propertyComponentProps"; -import { type BaseBlock, PropertyTypeForEdition, type IEditablePropertyOption, type IPropertyDescriptionForEdition } from "smart-filters"; +import { type BaseBlock, PropertyTypeForEdition, type IEditablePropertyOption, type IPropertyDescriptionForEdition, getSmartFilterEditableProperties } from "smart-filters"; import { CheckBoxLineComponent } from "../../sharedComponents/checkBoxLineComponent.js"; import { FloatSliderComponent } from "../../sharedComponents/floatSliderComponent.js"; import { FloatLineComponent } from "shared-ui-components/lines/floatLineComponent.js"; @@ -99,8 +99,8 @@ export class GenericPropertyTabComponent extends react.Component; } const componentList: { [groupName: string]: JSX.Element[] } = {}; const groups: string[] = []; - const classes: string[] = []; - let proto = Object.getPrototypeOf(block); - while (proto) { - classes.push(proto.constructor.name); - proto = Object.getPrototypeOf(proto); - } - for (const propDescription of propStore) { - const { displayName, type, groupName, options, className } = propDescription; + const { displayName, type, groupName, options } = propDescription; let propertyName = propDescription.propertyName; let target: unknown = block; @@ -138,10 +131,6 @@ export class GenericPropertyTabComponent extends react.Component; } diff --git a/packages/tools/snippetLoader/src/snippetLoader.ts b/packages/tools/snippetLoader/src/snippetLoader.ts index ad27a130504e..f2740cbe219f 100644 --- a/packages/tools/snippetLoader/src/snippetLoader.ts +++ b/packages/tools/snippetLoader/src/snippetLoader.ts @@ -101,8 +101,6 @@ async function BuiltInTranspile(source: string, fileName: string): Promise extends } @state() - private _isFaultedBacking = false; + private accessor _isFaultedBacking = false; protected get _isFaulted() { return this._isFaultedBacking; @@ -610,19 +610,19 @@ export abstract class ViewerElement extends * The engine to use for rendering. */ @property({ converter: coerceEngineAttribute }) - public engine: CanvasViewerOptions["engine"] = this._options.engine; + public accessor engine: CanvasViewerOptions["engine"] = this._options.engine; /** * When true, the scene will be rendered even if no scene state has changed. */ @property({ attribute: "render-when-idle", type: Boolean }) - public renderWhenIdle: boolean = this._options.autoSuspendRendering === false; + public accessor renderWhenIdle: boolean = this._options.autoSuspendRendering === false; /** * The model URL. */ @property() - public source: Nullable = this._options.source ?? null; + public accessor source: Nullable = this._options.source ?? null; /** * Forces the model to be loaded with the specified extension. @@ -630,7 +630,7 @@ export abstract class ViewerElement extends * If this property is not set, the extension will be inferred from the model URL when possible. */ @property() - public extension: Nullable = null; + public accessor extension: Nullable = null; /** * The texture URLs used for lighting and skybox. Setting this property will set both environmentLighting and environmentSkybox. @@ -640,31 +640,31 @@ export abstract class ViewerElement extends return newValue.lighting !== oldValue.lighting || newValue.skybox !== oldValue.skybox; }, }) - public get environment(): { lighting: Nullable; skybox: Nullable } { - return { lighting: this.environmentLighting, skybox: this.environmentSkybox }; - } public set environment(url: string) { this.environmentLighting = url || null; this.environmentSkybox = url || null; } + public get environment(): { lighting: Nullable; skybox: Nullable } { + return { lighting: this.environmentLighting, skybox: this.environmentSkybox }; + } /** * The texture URL for lighting. */ @property({ attribute: "environment-lighting" }) - public environmentLighting: Nullable = this._options.environmentLighting ?? null; + public accessor environmentLighting: Nullable = this._options.environmentLighting ?? null; /** * The texture URL for the skybox. */ @property({ attribute: "environment-skybox" }) - public environmentSkybox: Nullable = this._options.environmentSkybox ?? null; + public accessor environmentSkybox: Nullable = this._options.environmentSkybox ?? null; /** * A value between 0 and 2 that specifies the intensity of the environment lighting. */ @property({ type: Number, attribute: "environment-intensity" }) - public environmentIntensity: Nullable = this._options.environmentConfig?.intensity ?? null; + public accessor environmentIntensity: Nullable = this._options.environmentConfig?.intensity ?? null; /** * A value in radians that specifies the rotation of the environment. @@ -673,7 +673,7 @@ export abstract class ViewerElement extends type: Number, attribute: "environment-rotation", }) - public environmentRotation: Nullable = this._options.environmentConfig?.rotation ?? null; + public accessor environmentRotation: Nullable = this._options.environmentConfig?.rotation ?? null; /** * The type of shadows to use. @@ -681,10 +681,10 @@ export abstract class ViewerElement extends @property({ attribute: "shadow-quality", }) - public shadowQuality: Nullable = null; + public accessor shadowQuality: Nullable = null; @state() - private _loadingProgress: boolean | number = false; + private accessor _loadingProgress: boolean | number = false; /** * Gets information about loading activity. @@ -701,7 +701,7 @@ export abstract class ViewerElement extends * A value between 0 and 1 that specifies how much to blur the skybox. */ @property({ attribute: "skybox-blur" }) - public skyboxBlur: Nullable = this._options.environmentConfig?.blur ?? null; + public accessor skyboxBlur: Nullable = this._options.environmentConfig?.blur ?? null; /** * The tone mapping to use for rendering the scene. @@ -715,25 +715,25 @@ export abstract class ViewerElement extends return value; }, }) - public toneMapping: Nullable = this._options.postProcessing?.toneMapping ?? null; + public accessor toneMapping: Nullable = this._options.postProcessing?.toneMapping ?? null; /** * The contrast applied to the scene. */ @property() - public contrast: Nullable = this._options.postProcessing?.contrast ?? null; + public accessor contrast: Nullable = this._options.postProcessing?.contrast ?? null; /** * The exposure applied to the scene. */ @property() - public exposure: Nullable = this._options.postProcessing?.exposure ?? null; + public accessor exposure: Nullable = this._options.postProcessing?.exposure ?? null; /** * Enables or disables screen space ambient occlusion (SSAO). */ @property({ type: String }) - public ssao: Nullable = this._options.postProcessing?.ssao ?? null; + public accessor ssao: Nullable = this._options.postProcessing?.ssao ?? null; /** * The clear color (e.g. background color) for the viewer. @@ -745,7 +745,7 @@ export abstract class ViewerElement extends toAttribute: (color: Nullable) => (color ? color.toHexString() : null), }, }) - public clearColor: Nullable = this._options.clearColor + public accessor clearColor: Nullable = this._options.clearColor ? new Color4(this._options.clearColor[0], this._options.clearColor[1], this._options.clearColor[2], this._options.clearColor[3] ?? 1) : null; @@ -756,7 +756,7 @@ export abstract class ViewerElement extends attribute: "camera-auto-orbit", type: Boolean, }) - public cameraAutoOrbit = this._options.cameraAutoOrbit?.enabled ?? false; + public accessor cameraAutoOrbit = this._options.cameraAutoOrbit?.enabled ?? false; /** * The speed at which the camera auto-orbits around the target. @@ -765,7 +765,7 @@ export abstract class ViewerElement extends attribute: "camera-auto-orbit-speed", type: Number, }) - public cameraAutoOrbitSpeed: Nullable = this._options.cameraAutoOrbit?.speed ?? null; + public accessor cameraAutoOrbitSpeed: Nullable = this._options.cameraAutoOrbit?.speed ?? null; /** * The delay in milliseconds before the camera starts auto-orbiting. @@ -774,7 +774,7 @@ export abstract class ViewerElement extends attribute: "camera-auto-orbit-delay", type: Number, }) - public cameraAutoOrbitDelay: Nullable = this._options.cameraAutoOrbit?.delay ?? null; + public accessor cameraAutoOrbitDelay: Nullable = this._options.cameraAutoOrbit?.delay ?? null; /** * The set of defined hot spots. @@ -789,7 +789,7 @@ export abstract class ViewerElement extends return JSON.parse(value); }, }) - public hotSpots: Record = this._options.hotSpots ?? {}; + public accessor hotSpots: Record = this._options.hotSpots ?? {}; /** * True if the viewer has any hotspots. @@ -802,7 +802,7 @@ export abstract class ViewerElement extends * True if the default animation should play automatically when a model is loaded. */ @property({ attribute: "animation-auto-play", type: Boolean }) - public animationAutoPlay: boolean = !!this._options.animationAutoPlay; + public accessor animationAutoPlay: boolean = !!this._options.animationAutoPlay; /** * The list of animation names for the currently loaded model. @@ -822,7 +822,7 @@ export abstract class ViewerElement extends * The currently selected animation index. */ @property({ attribute: "selected-animation", type: Number }) - public selectedAnimation: Nullable = this._options.selectedAnimation ?? null; + public accessor selectedAnimation: Nullable = this._options.selectedAnimation ?? null; /** * True if an animation is currently playing. @@ -835,22 +835,22 @@ export abstract class ViewerElement extends * The speed scale at which animations are played. */ @property({ attribute: "animation-speed" }) - public animationSpeed = this._options.animationSpeed ?? 1; + public accessor animationSpeed = this._options.animationSpeed ?? 1; /** * The current point on the selected animation timeline, normalized between 0 and 1. */ @property({ attribute: false }) - public animationProgress = 0; + public accessor animationProgress = 0; @state() - private _animations: readonly string[] = []; + private accessor _animations: readonly string[] = []; @state() - private _isAnimationPlaying = false; + private accessor _isAnimationPlaying = false; @state() - private _showAnimationSlider = true; + private accessor _showAnimationSlider = true; /** * The list of material variants for the currently loaded model. @@ -863,13 +863,13 @@ export abstract class ViewerElement extends * The currently selected material variant. */ @property({ attribute: "material-variant" }) - public selectedMaterialVariant: Nullable = this._options.selectedMaterialVariant ?? null; + public accessor selectedMaterialVariant: Nullable = this._options.selectedMaterialVariant ?? null; /** * True if scene cameras should be used as hotspots. */ @property({ attribute: "cameras-as-hotspots", type: Boolean }) - public camerasAsHotSpots = false; + public accessor camerasAsHotSpots = false; /** * Determines the behavior of the reset function, and the associated default reset button. @@ -879,13 +879,13 @@ export abstract class ViewerElement extends * - [ResetFlag] - A space separated list of reset flags that reset various aspects of the viewer state. */ @property({ attribute: "reset-mode", converter: coerceResetMode }) - public resetMode: ResetMode = "auto"; + public accessor resetMode: ResetMode = "auto"; @query("#canvasContainer") - private _canvasContainer: HTMLDivElement | undefined; + private accessor _canvasContainer!: HTMLDivElement | null; @query("#hotSpotSelect") - private _hotSpotSelect: HTMLSelectElement | undefined; + private accessor _hotSpotSelect!: HTMLSelectElement | null; /** * Toggles the play/pause animation state if there is a selected animation. diff --git a/tsconfig.build.json b/tsconfig.build.json index aa880661a0a3..de1eb9957167 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -4,11 +4,10 @@ "importHelpers": true, "moduleResolution": "node", "module": "ES2020", - "target": "es2021", // esnext has an issue with class generation and our decoders. TODO - avoid using decorators until in standard + "target": "es2021", "declaration": true, "sourceMap": true, "inlineSources": true, - "experimentalDecorators": true, "noImplicitAny": true, "noImplicitOverride": true, "noImplicitReturns": true, @@ -32,8 +31,10 @@ "es2017", "es2022.error", "es2022.array", + "es2022.object", "es2021.string", - "es2022.string" + "es2022.string", + "esnext.decorators" ], "paths": { "core/*": ["dev/core/dist/*"], diff --git a/tsconfig.json b/tsconfig.json index 917912392589..fab6d1c4fe63 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,6 @@ "compilerOptions": { "baseUrl": "packages", - "experimentalDecorators": true, "noImplicitAny": true, "noImplicitOverride": true, "noImplicitReturns": true, diff --git a/tsconfig.test.json b/tsconfig.test.json index db069fb3249e..c566b9d3235b 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -15,7 +15,9 @@ "es2017", "es2022.error", "es2022.array", - "es2021.string" + "es2021.string", + "esnext.decorators", + "es2022.object" ] } } From f2fc3ad9c493d250be9abfb52f07dd7411bde0e8 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Fri, 20 Mar 2026 15:17:56 +0100 Subject: [PATCH 2/5] fix: update tslib import to use installed package instead of hardcoded copy --- packages/dev/buildTools/src/pathTransform.ts | 255 +------------------ 1 file changed, 4 insertions(+), 251 deletions(-) diff --git a/packages/dev/buildTools/src/pathTransform.ts b/packages/dev/buildTools/src/pathTransform.ts index 7af10ecbfbff..6331c40b0d06 100644 --- a/packages/dev/buildTools/src/pathTransform.ts +++ b/packages/dev/buildTools/src/pathTransform.ts @@ -218,256 +218,9 @@ function TransformerFactory(context: ts.Transformatio export const storeTsLib = () => { const tsLibPath = path.resolve(path.resolve(".", "tslib.es6.js")); if (!fs.existsSync(tsLibPath)) { - fs.writeFileSync(tsLibPath, TslibContent); + // Read from the installed tslib package instead of using a hardcoded copy, + // so that the helpers stay in sync with the TypeScript version. + const tslibSource = require.resolve("tslib/tslib.es6.mjs"); + fs.copyFileSync(tslibSource, tsLibPath); } }; - -// tslib 2.4.0 -const TslibContent = ` -/****************************************************************************** -Copyright (c) Microsoft Corporation. -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -export function __extends(d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -export var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -export function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) - t[p[i]] = s[p[i]]; - } - return t; -} - -export function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -export function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -export function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -export function __awaiter(thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -export function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -export var __createBinding = Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -}); - -export function __exportStar(m, o) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); -} - -export function __values(o) { - var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; - if (m) return m.call(o); - if (o && typeof o.length === "number") return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; - throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); -} - -export function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -/** @deprecated */ -export function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -/** @deprecated */ -export function __spreadArrays() { - for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; - for (var r = Array(s), k = 0, i = 0; i < il; i++) - for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) - r[k] = a[j]; - return r; -} - -export function __spreadArray(to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; - } - } - return to.concat(ar || Array.prototype.slice.call(from)); -} - -export function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -export function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -export function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -export function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -export function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -var __setModuleDefault = Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}; - -export function __importStar(mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -} - -export function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} - -export function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -export function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - -export function __classPrivateFieldIn(state, receiver) { - if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); - return typeof state === "function" ? receiver === state : state.has(receiver); -} -`; From c39754364a483ccdd38daeb137db49f23a36a761 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Fri, 27 Mar 2026 14:34:16 +0100 Subject: [PATCH 3/5] fix: resolve rebase conflicts and fix TC39 decorator migration issues - Resolve merge conflicts in convertShaders.ts and tsconfig.build.json - Add useDefineForClassFields: false to prevent class field override issues - Add 'declare' to type-narrowing _effectWrapper overrides in 18 PostProcess subclasses to prevent TC39 decorator lowering from emitting void 0 assignments that overwrite parent constructor values - Rename getEditableProperties/getSmartFilterEditableProperties to PascalCase per repo naming convention - Add eslint-disable for internal double-underscore metadata keys - Fix test assertion in decorators.test.ts (property stored under key name, not sourceName) - Add Symbol.metadata polyfill to vitest.setup.ts for Node.js compatibility - Fix missing curly braces in xml.interfaces.ts - Update customShaderBlock.test.ts: className is empty string with TC39 decorators (no target available in decorator context) --- packages/dev/core/src/Decorators/nodeDecorator.ts | 3 ++- packages/dev/core/src/Layers/highlightLayer.ts | 2 +- packages/dev/core/src/Misc/decorators.functions.ts | 2 ++ .../src/PostProcesses/blackAndWhitePostProcess.ts | 2 +- .../src/PostProcesses/bloomMergePostProcess.ts | 2 +- .../dev/core/src/PostProcesses/blurPostProcess.ts | 2 +- .../chromaticAberrationPostProcess.ts | 2 +- .../PostProcesses/circleOfConfusionPostProcess.ts | 2 +- .../PostProcesses/colorCorrectionPostProcess.ts | 2 +- .../src/PostProcesses/convolutionPostProcess.ts | 2 +- .../PostProcesses/extractHighlightsPostProcess.ts | 2 +- .../core/src/PostProcesses/filterPostProcess.ts | 2 +- .../dev/core/src/PostProcesses/fxaaPostProcess.ts | 2 +- .../dev/core/src/PostProcesses/grainPostProcess.ts | 2 +- .../PostProcesses/imageProcessingPostProcess.ts | 2 +- .../src/PostProcesses/motionBlurPostProcess.ts | 2 +- .../dev/core/src/PostProcesses/passPostProcess.ts | 2 +- .../screenSpaceCurvaturePostProcess.ts | 2 +- .../core/src/PostProcesses/sharpenPostProcess.ts | 2 +- .../core/src/PostProcesses/tonemapPostProcess.ts | 2 +- .../test/unit/Decorators/decorators.inline-test.ts | 1 + .../core/test/unit/Decorators/decorators.test.ts | 3 ++- .../serializers/src/3MF/core/xml/xml.interfaces.ts | 4 +++- .../src/nodeGraphSystem/graphNode.ts | 4 ++-- .../src/editorUtils/editableInPropertyPage.ts | 3 ++- .../test/unit/customShaderBlock.test.ts | 6 +++--- .../properties/genericNodePropertyComponent.tsx | 4 ++-- .../properties/genericNodePropertyComponent.tsx | 4 ++-- .../properties/genericNodePropertyComponent.tsx | 4 ++-- .../properties/genericNodePropertyComponent.tsx | 4 ++-- .../properties/genericNodePropertyComponent.tsx | 8 ++++---- .../properties/inputNodePropertyComponent.tsx | 4 ++-- tsconfig.build.json | 1 + tsconfig.json | 1 + vitest.config.mts | 14 ++++++++++++++ vitest.setup.ts | 4 ++++ 36 files changed, 69 insertions(+), 41 deletions(-) diff --git a/packages/dev/core/src/Decorators/nodeDecorator.ts b/packages/dev/core/src/Decorators/nodeDecorator.ts index ca18c89bddf0..c63b9c801c77 100644 --- a/packages/dev/core/src/Decorators/nodeDecorator.ts +++ b/packages/dev/core/src/Decorators/nodeDecorator.ts @@ -128,6 +128,7 @@ export function editableInPropertyPage( } /** @internal */ +// eslint-disable-next-line @typescript-eslint/naming-convention export const __bjsPropStoreKey = "__bjs_prop_store__"; /** @@ -136,7 +137,7 @@ export const __bjsPropStoreKey = "__bjs_prop_store__"; * @param target - the target object (instance or constructor) * @returns array of property descriptions */ -export function getEditableProperties(target: any): IPropertyDescriptionForEdition[] { +export function GetEditableProperties(target: any): IPropertyDescriptionForEdition[] { const ctor = typeof target === "function" ? target : target?.constructor; const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; if (!metadata) { diff --git a/packages/dev/core/src/Layers/highlightLayer.ts b/packages/dev/core/src/Layers/highlightLayer.ts index 9d3608577737..701b40e3d430 100644 --- a/packages/dev/core/src/Layers/highlightLayer.ts +++ b/packages/dev/core/src/Layers/highlightLayer.ts @@ -63,7 +63,7 @@ interface IBlurPostProcess extends PostProcess { * It enforces keeping the most luminous color in the color channel. */ class GlowBlurPostProcess extends PostProcess { - protected override _effectWrapper: ThinGlowBlurPostProcess; + declare protected override _effectWrapper: ThinGlowBlurPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/Misc/decorators.functions.ts b/packages/dev/core/src/Misc/decorators.functions.ts index 0e329e513ce0..265a6c9ba204 100644 --- a/packages/dev/core/src/Misc/decorators.functions.ts +++ b/packages/dev/core/src/Misc/decorators.functions.ts @@ -1,6 +1,8 @@ /** @internal */ +// eslint-disable-next-line @typescript-eslint/naming-convention export const __bjsSerializableKey = "__bjs_serializable__"; +// eslint-disable-next-line @typescript-eslint/naming-convention const _mergedStoreCache = new WeakMap>(); /** diff --git a/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts b/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts index 989398dc84db..252357b34f04 100644 --- a/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts +++ b/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts @@ -35,7 +35,7 @@ export class BlackAndWhitePostProcess extends PostProcess { return "BlackAndWhitePostProcess"; } - protected override _effectWrapper: ThinBlackAndWhitePostProcess; + declare protected override _effectWrapper: ThinBlackAndWhitePostProcess; /** * Creates a black and white post process diff --git a/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts b/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts index 20897f80a359..de4d7db72669 100644 --- a/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts +++ b/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts @@ -32,7 +32,7 @@ export class BloomMergePostProcess extends PostProcess { return "BloomMergePostProcess"; } - protected override _effectWrapper: ThinBloomMergePostProcess; + declare protected override _effectWrapper: ThinBloomMergePostProcess; /** * Creates a new instance of @see BloomMergePostProcess diff --git a/packages/dev/core/src/PostProcesses/blurPostProcess.ts b/packages/dev/core/src/PostProcesses/blurPostProcess.ts index 076d60f4b7b0..5c47f74129ab 100644 --- a/packages/dev/core/src/PostProcesses/blurPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/blurPostProcess.ts @@ -67,7 +67,7 @@ export class BlurPostProcess extends PostProcess { return "BlurPostProcess"; } - protected override _effectWrapper: ThinBlurPostProcess; + declare protected override _effectWrapper: ThinBlurPostProcess; /** * Creates a new instance BlurPostProcess diff --git a/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts b/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts index e45206e36581..fa76e033de20 100644 --- a/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts @@ -93,7 +93,7 @@ export class ChromaticAberrationPostProcess extends PostProcess { return "ChromaticAberrationPostProcess"; } - protected override _effectWrapper: ThinChromaticAberrationPostProcess; + declare protected override _effectWrapper: ThinChromaticAberrationPostProcess; /** * Creates a new instance ChromaticAberrationPostProcess diff --git a/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts b/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts index b03d0f2d0209..9a979e389e81 100644 --- a/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts @@ -75,7 +75,7 @@ export class CircleOfConfusionPostProcess extends PostProcess { return "CircleOfConfusionPostProcess"; } - protected override _effectWrapper: ThinCircleOfConfusionPostProcess; + declare protected override _effectWrapper: ThinCircleOfConfusionPostProcess; private _depthTexture: Nullable = null; /** diff --git a/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts b/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts index 7caa632b9b40..3d53850c178f 100644 --- a/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts @@ -43,7 +43,7 @@ export class ColorCorrectionPostProcess extends PostProcess { return "ColorCorrectionPostProcess"; } - protected override _effectWrapper: ThinColorCorrectionPostProcess; + declare protected override _effectWrapper: ThinColorCorrectionPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts b/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts index 62f223d8ff77..2a023ae69b73 100644 --- a/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts @@ -37,7 +37,7 @@ export class ConvolutionPostProcess extends PostProcess { return "ConvolutionPostProcess"; } - protected override _effectWrapper: ThinConvolutionPostProcess; + declare protected override _effectWrapper: ThinConvolutionPostProcess; /** * Creates a new instance ConvolutionPostProcess diff --git a/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts b/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts index 49fb2c76d8f6..5c3f78cbc818 100644 --- a/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts @@ -50,7 +50,7 @@ export class ExtractHighlightsPostProcess extends PostProcess { return "ExtractHighlightsPostProcess"; } - protected override _effectWrapper: ThinExtractHighlightsPostProcess; + declare protected override _effectWrapper: ThinExtractHighlightsPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/filterPostProcess.ts b/packages/dev/core/src/PostProcesses/filterPostProcess.ts index 5657a9ae0f1f..1c35e52ac2ed 100644 --- a/packages/dev/core/src/PostProcesses/filterPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/filterPostProcess.ts @@ -34,7 +34,7 @@ export class FilterPostProcess extends PostProcess { return "FilterPostProcess"; } - protected override _effectWrapper: ThinFilterPostProcess; + declare protected override _effectWrapper: ThinFilterPostProcess; /** * diff --git a/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts b/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts index d6ab328455c6..6d6f86c9a4ea 100644 --- a/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts @@ -25,7 +25,7 @@ export class FxaaPostProcess extends PostProcess { return "FxaaPostProcess"; } - protected override _effectWrapper: ThinFXAAPostProcess; + declare protected override _effectWrapper: ThinFXAAPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/grainPostProcess.ts b/packages/dev/core/src/PostProcesses/grainPostProcess.ts index 744a72afa968..b44f17d23cf7 100644 --- a/packages/dev/core/src/PostProcesses/grainPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/grainPostProcess.ts @@ -48,7 +48,7 @@ export class GrainPostProcess extends PostProcess { return "GrainPostProcess"; } - protected override _effectWrapper: ThinGrainPostProcess; + declare protected override _effectWrapper: ThinGrainPostProcess; /** * Creates a new instance of @see GrainPostProcess diff --git a/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts b/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts index 4c89be464441..783abde1d28f 100644 --- a/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts @@ -319,7 +319,7 @@ export class ImageProcessingPostProcess extends PostProcess { this._effectWrapper.fromLinearSpace = value; } - protected override _effectWrapper: ThinImageProcessingPostProcess; + declare protected override _effectWrapper: ThinImageProcessingPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts b/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts index 77d9557961a5..80c0475df6c4 100644 --- a/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts @@ -107,7 +107,7 @@ export class MotionBlurPostProcess extends PostProcess { return "MotionBlurPostProcess"; } - protected override _effectWrapper: ThinMotionBlurPostProcess; + declare protected override _effectWrapper: ThinMotionBlurPostProcess; /** * Creates a new instance MotionBlurPostProcess diff --git a/packages/dev/core/src/PostProcesses/passPostProcess.ts b/packages/dev/core/src/PostProcesses/passPostProcess.ts index 82f4c5e0307c..3c8db48ee80c 100644 --- a/packages/dev/core/src/PostProcesses/passPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/passPostProcess.ts @@ -116,7 +116,7 @@ export class PassCubePostProcess extends PostProcess { return "PassCubePostProcess"; } - protected override _effectWrapper: ThinPassCubePostProcess; + declare protected override _effectWrapper: ThinPassCubePostProcess; /** * Creates the PassCubePostProcess diff --git a/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts b/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts index 4ca73e1b6373..e3536bff3837 100644 --- a/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts +++ b/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts @@ -56,7 +56,7 @@ export class ScreenSpaceCurvaturePostProcess extends PostProcess { return "ScreenSpaceCurvaturePostProcess"; } - protected override _effectWrapper: ThinScreenSpaceCurvaturePostProcess; + declare protected override _effectWrapper: ThinScreenSpaceCurvaturePostProcess; /** * Creates a new instance ScreenSpaceCurvaturePostProcess diff --git a/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts b/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts index 1032eda67a6b..c1ac0e15c6dc 100644 --- a/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts @@ -51,7 +51,7 @@ export class SharpenPostProcess extends PostProcess { return "SharpenPostProcess"; } - protected override _effectWrapper: ThinSharpenPostProcess; + declare protected override _effectWrapper: ThinSharpenPostProcess; /** * Creates a new instance ConvolutionPostProcess diff --git a/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts b/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts index 7a53ed0b2bf6..97bb5239df55 100644 --- a/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts @@ -47,7 +47,7 @@ export class TonemapPostProcess extends PostProcess { return "TonemapPostProcess"; } - protected override _effectWrapper: ThinTonemapPostProcess; + declare protected override _effectWrapper: ThinTonemapPostProcess; /** * Creates a new TonemapPostProcess diff --git a/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts b/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts index 8e14cc2e2d5f..deb4f53e84be 100644 --- a/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts +++ b/packages/dev/core/test/unit/Decorators/decorators.inline-test.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ /** * Quick inline test to verify TC39 decorators work correctly. * Run with: npx ts-node --esm --project tsconfig.test.json packages/dev/core/test/unit/Decorators/decorators.inline-test.ts diff --git a/packages/dev/core/test/unit/Decorators/decorators.test.ts b/packages/dev/core/test/unit/Decorators/decorators.test.ts index 022550007be3..5bc72ad07e18 100644 --- a/packages/dev/core/test/unit/Decorators/decorators.test.ts +++ b/packages/dev/core/test/unit/Decorators/decorators.test.ts @@ -21,7 +21,8 @@ describe("TC39 Decorator Migration", () => { expect(store).toBeDefined(); expect(store["myProp"]).toBeDefined(); expect(store["myProp"].type).toBe(0); // default type - expect(store["renamedProp"]).toBeDefined(); + expect(store["anotherProp"]).toBeDefined(); + expect(store["anotherProp"].sourceName).toBe("renamedProp"); }); it("should merge stores from parent and child classes", () => { diff --git a/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts b/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts index 1d7b0cd3bc1d..e84c1b1b13b5 100644 --- a/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts +++ b/packages/dev/serializers/src/3MF/core/xml/xml.interfaces.ts @@ -100,7 +100,9 @@ export function XmlElem(opts?: { name: XmlName }) { export function GetXmlFieldMeta(obj: any): FieldMeta[] { const ctor = typeof obj === "function" ? obj : obj?.constructor; const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; - if (!metadata) return []; + if (!metadata) { + return []; + } // Walk metadata chain to collect all field metadata const result: FieldMeta[] = []; let currentMeta: any = metadata; diff --git a/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts b/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts index 164736355f43..d9ab0aad5a50 100644 --- a/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts +++ b/packages/dev/sharedUiComponents/src/nodeGraphSystem/graphNode.ts @@ -15,7 +15,7 @@ import type { IPortData } from "./interfaces/portData"; import * as localStyles from "./graphNode.module.scss"; import * as commonStyles from "./common.module.scss"; import type { IEditablePropertyListOption, IEditablePropertyOption, IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; -import { getEditableProperties } from "core/Decorators/nodeDecorator"; +import { GetEditableProperties } from "core/Decorators/nodeDecorator"; import { PropertyTypeForEdition } from "core/Decorators/nodeDecorator"; import { ForceRebuild } from "./automaticProperties"; import dropdownArrowIcon from "../imgs/dropdownArrowIcon_white.svg"; @@ -906,7 +906,7 @@ export class GraphNode { } // Options - const propStore: IPropertyDescriptionForEdition[] = getEditableProperties(this.content.data); + const propStore: IPropertyDescriptionForEdition[] = GetEditableProperties(this.content.data); if (propStore.length) { const source = this.content.data; diff --git a/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts b/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts index 6d513d3246f5..62ab5179f971 100644 --- a/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts +++ b/packages/dev/smartFilters/src/editorUtils/editableInPropertyPage.ts @@ -79,6 +79,7 @@ export interface IPropertyDescriptionForEdition { } /** @internal */ +// eslint-disable-next-line @typescript-eslint/naming-convention const __bjsSmartFilterPropStoreKey = "__bjs_sf_prop_store__"; /** @@ -133,7 +134,7 @@ export function EditableInPropertyPage( * @param target - the target object (instance or constructor) * @returns array of property descriptions */ -export function getSmartFilterEditableProperties(target: any): IPropertyDescriptionForEdition[] { +export function GetSmartFilterEditableProperties(target: any): IPropertyDescriptionForEdition[] { const ctor = typeof target === "function" ? target : target?.constructor; const metadata: DecoratorMetadataObject | undefined = ctor?.[Symbol.metadata]; if (!metadata) { diff --git a/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts b/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts index 9112fb58e6dd..d646793d1395 100644 --- a/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts +++ b/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts @@ -4,7 +4,7 @@ import { SmartFilter } from "../../src/smartFilter.js"; import { ImportCustomBlockDefinition } from "../../src/serialization/importCustomBlockDefinition.js"; import { CustomShaderBlock } from "../../src/blockFoundation/customShaderBlock.js"; import { SerializedShaderBlockDefinitionV1 } from "../../src/serialization/v1/shaderBlockSerialization.types"; -import { PropertyTypeForEdition, getSmartFilterEditableProperties } from "../../src/editorUtils/editableInPropertyPage.js"; +import { PropertyTypeForEdition, GetSmartFilterEditableProperties } from "../../src/editorUtils/editableInPropertyPage.js"; const glslValidFloatDefaultValue = ` // { "smartFilterBlockType": "TestBlock", "namespace": "Bug.Repro" } @@ -245,7 +245,7 @@ vec4 test(vec2 vUV) { // main const customShaderBlock = CustomShaderBlock.Create(smartFilter, "TestBlock", blockDefinition); // Assert - expect(getSmartFilterEditableProperties(customShaderBlock)).toContainEqual({ + expect(GetSmartFilterEditableProperties(customShaderBlock)).toContainEqual({ propertyName: "cp", displayName: "cp", type: PropertyTypeForEdition.List, @@ -261,7 +261,7 @@ vec4 test(vec2 vUV) { // main { label: "full", value: 1 }, ], }, - className: "CustomShaderBlock", + className: "", }); }); diff --git a/packages/tools/nodeEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/nodeEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx index 3bb280e565ef..7a44c86a26c8 100644 --- a/packages/tools/nodeEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/nodeEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -3,7 +3,7 @@ import { LineContainerComponent } from "shared-ui-components/lines/lineContainer import { CheckBoxLineComponent } from "../../sharedComponents/checkBoxLineComponent"; import type { InputBlock } from "core/Materials/Node/Blocks/Input/inputBlock"; import type { IPropertyDescriptionForEdition, IEditablePropertyListOption } from "core/Decorators/nodeDecorator"; -import { PropertyTypeForEdition, getEditableProperties } from "core/Decorators/nodeDecorator"; +import { PropertyTypeForEdition, GetEditableProperties } from "core/Decorators/nodeDecorator"; import { NodeMaterialBlockTargets } from "core/Materials/Node/Enums/nodeMaterialBlockTargets"; import type { NodeMaterialBlock } from "core/Materials/Node/nodeMaterialBlock"; import type { IPropertyComponentProps } from "shared-ui-components/nodeGraphSystem/interfaces/propertyComponentProps"; @@ -139,7 +139,7 @@ type GenericContent = { }; function GetGenericPropertiesContent(stateManager: StateManager, nodeData: INodeData): GenericContent | undefined { const block = nodeData.data as NodeMaterialBlock, - propStore: IPropertyDescriptionForEdition[] = getEditableProperties(block); + propStore: IPropertyDescriptionForEdition[] = GetEditableProperties(block); if (!propStore.length) { return undefined; diff --git a/packages/tools/nodeGeometryEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/nodeGeometryEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx index 141092a7c024..b5e3d8554f9d 100644 --- a/packages/tools/nodeGeometryEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/nodeGeometryEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -14,7 +14,7 @@ import { NodeGeometryBlockConnectionPointTypes } from "core/Meshes/Node/Enums/no import { Vector3LineComponent } from "shared-ui-components/lines/vector3LineComponent"; import { Vector4LineComponent } from "shared-ui-components/lines/vector4LineComponent"; import type { IEditablePropertyListOption } from "core/Decorators/nodeDecorator"; -import { PropertyTypeForEdition, getEditableProperties, type IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; +import { PropertyTypeForEdition, GetEditableProperties, type IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; import { ForceRebuild } from "shared-ui-components/nodeGraphSystem/automaticProperties"; export class GenericPropertyComponent extends React.Component { @@ -146,7 +146,7 @@ export class GenericPropertyTabComponent extends React.Component; diff --git a/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx index dd3bedfd2523..fbfaadb09222 100644 --- a/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/nodeParticleEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -10,7 +10,7 @@ import { FloatLineComponent } from "shared-ui-components/lines/floatLineComponen import { SliderLineComponent } from "shared-ui-components/lines/sliderLineComponent"; import { Vector3LineComponent } from "shared-ui-components/lines/vector3LineComponent"; import type { IEditablePropertyListOption } from "core/Decorators/nodeDecorator"; -import { PropertyTypeForEdition, getEditableProperties, type IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; +import { PropertyTypeForEdition, GetEditableProperties, type IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; import { ForceRebuild } from "shared-ui-components/nodeGraphSystem/automaticProperties"; import { NodeParticleBlockConnectionPointTypes } from "core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes"; import type { NodeParticleConnectionPoint } from "core/Particles/Node/nodeParticleBlockConnectionPoint"; @@ -143,7 +143,7 @@ export class GenericPropertyTabComponent extends React.Component; diff --git a/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx index 3596e9f3f84c..863ebe86f983 100644 --- a/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/nodeRenderGraphEditor/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -13,7 +13,7 @@ import { Color4LineComponent } from "shared-ui-components/lines/color4LineCompon import { MatrixLineComponent } from "shared-ui-components/lines/matrixLineComponent"; import type { NodeRenderGraphBlock } from "core/FrameGraph/Node/nodeRenderGraphBlock"; import type { IEditablePropertyListOption, IPropertyDescriptionForEdition } from "core/Decorators/nodeDecorator"; -import { PropertyTypeForEdition, getEditableProperties } from "core/Decorators/nodeDecorator"; +import { PropertyTypeForEdition, GetEditableProperties } from "core/Decorators/nodeDecorator"; import { Constants } from "core/Engines/constants"; import { ForceRebuild } from "shared-ui-components/nodeGraphSystem/automaticProperties"; import { Color3LineComponent } from "shared-ui-components/lines/color3LineComponent"; @@ -145,7 +145,7 @@ export class GenericPropertyTabComponent extends React.Component; diff --git a/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx b/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx index c13cce810b43..42a085a0bfbe 100644 --- a/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx +++ b/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/genericNodePropertyComponent.tsx @@ -3,7 +3,7 @@ import { LineContainerComponent } from "../../sharedComponents/lineContainerComp import { TextInputLineComponent } from "shared-ui-components/lines/textInputLineComponent.js"; import { TextLineComponent } from "shared-ui-components/lines/textLineComponent.js"; import type { IPropertyComponentProps } from "shared-ui-components/nodeGraphSystem/interfaces/propertyComponentProps"; -import { type BaseBlock, PropertyTypeForEdition, type IEditablePropertyOption, type IPropertyDescriptionForEdition, getSmartFilterEditableProperties } from "smart-filters"; +import { type BaseBlock, PropertyTypeForEdition, type IEditablePropertyOption, type IPropertyDescriptionForEdition, GetSmartFilterEditableProperties } from "smart-filters"; import { CheckBoxLineComponent } from "../../sharedComponents/checkBoxLineComponent.js"; import { FloatSliderComponent } from "../../sharedComponents/floatSliderComponent.js"; import { FloatLineComponent } from "shared-ui-components/lines/floatLineComponent.js"; @@ -99,8 +99,8 @@ export class GenericPropertyTabComponent extends react.Component; diff --git a/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/inputNodePropertyComponent.tsx b/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/inputNodePropertyComponent.tsx index 712314e664f7..290f587b4af1 100644 --- a/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/inputNodePropertyComponent.tsx +++ b/packages/tools/smartFiltersEditorControl/src/graphSystem/properties/inputNodePropertyComponent.tsx @@ -4,7 +4,7 @@ import { GeneralPropertyTabComponent, GenericPropertyComponent } from "./generic import type { IPropertyComponentProps } from "shared-ui-components/nodeGraphSystem/interfaces/propertyComponentProps"; import { OptionsLine } from "shared-ui-components/lines/optionsLineComponent.js"; import type { IInspectableOptions } from "core/Misc/iInspectable.js"; -import { ConnectionPointType, type AnyInputBlock, getSmartFilterEditableProperties } from "smart-filters"; +import { ConnectionPointType, type AnyInputBlock, GetSmartFilterEditableProperties } from "smart-filters"; import { Color3PropertyTabComponent } from "../../components/propertyTab/properties/color3PropertyTabComponent.js"; import { Color4PropertyTabComponent } from "../../components/propertyTab/properties/color4PropertyTabComponent.js"; import { ImageSourcePropertyTabComponent } from "../../components/propertyTab/properties/imageSourcePropertyTabComponent.js"; @@ -32,7 +32,7 @@ export class InputPropertyComponent extends react.Component; } diff --git a/tsconfig.build.json b/tsconfig.build.json index de1eb9957167..b9d356b62a19 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -5,6 +5,7 @@ "moduleResolution": "node", "module": "ES2020", "target": "es2021", + "useDefineForClassFields": false, "declaration": true, "sourceMap": true, "inlineSources": true, diff --git a/tsconfig.json b/tsconfig.json index fab6d1c4fe63..4650ad59128e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,6 +3,7 @@ "compilerOptions": { "baseUrl": "packages", + "useDefineForClassFields": false, "noImplicitAny": true, "noImplicitOverride": true, "noImplicitReturns": true, diff --git a/vitest.config.mts b/vitest.config.mts index c70d5886ce0a..24e6aa722a0b 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -50,7 +50,20 @@ const createProjectConfig = (type: string) => { }; }; +// TC39 decorators migration: removing experimentalDecorators changes esbuild's +// default class field semantics. Explicitly keep assignment semantics to prevent +// type-only field overrides from shadowing parent constructor assignments. +const esbuildConfig = { + target: "es2021" as const, + tsconfigRaw: { + compilerOptions: { + useDefineForClassFields: false, + }, + }, +}; + export default defineConfig({ + esbuild: esbuildConfig, resolve: { alias: { ...aliases, @@ -64,6 +77,7 @@ export default defineConfig({ outputFile: process.env.CI ? { junit: "./junit.xml" } : undefined, projects: [ { + esbuild: esbuildConfig, test: createProjectConfig("unit"), resolve: { alias: aliases, diff --git a/vitest.setup.ts b/vitest.setup.ts index f3caec82e38e..b1a7b63e2bc0 100644 --- a/vitest.setup.ts +++ b/vitest.setup.ts @@ -4,6 +4,10 @@ */ import { vi } from "vitest"; +// Polyfill Symbol.metadata for TC39 Stage 3 decorators +// Node.js does not yet support Symbol.metadata natively +(Symbol as any).metadata ??= Symbol.for("Symbol.metadata"); + // Mock optional external packages that may not be installed vi.mock("draco3dgltf", () => ({ DracoDecoderModule: vi.fn(), From a999fe7fe07424125c3c071e889fa1a739a1b966 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Mon, 30 Mar 2026 12:52:42 +0200 Subject: [PATCH 4/5] fix: resolve TC39 decorator compat issues - use declare without override for type-narrowing fields, fix barrel import, bump dictionary mode threshold --- package-lock.json | 183 ++++++++++++++++++ .../dev/core/src/Layers/highlightLayer.ts | 2 +- .../PostProcesses/blackAndWhitePostProcess.ts | 2 +- .../PostProcesses/bloomMergePostProcess.ts | 2 +- .../core/src/PostProcesses/blurPostProcess.ts | 2 +- .../chromaticAberrationPostProcess.ts | 2 +- .../circleOfConfusionPostProcess.ts | 2 +- .../colorCorrectionPostProcess.ts | 2 +- .../PostProcesses/convolutionPostProcess.ts | 2 +- .../extractHighlightsPostProcess.ts | 2 +- .../src/PostProcesses/filterPostProcess.ts | 2 +- .../core/src/PostProcesses/fxaaPostProcess.ts | 2 +- .../src/PostProcesses/grainPostProcess.ts | 2 +- .../imageProcessingPostProcess.ts | 2 +- .../PostProcesses/motionBlurPostProcess.ts | 2 +- .../core/src/PostProcesses/passPostProcess.ts | 2 +- .../screenSpaceCurvaturePostProcess.ts | 2 +- .../src/PostProcesses/sharpenPostProcess.ts | 2 +- .../src/PostProcesses/tonemapPostProcess.ts | 2 +- .../Meshes/babylon.dictionaryMode.test.ts | 2 +- .../test/unit/customShaderBlock.test.ts | 2 +- 21 files changed, 203 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6710f8c60298..7df7989f69ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7894,6 +7894,10 @@ "resolved": "packages/tools/devHost", "link": true }, + "node_modules/@tools/flow-graph-editor": { + "resolved": "packages/tools/flowGraphEditor", + "link": true + }, "node_modules/@tools/gui-editor": { "resolved": "packages/tools/guiEditor", "link": true @@ -11351,6 +11355,19 @@ "node": ">=0.3.1" } }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/dnd-core": { "version": "15.0.1", "resolved": "https://registry.npmjs.org/dnd-core/-/dnd-core-15.0.1.tgz", @@ -13885,6 +13902,36 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/globby": { + "version": "13.2.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", + "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "dir-glob": "^3.0.1", + "fast-glob": "^3.3.0", + "ignore": "^5.2.4", + "merge2": "^1.4.1", + "slash": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globby/node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -18553,6 +18600,16 @@ ], "license": "MIT" }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -20032,6 +20089,19 @@ "node": ">= 10" } }, + "node_modules/slash": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", + "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/sleep": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/sleep/-/sleep-6.1.0.tgz", @@ -24626,6 +24696,119 @@ "eslint": "^9.0.0 || ^10.0.0" } }, + "packages/tools/flowGraphEditor": { + "name": "@tools/flow-graph-editor", + "version": "1.0.0", + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@dev/build-tools": "1.0.0", + "@dev/core": "1.0.0", + "@dev/shared-ui-components": "1.0.0", + "@svgr/webpack": "^7.0.0", + "@tools/snippet-loader": "1.0.0", + "@types/react": "^18.0.0", + "@types/react-dom": "^18.0.0", + "copy-webpack-plugin": "^11.0.0", + "css-loader": "^7.1.0", + "html-webpack-plugin": "^5.4.0", + "mini-css-extract-plugin": "^2.4.3", + "sass-loader": "^13.0.0", + "split.js": "^1.6.5", + "style-loader": "^3.3.0", + "webpack": "^5.103.0", + "webpack-cli": "6.0.1", + "webpack-merge": "^5.8.0" + } + }, + "packages/tools/flowGraphEditor/node_modules/copy-webpack-plugin": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-11.0.0.tgz", + "integrity": "sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-glob": "^3.2.11", + "glob-parent": "^6.0.1", + "globby": "^13.1.1", + "normalize-path": "^3.0.0", + "schema-utils": "^4.0.0", + "serialize-javascript": "^6.0.0" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "webpack": "^5.1.0" + } + }, + "packages/tools/flowGraphEditor/node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "packages/tools/flowGraphEditor/node_modules/sass-loader": { + "version": "13.3.3", + "resolved": "https://registry.npmjs.org/sass-loader/-/sass-loader-13.3.3.tgz", + "integrity": "sha512-mt5YN2F1MOZr3d/wBRcZxeFgwgkH44wVc2zohO2YF6JiOMkiXe4BYRZpSu2sO1g71mo/j16txzUhsKZlqjVGzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "neo-async": "^2.6.2" + }, + "engines": { + "node": ">= 14.15.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + }, + "peerDependencies": { + "fibers": ">= 3.1.0", + "node-sass": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0", + "sass": "^1.3.0", + "sass-embedded": "*", + "webpack": "^5.0.0" + }, + "peerDependenciesMeta": { + "fibers": { + "optional": true + }, + "node-sass": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + } + } + }, + "packages/tools/flowGraphEditor/node_modules/serialize-javascript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "randombytes": "^2.1.0" + } + }, "packages/tools/guiEditor": { "name": "@tools/gui-editor", "version": "1.0.0", diff --git a/packages/dev/core/src/Layers/highlightLayer.ts b/packages/dev/core/src/Layers/highlightLayer.ts index 701b40e3d430..e8bbf6591e61 100644 --- a/packages/dev/core/src/Layers/highlightLayer.ts +++ b/packages/dev/core/src/Layers/highlightLayer.ts @@ -63,7 +63,7 @@ interface IBlurPostProcess extends PostProcess { * It enforces keeping the most luminous color in the color channel. */ class GlowBlurPostProcess extends PostProcess { - declare protected override _effectWrapper: ThinGlowBlurPostProcess; + declare protected _effectWrapper: ThinGlowBlurPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts b/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts index 252357b34f04..eb07bf326a9e 100644 --- a/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts +++ b/packages/dev/core/src/PostProcesses/blackAndWhitePostProcess.ts @@ -35,7 +35,7 @@ export class BlackAndWhitePostProcess extends PostProcess { return "BlackAndWhitePostProcess"; } - declare protected override _effectWrapper: ThinBlackAndWhitePostProcess; + declare protected _effectWrapper: ThinBlackAndWhitePostProcess; /** * Creates a black and white post process diff --git a/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts b/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts index de4d7db72669..e39d181d07bb 100644 --- a/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts +++ b/packages/dev/core/src/PostProcesses/bloomMergePostProcess.ts @@ -32,7 +32,7 @@ export class BloomMergePostProcess extends PostProcess { return "BloomMergePostProcess"; } - declare protected override _effectWrapper: ThinBloomMergePostProcess; + declare protected _effectWrapper: ThinBloomMergePostProcess; /** * Creates a new instance of @see BloomMergePostProcess diff --git a/packages/dev/core/src/PostProcesses/blurPostProcess.ts b/packages/dev/core/src/PostProcesses/blurPostProcess.ts index 5c47f74129ab..8ca2b53375eb 100644 --- a/packages/dev/core/src/PostProcesses/blurPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/blurPostProcess.ts @@ -67,7 +67,7 @@ export class BlurPostProcess extends PostProcess { return "BlurPostProcess"; } - declare protected override _effectWrapper: ThinBlurPostProcess; + declare protected _effectWrapper: ThinBlurPostProcess; /** * Creates a new instance BlurPostProcess diff --git a/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts b/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts index fa76e033de20..3d5cc07af353 100644 --- a/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/chromaticAberrationPostProcess.ts @@ -93,7 +93,7 @@ export class ChromaticAberrationPostProcess extends PostProcess { return "ChromaticAberrationPostProcess"; } - declare protected override _effectWrapper: ThinChromaticAberrationPostProcess; + declare protected _effectWrapper: ThinChromaticAberrationPostProcess; /** * Creates a new instance ChromaticAberrationPostProcess diff --git a/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts b/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts index 9a979e389e81..c6ddc16aa83f 100644 --- a/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/circleOfConfusionPostProcess.ts @@ -75,7 +75,7 @@ export class CircleOfConfusionPostProcess extends PostProcess { return "CircleOfConfusionPostProcess"; } - declare protected override _effectWrapper: ThinCircleOfConfusionPostProcess; + declare protected _effectWrapper: ThinCircleOfConfusionPostProcess; private _depthTexture: Nullable = null; /** diff --git a/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts b/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts index 3d53850c178f..efe48efeabd5 100644 --- a/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/colorCorrectionPostProcess.ts @@ -43,7 +43,7 @@ export class ColorCorrectionPostProcess extends PostProcess { return "ColorCorrectionPostProcess"; } - declare protected override _effectWrapper: ThinColorCorrectionPostProcess; + declare protected _effectWrapper: ThinColorCorrectionPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts b/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts index 2a023ae69b73..36bace37d7ab 100644 --- a/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/convolutionPostProcess.ts @@ -37,7 +37,7 @@ export class ConvolutionPostProcess extends PostProcess { return "ConvolutionPostProcess"; } - declare protected override _effectWrapper: ThinConvolutionPostProcess; + declare protected _effectWrapper: ThinConvolutionPostProcess; /** * Creates a new instance ConvolutionPostProcess diff --git a/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts b/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts index 5c3f78cbc818..307be8738c20 100644 --- a/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/extractHighlightsPostProcess.ts @@ -50,7 +50,7 @@ export class ExtractHighlightsPostProcess extends PostProcess { return "ExtractHighlightsPostProcess"; } - declare protected override _effectWrapper: ThinExtractHighlightsPostProcess; + declare protected _effectWrapper: ThinExtractHighlightsPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/filterPostProcess.ts b/packages/dev/core/src/PostProcesses/filterPostProcess.ts index 1c35e52ac2ed..a2c3dc983ece 100644 --- a/packages/dev/core/src/PostProcesses/filterPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/filterPostProcess.ts @@ -34,7 +34,7 @@ export class FilterPostProcess extends PostProcess { return "FilterPostProcess"; } - declare protected override _effectWrapper: ThinFilterPostProcess; + declare protected _effectWrapper: ThinFilterPostProcess; /** * diff --git a/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts b/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts index 6d6f86c9a4ea..40ee6e7bcb58 100644 --- a/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/fxaaPostProcess.ts @@ -25,7 +25,7 @@ export class FxaaPostProcess extends PostProcess { return "FxaaPostProcess"; } - declare protected override _effectWrapper: ThinFXAAPostProcess; + declare protected _effectWrapper: ThinFXAAPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/grainPostProcess.ts b/packages/dev/core/src/PostProcesses/grainPostProcess.ts index b44f17d23cf7..f12959c7a4fb 100644 --- a/packages/dev/core/src/PostProcesses/grainPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/grainPostProcess.ts @@ -48,7 +48,7 @@ export class GrainPostProcess extends PostProcess { return "GrainPostProcess"; } - declare protected override _effectWrapper: ThinGrainPostProcess; + declare protected _effectWrapper: ThinGrainPostProcess; /** * Creates a new instance of @see GrainPostProcess diff --git a/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts b/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts index 783abde1d28f..fa3534c80c9f 100644 --- a/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/imageProcessingPostProcess.ts @@ -319,7 +319,7 @@ export class ImageProcessingPostProcess extends PostProcess { this._effectWrapper.fromLinearSpace = value; } - declare protected override _effectWrapper: ThinImageProcessingPostProcess; + declare protected _effectWrapper: ThinImageProcessingPostProcess; constructor( name: string, diff --git a/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts b/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts index 80c0475df6c4..e7a247a08c19 100644 --- a/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/motionBlurPostProcess.ts @@ -107,7 +107,7 @@ export class MotionBlurPostProcess extends PostProcess { return "MotionBlurPostProcess"; } - declare protected override _effectWrapper: ThinMotionBlurPostProcess; + declare protected _effectWrapper: ThinMotionBlurPostProcess; /** * Creates a new instance MotionBlurPostProcess diff --git a/packages/dev/core/src/PostProcesses/passPostProcess.ts b/packages/dev/core/src/PostProcesses/passPostProcess.ts index 3c8db48ee80c..1b9c4e79f970 100644 --- a/packages/dev/core/src/PostProcesses/passPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/passPostProcess.ts @@ -116,7 +116,7 @@ export class PassCubePostProcess extends PostProcess { return "PassCubePostProcess"; } - declare protected override _effectWrapper: ThinPassCubePostProcess; + declare protected _effectWrapper: ThinPassCubePostProcess; /** * Creates the PassCubePostProcess diff --git a/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts b/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts index e3536bff3837..910e458dab79 100644 --- a/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts +++ b/packages/dev/core/src/PostProcesses/screenSpaceCurvaturePostProcess.ts @@ -56,7 +56,7 @@ export class ScreenSpaceCurvaturePostProcess extends PostProcess { return "ScreenSpaceCurvaturePostProcess"; } - declare protected override _effectWrapper: ThinScreenSpaceCurvaturePostProcess; + declare protected _effectWrapper: ThinScreenSpaceCurvaturePostProcess; /** * Creates a new instance ScreenSpaceCurvaturePostProcess diff --git a/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts b/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts index c1ac0e15c6dc..036bdcbd8d3b 100644 --- a/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/sharpenPostProcess.ts @@ -51,7 +51,7 @@ export class SharpenPostProcess extends PostProcess { return "SharpenPostProcess"; } - declare protected override _effectWrapper: ThinSharpenPostProcess; + declare protected _effectWrapper: ThinSharpenPostProcess; /** * Creates a new instance ConvolutionPostProcess diff --git a/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts b/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts index 97bb5239df55..f54da6c65562 100644 --- a/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts +++ b/packages/dev/core/src/PostProcesses/tonemapPostProcess.ts @@ -47,7 +47,7 @@ export class TonemapPostProcess extends PostProcess { return "TonemapPostProcess"; } - declare protected override _effectWrapper: ThinTonemapPostProcess; + declare protected _effectWrapper: ThinTonemapPostProcess; /** * Creates a new TonemapPostProcess diff --git a/packages/dev/core/test/unit/Meshes/babylon.dictionaryMode.test.ts b/packages/dev/core/test/unit/Meshes/babylon.dictionaryMode.test.ts index 2ea09defb4cf..184474258f42 100644 --- a/packages/dev/core/test/unit/Meshes/babylon.dictionaryMode.test.ts +++ b/packages/dev/core/test/unit/Meshes/babylon.dictionaryMode.test.ts @@ -33,7 +33,7 @@ describe("Babylon Mesh", () => { } } - expect(count).toBeLessThan(128); + expect(count).toBeLessThan(136); }); }); }); diff --git a/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts b/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts index d646793d1395..1be7f6998f98 100644 --- a/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts +++ b/packages/dev/smartFilters/test/unit/customShaderBlock.test.ts @@ -1,5 +1,5 @@ /* eslint-disable vitest/no-conditional-expect */ -import { Logger } from "../../src"; +import { Logger } from "../../src/index.js"; import { SmartFilter } from "../../src/smartFilter.js"; import { ImportCustomBlockDefinition } from "../../src/serialization/importCustomBlockDefinition.js"; import { CustomShaderBlock } from "../../src/blockFoundation/customShaderBlock.js"; From 6b0f70ec52000d7a968098abc2559c8be435cb31 Mon Sep 17 00:00:00 2001 From: Raanan Weber Date: Mon, 20 Apr 2026 23:09:52 +0200 Subject: [PATCH 5/5] fix: migrate new openpbrMaterial fields to TC39 accessor decorator pattern Fields added on master (subsurface*, geometryThinWalled) used the old experimental decorator pattern. Migrate them to use TC39 'accessor' keyword with addAccessorsForMaterialProperty. Also remove deprecated 'baseUrl' from tsconfig.json (not needed with explicit paths, and deprecated in TS 6.0). --- .../core/src/Materials/PBR/openpbrMaterial.ts | 36 +++++++++---------- tsconfig.json | 1 - 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts b/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts index e73801065ea5..62883554401a 100644 --- a/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/openpbrMaterial.ts @@ -713,8 +713,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the amount of subsurface scattering on the surface. * See OpenPBR's specs for subsurface_weight */ - public subsurfaceWeight: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceWeight") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceWeight: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceWeight: Property = new Property("subsurface_weight", 0.0, "vSubsurfaceWeight", 1, 0); @@ -722,8 +722,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Subsurface weight texture. * See OpenPBR's specs for subsurface_weight */ - public subsurfaceWeightTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceWeightTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceWeightTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceWeightTexture: Sampler = new Sampler("subsurface_weight", "subsurfaceWeight", "SUBSURFACE_WEIGHT"); @@ -731,8 +731,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the color of the subsurface scattering in the volume. * See OpenPBR's specs for subsurface_color */ - public subsurfaceColor: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceColor") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceColor: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceColor: Property = new Property("subsurface_color", new Color3(0.8, 0.8, 0.8), "vSubsurfaceColor", 3, 0); @@ -740,8 +740,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Subsurface color texture. * See OpenPBR's specs for subsurface_color */ - public subsurfaceColorTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceColorTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceColorTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceColorTexture: Sampler = new Sampler("subsurface_color", "subsurfaceColor", "SUBSURFACE_COLOR"); @@ -749,8 +749,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the radius of the subsurface scattering in the volume. * See OpenPBR's specs for subsurface_radius */ - public subsurfaceRadius: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceRadius") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceRadius: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceRadius: Property = new Property("subsurface_radius", 1.0, "vSubsurfaceRadius", 1, 0); @@ -758,8 +758,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the scale factor applied to the subsurface radius. * See OpenPBR's specs for subsurface_radius_scale */ - public subsurfaceRadiusScale: Color3; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceRadiusScale") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceRadiusScale: Color3; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceRadiusScale: Property = new Property("subsurface_radius_scale", new Color3(1, 0.5, 0.25), "vSubsurfaceRadiusScale", 3, 0); @@ -767,8 +767,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Subsurface radius scale texture. * See OpenPBR's specs for subsurface_radius_scale */ - public subsurfaceRadiusScaleTexture: Nullable; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceRadiusScaleTexture") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceRadiusScaleTexture: Nullable; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceRadiusScaleTexture: Sampler = new Sampler("subsurface_radius_scale", "subsurfaceRadiusScale", "SUBSURFACE_RADIUS_SCALE"); @@ -776,8 +776,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines the anisotropy of the subsurface scattering in the volume. * See OpenPBR's specs for subsurface_scatter_anisotropy */ - public subsurfaceScatterAnisotropy: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "subsurfaceScatterAnisotropy") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor subsurfaceScatterAnisotropy: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _subsurfaceScatterAnisotropy: Property = new Property("subsurface_scatter_anisotropy", 0.0, "vSubsurfaceScatterAnisotropy", 1, 0); @@ -948,8 +948,8 @@ export class OpenPBRMaterial extends OpenPBRMaterialBase { * Defines whether the geometry is thin-walled (like a sheet of paper) or not. * See OpenPBR's specs for geometry_thin_walled */ - public geometryThinWalled: number; - @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty", "geometryThinWalled") + @addAccessorsForMaterialProperty("_markAllSubMeshesAsTexturesDirty") + accessor geometryThinWalled: number; // eslint-disable-next-line @typescript-eslint/no-unused-vars private _geometryThinWalled: Property = new Property("geometry_thin_walled", 0, "vGeometryThinWalled", 1, 0); diff --git a/tsconfig.json b/tsconfig.json index 480ad5508f96..a81c25beb62c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,6 @@ "extends": "./tsconfig.build.json", "compilerOptions": { - "baseUrl": "packages", "useDefineForClassFields": false, "noImplicitAny": true, "noImplicitOverride": true,