@babylonjs/gui 6.45.1 → 6.46.1
Sign up to get free protection for your applications and to get access to all the features.
- package/2D/advancedDynamicTexture.d.ts +3 -2
- package/2D/advancedDynamicTexture.js +15 -3
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/control.js +2 -1
- package/2D/controls/control.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js +2 -1
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +2 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js +2 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlBackglowMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlFrontplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlInnerquadMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +2 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/package.json +2 -2
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3
|
2
|
+
import { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Vector3, TmpVectors } from "@babylonjs/core/Maths/math.vector.js";
|
4
5
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
5
6
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fluentMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluent/fluentMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAEtK,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAE7D,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAEvD,OAAO,yBAAyB,CAAC;AACjC,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,8BAA8B,EAAE,8DAAgD;AAEzF,gBAAgB;AAChB,MAAM,OAAO,qBAAsB,SAAQ,eAAe;IAMtD;QACI,KAAK,EAAE,CAAC;QANL,cAAS,GAAG,KAAK,CAAC;QAClB,WAAM,GAAG,KAAK,CAAC;QACf,eAAU,GAAG,KAAK,CAAC;QACnB,YAAO,GAAG,KAAK,CAAC;QAInB,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,YAAY;IA6E5C;;;;OAIG;IACH,YAAY,IAAY,EAAE,KAAa;QACnC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAlFvB;;WAEG;QAGI,4BAAuB,GAAG,GAAG,CAAC;QAEr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SAAS;QACZ,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,4BAA4B,CAAC;QAC9D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY;QACf,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AA9RU;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DAChB;AAM9B;IADN,iBAAiB,EAAE;sDAC8B;AAM3C;IADN,iBAAiB,EAAE;mDAC4B;AAOzC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAMtB;IADN,SAAS,EAAE;mDACa;AAMlB;IADN,SAAS,EAAE;0DACqB;AAM1B;IADN,SAAS,EAAE;sDACgB;AAOrB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAMzB;IADN,SAAS,EAAE;mDACc;AAMnB;IADN,iBAAiB,EAAE;kDAC+B;AAM5C;IADN,kBAAkB,EAAE;qDACiB;AAG9B;IADP,kBAAkB,CAAC,eAAe,CAAC;sDACU;AAIvC;IADN,gBAAgB,CAAC,yCAAyC,CAAC;qDAChB;AA2NhD,aAAa,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\n\r\nimport \"./shaders/fluent.vertex\";\r\nimport \"./shaders/fluent.fragment\";\r\nimport { PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nexport class FluentMaterialDefines extends MaterialDefines {\r\n public INNERGLOW = false;\r\n public BORDER = false;\r\n public HOVERLIGHT = false;\r\n public TEXTURE = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render controls with fluent design\r\n */\r\nexport class FluentMaterial extends PushMaterial {\r\n /**\r\n * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public innerGlowColorIntensity = 0.5;\r\n\r\n /**\r\n * Gets or sets the inner glow color (white by default)\r\n */\r\n @serializeAsColor3()\r\n public innerGlowColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))\r\n */\r\n @serializeAsColor3()\r\n public albedoColor = new Color3(0.3, 0.35, 0.4);\r\n\r\n /**\r\n * Gets or sets a boolean indicating if borders must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderBorders = false;\r\n\r\n /**\r\n * Gets or sets border width (default is 0.5)\r\n */\r\n @serialize()\r\n public borderWidth = 0.5;\r\n\r\n /**\r\n * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)\r\n */\r\n @serialize()\r\n public edgeSmoothingValue = 0.02;\r\n\r\n /**\r\n * Gets or sets the minimum value that can be applied to border width (default is 0.1)\r\n */\r\n @serialize()\r\n public borderMinValue = 0.1;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if hover light must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderHoverLight = false;\r\n\r\n /**\r\n * Gets or sets the radius used to render the hover light (default is 0.01)\r\n */\r\n @serialize()\r\n public hoverRadius = 0.01;\r\n\r\n /**\r\n * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))\r\n */\r\n @serializeAsColor4()\r\n public hoverColor = new Color4(0.3, 0.3, 0.3, 1.0);\r\n\r\n /**\r\n * Gets or sets the hover light position in world space (default is Vector3.Zero())\r\n */\r\n @serializeAsVector3()\r\n public hoverPosition = Vector3.Zero();\r\n\r\n @serializeAsTexture(\"albedoTexture\")\r\n private _albedoTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the texture to use for albedo color */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Creates a new Fluent material\r\n * @param name defines the name of the material\r\n * @param scene defines the hosting scene\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha !== 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (defines._areTexturesDirty) {\r\n defines.INNERGLOW = this.innerGlowColorIntensity > 0;\r\n defines.BORDER = this.renderBorders;\r\n defines.HOVERLIGHT = this.renderHoverLight;\r\n\r\n if (this._albedoTexture) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n } else {\r\n defines.TEXTURE = true;\r\n }\r\n } else {\r\n defines.TEXTURE = false;\r\n }\r\n }\r\n\r\n const engine = scene.getEngine();\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n attribs.push(VertexBuffer.NormalKind);\r\n attribs.push(VertexBuffer.UVKind);\r\n\r\n const shaderName = \"fluent\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"innerGlowColor\",\r\n \"albedoColor\",\r\n \"borderWidth\",\r\n \"edgeSmoothingValue\",\r\n \"scaleFactor\",\r\n \"borderMinValue\",\r\n \"hoverColor\",\r\n \"hoverPosition\",\r\n \"hoverRadius\",\r\n \"textureMatrix\",\r\n ];\r\n\r\n const samplers = [\"albedoSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: null,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor4(\"albedoColor\", this.albedoColor, this.alpha);\r\n\r\n if (defines.INNERGLOW) {\r\n this._activeEffect.setColor4(\"innerGlowColor\", this.innerGlowColor, this.innerGlowColorIntensity);\r\n }\r\n\r\n if (defines.BORDER) {\r\n this._activeEffect.setFloat(\"borderWidth\", this.borderWidth);\r\n this._activeEffect.setFloat(\"edgeSmoothingValue\", this.edgeSmoothingValue);\r\n this._activeEffect.setFloat(\"borderMinValue\", this.borderMinValue);\r\n\r\n mesh.getBoundingInfo().boundingBox.extendSize.multiplyToRef(mesh.scaling, TmpVectors.Vector3[0]);\r\n this._activeEffect.setVector3(\"scaleFactor\", TmpVectors.Vector3[0]);\r\n }\r\n\r\n if (defines.HOVERLIGHT) {\r\n this._activeEffect.setDirectColor4(\"hoverColor\", this.hoverColor);\r\n this._activeEffect.setFloat(\"hoverRadius\", this.hoverRadius);\r\n this._activeEffect.setVector3(\"hoverPosition\", this.hoverPosition);\r\n }\r\n\r\n if (defines.TEXTURE && this._albedoTexture) {\r\n this._activeEffect.setTexture(\"albedoSampler\", this._albedoTexture);\r\n const matrix = this._albedoTexture.getTextureMatrix();\r\n this._activeEffect.setMatrix(\"textureMatrix\", matrix);\r\n }\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FluentMaterial {\r\n return SerializationHelper.Clone(() => new FluentMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GUI.FluentMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial {\r\n return SerializationHelper.Parse(() => new FluentMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentMaterial\", FluentMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"fluentMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluent/fluentMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CA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,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AA9RU;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;+DAChB;AAM9B;IADN,iBAAiB,EAAE;sDAC8B;AAM3C;IADN,iBAAiB,EAAE;mDAC4B;AAOzC;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;qDACxB;AAMtB;IADN,SAAS,EAAE;mDACa;AAMlB;IADN,SAAS,EAAE;0DACqB;AAM1B;IADN,SAAS,EAAE;sDACgB;AAOrB;IAFN,SAAS,EAAE;IACX,gBAAgB,CAAC,kCAAkC,CAAC;wDACrB;AAMzB;IADN,SAAS,EAAE;mDACc;AAMnB;IADN,iBAAiB,EAAE;kDAC+B;AAM5C;IADN,kBAAkB,EAAE;qDACiB;AAG9B;IADP,kBAAkB,CAAC,eAAe,CAAC;sDACU;AAIvC;IADN,gBAAgB,CAAC,yCAAyC,CAAC;qDAChB;AA2NhD,aAAa,CAAC,4BAA4B,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsColor4, serializeAsVector3, serializeAsTexture, serialize, expandToProperty, serializeAsColor3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, TmpVectors } from \"core/Maths/math.vector\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\n\r\nimport \"./shaders/fluent.vertex\";\r\nimport \"./shaders/fluent.fragment\";\r\nimport { PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nexport class FluentMaterialDefines extends MaterialDefines {\r\n public INNERGLOW = false;\r\n public BORDER = false;\r\n public HOVERLIGHT = false;\r\n public TEXTURE = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render controls with fluent design\r\n */\r\nexport class FluentMaterial extends PushMaterial {\r\n /**\r\n * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public innerGlowColorIntensity = 0.5;\r\n\r\n /**\r\n * Gets or sets the inner glow color (white by default)\r\n */\r\n @serializeAsColor3()\r\n public innerGlowColor = new Color3(1.0, 1.0, 1.0);\r\n\r\n /**\r\n * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))\r\n */\r\n @serializeAsColor3()\r\n public albedoColor = new Color3(0.3, 0.35, 0.4);\r\n\r\n /**\r\n * Gets or sets a boolean indicating if borders must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderBorders = false;\r\n\r\n /**\r\n * Gets or sets border width (default is 0.5)\r\n */\r\n @serialize()\r\n public borderWidth = 0.5;\r\n\r\n /**\r\n * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)\r\n */\r\n @serialize()\r\n public edgeSmoothingValue = 0.02;\r\n\r\n /**\r\n * Gets or sets the minimum value that can be applied to border width (default is 0.1)\r\n */\r\n @serialize()\r\n public borderMinValue = 0.1;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if hover light must be rendered (default is false)\r\n */\r\n @serialize()\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public renderHoverLight = false;\r\n\r\n /**\r\n * Gets or sets the radius used to render the hover light (default is 0.01)\r\n */\r\n @serialize()\r\n public hoverRadius = 0.01;\r\n\r\n /**\r\n * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))\r\n */\r\n @serializeAsColor4()\r\n public hoverColor = new Color4(0.3, 0.3, 0.3, 1.0);\r\n\r\n /**\r\n * Gets or sets the hover light position in world space (default is Vector3.Zero())\r\n */\r\n @serializeAsVector3()\r\n public hoverPosition = Vector3.Zero();\r\n\r\n @serializeAsTexture(\"albedoTexture\")\r\n private _albedoTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the texture to use for albedo color */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesAndMiscDirty\")\r\n public albedoTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Creates a new Fluent material\r\n * @param name defines the name of the material\r\n * @param scene defines the hosting scene\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return this.alpha !== 1.0;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentMaterialDefines();\r\n }\r\n\r\n const scene = this.getScene();\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!this.checkReadyOnEveryCall && subMesh.effect) {\r\n if (defines._renderId === scene.getRenderId()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (defines._areTexturesDirty) {\r\n defines.INNERGLOW = this.innerGlowColorIntensity > 0;\r\n defines.BORDER = this.renderBorders;\r\n defines.HOVERLIGHT = this.renderHoverLight;\r\n\r\n if (this._albedoTexture) {\r\n if (!this._albedoTexture.isReadyOrNotBlocking()) {\r\n return false;\r\n } else {\r\n defines.TEXTURE = true;\r\n }\r\n } else {\r\n defines.TEXTURE = false;\r\n }\r\n }\r\n\r\n const engine = scene.getEngine();\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n scene.resetCachedMaterial();\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n attribs.push(VertexBuffer.NormalKind);\r\n attribs.push(VertexBuffer.UVKind);\r\n\r\n const shaderName = \"fluent\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"innerGlowColor\",\r\n \"albedoColor\",\r\n \"borderWidth\",\r\n \"edgeSmoothingValue\",\r\n \"scaleFactor\",\r\n \"borderMinValue\",\r\n \"hoverColor\",\r\n \"hoverPosition\",\r\n \"hoverRadius\",\r\n \"textureMatrix\",\r\n ];\r\n\r\n const samplers = [\"albedoSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: null,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FluentMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor4(\"albedoColor\", this.albedoColor, this.alpha);\r\n\r\n if (defines.INNERGLOW) {\r\n this._activeEffect.setColor4(\"innerGlowColor\", this.innerGlowColor, this.innerGlowColorIntensity);\r\n }\r\n\r\n if (defines.BORDER) {\r\n this._activeEffect.setFloat(\"borderWidth\", this.borderWidth);\r\n this._activeEffect.setFloat(\"edgeSmoothingValue\", this.edgeSmoothingValue);\r\n this._activeEffect.setFloat(\"borderMinValue\", this.borderMinValue);\r\n\r\n mesh.getBoundingInfo().boundingBox.extendSize.multiplyToRef(mesh.scaling, TmpVectors.Vector3[0]);\r\n this._activeEffect.setVector3(\"scaleFactor\", TmpVectors.Vector3[0]);\r\n }\r\n\r\n if (defines.HOVERLIGHT) {\r\n this._activeEffect.setDirectColor4(\"hoverColor\", this.hoverColor);\r\n this._activeEffect.setFloat(\"hoverRadius\", this.hoverRadius);\r\n this._activeEffect.setVector3(\"hoverPosition\", this.hoverPosition);\r\n }\r\n\r\n if (defines.TEXTURE && this._albedoTexture) {\r\n this._activeEffect.setTexture(\"albedoSampler\", this._albedoTexture);\r\n const matrix = this._albedoTexture.getTextureMatrix();\r\n this._activeEffect.setMatrix(\"textureMatrix\", matrix);\r\n }\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n return activeTextures;\r\n }\r\n\r\n public hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FluentMaterial {\r\n return SerializationHelper.Clone(() => new FluentMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GUI.FluentMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial {\r\n return SerializationHelper.Parse(() => new FluentMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentMaterial\", FluentMaterial);\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import {
|
2
|
+
import { serialize, serializeAsVector3 } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Vector3, Vector4 } from "@babylonjs/core/Maths/math.vector.js";
|
4
5
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
5
6
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fluentBackplateMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentBackplate/fluentBackplateMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,kBAAkB,EAAE,2CAA6B;AAE1F,OAA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EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpH,CAAC;;AAleD;;GAEG;AACW,wCAAgB,GAAG,yEAAyE,AAA5E,CAA6E;AAE3G;;GAEG;AACW,sCAAc,GAAG,gFAAgF,AAAnF,CAAoF;AASzG;IADN,SAAS,EAAE;uDACS;AAMd;IADN,SAAS,EAAE;0DACY;AAOjB;IADN,SAAS,EAAE;8DACiB;AAStB;IADN,SAAS,EAAE;0DACqD;AAM1D;IADN,SAAS,EAAE;0DACkD;AAMvD;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;4DACc;AAMnB;IADN,SAAS,EAAE;iEACgB;AAMrB;IADN,SAAS,EAAE;gEACkB;AAMvB;IADN,SAAS,EAAE;+DACiB;AAMtB;IADN,SAAS,EAAE;6DACe;AAMpB;IADN,SAAS,EAAE;0DACS;AAMd;IADN,SAAS,EAAE;yDACQ;AAMb;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;2DACU;AAMf;IADN,SAAS,EAAE;0DACS;AASd;IADN,SAAS,EAAE;+DAC4C;AAMjD;IADN,SAAS,EAAE;+DACiB;AAYtB;IADN,SAAS,EAAE;qEACoB;AAMzB;IADN,SAAS,EAAE;yEACwB;AAS7B;IADN,SAAS,EAAE;wDACO;AAeZ;IADN,kBAAkB,EAAE;2EAC8B;AAO5C;IADN,kBAAkB,EAAE;4EAC+B;AAsTxD,aAAa,CAAC,qCAAqC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { SerializationHelper, serialize, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nimport \"./shaders/fluentBackplate.fragment\";\r\nimport \"./shaders/fluentBackplate.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass FluentBackplateMaterialDefines extends MaterialDefines {\r\n public BLOB_ENABLE = true;\r\n public BLOB_ENABLE_2 = true;\r\n public SMOOTH_EDGES = true;\r\n public IRIDESCENT_MAP_ENABLE = true;\r\n\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render square buttons with fluent design\r\n */\r\nexport class FluentBackplateMaterial extends PushMaterial {\r\n /**\r\n * URL pointing to the texture used to define the coloring for the fluent blob effect.\r\n */\r\n public static BLOB_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png\";\r\n\r\n /**\r\n * URL pointing to the texture used to define iridescent map.\r\n */\r\n public static IM_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png\";\r\n\r\n private _blobTexture: Texture;\r\n private _iridescentMap: Texture;\r\n\r\n /**\r\n * Gets or sets the corner radius on the backplate. Best to keep this value between 0.01 and 0.5. Default is 0.03.\r\n */\r\n @serialize()\r\n public radius = 0.03;\r\n\r\n /**\r\n * Gets or sets the line width of the backplate.\r\n */\r\n @serialize()\r\n public lineWidth = 0.01;\r\n\r\n /**\r\n * Gets or sets whether to use absolute sizes when calculating effects on the backplate.\r\n * Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.\r\n */\r\n @serialize()\r\n public absoluteSizes = false;\r\n\r\n /** @internal */\r\n public _filterWidth = 1;\r\n\r\n /**\r\n * Gets or sets the base color of the backplate.\r\n */\r\n @serialize()\r\n public baseColor = new Color4(0.0392157, 0.0666667, 0.207843, 1);\r\n\r\n /**\r\n * Gets or sets the line color of the backplate.\r\n */\r\n @serialize()\r\n public lineColor = new Color4(0.14902, 0.133333, 0.384314, 1);\r\n\r\n /**\r\n * Gets or sets the intensity of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobIntensity = 0.98;\r\n\r\n /**\r\n * Gets or sets the far size of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobFarSize = 0.04;\r\n\r\n /**\r\n * Gets or sets the distance considered \"near\" to the backplate, which controls the size of the fluent hover glow effect (see blobNearSize).\r\n */\r\n @serialize()\r\n public blobNearDistance = 0;\r\n\r\n /**\r\n * Gets or sets the distance considered \"far\" from the backplate, which controls the size of the fluent hover glow effect (see blobFarSize).\r\n */\r\n @serialize()\r\n public blobFarDistance = 0.08;\r\n\r\n /**\r\n * Gets or sets the length of the fluent hover glow effect fade.\r\n */\r\n @serialize()\r\n public blobFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the left pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the left pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the left pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade = 0;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the right pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize2 = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the right pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse2 = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the right pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade2 = 0;\r\n\r\n /** @internal */\r\n public _rate = 0.135;\r\n\r\n /**\r\n * Gets or sets the color of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightColor = new Color4(0.98, 0.98, 0.98, 1);\r\n\r\n /**\r\n * Gets or sets the width of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightWidth = 0.25;\r\n\r\n /** @internal */\r\n public _highlightTransform = new Vector4(1, 1, 0, 0);\r\n\r\n /** @internal */\r\n public _highlight = 1;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect.\r\n */\r\n @serialize()\r\n public iridescenceIntensity = 0;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect on the backplate edges.\r\n */\r\n @serialize()\r\n public iridescenceEdgeIntensity = 1;\r\n\r\n /** @internal */\r\n public _angle = -45;\r\n\r\n /**\r\n * Gets or sets the opacity of the backplate (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public fadeOut = 1;\r\n\r\n /** @internal */\r\n public _reflected = true;\r\n\r\n /** @internal */\r\n public _frequency = 1;\r\n\r\n /** @internal */\r\n public _verticalOffset = 0;\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the left index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalLeftIndexTipPosition = Vector3.Zero();\r\n private _globalLeftIndexTipPosition4 = Vector4.Zero();\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the right index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalRightIndexTipPosition = Vector3.Zero();\r\n private _globalRightIndexTipPosition4 = Vector4.Zero();\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_DISABLE;\r\n this.backFaceCulling = false;\r\n\r\n this._blobTexture = new Texture(FluentBackplateMaterial.BLOB_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n this._iridescentMap = new Texture(FluentBackplateMaterial.IM_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentBackplateMaterialDefines();\r\n }\r\n\r\n const defines = <FluentBackplateMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fluentBackplate\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n \"_Radius_\",\r\n \"_Line_Width_\",\r\n \"_Absolute_Sizes_\",\r\n \"_Filter_Width_\",\r\n \"_Base_Color_\",\r\n \"_Line_Color_\",\r\n \"_Radius_Top_Left_\",\r\n \"_Radius_Top_Right_\",\r\n \"_Radius_Bottom_Left_\",\r\n \"_Radius_Bottom_Right_\",\r\n \"_Blob_Position_\",\r\n \"_Blob_Intensity_\",\r\n \"_Blob_Near_Size_\",\r\n \"_Blob_Far_Size_\",\r\n \"_Blob_Near_Distance_\",\r\n \"_Blob_Far_Distance_\",\r\n \"_Blob_Fade_Length_\",\r\n \"_Blob_Pulse_\",\r\n \"_Blob_Fade_\",\r\n \"_Blob_Texture_\",\r\n \"_Blob_Position_2_\",\r\n \"_Blob_Near_Size_2_\",\r\n \"_Blob_Pulse_2_\",\r\n \"_Blob_Fade_2_\",\r\n \"_Rate_\",\r\n \"_Highlight_Color_\",\r\n \"_Highlight_Width_\",\r\n \"_Highlight_Transform_\",\r\n \"_Highlight_\",\r\n \"_Iridescence_Intensity_\",\r\n \"_Iridescence_Edge_Intensity_\",\r\n \"_Angle_\",\r\n \"_Fade_Out_\",\r\n \"_Reflected_\",\r\n \"_Frequency_\",\r\n \"_Vertical_Offset_\",\r\n \"_Iridescent_Map_\",\r\n \"_Use_Global_Left_Index_\",\r\n \"_Use_Global_Right_Index_\",\r\n \"Global_Left_Index_Tip_Position\",\r\n \"Global_Right_Index_Tip_Position\",\r\n ];\r\n const samplers: string[] = [\"_Blob_Texture_\", \"_Iridescent_Map_\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const defines = <FluentBackplateMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", this.getScene().activeCamera?.position ?? Vector3.ZeroReadOnly);\r\n\r\n // \"Round Rect\"\r\n this._activeEffect.setFloat(\"_Radius_\", this.radius);\r\n this._activeEffect.setFloat(\"_Line_Width_\", this.lineWidth);\r\n this._activeEffect.setFloat(\"_Absolute_Sizes_\", this.absoluteSizes ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Filter_Width_\", this._filterWidth);\r\n this._activeEffect.setDirectColor4(\"_Base_Color_\", this.baseColor);\r\n this._activeEffect.setDirectColor4(\"_Line_Color_\", this.lineColor);\r\n\r\n // \"Radii Multipliers\"\r\n this._activeEffect.setFloat(\"_Radius_Top_Left_\", 1);\r\n this._activeEffect.setFloat(\"_Radius_Top_Right_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Left_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Right_\", 1.0);\r\n\r\n // \"Blob\"\r\n //define BLOB_ENABLE true;\r\n this._activeEffect.setFloat(\"_Blob_Intensity_\", this.blobIntensity);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_\", this.blobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Far_Size_\", this.blobFarSize);\r\n this._activeEffect.setFloat(\"_Blob_Near_Distance_\", this.blobNearDistance);\r\n this._activeEffect.setFloat(\"_Blob_Far_Distance_\", this.blobFarDistance);\r\n this._activeEffect.setFloat(\"_Blob_Fade_Length_\", this.blobFadeLength);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_\", this.blobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_\", this.blobFade);\r\n\r\n // \"Blob Texture\"\r\n this._activeEffect.setTexture(\"_Blob_Texture_\", this._blobTexture);\r\n\r\n // \"Blob 2\"\r\n //define BLOB_ENABLE_2 true;\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_2_\", this.blobNearSize2);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_2_\", this.blobPulse2);\r\n this._activeEffect.setFloat(\"_Blob_Fade_2_\", this.blobFade2);\r\n\r\n // \"Line Highlight\"\r\n this._activeEffect.setFloat(\"_Rate_\", this._rate);\r\n this._activeEffect.setDirectColor4(\"_Highlight_Color_\", this.highlightColor);\r\n this._activeEffect.setFloat(\"_Highlight_Width_\", this.highlightWidth);\r\n this._activeEffect.setVector4(\"_Highlight_Transform_\", this._highlightTransform);\r\n this._activeEffect.setFloat(\"_Highlight_\", this._highlight);\r\n\r\n // \"Iridescence\"\r\n this._activeEffect.setFloat(\"_Iridescence_Intensity_\", this.iridescenceIntensity);\r\n this._activeEffect.setFloat(\"_Iridescence_Edge_Intensity_\", this.iridescenceEdgeIntensity);\r\n this._activeEffect.setFloat(\"_Angle_\", this._angle);\r\n\r\n // \"Fade\"\r\n this._activeEffect.setFloat(\"_Fade_Out_\", this.fadeOut);\r\n\r\n // \"Antialiasing\"\r\n //define SMOOTH_EDGES true;\r\n\r\n // \"ChooseAngle\"\r\n this._activeEffect.setFloat(\"_Reflected_\", this._reflected ? 1.0 : 0.0);\r\n\r\n // \"Multiply\"\r\n this._activeEffect.setFloat(\"_Frequency_\", this._frequency);\r\n this._activeEffect.setFloat(\"_Vertical_Offset_\", this._verticalOffset);\r\n\r\n // \"Color Texture\"\r\n //define IRIDESCENT_MAP_ENABLE true;\r\n this._activeEffect.setTexture(\"_Iridescent_Map_\", this._iridescentMap);\r\n\r\n // \"Global\"\r\n this._activeEffect.setFloat(\"_Use_Global_Left_Index_\", 1.0);\r\n this._activeEffect.setFloat(\"_Use_Global_Right_Index_\", 1.0);\r\n\r\n this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x, this.globalLeftIndexTipPosition.y, this.globalLeftIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Left_Index_Tip_Position\", this._globalLeftIndexTipPosition4);\r\n\r\n this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x, this.globalRightIndexTipPosition.y, this.globalRightIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Right_Index_Tip_Position\", this._globalRightIndexTipPosition4);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n\r\n this._blobTexture.dispose();\r\n this._iridescentMap.dispose();\r\n }\r\n\r\n public clone(name: string): FluentBackplateMaterial {\r\n return SerializationHelper.Clone(() => new FluentBackplateMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FluentBackplateMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentBackplateMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentBackplateMaterial {\r\n return SerializationHelper.Parse(() => new FluentBackplateMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentBackplateMaterial\", FluentBackplateMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"fluentBackplateMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentBackplate/fluentBackplateMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,2CAA6B;AACrE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAG1D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EA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;0DACkD;AAMvD;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;4DACc;AAMnB;IADN,SAAS,EAAE;iEACgB;AAMrB;IADN,SAAS,EAAE;gEACkB;AAMvB;IADN,SAAS,EAAE;+DACiB;AAMtB;IADN,SAAS,EAAE;6DACe;AAMpB;IADN,SAAS,EAAE;0DACS;AAMd;IADN,SAAS,EAAE;yDACQ;AAMb;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;2DACU;AAMf;IADN,SAAS,EAAE;0DACS;AASd;IADN,SAAS,EAAE;+DAC4C;AAMjD;IADN,SAAS,EAAE;+DACiB;AAYtB;IADN,SAAS,EAAE;qEACoB;AAMzB;IADN,SAAS,EAAE;yEACwB;AAS7B;IADN,SAAS,EAAE;wDACO;AAeZ;IADN,kBAAkB,EAAE;2EAC8B;AAO5C;IADN,kBAAkB,EAAE;4EAC+B;AAsTxD,aAAa,CAAC,qCAAqC,EAAE,uBAAuB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serialize, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nimport \"./shaders/fluentBackplate.fragment\";\r\nimport \"./shaders/fluentBackplate.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass FluentBackplateMaterialDefines extends MaterialDefines {\r\n public BLOB_ENABLE = true;\r\n public BLOB_ENABLE_2 = true;\r\n public SMOOTH_EDGES = true;\r\n public IRIDESCENT_MAP_ENABLE = true;\r\n\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render square buttons with fluent design\r\n */\r\nexport class FluentBackplateMaterial extends PushMaterial {\r\n /**\r\n * URL pointing to the texture used to define the coloring for the fluent blob effect.\r\n */\r\n public static BLOB_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-blob.png\";\r\n\r\n /**\r\n * URL pointing to the texture used to define iridescent map.\r\n */\r\n public static IM_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-backplate-iridescence.png\";\r\n\r\n private _blobTexture: Texture;\r\n private _iridescentMap: Texture;\r\n\r\n /**\r\n * Gets or sets the corner radius on the backplate. Best to keep this value between 0.01 and 0.5. Default is 0.03.\r\n */\r\n @serialize()\r\n public radius = 0.03;\r\n\r\n /**\r\n * Gets or sets the line width of the backplate.\r\n */\r\n @serialize()\r\n public lineWidth = 0.01;\r\n\r\n /**\r\n * Gets or sets whether to use absolute sizes when calculating effects on the backplate.\r\n * Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.\r\n */\r\n @serialize()\r\n public absoluteSizes = false;\r\n\r\n /** @internal */\r\n public _filterWidth = 1;\r\n\r\n /**\r\n * Gets or sets the base color of the backplate.\r\n */\r\n @serialize()\r\n public baseColor = new Color4(0.0392157, 0.0666667, 0.207843, 1);\r\n\r\n /**\r\n * Gets or sets the line color of the backplate.\r\n */\r\n @serialize()\r\n public lineColor = new Color4(0.14902, 0.133333, 0.384314, 1);\r\n\r\n /**\r\n * Gets or sets the intensity of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobIntensity = 0.98;\r\n\r\n /**\r\n * Gets or sets the far size of the fluent hover glow effect.\r\n */\r\n @serialize()\r\n public blobFarSize = 0.04;\r\n\r\n /**\r\n * Gets or sets the distance considered \"near\" to the backplate, which controls the size of the fluent hover glow effect (see blobNearSize).\r\n */\r\n @serialize()\r\n public blobNearDistance = 0;\r\n\r\n /**\r\n * Gets or sets the distance considered \"far\" from the backplate, which controls the size of the fluent hover glow effect (see blobFarSize).\r\n */\r\n @serialize()\r\n public blobFarDistance = 0.08;\r\n\r\n /**\r\n * Gets or sets the length of the fluent hover glow effect fade.\r\n */\r\n @serialize()\r\n public blobFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the left pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the left pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the left pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade = 0;\r\n\r\n /**\r\n * Gets or sets the size of the fluent hover glow effect when the right pointer is considered \"near\" to the backplate (see blobNearDistance).\r\n */\r\n @serialize()\r\n public blobNearSize2 = 0.22;\r\n\r\n /**\r\n * Gets or sets the progress of the fluent hover glow effect selection animation corresponding to the right pointer (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public blobPulse2 = 0;\r\n\r\n /**\r\n * Gets or sets the opacity of the fluent hover glow effect corresponding to the right pointer (0.0 - 1.0). Default is 0.\r\n */\r\n @serialize()\r\n public blobFade2 = 0;\r\n\r\n /** @internal */\r\n public _rate = 0.135;\r\n\r\n /**\r\n * Gets or sets the color of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightColor = new Color4(0.98, 0.98, 0.98, 1);\r\n\r\n /**\r\n * Gets or sets the width of the highlights on the backplate line.\r\n */\r\n @serialize()\r\n public highlightWidth = 0.25;\r\n\r\n /** @internal */\r\n public _highlightTransform = new Vector4(1, 1, 0, 0);\r\n\r\n /** @internal */\r\n public _highlight = 1;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect.\r\n */\r\n @serialize()\r\n public iridescenceIntensity = 0;\r\n\r\n /**\r\n * Gets or sets the intensity of the iridescence effect on the backplate edges.\r\n */\r\n @serialize()\r\n public iridescenceEdgeIntensity = 1;\r\n\r\n /** @internal */\r\n public _angle = -45;\r\n\r\n /**\r\n * Gets or sets the opacity of the backplate (0.0 - 1.0).\r\n */\r\n @serialize()\r\n public fadeOut = 1;\r\n\r\n /** @internal */\r\n public _reflected = true;\r\n\r\n /** @internal */\r\n public _frequency = 1;\r\n\r\n /** @internal */\r\n public _verticalOffset = 0;\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the left index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalLeftIndexTipPosition = Vector3.Zero();\r\n private _globalLeftIndexTipPosition4 = Vector4.Zero();\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the right index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalRightIndexTipPosition = Vector3.Zero();\r\n private _globalRightIndexTipPosition4 = Vector4.Zero();\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_DISABLE;\r\n this.backFaceCulling = false;\r\n\r\n this._blobTexture = new Texture(FluentBackplateMaterial.BLOB_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n this._iridescentMap = new Texture(FluentBackplateMaterial.IM_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return false;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentBackplateMaterialDefines();\r\n }\r\n\r\n const defines = <FluentBackplateMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fluentBackplate\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n \"_Radius_\",\r\n \"_Line_Width_\",\r\n \"_Absolute_Sizes_\",\r\n \"_Filter_Width_\",\r\n \"_Base_Color_\",\r\n \"_Line_Color_\",\r\n \"_Radius_Top_Left_\",\r\n \"_Radius_Top_Right_\",\r\n \"_Radius_Bottom_Left_\",\r\n \"_Radius_Bottom_Right_\",\r\n \"_Blob_Position_\",\r\n \"_Blob_Intensity_\",\r\n \"_Blob_Near_Size_\",\r\n \"_Blob_Far_Size_\",\r\n \"_Blob_Near_Distance_\",\r\n \"_Blob_Far_Distance_\",\r\n \"_Blob_Fade_Length_\",\r\n \"_Blob_Pulse_\",\r\n \"_Blob_Fade_\",\r\n \"_Blob_Texture_\",\r\n \"_Blob_Position_2_\",\r\n \"_Blob_Near_Size_2_\",\r\n \"_Blob_Pulse_2_\",\r\n \"_Blob_Fade_2_\",\r\n \"_Rate_\",\r\n \"_Highlight_Color_\",\r\n \"_Highlight_Width_\",\r\n \"_Highlight_Transform_\",\r\n \"_Highlight_\",\r\n \"_Iridescence_Intensity_\",\r\n \"_Iridescence_Edge_Intensity_\",\r\n \"_Angle_\",\r\n \"_Fade_Out_\",\r\n \"_Reflected_\",\r\n \"_Frequency_\",\r\n \"_Vertical_Offset_\",\r\n \"_Iridescent_Map_\",\r\n \"_Use_Global_Left_Index_\",\r\n \"_Use_Global_Right_Index_\",\r\n \"Global_Left_Index_Tip_Position\",\r\n \"Global_Right_Index_Tip_Position\",\r\n ];\r\n const samplers: string[] = [\"_Blob_Texture_\", \"_Iridescent_Map_\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const defines = <FluentBackplateMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", this.getScene().getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", this.getScene().activeCamera?.position ?? Vector3.ZeroReadOnly);\r\n\r\n // \"Round Rect\"\r\n this._activeEffect.setFloat(\"_Radius_\", this.radius);\r\n this._activeEffect.setFloat(\"_Line_Width_\", this.lineWidth);\r\n this._activeEffect.setFloat(\"_Absolute_Sizes_\", this.absoluteSizes ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Filter_Width_\", this._filterWidth);\r\n this._activeEffect.setDirectColor4(\"_Base_Color_\", this.baseColor);\r\n this._activeEffect.setDirectColor4(\"_Line_Color_\", this.lineColor);\r\n\r\n // \"Radii Multipliers\"\r\n this._activeEffect.setFloat(\"_Radius_Top_Left_\", 1);\r\n this._activeEffect.setFloat(\"_Radius_Top_Right_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Left_\", 1.0);\r\n this._activeEffect.setFloat(\"_Radius_Bottom_Right_\", 1.0);\r\n\r\n // \"Blob\"\r\n //define BLOB_ENABLE true;\r\n this._activeEffect.setFloat(\"_Blob_Intensity_\", this.blobIntensity);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_\", this.blobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Far_Size_\", this.blobFarSize);\r\n this._activeEffect.setFloat(\"_Blob_Near_Distance_\", this.blobNearDistance);\r\n this._activeEffect.setFloat(\"_Blob_Far_Distance_\", this.blobFarDistance);\r\n this._activeEffect.setFloat(\"_Blob_Fade_Length_\", this.blobFadeLength);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_\", this.blobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_\", this.blobFade);\r\n\r\n // \"Blob Texture\"\r\n this._activeEffect.setTexture(\"_Blob_Texture_\", this._blobTexture);\r\n\r\n // \"Blob 2\"\r\n //define BLOB_ENABLE_2 true;\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_2_\", this.blobNearSize2);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_2_\", this.blobPulse2);\r\n this._activeEffect.setFloat(\"_Blob_Fade_2_\", this.blobFade2);\r\n\r\n // \"Line Highlight\"\r\n this._activeEffect.setFloat(\"_Rate_\", this._rate);\r\n this._activeEffect.setDirectColor4(\"_Highlight_Color_\", this.highlightColor);\r\n this._activeEffect.setFloat(\"_Highlight_Width_\", this.highlightWidth);\r\n this._activeEffect.setVector4(\"_Highlight_Transform_\", this._highlightTransform);\r\n this._activeEffect.setFloat(\"_Highlight_\", this._highlight);\r\n\r\n // \"Iridescence\"\r\n this._activeEffect.setFloat(\"_Iridescence_Intensity_\", this.iridescenceIntensity);\r\n this._activeEffect.setFloat(\"_Iridescence_Edge_Intensity_\", this.iridescenceEdgeIntensity);\r\n this._activeEffect.setFloat(\"_Angle_\", this._angle);\r\n\r\n // \"Fade\"\r\n this._activeEffect.setFloat(\"_Fade_Out_\", this.fadeOut);\r\n\r\n // \"Antialiasing\"\r\n //define SMOOTH_EDGES true;\r\n\r\n // \"ChooseAngle\"\r\n this._activeEffect.setFloat(\"_Reflected_\", this._reflected ? 1.0 : 0.0);\r\n\r\n // \"Multiply\"\r\n this._activeEffect.setFloat(\"_Frequency_\", this._frequency);\r\n this._activeEffect.setFloat(\"_Vertical_Offset_\", this._verticalOffset);\r\n\r\n // \"Color Texture\"\r\n //define IRIDESCENT_MAP_ENABLE true;\r\n this._activeEffect.setTexture(\"_Iridescent_Map_\", this._iridescentMap);\r\n\r\n // \"Global\"\r\n this._activeEffect.setFloat(\"_Use_Global_Left_Index_\", 1.0);\r\n this._activeEffect.setFloat(\"_Use_Global_Right_Index_\", 1.0);\r\n\r\n this._globalLeftIndexTipPosition4.set(this.globalLeftIndexTipPosition.x, this.globalLeftIndexTipPosition.y, this.globalLeftIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Left_Index_Tip_Position\", this._globalLeftIndexTipPosition4);\r\n\r\n this._globalRightIndexTipPosition4.set(this.globalRightIndexTipPosition.x, this.globalRightIndexTipPosition.y, this.globalRightIndexTipPosition.z, 1.0);\r\n this._activeEffect.setVector4(\"Global_Right_Index_Tip_Position\", this._globalRightIndexTipPosition4);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n\r\n this._blobTexture.dispose();\r\n this._iridescentMap.dispose();\r\n }\r\n\r\n public clone(name: string): FluentBackplateMaterial {\r\n return SerializationHelper.Clone(() => new FluentBackplateMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FluentBackplateMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentBackplateMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentBackplateMaterial {\r\n return SerializationHelper.Parse(() => new FluentBackplateMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentBackplateMaterial\", FluentBackplateMaterial);\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import { serializeAsColor4, serializeAsVector3, serialize
|
2
|
+
import { serializeAsColor4, serializeAsVector3, serialize } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Vector3, Vector4 } from "@babylonjs/core/Maths/math.vector.js";
|
4
5
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
5
6
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fluentButtonMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentButton/fluentButtonMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,mBAAmB,EAAE,2CAA6B;AAE7G,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAG1D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,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B;AAM7B;IADN,SAAS,EAAE;kEACuB;AAM5B;IADN,SAAS,EAAE;iEACqB;AAM1B;IADN,SAAS,EAAE;iEACmB;AAMxB;IADN,SAAS,EAAE;2DACe;AAMpB;IADN,SAAS,EAAE;sDACQ;AAMb;IADN,SAAS,EAAE;2DACa;AAMlB;IADN,SAAS,EAAE;+DACmB;AAOxB;IADN,SAAS,EAAE;8DACmB;AAMxB;IADN,SAAS,EAAE;gEACqB;AAM1B;IADN,SAAS,EAAE;2DACe;AAMpB;IADN,SAAS,EAAE;yDACc;AAMnB;IADN,SAAS,EAAE;8DACgB;AAMrB;IADN,SAAS,EAAE;6DACkB;AAMvB;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,SAAS,EAAE;8DACoB;AAMzB;IADN,SAAS,EAAE;2DACa;AAMlB;IADN,SAAS,EAAE;0DACY;AAMjB;IADN,SAAS,EAAE;+DACoB;AAMzB;IADN,SAAS,EAAE;6DACkB;AAMvB;IADN,SAAS,EAAE;+DACqB;AAM1B;IADN,SAAS,EAAE;4DACc;AAMnB;IADN,SAAS,EAAE;2DACa;AAMlB;IADN,SAAS,EAAE;gEACqB;AAO1B;IADN,kBAAkB,EAAE;2DACwB;AAOtC;IADN,kBAAkB,EAAE;0DACsB;AAMpC;IADN,SAAS,EAAE;wDACa;AAMlB;IADN,SAAS,EAAE;uDACW;AAMhB;IADN,SAAS,EAAE;8DACmB;AAOxB;IADN,SAAS,EAAE;uDACa;AAOlB;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,kBAAkB,EAAE;wEAC8B;AAM5C;IADN,kBAAkB,EAAE;yEAC+B;AAwTxD,aAAa,CAAC,kCAAkC,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsColor4, serializeAsVector3, serialize, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nimport \"./shaders/fluentButton.fragment\";\r\nimport \"./shaders/fluentButton.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass FluentButtonMaterialDefines extends MaterialDefines {\r\n public RELATIVE_WIDTH = true;\r\n public ENABLE_FADE = true;\r\n\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this._needUVs = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render square buttons with fluent design\r\n * @since 5.0.0\r\n */\r\nexport class FluentButtonMaterial extends PushMaterial {\r\n /**\r\n * URL pointing to the texture used to define the coloring for the fluent blob effect.\r\n */\r\n public static BLOB_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png\";\r\n\r\n /**\r\n * Gets or sets the width of the glowing edge, relative to the scale of the button.\r\n * (Default is 4% of the height).\r\n */\r\n @serialize()\r\n public edgeWidth = 0.04;\r\n\r\n /**\r\n * Gets or sets the color of the glowing edge.\r\n */\r\n @serializeAsColor4()\r\n public edgeColor = new Color4(0.592157, 0.592157, 0.592157, 1.0);\r\n\r\n /**\r\n * Gets or sets the maximum intensity of the proximity light.\r\n */\r\n @serialize()\r\n public proximityMaxIntensity = 0.45;\r\n\r\n /**\r\n * Gets or sets the maximum distance for the proximity light (Default is 16mm).\r\n */\r\n @serialize()\r\n public proximityFarDistance = 0.16;\r\n\r\n /**\r\n * Gets or sets the radius of the proximity light when near to the surface.\r\n */\r\n @serialize()\r\n public proximityNearRadius = 1.5;\r\n\r\n /**\r\n * Gets or sets the anisotropy of the proximity light.\r\n */\r\n @serialize()\r\n public proximityAnisotropy = 1;\r\n\r\n /**\r\n * Gets or sets the amount of fuzzing in the selection focus.\r\n */\r\n @serialize()\r\n public selectionFuzz = 0.5;\r\n\r\n /**\r\n * Gets or sets an override value to display the button as selected.\r\n */\r\n @serialize()\r\n public selected = 0;\r\n\r\n /**\r\n * Gets or sets a value to manually fade the blob size.\r\n */\r\n @serialize()\r\n public selectionFade = 0;\r\n\r\n /**\r\n * Gets or sets a value to manually shrink the blob size as it fades (see selectionFade).\r\n */\r\n @serialize()\r\n public selectionFadeSize = 0.3;\r\n\r\n /**\r\n * Gets or sets the distance from the button the cursor should be for the button\r\n * to appear selected (Default is 8cm).\r\n */\r\n @serialize()\r\n public selectedDistance = 0.08;\r\n\r\n /**\r\n * Gets or sets the fall-off distance for the selection fade (Default is 8cm).\r\n */\r\n @serialize()\r\n public selectedFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets the intensity of the luminous blob (Ranges 0-1, default is 0.5).\r\n */\r\n @serialize()\r\n public blobIntensity = 0.5;\r\n\r\n /**\r\n * The size of the blob when the pointer is at the blobFarDistance (Default is 5cm).\r\n */\r\n @serialize()\r\n public blobFarSize = 0.05;\r\n\r\n /**\r\n * The distance at which the pointer is considered near. See [left|right]BlobNearSize. (Default is 0cm).\r\n */\r\n @serialize()\r\n public blobNearDistance = 0;\r\n\r\n /**\r\n * The distance at which the pointer is considered far. See [left|right]BlobFarSize. (Default is 8cm).\r\n */\r\n @serialize()\r\n public blobFarDistance = 0.08;\r\n\r\n /**\r\n * The distance over which the blob intensity fades from full to none (Default is 8cm).\r\n */\r\n @serialize()\r\n public blobFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets whether the blob corresponding to the left index finger is enabled.\r\n */\r\n @serialize()\r\n public leftBlobEnable = true;\r\n\r\n /**\r\n * Gets or sets the size of the left blob when the left pointer is considered near. See blobNearDistance. (Default is 2.5cm).\r\n */\r\n @serialize()\r\n public leftBlobNearSize = 0.025;\r\n\r\n /**\r\n * Gets or sets the progress of the pulse animation on the left blob (Ranges 0-1).\r\n */\r\n @serialize()\r\n public leftBlobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the fade factor on the left blob.\r\n */\r\n @serialize()\r\n public leftBlobFade = 1;\r\n\r\n /**\r\n * Gets or sets the inner fade on the left blob;\r\n */\r\n @serialize()\r\n public leftBlobInnerFade = 0.01;\r\n\r\n /**\r\n * Gets or sets whether the blob corresponding to the right index finger is enabled.\r\n */\r\n @serialize()\r\n public rightBlobEnable = true;\r\n\r\n /**\r\n * Gets or sets the size of the right blob when the right pointer is considered near. See blobNearDistance. (Default is 2.5cm).\r\n */\r\n @serialize()\r\n public rightBlobNearSize = 0.025;\r\n\r\n /**\r\n * Gets or sets the progress of the pulse animation on the right blob (Ranges 0-1).\r\n */\r\n @serialize()\r\n public rightBlobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the fade factor on the right blob.\r\n */\r\n @serialize()\r\n public rightBlobFade = 1;\r\n\r\n /**\r\n * Gets or sets the inner fade on the right blob;\r\n */\r\n @serialize()\r\n public rightBlobInnerFade = 0.01;\r\n\r\n /**\r\n * Gets or sets the direction of the active face before the world transform is applied.\r\n * This should almost always be set to -z.\r\n */\r\n @serializeAsVector3()\r\n public activeFaceDir = new Vector3(0, 0, -1);\r\n\r\n /**\r\n * Gets or sets the button's up direction before the world transform is applied.\r\n * This should almost always be set to +y.\r\n */\r\n @serializeAsVector3()\r\n public activeFaceUp = new Vector3(0, 1, 0);\r\n\r\n /**\r\n * Gets or sets whether the edge fade effect is enabled.\r\n */\r\n @serialize()\r\n public enableFade = true;\r\n\r\n /**\r\n * Gets or sets a value corresponding to the width of the edge fade effect (Default 1.5).\r\n */\r\n @serialize()\r\n public fadeWidth = 1.5;\r\n\r\n /**\r\n * Gets or sets whether the active face is smoothly interpolated.\r\n */\r\n @serialize()\r\n public smoothActiveFace = true;\r\n\r\n /**\r\n * Gets or sets whether the frame of the fluent button model is visible.\r\n * This is usually only enabled for debugging purposes.\r\n */\r\n @serialize()\r\n public showFrame = false;\r\n\r\n /**\r\n * Gets or sets whether the blob color texture is used for the proximity\r\n * light effect. This is usually only disabled for debugging purposes.\r\n */\r\n @serialize()\r\n public useBlobTexture = true;\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the left index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalLeftIndexTipPosition = Vector3.Zero();\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the right index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalRightIndexTipPosition = Vector3.Zero();\r\n\r\n private _blobTexture: Texture;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_ADD;\r\n this.disableDepthWrite = true;\r\n this.backFaceCulling = false;\r\n\r\n this._blobTexture = new Texture(FluentButtonMaterial.BLOB_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentButtonMaterialDefines();\r\n }\r\n\r\n const defines = <FluentButtonMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fluentButton\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n\r\n \"_Edge_Width_\",\r\n \"_Edge_Color_\",\r\n \"_Relative_Width_\",\r\n \"_Proximity_Max_Intensity_\",\r\n \"_Proximity_Far_Distance_\",\r\n \"_Proximity_Near_Radius_\",\r\n \"_Proximity_Anisotropy_\",\r\n \"_Selection_Fuzz_\",\r\n \"_Selected_\",\r\n \"_Selection_Fade_\",\r\n \"_Selection_Fade_Size_\",\r\n \"_Selected_Distance_\",\r\n \"_Selected_Fade_Length_\",\r\n \"_Blob_Enable_\",\r\n \"_Blob_Position_\",\r\n \"_Blob_Intensity_\",\r\n \"_Blob_Near_Size_\",\r\n \"_Blob_Far_Size_\",\r\n \"_Blob_Near_Distance_\",\r\n \"_Blob_Far_Distance_\",\r\n \"_Blob_Fade_Length_\",\r\n \"_Blob_Inner_Fade_\",\r\n \"_Blob_Pulse_\",\r\n \"_Blob_Fade_\",\r\n \"_Blob_Texture_\",\r\n \"_Blob_Enable_2_\",\r\n \"_Blob_Position_2_\",\r\n \"_Blob_Near_Size_2_\",\r\n \"_Blob_Inner_Fade_2_\",\r\n \"_Blob_Pulse_2_\",\r\n \"_Blob_Fade_2_\",\r\n \"_Active_Face_Dir_\",\r\n \"_Active_Face_Up_\",\r\n \"_Enable_Fade_\",\r\n \"_Fade_Width_\",\r\n \"_Smooth_Active_Face_\",\r\n \"_Show_Frame_\",\r\n \"_Use_Blob_Texture_\",\r\n\r\n \"Use_Global_Left_Index\",\r\n \"Use_Global_Right_Index\",\r\n \"Global_Left_Index_Tip_Position\",\r\n \"Global_Right_Index_Tip_Position\",\r\n \"Global_Left_Thumb_Tip_Position\",\r\n \"Global_Right_Thumb_Tip_Position\",\r\n \"Global_Left_Index_Tip_Proximity\",\r\n \"Global_Right_Index_Tip_Proximity\",\r\n ];\r\n const samplers: string[] = [\"_Blob_Texture_\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FluentButtonMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", scene.activeCamera!.position);\r\n\r\n // \"Blob Texture\"\r\n this._activeEffect.setTexture(\"_Blob_Texture_\", this._blobTexture);\r\n\r\n // \"Wireframe\"\r\n this._activeEffect.setFloat(\"_Edge_Width_\", this.edgeWidth);\r\n this._activeEffect.setColor4(\"_Edge_Color_\", new Color3(this.edgeColor.r, this.edgeColor.g, this.edgeColor.b), this.edgeColor.a);\r\n //define _Relative_Width_ true;\r\n\r\n // \"Proximity\"\r\n this._activeEffect.setFloat(\"_Proximity_Max_Intensity_\", this.proximityMaxIntensity);\r\n this._activeEffect.setFloat(\"_Proximity_Far_Distance_\", this.proximityFarDistance);\r\n this._activeEffect.setFloat(\"_Proximity_Near_Radius_\", this.proximityNearRadius);\r\n this._activeEffect.setFloat(\"_Proximity_Anisotropy_\", this.proximityAnisotropy);\r\n\r\n // \"Selection\"\r\n this._activeEffect.setFloat(\"_Selection_Fuzz_\", this.selectionFuzz);\r\n this._activeEffect.setFloat(\"_Selected_\", this.selected);\r\n this._activeEffect.setFloat(\"_Selection_Fade_\", this.selectionFade);\r\n this._activeEffect.setFloat(\"_Selection_Fade_Size_\", this.selectionFadeSize);\r\n this._activeEffect.setFloat(\"_Selected_Distance_\", this.selectedDistance);\r\n this._activeEffect.setFloat(\"_Selected_Fade_Length_\", this.selectedFadeLength);\r\n\r\n // \"Blob\"\r\n this._activeEffect.setFloat(\"_Blob_Enable_\", this.leftBlobEnable ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Blob_Intensity_\", this.blobIntensity);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_\", this.leftBlobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Far_Size_\", this.blobFarSize);\r\n this._activeEffect.setFloat(\"_Blob_Near_Distance_\", this.blobNearDistance);\r\n this._activeEffect.setFloat(\"_Blob_Far_Distance_\", this.blobFarDistance);\r\n this._activeEffect.setFloat(\"_Blob_Fade_Length_\", this.blobFadeLength);\r\n this._activeEffect.setFloat(\"_Blob_Inner_Fade_\", this.leftBlobInnerFade);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_\", this.leftBlobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_\", this.leftBlobFade);\r\n\r\n // \"Blob 2\"\r\n this._activeEffect.setFloat(\"_Blob_Enable_2_\", this.rightBlobEnable ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_2_\", this.rightBlobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Inner_Fade_2_\", this.rightBlobInnerFade);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_2_\", this.rightBlobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_2_\", this.rightBlobFade);\r\n\r\n // \"Active Face\"\r\n this._activeEffect.setVector3(\"_Active_Face_Dir_\", this.activeFaceDir);\r\n this._activeEffect.setVector3(\"_Active_Face_Up_\", this.activeFaceUp);\r\n\r\n // \"Hololens Edge Fade\"\r\n //define _Enable_Fade_ true;\r\n this._activeEffect.setFloat(\"_Fade_Width_\", this.fadeWidth);\r\n this._activeEffect.setFloat(\"_Smooth_Active_Face_\", this.smoothActiveFace ? 1.0 : 0.0);\r\n\r\n // \"Debug\"\r\n this._activeEffect.setFloat(\"_Show_Frame_\", this.showFrame ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Use_Blob_Texture_\", this.useBlobTexture ? 1.0 : 0.0);\r\n\r\n // Global inputs\r\n this._activeEffect.setFloat(\"Use_Global_Left_Index\", 1.0);\r\n this._activeEffect.setFloat(\"Use_Global_Right_Index\", 1.0);\r\n\r\n this._activeEffect.setVector4(\r\n \"Global_Left_Index_Tip_Position\",\r\n new Vector4(this.globalLeftIndexTipPosition.x, this.globalLeftIndexTipPosition.y, this.globalLeftIndexTipPosition.z, 1.0)\r\n );\r\n this._activeEffect.setVector4(\r\n \"Global_Right_Index_Tip_Position\",\r\n new Vector4(this.globalRightIndexTipPosition.x, this.globalRightIndexTipPosition.y, this.globalRightIndexTipPosition.z, 1.0)\r\n );\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FluentButtonMaterial {\r\n return SerializationHelper.Clone(() => new FluentButtonMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FluentButtonMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentButtonMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentButtonMaterial {\r\n return SerializationHelper.Parse(() => new FluentButtonMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentButtonMaterial\", FluentButtonMaterial);\r\n"]}
|
1
|
+
{"version":3,"file":"fluentButtonMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/fluentButton/fluentButtonMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,SAAS,EAAE,2CAA6B;AACxF,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAG1D,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AACvD,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,SAAS,EAAE,6CAA+B;AAEnD,OAAO,iCAAiC,CAAC;AACzC,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,8DAAgD;AAEhL,gBAAgB;AAChB,MAAM,2BAA4B,SAAQ,eAAe;IAIrD;QACI,KAAK,EAAE,CAAC;QAJL,mBAAc,GAAG,IAAI,CAAC;QACtB,gBAAW,GAAG,IAAI,CAAC;QAItB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAsOlD,YAAY,IAA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,SAAS,EAAE;6DACkB;AAMvB;IADN,SAAS,EAAE;+DACqB;AAM1B;IADN,SAAS,EAAE;4DACc;AAMnB;IADN,SAAS,EAAE;2DACa;AAMlB;IADN,SAAS,EAAE;gEACqB;AAO1B;IADN,kBAAkB,EAAE;2DACwB;AAOtC;IADN,kBAAkB,EAAE;0DACsB;AAMpC;IADN,SAAS,EAAE;wDACa;AAMlB;IADN,SAAS,EAAE;uDACW;AAMhB;IADN,SAAS,EAAE;8DACmB;AAOxB;IADN,SAAS,EAAE;uDACa;AAOlB;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,kBAAkB,EAAE;wEAC8B;AAM5C;IADN,kBAAkB,EAAE;yEAC+B;AAwTxD,aAAa,CAAC,kCAAkC,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsColor4, serializeAsVector3, serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { Constants } from \"core/Engines/constants\";\r\n\r\nimport \"./shaders/fluentButton.fragment\";\r\nimport \"./shaders/fluentButton.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass FluentButtonMaterialDefines extends MaterialDefines {\r\n public RELATIVE_WIDTH = true;\r\n public ENABLE_FADE = true;\r\n\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this._needUVs = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * Class used to render square buttons with fluent design\r\n * @since 5.0.0\r\n */\r\nexport class FluentButtonMaterial extends PushMaterial {\r\n /**\r\n * URL pointing to the texture used to define the coloring for the fluent blob effect.\r\n */\r\n public static BLOB_TEXTURE_URL = \"https://assets.babylonjs.com/meshes/MRTK/mrtk-fluent-button-blob.png\";\r\n\r\n /**\r\n * Gets or sets the width of the glowing edge, relative to the scale of the button.\r\n * (Default is 4% of the height).\r\n */\r\n @serialize()\r\n public edgeWidth = 0.04;\r\n\r\n /**\r\n * Gets or sets the color of the glowing edge.\r\n */\r\n @serializeAsColor4()\r\n public edgeColor = new Color4(0.592157, 0.592157, 0.592157, 1.0);\r\n\r\n /**\r\n * Gets or sets the maximum intensity of the proximity light.\r\n */\r\n @serialize()\r\n public proximityMaxIntensity = 0.45;\r\n\r\n /**\r\n * Gets or sets the maximum distance for the proximity light (Default is 16mm).\r\n */\r\n @serialize()\r\n public proximityFarDistance = 0.16;\r\n\r\n /**\r\n * Gets or sets the radius of the proximity light when near to the surface.\r\n */\r\n @serialize()\r\n public proximityNearRadius = 1.5;\r\n\r\n /**\r\n * Gets or sets the anisotropy of the proximity light.\r\n */\r\n @serialize()\r\n public proximityAnisotropy = 1;\r\n\r\n /**\r\n * Gets or sets the amount of fuzzing in the selection focus.\r\n */\r\n @serialize()\r\n public selectionFuzz = 0.5;\r\n\r\n /**\r\n * Gets or sets an override value to display the button as selected.\r\n */\r\n @serialize()\r\n public selected = 0;\r\n\r\n /**\r\n * Gets or sets a value to manually fade the blob size.\r\n */\r\n @serialize()\r\n public selectionFade = 0;\r\n\r\n /**\r\n * Gets or sets a value to manually shrink the blob size as it fades (see selectionFade).\r\n */\r\n @serialize()\r\n public selectionFadeSize = 0.3;\r\n\r\n /**\r\n * Gets or sets the distance from the button the cursor should be for the button\r\n * to appear selected (Default is 8cm).\r\n */\r\n @serialize()\r\n public selectedDistance = 0.08;\r\n\r\n /**\r\n * Gets or sets the fall-off distance for the selection fade (Default is 8cm).\r\n */\r\n @serialize()\r\n public selectedFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets the intensity of the luminous blob (Ranges 0-1, default is 0.5).\r\n */\r\n @serialize()\r\n public blobIntensity = 0.5;\r\n\r\n /**\r\n * The size of the blob when the pointer is at the blobFarDistance (Default is 5cm).\r\n */\r\n @serialize()\r\n public blobFarSize = 0.05;\r\n\r\n /**\r\n * The distance at which the pointer is considered near. See [left|right]BlobNearSize. (Default is 0cm).\r\n */\r\n @serialize()\r\n public blobNearDistance = 0;\r\n\r\n /**\r\n * The distance at which the pointer is considered far. See [left|right]BlobFarSize. (Default is 8cm).\r\n */\r\n @serialize()\r\n public blobFarDistance = 0.08;\r\n\r\n /**\r\n * The distance over which the blob intensity fades from full to none (Default is 8cm).\r\n */\r\n @serialize()\r\n public blobFadeLength = 0.08;\r\n\r\n /**\r\n * Gets or sets whether the blob corresponding to the left index finger is enabled.\r\n */\r\n @serialize()\r\n public leftBlobEnable = true;\r\n\r\n /**\r\n * Gets or sets the size of the left blob when the left pointer is considered near. See blobNearDistance. (Default is 2.5cm).\r\n */\r\n @serialize()\r\n public leftBlobNearSize = 0.025;\r\n\r\n /**\r\n * Gets or sets the progress of the pulse animation on the left blob (Ranges 0-1).\r\n */\r\n @serialize()\r\n public leftBlobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the fade factor on the left blob.\r\n */\r\n @serialize()\r\n public leftBlobFade = 1;\r\n\r\n /**\r\n * Gets or sets the inner fade on the left blob;\r\n */\r\n @serialize()\r\n public leftBlobInnerFade = 0.01;\r\n\r\n /**\r\n * Gets or sets whether the blob corresponding to the right index finger is enabled.\r\n */\r\n @serialize()\r\n public rightBlobEnable = true;\r\n\r\n /**\r\n * Gets or sets the size of the right blob when the right pointer is considered near. See blobNearDistance. (Default is 2.5cm).\r\n */\r\n @serialize()\r\n public rightBlobNearSize = 0.025;\r\n\r\n /**\r\n * Gets or sets the progress of the pulse animation on the right blob (Ranges 0-1).\r\n */\r\n @serialize()\r\n public rightBlobPulse = 0;\r\n\r\n /**\r\n * Gets or sets the fade factor on the right blob.\r\n */\r\n @serialize()\r\n public rightBlobFade = 1;\r\n\r\n /**\r\n * Gets or sets the inner fade on the right blob;\r\n */\r\n @serialize()\r\n public rightBlobInnerFade = 0.01;\r\n\r\n /**\r\n * Gets or sets the direction of the active face before the world transform is applied.\r\n * This should almost always be set to -z.\r\n */\r\n @serializeAsVector3()\r\n public activeFaceDir = new Vector3(0, 0, -1);\r\n\r\n /**\r\n * Gets or sets the button's up direction before the world transform is applied.\r\n * This should almost always be set to +y.\r\n */\r\n @serializeAsVector3()\r\n public activeFaceUp = new Vector3(0, 1, 0);\r\n\r\n /**\r\n * Gets or sets whether the edge fade effect is enabled.\r\n */\r\n @serialize()\r\n public enableFade = true;\r\n\r\n /**\r\n * Gets or sets a value corresponding to the width of the edge fade effect (Default 1.5).\r\n */\r\n @serialize()\r\n public fadeWidth = 1.5;\r\n\r\n /**\r\n * Gets or sets whether the active face is smoothly interpolated.\r\n */\r\n @serialize()\r\n public smoothActiveFace = true;\r\n\r\n /**\r\n * Gets or sets whether the frame of the fluent button model is visible.\r\n * This is usually only enabled for debugging purposes.\r\n */\r\n @serialize()\r\n public showFrame = false;\r\n\r\n /**\r\n * Gets or sets whether the blob color texture is used for the proximity\r\n * light effect. This is usually only disabled for debugging purposes.\r\n */\r\n @serialize()\r\n public useBlobTexture = true;\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the left index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalLeftIndexTipPosition = Vector3.Zero();\r\n\r\n /**\r\n * Gets or sets the world-space position of the tip of the right index finger.\r\n */\r\n @serializeAsVector3()\r\n public globalRightIndexTipPosition = Vector3.Zero();\r\n\r\n private _blobTexture: Texture;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_ADD;\r\n this.disableDepthWrite = true;\r\n this.backFaceCulling = false;\r\n\r\n this._blobTexture = new Texture(FluentButtonMaterial.BLOB_TEXTURE_URL, this.getScene(), true, false, Texture.NEAREST_SAMPLINGMODE);\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FluentButtonMaterialDefines();\r\n }\r\n\r\n const defines = <FluentButtonMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fluentButton\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n\r\n \"_Edge_Width_\",\r\n \"_Edge_Color_\",\r\n \"_Relative_Width_\",\r\n \"_Proximity_Max_Intensity_\",\r\n \"_Proximity_Far_Distance_\",\r\n \"_Proximity_Near_Radius_\",\r\n \"_Proximity_Anisotropy_\",\r\n \"_Selection_Fuzz_\",\r\n \"_Selected_\",\r\n \"_Selection_Fade_\",\r\n \"_Selection_Fade_Size_\",\r\n \"_Selected_Distance_\",\r\n \"_Selected_Fade_Length_\",\r\n \"_Blob_Enable_\",\r\n \"_Blob_Position_\",\r\n \"_Blob_Intensity_\",\r\n \"_Blob_Near_Size_\",\r\n \"_Blob_Far_Size_\",\r\n \"_Blob_Near_Distance_\",\r\n \"_Blob_Far_Distance_\",\r\n \"_Blob_Fade_Length_\",\r\n \"_Blob_Inner_Fade_\",\r\n \"_Blob_Pulse_\",\r\n \"_Blob_Fade_\",\r\n \"_Blob_Texture_\",\r\n \"_Blob_Enable_2_\",\r\n \"_Blob_Position_2_\",\r\n \"_Blob_Near_Size_2_\",\r\n \"_Blob_Inner_Fade_2_\",\r\n \"_Blob_Pulse_2_\",\r\n \"_Blob_Fade_2_\",\r\n \"_Active_Face_Dir_\",\r\n \"_Active_Face_Up_\",\r\n \"_Enable_Fade_\",\r\n \"_Fade_Width_\",\r\n \"_Smooth_Active_Face_\",\r\n \"_Show_Frame_\",\r\n \"_Use_Blob_Texture_\",\r\n\r\n \"Use_Global_Left_Index\",\r\n \"Use_Global_Right_Index\",\r\n \"Global_Left_Index_Tip_Position\",\r\n \"Global_Right_Index_Tip_Position\",\r\n \"Global_Left_Thumb_Tip_Position\",\r\n \"Global_Right_Thumb_Tip_Position\",\r\n \"Global_Left_Index_Tip_Proximity\",\r\n \"Global_Right_Index_Tip_Proximity\",\r\n ];\r\n const samplers: string[] = [\"_Blob_Texture_\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines,\r\n this._materialContext\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FluentButtonMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", scene.activeCamera!.position);\r\n\r\n // \"Blob Texture\"\r\n this._activeEffect.setTexture(\"_Blob_Texture_\", this._blobTexture);\r\n\r\n // \"Wireframe\"\r\n this._activeEffect.setFloat(\"_Edge_Width_\", this.edgeWidth);\r\n this._activeEffect.setColor4(\"_Edge_Color_\", new Color3(this.edgeColor.r, this.edgeColor.g, this.edgeColor.b), this.edgeColor.a);\r\n //define _Relative_Width_ true;\r\n\r\n // \"Proximity\"\r\n this._activeEffect.setFloat(\"_Proximity_Max_Intensity_\", this.proximityMaxIntensity);\r\n this._activeEffect.setFloat(\"_Proximity_Far_Distance_\", this.proximityFarDistance);\r\n this._activeEffect.setFloat(\"_Proximity_Near_Radius_\", this.proximityNearRadius);\r\n this._activeEffect.setFloat(\"_Proximity_Anisotropy_\", this.proximityAnisotropy);\r\n\r\n // \"Selection\"\r\n this._activeEffect.setFloat(\"_Selection_Fuzz_\", this.selectionFuzz);\r\n this._activeEffect.setFloat(\"_Selected_\", this.selected);\r\n this._activeEffect.setFloat(\"_Selection_Fade_\", this.selectionFade);\r\n this._activeEffect.setFloat(\"_Selection_Fade_Size_\", this.selectionFadeSize);\r\n this._activeEffect.setFloat(\"_Selected_Distance_\", this.selectedDistance);\r\n this._activeEffect.setFloat(\"_Selected_Fade_Length_\", this.selectedFadeLength);\r\n\r\n // \"Blob\"\r\n this._activeEffect.setFloat(\"_Blob_Enable_\", this.leftBlobEnable ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Blob_Intensity_\", this.blobIntensity);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_\", this.leftBlobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Far_Size_\", this.blobFarSize);\r\n this._activeEffect.setFloat(\"_Blob_Near_Distance_\", this.blobNearDistance);\r\n this._activeEffect.setFloat(\"_Blob_Far_Distance_\", this.blobFarDistance);\r\n this._activeEffect.setFloat(\"_Blob_Fade_Length_\", this.blobFadeLength);\r\n this._activeEffect.setFloat(\"_Blob_Inner_Fade_\", this.leftBlobInnerFade);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_\", this.leftBlobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_\", this.leftBlobFade);\r\n\r\n // \"Blob 2\"\r\n this._activeEffect.setFloat(\"_Blob_Enable_2_\", this.rightBlobEnable ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Blob_Near_Size_2_\", this.rightBlobNearSize);\r\n this._activeEffect.setFloat(\"_Blob_Inner_Fade_2_\", this.rightBlobInnerFade);\r\n this._activeEffect.setFloat(\"_Blob_Pulse_2_\", this.rightBlobPulse);\r\n this._activeEffect.setFloat(\"_Blob_Fade_2_\", this.rightBlobFade);\r\n\r\n // \"Active Face\"\r\n this._activeEffect.setVector3(\"_Active_Face_Dir_\", this.activeFaceDir);\r\n this._activeEffect.setVector3(\"_Active_Face_Up_\", this.activeFaceUp);\r\n\r\n // \"Hololens Edge Fade\"\r\n //define _Enable_Fade_ true;\r\n this._activeEffect.setFloat(\"_Fade_Width_\", this.fadeWidth);\r\n this._activeEffect.setFloat(\"_Smooth_Active_Face_\", this.smoothActiveFace ? 1.0 : 0.0);\r\n\r\n // \"Debug\"\r\n this._activeEffect.setFloat(\"_Show_Frame_\", this.showFrame ? 1.0 : 0.0);\r\n this._activeEffect.setFloat(\"_Use_Blob_Texture_\", this.useBlobTexture ? 1.0 : 0.0);\r\n\r\n // Global inputs\r\n this._activeEffect.setFloat(\"Use_Global_Left_Index\", 1.0);\r\n this._activeEffect.setFloat(\"Use_Global_Right_Index\", 1.0);\r\n\r\n this._activeEffect.setVector4(\r\n \"Global_Left_Index_Tip_Position\",\r\n new Vector4(this.globalLeftIndexTipPosition.x, this.globalLeftIndexTipPosition.y, this.globalLeftIndexTipPosition.z, 1.0)\r\n );\r\n this._activeEffect.setVector4(\r\n \"Global_Right_Index_Tip_Position\",\r\n new Vector4(this.globalRightIndexTipPosition.x, this.globalRightIndexTipPosition.y, this.globalRightIndexTipPosition.z, 1.0)\r\n );\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): FluentButtonMaterial {\r\n return SerializationHelper.Clone(() => new FluentButtonMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FluentButtonMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"FluentButtonMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): FluentButtonMaterial {\r\n return SerializationHelper.Parse(() => new FluentButtonMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.FluentButtonMaterial\", FluentButtonMaterial);\r\n"]}
|
@@ -5,7 +5,8 @@ import { EffectFallbacks } from "@babylonjs/core/Materials/effectFallbacks.js";
|
|
5
5
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
6
6
|
import { PushMaterial } from "@babylonjs/core/Materials/pushMaterial.js";
|
7
7
|
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
8
|
-
import {
|
8
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
9
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
9
10
|
import { VertexBuffer } from "@babylonjs/core/Buffers/buffer.js";
|
10
11
|
import "./shaders/mrdlBackglow.fragment.js";
|
11
12
|
import "./shaders/mrdlBackglow.vertex.js";
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mrdlBackglowMaterial.js","sourceRoot":"","sources":["../../../../../../dev/gui/src/3D/materials/mrdl/mrdlBackglowMaterial.ts"],"names":[],"mappings":";AAUA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,SAAS,EAAE,6CAA+B;AACnD,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,2CAA6B;AACtE,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAEnD,OAAO,iCAAiC,CAAC;AACzC,OAAO,+BAA+B,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,2BAA2B,EAAE,8BAA8B,EAAE,8DAAgD;AAEhL,cAAc;AACd,MAAM,2BAA4B,SAAQ,eAAe;IACrD;QACI,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;CACJ;AAED,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAsFlD,YAAY,IAAY,EAAE,KAAY;QAClC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAtFvB;;WAEG;QAEI,gBAAW,GAAG,IAAI,CAAC;QAE1B;;WAEG;QAEI,cAAS,GAAG,IAAI,CAAC;QAExB;;;WAGG;QAEI,kBAAa,GAAG,KAAK,CAAC;QAE7B;;WAEG;QAEI,iBAAY,GAAG,GAAG,CAAC;QAE1B;;WAEG;QAEI,WAAM,GAAG,GAAG,CAAC;QAEpB;;WAEG;QAEI,iBAAY,GAAG,GAAG,CAAC;QA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AC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAClG,CAAC;IAEM,SAAS;QACZ,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChE,mBAAmB,CAAC,UAAU,GAAG,8BAA8B,CAAC;QAChE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACjH,CAAC;CACJ;AArTU;IADN,SAAS,EAAE;yDACc;AAMnB;IADN,SAAS,EAAE;uDACY;AAOjB;IADN,SAAS,EAAE;2DACiB;AAMtB;IADN,SAAS,EAAE;0DACc;AAMnB;IADN,SAAS,EAAE;oDACQ;AAMb;IADN,SAAS,EAAE;0DACc;AAMnB;IADN,SAAS,EAAE;qEACyB;AAM9B;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,SAAS,EAAE;0DACe;AAMpB;IADN,SAAS,EAAE;mDACgD;AAMrD;IADN,SAAS,EAAE;wDAC4D;AAMjE;IADN,SAAS,EAAE;2DACe;AAMpB;IADN,SAAS,EAAE;qDACS;AAMd;IADN,SAAS,EAAE;kDACM;AAwOtB,aAAa,CAAC,kCAAkC,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\n\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { SerializationHelper, serialize } from \"core/Misc/decorators\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\n\r\nimport \"./shaders/mrdlBackglow.fragment\";\r\nimport \"./shaders/mrdlBackglow.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @hidden */\r\nclass MRDLBackglowMaterialDefines extends MaterialDefines {\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this._needUVs = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class MRDLBackglowMaterial extends PushMaterial {\r\n /**\r\n * Gets or sets the bevel radius on the backglow. If this value is changed, update the lineWidth to match.\r\n */\r\n @serialize()\r\n public bevelRadius = 0.16;\r\n\r\n /**\r\n * Gets or sets the line width of the backglow.\r\n */\r\n @serialize()\r\n public lineWidth = 0.16;\r\n\r\n /**\r\n * Gets or sets whether to use absolute sizes when calculating effects on the backglow.\r\n * Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.\r\n */\r\n @serialize()\r\n public absoluteSizes = false;\r\n\r\n /**\r\n * Gets or sets the tuning motion of the backglow.\r\n */\r\n @serialize()\r\n public tuningMotion = 0.0;\r\n\r\n /**\r\n * Gets or sets the motion of the backglow.\r\n */\r\n @serialize()\r\n public motion = 1.0;\r\n\r\n /**\r\n * Gets or sets the maximum intensity of the backglow.\r\n */\r\n @serialize()\r\n public maxIntensity = 0.7;\r\n\r\n /**\r\n * Gets or sets the fade-in exponent of the intensity of the backglow.\r\n */\r\n @serialize()\r\n public intensityFadeInExponent = 2.0;\r\n\r\n /**\r\n * Gets or sets the start of the outer fuzz effect on the backglow.\r\n */\r\n @serialize()\r\n public outerFuzzStart = 0.04;\r\n\r\n /**\r\n * Gets or sets the end of the outer fuzz effect on the backglow.\r\n */\r\n @serialize()\r\n public outerFuzzEnd = 0.04;\r\n\r\n /**\r\n * Gets or sets the color of the backglow.\r\n */\r\n @serialize()\r\n public color: Color4 = new Color4(0.682353, 0.698039, 1, 1);\r\n\r\n /**\r\n * Gets or sets the inner color of the backglow.\r\n */\r\n @serialize()\r\n public innerColor: Color4 = new Color4(0.356863, 0.392157, 0.796078, 1);\r\n\r\n /**\r\n * Gets or sets the blend exponent of the backglow.\r\n */\r\n @serialize()\r\n public blendExponent = 1.5;\r\n\r\n /**\r\n * Gets or sets the falloff of the backglow.\r\n */\r\n @serialize()\r\n public falloff = 2.0;\r\n\r\n /**\r\n * Gets or sets the bias of the backglow.\r\n */\r\n @serialize()\r\n public bias = 0.5;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_ADD;\r\n this.disableDepthWrite = true;\r\n this.backFaceCulling = false;\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new MRDLBackglowMaterialDefines();\r\n }\r\n\r\n const defines = <MRDLBackglowMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"mrdlBackglow\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"worldView\",\r\n \"worldViewProjection\",\r\n \"view\",\r\n \"projection\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n \"_Bevel_Radius_\",\r\n \"_Line_Width_\",\r\n \"_Absolute_Sizes_\",\r\n \"_Tuning_Motion_\",\r\n \"_Motion_\",\r\n \"_Max_Intensity_\",\r\n \"_Intensity_Fade_In_Exponent_\",\r\n \"_Outer_Fuzz_Start_\",\r\n \"_Outer_Fuzz_End_\",\r\n \"_Color_\",\r\n \"_Inner_Color_\",\r\n \"_Blend_Exponent_\",\r\n \"_Falloff_\",\r\n \"_Bias_\",\r\n ];\r\n const samplers: string[] = [];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <MRDLBackglowMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", scene.activeCamera!.position);\r\n\r\n // \"Rounded Rectangle\"\r\n this._activeEffect.setFloat(\"_Bevel_Radius_\", this.bevelRadius);\r\n this._activeEffect.setFloat(\"_Line_Width_\", this.lineWidth);\r\n this._activeEffect.setFloat(\"_Absolute_Sizes_\", this.absoluteSizes ? 1.0 : 0.0);\r\n\r\n // \"Animation\"\r\n this._activeEffect.setFloat(\"_Tuning_Motion_\", this.tuningMotion);\r\n this._activeEffect.setFloat(\"_Motion_\", this.motion);\r\n this._activeEffect.setFloat(\"_Max_Intensity_\", this.maxIntensity);\r\n this._activeEffect.setFloat(\"_Intensity_Fade_In_Exponent_\", this.intensityFadeInExponent);\r\n this._activeEffect.setFloat(\"_Outer_Fuzz_Start_\", this.outerFuzzStart);\r\n this._activeEffect.setFloat(\"_Outer_Fuzz_End_\", this.outerFuzzEnd);\r\n\r\n // \"Color\"\r\n this._activeEffect.setDirectColor4(\"_Color_\", this.color);\r\n this._activeEffect.setDirectColor4(\"_Inner_Color_\", this.innerColor);\r\n this._activeEffect.setFloat(\"_Blend_Exponent_\", this.blendExponent);\r\n\r\n // \"Inner Transition\"\r\n this._activeEffect.setFloat(\"_Falloff_\", this.falloff);\r\n this._activeEffect.setFloat(\"_Bias_\", this.bias);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): MRDLBackglowMaterial {\r\n return SerializationHelper.Clone(() => new MRDLBackglowMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): unknown {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.MRDLBackglowMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"MRDLBackglowMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): MRDLBackglowMaterial {\r\n return SerializationHelper.Parse(() => new MRDLBackglowMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.MRDLBackglowMaterial\", MRDLBackglowMaterial);\r\n"]}
|
1
|
+
{"version":3,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I,CAAC,CAAC;IAClG,CAAC;IAEM,SAAS;QACZ,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChE,mBAAmB,CAAC,UAAU,GAAG,8BAA8B,CAAC;QAChE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEM,YAAY;QACf,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAED,UAAU;IACH,MAAM,CAAC,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QAC1D,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACjH,CAAC;CACJ;AArTU;IADN,SAAS,EAAE;yDACc;AAMnB;IADN,SAAS,EAAE;uDACY;AAOjB;IADN,SAAS,EAAE;2DACiB;AAMtB;IADN,SAAS,EAAE;0DACc;AAMnB;IADN,SAAS,EAAE;oDACQ;AAMb;IADN,SAAS,EAAE;0DACc;AAMnB;IADN,SAAS,EAAE;qEACyB;AAM9B;IADN,SAAS,EAAE;4DACiB;AAMtB;IADN,SAAS,EAAE;0DACe;AAMpB;IADN,SAAS,EAAE;mDACgD;AAMrD;IADN,SAAS,EAAE;wDAC4D;AAMjE;IADN,SAAS,EAAE;2DACe;AAMpB;IADN,SAAS,EAAE;qDACS;AAMd;IADN,SAAS,EAAE;kDACM;AAwOtB,aAAa,CAAC,kCAAkC,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { SubMesh } from \"core/Meshes/subMesh\";\r\n\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { VertexBuffer } from \"core/Buffers/buffer\";\r\n\r\nimport \"./shaders/mrdlBackglow.fragment\";\r\nimport \"./shaders/mrdlBackglow.vertex\";\r\nimport { HandleFallbacksForShadows, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareUniformsAndSamplersList } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @hidden */\r\nclass MRDLBackglowMaterialDefines extends MaterialDefines {\r\n constructor() {\r\n super();\r\n this._needNormals = true;\r\n this._needUVs = true;\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class MRDLBackglowMaterial extends PushMaterial {\r\n /**\r\n * Gets or sets the bevel radius on the backglow. If this value is changed, update the lineWidth to match.\r\n */\r\n @serialize()\r\n public bevelRadius = 0.16;\r\n\r\n /**\r\n * Gets or sets the line width of the backglow.\r\n */\r\n @serialize()\r\n public lineWidth = 0.16;\r\n\r\n /**\r\n * Gets or sets whether to use absolute sizes when calculating effects on the backglow.\r\n * Since desktop and VR/AR have different relative sizes, it's usually best to keep this false.\r\n */\r\n @serialize()\r\n public absoluteSizes = false;\r\n\r\n /**\r\n * Gets or sets the tuning motion of the backglow.\r\n */\r\n @serialize()\r\n public tuningMotion = 0.0;\r\n\r\n /**\r\n * Gets or sets the motion of the backglow.\r\n */\r\n @serialize()\r\n public motion = 1.0;\r\n\r\n /**\r\n * Gets or sets the maximum intensity of the backglow.\r\n */\r\n @serialize()\r\n public maxIntensity = 0.7;\r\n\r\n /**\r\n * Gets or sets the fade-in exponent of the intensity of the backglow.\r\n */\r\n @serialize()\r\n public intensityFadeInExponent = 2.0;\r\n\r\n /**\r\n * Gets or sets the start of the outer fuzz effect on the backglow.\r\n */\r\n @serialize()\r\n public outerFuzzStart = 0.04;\r\n\r\n /**\r\n * Gets or sets the end of the outer fuzz effect on the backglow.\r\n */\r\n @serialize()\r\n public outerFuzzEnd = 0.04;\r\n\r\n /**\r\n * Gets or sets the color of the backglow.\r\n */\r\n @serialize()\r\n public color: Color4 = new Color4(0.682353, 0.698039, 1, 1);\r\n\r\n /**\r\n * Gets or sets the inner color of the backglow.\r\n */\r\n @serialize()\r\n public innerColor: Color4 = new Color4(0.356863, 0.392157, 0.796078, 1);\r\n\r\n /**\r\n * Gets or sets the blend exponent of the backglow.\r\n */\r\n @serialize()\r\n public blendExponent = 1.5;\r\n\r\n /**\r\n * Gets or sets the falloff of the backglow.\r\n */\r\n @serialize()\r\n public falloff = 2.0;\r\n\r\n /**\r\n * Gets or sets the bias of the backglow.\r\n */\r\n @serialize()\r\n public bias = 0.5;\r\n\r\n constructor(name: string, scene: Scene) {\r\n super(name, scene);\r\n this.alphaMode = Constants.ALPHA_ADD;\r\n this.disableDepthWrite = true;\r\n this.backFaceCulling = false;\r\n }\r\n\r\n public needAlphaBlending(): boolean {\r\n return true;\r\n }\r\n\r\n public needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new MRDLBackglowMaterialDefines();\r\n }\r\n\r\n const defines = <MRDLBackglowMaterialDefines>subMesh.materialDefines;\r\n const scene = this.getScene();\r\n\r\n if (this._isReadyForSubMesh(subMesh)) {\r\n return true;\r\n }\r\n\r\n const engine = scene.getEngine();\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, false);\r\n\r\n // Get correct effect\r\n if (defines.isDirty) {\r\n defines.markAsProcessed();\r\n\r\n scene.resetCachedMaterial();\r\n\r\n // Fallbacks\r\n const fallbacks = new EffectFallbacks();\r\n if (defines.FOG) {\r\n fallbacks.addFallback(1, \"FOG\");\r\n }\r\n\r\n HandleFallbacksForShadows(defines, fallbacks);\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.NORMAL) {\r\n attribs.push(VertexBuffer.NormalKind);\r\n }\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n if (defines.TANGENT) {\r\n attribs.push(VertexBuffer.TangentKind);\r\n }\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"mrdlBackglow\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"worldView\",\r\n \"worldViewProjection\",\r\n \"view\",\r\n \"projection\",\r\n \"viewProjection\",\r\n \"cameraPosition\",\r\n \"_Bevel_Radius_\",\r\n \"_Line_Width_\",\r\n \"_Absolute_Sizes_\",\r\n \"_Tuning_Motion_\",\r\n \"_Motion_\",\r\n \"_Max_Intensity_\",\r\n \"_Intensity_Fade_In_Exponent_\",\r\n \"_Outer_Fuzz_Start_\",\r\n \"_Outer_Fuzz_End_\",\r\n \"_Color_\",\r\n \"_Inner_Color_\",\r\n \"_Blend_Exponent_\",\r\n \"_Falloff_\",\r\n \"_Bias_\",\r\n ];\r\n const samplers: string[] = [];\r\n const uniformBuffers: string[] = [];\r\n\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 4,\r\n });\r\n\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\r\n shaderName,\r\n <IEffectCreationOptions>{\r\n attributes: attribs,\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: join,\r\n fallbacks: fallbacks,\r\n onCompiled: this.onCompiled,\r\n onError: this.onError,\r\n indexParameters: { maxSimultaneousLights: 4 },\r\n },\r\n engine\r\n ),\r\n defines\r\n );\r\n }\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n public bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <MRDLBackglowMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n this._activeEffect.setVector3(\"cameraPosition\", scene.activeCamera!.position);\r\n\r\n // \"Rounded Rectangle\"\r\n this._activeEffect.setFloat(\"_Bevel_Radius_\", this.bevelRadius);\r\n this._activeEffect.setFloat(\"_Line_Width_\", this.lineWidth);\r\n this._activeEffect.setFloat(\"_Absolute_Sizes_\", this.absoluteSizes ? 1.0 : 0.0);\r\n\r\n // \"Animation\"\r\n this._activeEffect.setFloat(\"_Tuning_Motion_\", this.tuningMotion);\r\n this._activeEffect.setFloat(\"_Motion_\", this.motion);\r\n this._activeEffect.setFloat(\"_Max_Intensity_\", this.maxIntensity);\r\n this._activeEffect.setFloat(\"_Intensity_Fade_In_Exponent_\", this.intensityFadeInExponent);\r\n this._activeEffect.setFloat(\"_Outer_Fuzz_Start_\", this.outerFuzzStart);\r\n this._activeEffect.setFloat(\"_Outer_Fuzz_End_\", this.outerFuzzEnd);\r\n\r\n // \"Color\"\r\n this._activeEffect.setDirectColor4(\"_Color_\", this.color);\r\n this._activeEffect.setDirectColor4(\"_Inner_Color_\", this.innerColor);\r\n this._activeEffect.setFloat(\"_Blend_Exponent_\", this.blendExponent);\r\n\r\n // \"Inner Transition\"\r\n this._activeEffect.setFloat(\"_Falloff_\", this.falloff);\r\n this._activeEffect.setFloat(\"_Bias_\", this.bias);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public clone(name: string): MRDLBackglowMaterial {\r\n return SerializationHelper.Clone(() => new MRDLBackglowMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public serialize(): unknown {\r\n const serializationObject = SerializationHelper.Serialize(this);\r\n serializationObject.customType = \"BABYLON.MRDLBackglowMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public getClassName(): string {\r\n return \"MRDLBackglowMaterial\";\r\n }\r\n\r\n // Statics\r\n public static Parse(source: any, scene: Scene, rootUrl: string): MRDLBackglowMaterial {\r\n return SerializationHelper.Parse(() => new MRDLBackglowMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GUI.MRDLBackglowMaterial\", MRDLBackglowMaterial);\r\n"]}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { __decorate } from "@babylonjs/core/tslib.es6.js";
|
2
|
-
import {
|
2
|
+
import { serialize } from "@babylonjs/core/Misc/decorators.js";
|
3
|
+
import { SerializationHelper } from "@babylonjs/core/Misc/decorators.serialization.js";
|
3
4
|
import { Vector4 } from "@babylonjs/core/Maths/math.vector.js";
|
4
5
|
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
5
6
|
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|