a38400c8d23d7cd8dba37f4cc6f613f85826bac9ad9111d5737116331ed7e841.json 14 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators.js\";\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial.js\";\nimport { RegisterClass } from \"../../Misc/typeStore.js\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization.js\";\n/**\n * The PBR material of BJS following the specular glossiness convention.\n *\n * This fits to the PBR convention in the GLTF definition:\n * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness\n */\nexport class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial {\n /**\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\n */\n get useMicroSurfaceFromReflectivityMapAlpha() {\n return this._useMicroSurfaceFromReflectivityMapAlpha;\n }\n /**\n * Instantiates a new PBRSpecularGlossinessMaterial instance.\n *\n * @param name The material name\n * @param scene The scene the material will be use in.\n */\n constructor(name, scene) {\n super(name, scene);\n this._useMicroSurfaceFromReflectivityMapAlpha = true;\n }\n /**\n * @returns the current class name of the material.\n */\n getClassName() {\n return \"PBRSpecularGlossinessMaterial\";\n }\n /**\n * Makes a duplicate of the current material.\n * @param name - name to use for the new material.\n * @returns cloned material instance\n */\n clone(name) {\n const clone = SerializationHelper.Clone(() => new PBRSpecularGlossinessMaterial(name, this.getScene()), this);\n clone.id = name;\n clone.name = name;\n this.clearCoat.copyTo(clone.clearCoat);\n this.anisotropy.copyTo(clone.anisotropy);\n this.brdf.copyTo(clone.brdf);\n this.sheen.copyTo(clone.sheen);\n this.subSurface.copyTo(clone.subSurface);\n return clone;\n }\n /**\n * Serialize the material to a parsable JSON object.\n * @returns the JSON object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.PBRSpecularGlossinessMaterial\";\n serializationObject.clearCoat = this.clearCoat.serialize();\n serializationObject.anisotropy = this.anisotropy.serialize();\n serializationObject.brdf = this.brdf.serialize();\n serializationObject.sheen = this.sheen.serialize();\n serializationObject.subSurface = this.subSurface.serialize();\n serializationObject.iridescence = this.iridescence.serialize();\n return serializationObject;\n }\n /**\n * Parses a JSON object corresponding to the serialize function.\n * @param source - JSON source object.\n * @param scene - the scene to parse to.\n * @param rootUrl - root url of the assets.\n * @returns a new PBRSpecularGlossinessMaterial.\n */\n static Parse(source, scene, rootUrl) {\n const material = SerializationHelper.Parse(() => new PBRSpecularGlossinessMaterial(source.name, scene), source, scene, rootUrl);\n if (source.clearCoat) {\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\n }\n if (source.anisotropy) {\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\n }\n if (source.brdf) {\n material.brdf.parse(source.brdf, scene, rootUrl);\n }\n if (source.sheen) {\n material.sheen.parse(source.sheen, scene, rootUrl);\n }\n if (source.subSurface) {\n material.subSurface.parse(source.subSurface, scene, rootUrl);\n }\n if (source.iridescence) {\n material.iridescence.parse(source.iridescence, scene, rootUrl);\n }\n return material;\n }\n}\n__decorate([serializeAsColor3(\"diffuse\"), expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")], PBRSpecularGlossinessMaterial.prototype, \"diffuseColor\", void 0);\n__decorate([serializeAsTexture(), expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")], PBRSpecularGlossinessMaterial.prototype, \"diffuseTexture\", void 0);\n__decorate([serializeAsColor3(\"specular\"), expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityColor\")], PBRSpecularGlossinessMaterial.prototype, \"specularColor\", void 0);\n__decorate([serialize(), expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_microSurface\")], PBRSpecularGlossinessMaterial.prototype, \"glossiness\", void 0);\n__decorate([serializeAsTexture(), expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityTexture\")], PBRSpecularGlossinessMaterial.prototype, \"specularGlossinessTexture\", void 0);\nRegisterClass(\"BABYLON.PBRSpecularGlossinessMaterial\", PBRSpecularGlossinessMaterial);","map":{"version":3,"names":["__decorate","serialize","serializeAsColor3","expandToProperty","serializeAsTexture","PBRBaseSimpleMaterial","RegisterClass","SerializationHelper","PBRSpecularGlossinessMaterial","useMicroSurfaceFromReflectivityMapAlpha","_useMicroSurfaceFromReflectivityMapAlpha","constructor","name","scene","getClassName","clone","Clone","getScene","id","clearCoat","copyTo","anisotropy","brdf","sheen","subSurface","serializationObject","Serialize","customType","iridescence","Parse","source","rootUrl","material","parse","prototype"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Materials/PBR/pbrSpecularGlossinessMaterial.js"],"sourcesContent":["import { __decorate } from \"../../tslib.es6.js\";\nimport { serialize, serializeAsColor3, expandToProperty, serializeAsTexture } from \"../../Misc/decorators.js\";\nimport { PBRBaseSimpleMaterial } from \"./pbrBaseSimpleMaterial.js\";\nimport { RegisterClass } from \"../../Misc/typeStore.js\";\nimport { SerializationHelper } from \"../../Misc/decorators.serialization.js\";\n/**\n * The PBR material of BJS following the specular glossiness convention.\n *\n * This fits to the PBR convention in the GLTF definition:\n * https://github.com/KhronosGroup/glTF/tree/2.0/extensions/Khronos/KHR_materials_pbrSpecularGlossiness\n */\nexport class PBRSpecularGlossinessMaterial extends PBRBaseSimpleMaterial {\n /**\n * Specifies if the reflectivity texture contains the glossiness information in its alpha channel.\n */\n get useMicroSurfaceFromReflectivityMapAlpha() {\n return this._useMicroSurfaceFromReflectivityMapAlpha;\n }\n /**\n * Instantiates a new PBRSpecularGlossinessMaterial instance.\n *\n * @param name The material name\n * @param scene The scene the material will be use in.\n */\n constructor(name, scene) {\n super(name, scene);\n this._useMicroSurfaceFromReflectivityMapAlpha = true;\n }\n /**\n * @returns the current class name of the material.\n */\n getClassName() {\n return \"PBRSpecularGlossinessMaterial\";\n }\n /**\n * Makes a duplicate of the current material.\n * @param name - name to use for the new material.\n * @returns cloned material instance\n */\n clone(name) {\n const clone = SerializationHelper.Clone(() => new PBRSpecularGlossinessMaterial(name, this.getScene()), this);\n clone.id = name;\n clone.name = name;\n this.clearCoat.copyTo(clone.clearCoat);\n this.anisotropy.copyTo(clone.anisotropy);\n this.brdf.copyTo(clone.brdf);\n this.sheen.copyTo(clone.sheen);\n this.subSurface.copyTo(clone.subSurface);\n return clone;\n }\n /**\n * Serialize the material to a parsable JSON object.\n * @returns the JSON object\n */\n serialize() {\n const serializationObject = SerializationHelper.Serialize(this);\n serializationObject.customType = \"BABYLON.PBRSpecularGlossinessMaterial\";\n serializationObject.clearCoat = this.clearCoat.serialize();\n serializationObject.anisotropy = this.anisotropy.serialize();\n serializationObject.brdf = this.brdf.serialize();\n serializationObject.sheen = this.sheen.serialize();\n serializationObject.subSurface = this.subSurface.serialize();\n serializationObject.iridescence = this.iridescence.serialize();\n return serializationObject;\n }\n /**\n * Parses a JSON object corresponding to the serialize function.\n * @param source - JSON source object.\n * @param scene - the scene to parse to.\n * @param rootUrl - root url of the assets.\n * @returns a new PBRSpecularGlossinessMaterial.\n */\n static Parse(source, scene, rootUrl) {\n const material = SerializationHelper.Parse(() => new PBRSpecularGlossinessMaterial(source.name, scene), source, scene, rootUrl);\n if (source.clearCoat) {\n material.clearCoat.parse(source.clearCoat, scene, rootUrl);\n }\n if (source.anisotropy) {\n material.anisotropy.parse(source.anisotropy, scene, rootUrl);\n }\n if (source.brdf) {\n material.brdf.parse(source.brdf, scene, rootUrl);\n }\n if (source.sheen) {\n material.sheen.parse(source.sheen, scene, rootUrl);\n }\n if (source.subSurface) {\n material.subSurface.parse(source.subSurface, scene, rootUrl);\n }\n if (source.iridescence) {\n material.iridescence.parse(source.iridescence, scene, rootUrl);\n }\n return material;\n }\n}\n__decorate([\n serializeAsColor3(\"diffuse\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoColor\")\n], PBRSpecularGlossinessMaterial.prototype, \"diffuseColor\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_albedoTexture\")\n], PBRSpecularGlossinessMaterial.prototype, \"diffuseTexture\", void 0);\n__decorate([\n serializeAsColor3(\"specular\"),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityColor\")\n], PBRSpecularGlossinessMaterial.prototype, \"specularColor\", void 0);\n__decorate([\n serialize(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_microSurface\")\n], PBRSpecularGlossinessMaterial.prototype, \"glossiness\", void 0);\n__decorate([\n serializeAsTexture(),\n expandToProperty(\"_markAllSubMeshesAsTexturesDirty\", \"_reflectivityTexture\")\n], PBRSpecularGlossinessMaterial.prototype, \"specularGlossinessTexture\", void 0);\nRegisterClass(\"BABYLON.PBRSpecularGlossinessMaterial\", PBRSpecularGlossinessMaterial);\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,SAAS,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,kBAAkB,QAAQ,0BAA0B;AAC7G,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,mBAAmB,QAAQ,wCAAwC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,6BAA6B,SAASH,qBAAqB,CAAC;EACrE;AACJ;AACA;EACI,IAAII,uCAAuCA,CAAA,EAAG;IAC1C,OAAO,IAAI,CAACC,wCAAwC;EACxD;EACA;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,EAAEC,KAAK,EAAE;IACrB,KAAK,CAACD,IAAI,EAAEC,KAAK,CAAC;IAClB,IAAI,CAACH,wCAAwC,GAAG,IAAI;EACxD;EACA;AACJ;AACA;EACII,YAAYA,CAAA,EAAG;IACX,OAAO,+BAA+B;EAC1C;EACA;AACJ;AACA;AACA;AACA;EACIC,KAAKA,C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