@babylonjs/materials 7.34.4 → 7.35.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. package/cell/cellMaterial.js.map +1 -1
  2. package/custom/customMaterial.js.map +1 -1
  3. package/custom/pbrCustomMaterial.js.map +1 -1
  4. package/fire/fireMaterial.js.map +1 -1
  5. package/fur/furMaterial.js.map +1 -1
  6. package/gradient/gradientMaterial.js.map +1 -1
  7. package/grid/grid.fragment.d.ts +2 -0
  8. package/grid/grid.fragment.js +4 -0
  9. package/grid/grid.fragment.js.map +1 -1
  10. package/grid/grid.vertex.d.ts +2 -0
  11. package/grid/grid.vertex.js +4 -0
  12. package/grid/grid.vertex.js.map +1 -1
  13. package/grid/gridMaterial.js +15 -6
  14. package/grid/gridMaterial.js.map +1 -1
  15. package/lava/lavaMaterial.js.map +1 -1
  16. package/legacy/legacy-cell.js.map +1 -1
  17. package/legacy/legacy-custom.js.map +1 -1
  18. package/legacy/legacy-fire.js.map +1 -1
  19. package/legacy/legacy-fur.js.map +1 -1
  20. package/legacy/legacy-gradient.js.map +1 -1
  21. package/legacy/legacy-grid.js.map +1 -1
  22. package/legacy/legacy-lava.js.map +1 -1
  23. package/legacy/legacy-mix.js.map +1 -1
  24. package/legacy/legacy-normal.js.map +1 -1
  25. package/legacy/legacy-shadowOnly.js.map +1 -1
  26. package/legacy/legacy-simple.js.map +1 -1
  27. package/legacy/legacy-sky.js.map +1 -1
  28. package/legacy/legacy-terrain.js.map +1 -1
  29. package/legacy/legacy-triPlanar.js.map +1 -1
  30. package/legacy/legacy-water.js.map +1 -1
  31. package/legacy/legacy.js.map +1 -1
  32. package/mix/mixMaterial.js.map +1 -1
  33. package/normal/normalMaterial.js.map +1 -1
  34. package/package.json +2 -2
  35. package/shadowOnly/shadowOnlyMaterial.js.map +1 -1
  36. package/simple/simpleMaterial.js.map +1 -1
  37. package/sky/skyMaterial.js.map +1 -1
  38. package/terrain/terrainMaterial.js.map +1 -1
  39. package/triPlanar/triPlanarMaterial.js.map +1 -1
  40. package/water/waterMaterial.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"furMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/fur/furMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC9H,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,IAAI,EAAE,qCAAuB;AAEtC,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,cAAc,EAAE,6DAA+C;AAExE,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,8DAAgD;AAEjD,MAAM,kBAAmB,SAAQ,eAAe;IA2B5C;QACI,KAAK,EAAE,CAAC;QA3BL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,eAA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,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport { Tags } from \"core/Misc/tags\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"core/Materials/Textures/dynamicTexture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\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 { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\n\r\nimport \"./fur.fragment\";\r\nimport \"./fur.vertex\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass FurMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public HEIGHTMAP = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public HIGHLEVEL = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FurMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"heightTexture\")\r\n private _heightTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public heightTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public furLength: number = 1;\r\n\r\n @serialize()\r\n public furAngle: number = 0;\r\n\r\n @serializeAsColor3()\r\n public furColor = new Color3(0.44, 0.21, 0.02);\r\n\r\n @serialize()\r\n public furOffset: number = 0.0;\r\n\r\n @serialize()\r\n public furSpacing: number = 12;\r\n\r\n @serializeAsVector3()\r\n public furGravity = new Vector3(0, 0, 0);\r\n\r\n @serialize()\r\n public furSpeed: number = 100;\r\n\r\n @serialize()\r\n public furDensity: number = 20;\r\n\r\n @serialize()\r\n public furOcclusion: number = 0.0;\r\n\r\n public furTexture: DynamicTexture;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n @serialize()\r\n public highLevelFur: boolean = true;\r\n\r\n public _meshes: AbstractMesh[];\r\n\r\n private _furTime: number = 0;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n @serialize()\r\n public get furTime() {\r\n return this._furTime;\r\n }\r\n\r\n public set furTime(furTime: number) {\r\n this._furTime = furTime;\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public updateFur(): void {\r\n for (let i = 1; i < this._meshes.length; i++) {\r\n const offsetFur = <FurMaterial>this._meshes[i].material;\r\n\r\n offsetFur.furLength = this.furLength;\r\n offsetFur.furAngle = this.furAngle;\r\n offsetFur.furGravity = this.furGravity;\r\n offsetFur.furSpacing = this.furSpacing;\r\n offsetFur.furSpeed = this.furSpeed;\r\n offsetFur.furColor = this.furColor;\r\n offsetFur.diffuseTexture = this.diffuseTexture;\r\n offsetFur.furTexture = this.furTexture;\r\n offsetFur.highLevelFur = this.highLevelFur;\r\n offsetFur.furTime = this.furTime;\r\n offsetFur.furDensity = this.furDensity;\r\n }\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FurMaterialDefines();\r\n }\r\n\r\n const defines = <FurMaterialDefines>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 // Textures\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n if (this.heightTexture && engine.getCaps().maxVertexTextureImageUnits) {\r\n if (!this.heightTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.HEIGHTMAP = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n if (this.highLevelFur !== defines.HIGHLEVEL) {\r\n defines.HIGHLEVEL = true;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, true);\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, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fur\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n \"furLength\",\r\n \"furAngle\",\r\n \"furColor\",\r\n \"furOffset\",\r\n \"furGravity\",\r\n \"furTime\",\r\n \"furSpacing\",\r\n \"furDensity\",\r\n \"furOcclusion\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n const samplers = [\"diffuseSampler\", \"heightTexture\", \"furTexture\"];\r\n\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: this.maxSimultaneousLights,\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: this.maxSimultaneousLights },\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 drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FurMaterialDefines>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 // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n if (this._heightTexture) {\r\n this._activeEffect.setTexture(\"heightTexture\", this._heightTexture);\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setFloat(\"furLength\", this.furLength);\r\n this._activeEffect.setFloat(\"furAngle\", this.furAngle);\r\n this._activeEffect.setColor4(\"furColor\", this.furColor, 1.0);\r\n\r\n if (this.highLevelFur) {\r\n this._activeEffect.setVector3(\"furGravity\", this.furGravity);\r\n this._activeEffect.setFloat(\"furOffset\", this.furOffset);\r\n this._activeEffect.setFloat(\"furSpacing\", this.furSpacing);\r\n this._activeEffect.setFloat(\"furDensity\", this.furDensity);\r\n this._activeEffect.setFloat(\"furOcclusion\", this.furOcclusion);\r\n\r\n this._furTime += this.getScene().getEngine().getDeltaTime() / this.furSpeed;\r\n this._activeEffect.setFloat(\"furTime\", this._furTime);\r\n\r\n this._activeEffect.setTexture(\"furTexture\", this.furTexture);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n if (this.heightTexture && this.heightTexture.animations && this.heightTexture.animations.length > 0) {\r\n results.push(this.heightTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._heightTexture) {\r\n activeTextures.push(this._heightTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._heightTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n if (this._meshes) {\r\n for (let i = 1; i < this._meshes.length; i++) {\r\n const mat = this._meshes[i].material;\r\n\r\n if (mat) {\r\n mat.dispose(forceDisposeEffect);\r\n }\r\n this._meshes[i].dispose();\r\n }\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): FurMaterial {\r\n return SerializationHelper.Clone(() => new FurMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FurMaterial\";\r\n\r\n if (this._meshes) {\r\n serializationObject.sourceMeshName = this._meshes[0].name;\r\n serializationObject.quality = this._meshes.length;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FurMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FurMaterial {\r\n const material = SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.sourceMeshName && material.highLevelFur) {\r\n scene.executeWhenReady(() => {\r\n const sourceMesh = <Mesh>scene.getMeshByName(source.sourceMeshName);\r\n if (sourceMesh) {\r\n const furTexture = FurMaterial.GenerateTexture(\"Fur Texture\", scene);\r\n material.furTexture = furTexture;\r\n FurMaterial.FurifyMesh(sourceMesh, source.quality);\r\n }\r\n });\r\n }\r\n\r\n return material;\r\n }\r\n\r\n public static GenerateTexture(name: string, scene: Scene): DynamicTexture {\r\n // Generate fur textures\r\n const texture = new DynamicTexture(\"FurTexture \" + name, 256, scene, true);\r\n const context = texture.getContext();\r\n\r\n for (let i = 0; i < 20000; ++i) {\r\n context.fillStyle = \"rgba(255, \" + Math.floor(Math.random() * 255) + \", \" + Math.floor(Math.random() * 255) + \", 1)\";\r\n context.fillRect(Math.random() * texture.getSize().width, Math.random() * texture.getSize().height, 2, 2);\r\n }\r\n\r\n texture.update(false);\r\n texture.wrapU = Texture.WRAP_ADDRESSMODE;\r\n texture.wrapV = Texture.WRAP_ADDRESSMODE;\r\n\r\n return texture;\r\n }\r\n\r\n // Creates and returns an array of meshes used as shells for the Fur Material\r\n // that can be disposed later in your code\r\n // The quality is in interval [0, 100]\r\n public static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[] {\r\n const meshes = [sourceMesh];\r\n const mat: FurMaterial = <FurMaterial>sourceMesh.material;\r\n let i;\r\n\r\n if (!(mat instanceof FurMaterial)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"The material of the source mesh must be a Fur Material\";\r\n }\r\n\r\n for (i = 1; i < quality; i++) {\r\n const offsetFur = new FurMaterial(mat.name + i, sourceMesh.getScene());\r\n sourceMesh.getScene().materials.pop();\r\n Tags.EnableFor(offsetFur);\r\n Tags.AddTagsTo(offsetFur, \"furShellMaterial\");\r\n\r\n offsetFur.furLength = mat.furLength;\r\n offsetFur.furAngle = mat.furAngle;\r\n offsetFur.furGravity = mat.furGravity;\r\n offsetFur.furSpacing = mat.furSpacing;\r\n offsetFur.furSpeed = mat.furSpeed;\r\n offsetFur.furColor = mat.furColor;\r\n offsetFur.diffuseTexture = mat.diffuseTexture;\r\n offsetFur.furOffset = i / quality;\r\n offsetFur.furTexture = mat.furTexture;\r\n offsetFur.highLevelFur = mat.highLevelFur;\r\n offsetFur.furTime = mat.furTime;\r\n offsetFur.furDensity = mat.furDensity;\r\n\r\n const offsetMesh = sourceMesh.clone(sourceMesh.name + i) as Mesh;\r\n\r\n offsetMesh.material = offsetFur;\r\n offsetMesh.skeleton = sourceMesh.skeleton;\r\n offsetMesh.position = Vector3.Zero();\r\n meshes.push(offsetMesh);\r\n }\r\n\r\n for (i = 1; i < meshes.length; i++) {\r\n meshes[i].parent = sourceMesh;\r\n }\r\n\r\n (<FurMaterial>sourceMesh.material)._meshes = meshes;\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FurMaterial\", FurMaterial);\r\n"]}
1
+ {"version":3,"file":"furMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/fur/furMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC9H,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AACjD,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,IAAI,EAAE,qCAAuB;AAEtC,OAAO,EAAE,OAAO,EAAE,sDAAwC;AAC1D,OAAO,EAAE,cAAc,EAAE,6DAA+C;AAExE,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AACpD,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,gBAAgB,CAAC;AACxB,OAAO,cAAc,CAAC;AACtB,OAAO,EA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AED,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACjC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,UAAU,CAAC;QAClC,CAAC;QAEa,UAAU,CAAC,QAAS,CAAC,OAAO,GAAG,MAAM,CAAC;QAEpD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA/gBW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;oDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;mDAClB;AAG3B;IADP,kBAAkB,CAAC,eAAe,CAAC;mDACA;AAE7B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;kDACnB;AAG3B;IADN,iBAAiB,EAAE;iDACsB;AAGnC;IADN,SAAS,EAAE;8CACiB;AAGtB;IADN,SAAS,EAAE;6CACgB;AAGrB;IADN,iBAAiB,EAAE;6CAC2B;AAGxC;IADN,SAAS,EAAE;8CACmB;AAGxB;IADN,SAAS,EAAE;+CACmB;AAGxB;IADN,kBAAkB,EAAE;+CACoB;AAGlC;IADN,SAAS,EAAE;6CACkB;AAGvB;IADN,SAAS,EAAE;+CACmB;AAGxB;IADN,SAAS,EAAE;iDACsB;AAK1B;IADP,SAAS,CAAC,iBAAiB,CAAC;qDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;oDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;2DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;0DACd;AAG9B;IADN,SAAS,EAAE;iDACwB;AAWpC;IADC,SAAS,EAAE;0CAGX;AAgdL,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport { Tags } from \"core/Misc/tags\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { DynamicTexture } from \"core/Materials/Textures/dynamicTexture\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\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 { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\n\r\nimport \"./fur.fragment\";\r\nimport \"./fur.vertex\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass FurMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = false;\r\n public HEIGHTMAP = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public HIGHLEVEL = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class FurMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsTexture(\"heightTexture\")\r\n private _heightTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public heightTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\r\n\r\n @serialize()\r\n public furLength: number = 1;\r\n\r\n @serialize()\r\n public furAngle: number = 0;\r\n\r\n @serializeAsColor3()\r\n public furColor = new Color3(0.44, 0.21, 0.02);\r\n\r\n @serialize()\r\n public furOffset: number = 0.0;\r\n\r\n @serialize()\r\n public furSpacing: number = 12;\r\n\r\n @serializeAsVector3()\r\n public furGravity = new Vector3(0, 0, 0);\r\n\r\n @serialize()\r\n public furSpeed: number = 100;\r\n\r\n @serialize()\r\n public furDensity: number = 20;\r\n\r\n @serialize()\r\n public furOcclusion: number = 0.0;\r\n\r\n public furTexture: DynamicTexture;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n @serialize()\r\n public highLevelFur: boolean = true;\r\n\r\n public _meshes: AbstractMesh[];\r\n\r\n private _furTime: number = 0;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n @serialize()\r\n public get furTime() {\r\n return this._furTime;\r\n }\r\n\r\n public set furTime(furTime: number) {\r\n this._furTime = furTime;\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n public updateFur(): void {\r\n for (let i = 1; i < this._meshes.length; i++) {\r\n const offsetFur = <FurMaterial>this._meshes[i].material;\r\n\r\n offsetFur.furLength = this.furLength;\r\n offsetFur.furAngle = this.furAngle;\r\n offsetFur.furGravity = this.furGravity;\r\n offsetFur.furSpacing = this.furSpacing;\r\n offsetFur.furSpeed = this.furSpeed;\r\n offsetFur.furColor = this.furColor;\r\n offsetFur.diffuseTexture = this.diffuseTexture;\r\n offsetFur.furTexture = this.furTexture;\r\n offsetFur.highLevelFur = this.highLevelFur;\r\n offsetFur.furTime = this.furTime;\r\n offsetFur.furDensity = this.furDensity;\r\n }\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new FurMaterialDefines();\r\n }\r\n\r\n const defines = <FurMaterialDefines>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 // Textures\r\n if (defines._areTexturesDirty) {\r\n if (scene.texturesEnabled) {\r\n if (this.diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n if (!this.diffuseTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.DIFFUSE = true;\r\n }\r\n }\r\n if (this.heightTexture && engine.getCaps().maxVertexTextureImageUnits) {\r\n if (!this.heightTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.HEIGHTMAP = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // High level\r\n if (this.highLevelFur !== defines.HIGHLEVEL) {\r\n defines.HIGHLEVEL = true;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Misc.\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n // Lights\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, true);\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, this.maxSimultaneousLights);\r\n\r\n if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"fur\";\r\n const join = defines.toString();\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n \"furLength\",\r\n \"furAngle\",\r\n \"furColor\",\r\n \"furOffset\",\r\n \"furGravity\",\r\n \"furTime\",\r\n \"furSpacing\",\r\n \"furDensity\",\r\n \"furOcclusion\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n const samplers = [\"diffuseSampler\", \"heightTexture\", \"furTexture\"];\r\n\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: this.maxSimultaneousLights,\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: this.maxSimultaneousLights },\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 drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <FurMaterialDefines>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 // Bones\r\n BindBonesParameters(mesh, this._activeEffect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Textures\r\n if (this._diffuseTexture && MaterialFlags.DiffuseTextureEnabled) {\r\n this._activeEffect.setTexture(\"diffuseSampler\", this._diffuseTexture);\r\n\r\n this._activeEffect.setFloat2(\"vDiffuseInfos\", this._diffuseTexture.coordinatesIndex, this._diffuseTexture.level);\r\n this._activeEffect.setMatrix(\"diffuseMatrix\", this._diffuseTexture.getTextureMatrix());\r\n }\r\n\r\n if (this._heightTexture) {\r\n this._activeEffect.setTexture(\"heightTexture\", this._heightTexture);\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(this._activeEffect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setFloat(\"furLength\", this.furLength);\r\n this._activeEffect.setFloat(\"furAngle\", this.furAngle);\r\n this._activeEffect.setColor4(\"furColor\", this.furColor, 1.0);\r\n\r\n if (this.highLevelFur) {\r\n this._activeEffect.setVector3(\"furGravity\", this.furGravity);\r\n this._activeEffect.setFloat(\"furOffset\", this.furOffset);\r\n this._activeEffect.setFloat(\"furSpacing\", this.furSpacing);\r\n this._activeEffect.setFloat(\"furDensity\", this.furDensity);\r\n this._activeEffect.setFloat(\"furOcclusion\", this.furOcclusion);\r\n\r\n this._furTime += this.getScene().getEngine().getDeltaTime() / this.furSpeed;\r\n this._activeEffect.setFloat(\"furTime\", this._furTime);\r\n\r\n this._activeEffect.setTexture(\"furTexture\", this.furTexture);\r\n }\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n const results = [];\r\n\r\n if (this.diffuseTexture && this.diffuseTexture.animations && this.diffuseTexture.animations.length > 0) {\r\n results.push(this.diffuseTexture);\r\n }\r\n\r\n if (this.heightTexture && this.heightTexture.animations && this.heightTexture.animations.length > 0) {\r\n results.push(this.heightTexture);\r\n }\r\n\r\n return results;\r\n }\r\n\r\n public override getActiveTextures(): BaseTexture[] {\r\n const activeTextures = super.getActiveTextures();\r\n\r\n if (this._diffuseTexture) {\r\n activeTextures.push(this._diffuseTexture);\r\n }\r\n\r\n if (this._heightTexture) {\r\n activeTextures.push(this._heightTexture);\r\n }\r\n\r\n return activeTextures;\r\n }\r\n\r\n public override hasTexture(texture: BaseTexture): boolean {\r\n if (super.hasTexture(texture)) {\r\n return true;\r\n }\r\n\r\n if (this.diffuseTexture === texture) {\r\n return true;\r\n }\r\n\r\n if (this._heightTexture === texture) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n if (this.diffuseTexture) {\r\n this.diffuseTexture.dispose();\r\n }\r\n\r\n if (this._meshes) {\r\n for (let i = 1; i < this._meshes.length; i++) {\r\n const mat = this._meshes[i].material;\r\n\r\n if (mat) {\r\n mat.dispose(forceDisposeEffect);\r\n }\r\n this._meshes[i].dispose();\r\n }\r\n }\r\n\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): FurMaterial {\r\n return SerializationHelper.Clone(() => new FurMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.FurMaterial\";\r\n\r\n if (this._meshes) {\r\n serializationObject.sourceMeshName = this._meshes[0].name;\r\n serializationObject.quality = this._meshes.length;\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"FurMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): FurMaterial {\r\n const material = SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl);\r\n\r\n if (source.sourceMeshName && material.highLevelFur) {\r\n scene.executeWhenReady(() => {\r\n const sourceMesh = <Mesh>scene.getMeshByName(source.sourceMeshName);\r\n if (sourceMesh) {\r\n const furTexture = FurMaterial.GenerateTexture(\"Fur Texture\", scene);\r\n material.furTexture = furTexture;\r\n FurMaterial.FurifyMesh(sourceMesh, source.quality);\r\n }\r\n });\r\n }\r\n\r\n return material;\r\n }\r\n\r\n public static GenerateTexture(name: string, scene: Scene): DynamicTexture {\r\n // Generate fur textures\r\n const texture = new DynamicTexture(\"FurTexture \" + name, 256, scene, true);\r\n const context = texture.getContext();\r\n\r\n for (let i = 0; i < 20000; ++i) {\r\n context.fillStyle = \"rgba(255, \" + Math.floor(Math.random() * 255) + \", \" + Math.floor(Math.random() * 255) + \", 1)\";\r\n context.fillRect(Math.random() * texture.getSize().width, Math.random() * texture.getSize().height, 2, 2);\r\n }\r\n\r\n texture.update(false);\r\n texture.wrapU = Texture.WRAP_ADDRESSMODE;\r\n texture.wrapV = Texture.WRAP_ADDRESSMODE;\r\n\r\n return texture;\r\n }\r\n\r\n // Creates and returns an array of meshes used as shells for the Fur Material\r\n // that can be disposed later in your code\r\n // The quality is in interval [0, 100]\r\n public static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[] {\r\n const meshes = [sourceMesh];\r\n const mat: FurMaterial = <FurMaterial>sourceMesh.material;\r\n let i;\r\n\r\n if (!(mat instanceof FurMaterial)) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"The material of the source mesh must be a Fur Material\";\r\n }\r\n\r\n for (i = 1; i < quality; i++) {\r\n const offsetFur = new FurMaterial(mat.name + i, sourceMesh.getScene());\r\n sourceMesh.getScene().materials.pop();\r\n Tags.EnableFor(offsetFur);\r\n Tags.AddTagsTo(offsetFur, \"furShellMaterial\");\r\n\r\n offsetFur.furLength = mat.furLength;\r\n offsetFur.furAngle = mat.furAngle;\r\n offsetFur.furGravity = mat.furGravity;\r\n offsetFur.furSpacing = mat.furSpacing;\r\n offsetFur.furSpeed = mat.furSpeed;\r\n offsetFur.furColor = mat.furColor;\r\n offsetFur.diffuseTexture = mat.diffuseTexture;\r\n offsetFur.furOffset = i / quality;\r\n offsetFur.furTexture = mat.furTexture;\r\n offsetFur.highLevelFur = mat.highLevelFur;\r\n offsetFur.furTime = mat.furTime;\r\n offsetFur.furDensity = mat.furDensity;\r\n\r\n const offsetMesh = sourceMesh.clone(sourceMesh.name + i) as Mesh;\r\n\r\n offsetMesh.material = offsetFur;\r\n offsetMesh.skeleton = sourceMesh.skeleton;\r\n offsetMesh.position = Vector3.Zero();\r\n meshes.push(offsetMesh);\r\n }\r\n\r\n for (i = 1; i < meshes.length; i++) {\r\n meshes[i].parent = sourceMesh;\r\n }\r\n\r\n (<FurMaterial>sourceMesh.material)._meshes = meshes;\r\n\r\n return meshes;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.FurMaterial\", FurMaterial);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"gradientMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/gradient/gradientMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AACtF,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAG/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,8DAAgD;AAEjD,MAAM,uBAAwB,SAAQ,eAAe;IAyBjD;QACI,KAAK,EAAE,CAAC;QAzBL,aAAQ,GAAG,KAAK,CAAC;QACjB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,e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\nimport type { Nullable } from \"core/types\";\r\nimport { 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 { Color3 } from \"core/Maths/math.color\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\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 { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nimport \"./gradient.fragment\";\r\nimport \"./gradient.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass GradientMaterialDefines extends MaterialDefines {\r\n public EMISSIVE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class GradientMaterial extends PushMaterial {\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n // The gradient top color, red by default\r\n @serializeAsColor3()\r\n public topColor = new Color3(1, 0, 0);\r\n\r\n @serialize()\r\n public topColorAlpha = 1.0;\r\n\r\n // The gradient top color, blue by default\r\n @serializeAsColor3()\r\n public bottomColor = new Color3(0, 0, 1);\r\n\r\n @serialize()\r\n public bottomColorAlpha = 1.0;\r\n\r\n // Gradient offset\r\n @serialize()\r\n public offset = 0;\r\n\r\n @serialize()\r\n public scale = 1.0;\r\n\r\n @serialize()\r\n public smoothness = 1.0;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0 || this.topColorAlpha < 1.0 || this.bottomColorAlpha < 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GradientMaterialDefines();\r\n }\r\n\r\n const defines = <GradientMaterialDefines>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 PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n defines.EMISSIVE = this._disableLighting;\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, true);\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 if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"gradient\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n \"topColor\",\r\n \"bottomColor\",\r\n \"offset\",\r\n \"smoothness\",\r\n \"scale\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\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 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 drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GradientMaterialDefines>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\r\n // Bones\r\n BindBonesParameters(mesh, effect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setColor4(\"topColor\", this.topColor, this.topColorAlpha);\r\n this._activeEffect.setColor4(\"bottomColor\", this.bottomColor, this.bottomColorAlpha);\r\n this._activeEffect.setFloat(\"offset\", this.offset);\r\n this._activeEffect.setFloat(\"scale\", this.scale);\r\n this._activeEffect.setFloat(\"smoothness\", this.smoothness);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): GradientMaterial {\r\n return SerializationHelper.Clone(() => new GradientMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GradientMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"GradientMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial {\r\n return SerializationHelper.Parse(() => new GradientMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GradientMaterial\", GradientMaterial);\r\n"]}
1
+ {"version":3,"file":"gradientMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/gradient/gradientMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AACtF,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAG/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,6DAA+C;AAC7F,OAAO,EACH,mBAAmB,EACnB,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,uBAAuB,EACvB,qBAAqB,EACrB,8BAA8B,GACjC,8DAAgD;AAEjD,MAAM,uBAAwB,SAAQ,eAAe;IAyBjD;QACI,KAAK,EAAE,CAAC;QAzBL,aAAQ,GAAG,KAAK,CAAC;QACjB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,e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,EAAE;+CACO;AAGZ;IADN,SAAS,EAAE;oDACY;AAGhB;IADP,SAAS,CAAC,iBAAiB,CAAC;0DACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;yDACnB;AAsPpC,aAAa,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 { Color3 } from \"core/Maths/math.color\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\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 { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\n\r\nimport \"./gradient.fragment\";\r\nimport \"./gradient.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport {\r\n BindBonesParameters,\r\n BindFogParameters,\r\n BindLights,\r\n BindLogDepth,\r\n HandleFallbacksForShadows,\r\n PrepareAttributesForBones,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForLights,\r\n PrepareDefinesForMisc,\r\n PrepareUniformsAndSamplersList,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass GradientMaterialDefines extends MaterialDefines {\r\n public EMISSIVE = false;\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public ALPHATEST = false;\r\n public DEPTHPREPASS = false;\r\n public POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public INSTANCESCOLOR = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\nexport class GradientMaterial extends PushMaterial {\r\n @serialize(\"maxSimultaneousLights\")\r\n private _maxSimultaneousLights = 4;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public maxSimultaneousLights: number;\r\n\r\n // The gradient top color, red by default\r\n @serializeAsColor3()\r\n public topColor = new Color3(1, 0, 0);\r\n\r\n @serialize()\r\n public topColorAlpha = 1.0;\r\n\r\n // The gradient top color, blue by default\r\n @serializeAsColor3()\r\n public bottomColor = new Color3(0, 0, 1);\r\n\r\n @serialize()\r\n public bottomColorAlpha = 1.0;\r\n\r\n // Gradient offset\r\n @serialize()\r\n public offset = 0;\r\n\r\n @serialize()\r\n public scale = 1.0;\r\n\r\n @serialize()\r\n public smoothness = 1.0;\r\n\r\n @serialize(\"disableLighting\")\r\n private _disableLighting = false;\r\n @expandToProperty(\"_markAllSubMeshesAsLightsDirty\")\r\n public disableLighting: boolean;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0 || this.topColorAlpha < 1.0 || this.bottomColorAlpha < 1.0;\r\n }\r\n\r\n public override needAlphaTesting(): boolean {\r\n return true;\r\n }\r\n\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n // Methods\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GradientMaterialDefines();\r\n }\r\n\r\n const defines = <GradientMaterialDefines>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 PrepareDefinesForFrameBoundValues(scene, engine, this, defines, useInstances ? true : false);\r\n\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, this._shouldTurnAlphaTestOn(mesh), defines);\r\n\r\n defines._needNormals = PrepareDefinesForLights(scene, mesh, defines, false, this._maxSimultaneousLights, this._disableLighting);\r\n\r\n defines.EMISSIVE = this._disableLighting;\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, false, true);\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 if (defines.NUM_BONE_INFLUENCERS > 0) {\r\n fallbacks.addCPUSkinningFallback(0, mesh);\r\n }\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Legacy browser patch\r\n const shaderName = \"gradient\";\r\n const join = defines.toString();\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"view\",\r\n \"viewProjection\",\r\n \"vEyePosition\",\r\n \"vLightsType\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n \"topColor\",\r\n \"bottomColor\",\r\n \"offset\",\r\n \"smoothness\",\r\n \"scale\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\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 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 drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GradientMaterialDefines>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\r\n // Bones\r\n BindBonesParameters(mesh, effect);\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n\r\n // Point size\r\n if (this.pointsCloud) {\r\n this._activeEffect.setFloat(\"pointSize\", this.pointSize);\r\n }\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n\r\n scene.bindEyePosition(effect);\r\n }\r\n\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines, this.maxSimultaneousLights);\r\n }\r\n\r\n // View\r\n if (scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) {\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n }\r\n\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._activeEffect.setColor4(\"topColor\", this.topColor, this.topColorAlpha);\r\n this._activeEffect.setColor4(\"bottomColor\", this.bottomColor, this.bottomColorAlpha);\r\n this._activeEffect.setFloat(\"offset\", this.offset);\r\n this._activeEffect.setFloat(\"scale\", this.scale);\r\n this._activeEffect.setFloat(\"smoothness\", this.smoothness);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): GradientMaterial {\r\n return SerializationHelper.Clone(() => new GradientMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GradientMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"GradientMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial {\r\n return SerializationHelper.Parse(() => new GradientMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GradientMaterial\", GradientMaterial);\r\n"]}
@@ -1,5 +1,7 @@
1
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
1
2
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
2
3
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
3
5
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
4
6
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
5
7
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
@@ -1,7 +1,9 @@
1
1
  // Do not edit.
2
2
  import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration.js";
3
4
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
4
5
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment.js";
5
7
  import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
6
8
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthFragment.js";
7
9
  import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
@@ -13,6 +15,7 @@ precision highp float;uniform float visibility;uniform vec3 mainColor;uniform ve
13
15
  #ifdef LOGARITHMICDEPTH
14
16
  #extension GL_EXT_frag_depth : enable
15
17
  #endif
18
+ #include<clipPlaneFragmentDeclaration>
16
19
  #include<logDepthDeclaration>
17
20
  #include<fogFragmentDeclaration>
18
21
  #ifdef OPACITY
@@ -37,6 +40,7 @@ float normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0
37
40
  #define CUSTOM_FRAGMENT_DEFINITIONS
38
41
  void main(void) {
39
42
  #define CUSTOM_FRAGMENT_MAIN_BEGIN
43
+ #include<clipPlaneFragment>
40
44
  float gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);
41
45
  #ifdef MAX_LINE
42
46
  float grid=clamp(max(max(x,y),z),0.,1.);
@@ -1 +1 @@
1
- {"version":3,"file":"grid.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/grid.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,uEAAyD;AACzD,0EAA4D;AAC5D,+DAAiD;AACjD,oEAAsD;AACtD,gFAAkE;AAElE,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Dd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"gridPixelShader\";\nconst shader = `#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;varying vec3 vPosition;varying vec3 vNormal;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform sampler2D opacitySampler;uniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {float majorGridFrequency=gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn gridControl.z;}\nfloat getAnisotropicAttenuation(float differentialLength) {const float maxNumberOfLines=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfloat isPointOnLine(float position,float differentialLength) {float fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);float result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result;\n#else\nreturn abs(fractionPartOfPosition)<SQRT2/4. ? 1. : 0.;\n#endif\n}\nfloat contributionOnAxis(float position) {float differentialLength=length(vec2(dFdx(position),dFdy(position)));differentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);float dynamicVisibility=getDynamicVisibility(position);result*=dynamicVisibility;float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);result*=anisotropicAttenuation;return result;}\nfloat normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const gridPixelShader = { name, shader };\n"]}
1
+ {"version":3,"file":"grid.fragment.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/grid.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,gFAAkE;AAClE,uEAAyD;AACzD,0EAA4D;AAC5D,qEAAuD;AACvD,+DAAiD;AACjD,oEAAsD;AACtD,gFAAkE;AAElE,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAC/B,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Dd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"core/Shaders/ShadersInclude/fogFragment\";\nimport \"core/Shaders/ShadersInclude/logDepthFragment\";\nimport \"core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nconst name = \"gridPixelShader\";\nconst shader = `#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;varying vec3 vPosition;varying vec3 vNormal;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform sampler2D opacitySampler;uniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {float majorGridFrequency=gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn gridControl.z;}\nfloat getAnisotropicAttenuation(float differentialLength) {const float maxNumberOfLines=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfloat isPointOnLine(float position,float differentialLength) {float fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);float result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result;\n#else\nreturn abs(fractionPartOfPosition)<SQRT2/4. ? 1. : 0.;\n#endif\n}\nfloat contributionOnAxis(float position) {float differentialLength=length(vec2(dFdx(position),dFdy(position)));differentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);float dynamicVisibility=getDynamicVisibility(position);result*=dynamicVisibility;float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);result*=anisotropicAttenuation;return result;}\nfloat normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const gridPixelShader = { name, shader };\n"]}
@@ -1,8 +1,10 @@
1
1
  import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
2
2
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
3
3
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
4
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
4
5
  import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
5
6
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
7
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
6
8
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
7
9
  /** @internal */
8
10
  export declare const gridVertexShader: {
@@ -3,8 +3,10 @@ import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
3
3
  import "@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration.js";
4
4
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthDeclaration.js";
5
5
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration.js";
6
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration.js";
6
7
  import "@babylonjs/core/Shaders/ShadersInclude/instancesVertex.js";
7
8
  import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
9
+ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
8
10
  import "@babylonjs/core/Shaders/ShadersInclude/logDepthVertex.js";
9
11
  const name = "gridVertexShader";
10
12
  const shader = `precision highp float;attribute vec3 position;attribute vec3 normal;
@@ -21,6 +23,7 @@ uniform mat4 projection;uniform mat4 view;varying vec3 vPosition;varying vec3 vN
21
23
  #ifdef OPACITY
22
24
  varying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;
23
25
  #endif
26
+ #include<clipPlaneVertexDeclaration>
24
27
  #define CUSTOM_VERTEX_DEFINITIONS
25
28
  void main(void) {
26
29
  #define CUSTOM_VERTEX_MAIN_BEGIN
@@ -40,6 +43,7 @@ if (vOpacityInfos.x==0.)
40
43
  else
41
44
  {vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}
42
45
  #endif
46
+ #include<clipPlaneVertex>
43
47
  #include<logDepthVertex>
44
48
  vPosition=position;vNormal=normal;
45
49
  #define CUSTOM_VERTEX_MAIN_END
@@ -1 +1 @@
1
- {"version":3,"file":"grid.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/grid.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,wEAA0D;AAC1D,uEAAyD;AACzD,wEAA0D;AAC1D,mEAAqD;AACrD,6DAA+C;AAC/C,kEAAoD;AAEpD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/logDepthVertex\";\n\nconst name = \"gridVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\nuniform mat4 projection;uniform mat4 view;varying vec3 vPosition;varying vec3 vNormal;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;gl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));}\nelse\n{vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}\n#endif \n#include<logDepthVertex>\nvPosition=position;vNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const gridVertexShader = { name, shader };\n"]}
1
+ {"version":3,"file":"grid.vertex.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/grid.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AACvD,wEAA0D;AAC1D,uEAAyD;AACzD,wEAA0D;AAC1D,8EAAgE;AAChE,mEAAqD;AACrD,6DAA+C;AAC/C,mEAAqD;AACrD,kEAAoD;AAEpD,MAAM,IAAI,GAAG,kBAAkB,CAAC;AAChC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\nimport \"core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"core/Shaders/ShadersInclude/logDepthDeclaration\";\nimport \"core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"core/Shaders/ShadersInclude/instancesVertex\";\nimport \"core/Shaders/ShadersInclude/fogVertex\";\nimport \"core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"core/Shaders/ShadersInclude/logDepthVertex\";\n\nconst name = \"gridVertexShader\";\nconst shader = `precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\nuniform mat4 projection;uniform mat4 view;varying vec3 vPosition;varying vec3 vNormal;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;gl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));}\nelse\n{vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}\n#endif \n#include<clipPlaneVertex>\n#include<logDepthVertex>\nvPosition=position;vNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @internal */\nexport const gridVertexShader = { name, shader };\n"]}
@@ -12,9 +12,16 @@ import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
12
12
  import "./grid.fragment.js";
13
13
  import "./grid.vertex.js";
14
14
  import { BindFogParameters, BindLogDepth, PrepareAttributesForInstances, PrepareDefinesForAttributes, PrepareDefinesForFrameBoundValues, PrepareDefinesForMisc, } from "@babylonjs/core/Materials/materialHelper.functions.js";
15
+ import { addClipPlaneUniforms, bindClipPlane } from "@babylonjs/core/Materials/clipPlaneMaterialHelper.js";
15
16
  class GridMaterialDefines extends MaterialDefines {
16
17
  constructor() {
17
18
  super();
19
+ this.CLIPPLANE = false;
20
+ this.CLIPPLANE2 = false;
21
+ this.CLIPPLANE3 = false;
22
+ this.CLIPPLANE4 = false;
23
+ this.CLIPPLANE5 = false;
24
+ this.CLIPPLANE6 = false;
18
25
  this.OPACITY = false;
19
26
  this.ANTIALIAS = false;
20
27
  this.TRANSPARENT = false;
@@ -158,11 +165,7 @@ export class GridMaterial extends PushMaterial {
158
165
  }
159
166
  defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;
160
167
  PrepareAttributesForInstances(attribs, defines);
161
- // Defines
162
- const join = defines.toString();
163
- subMesh.setEffect(scene
164
- .getEngine()
165
- .createEffect("grid", attribs, [
168
+ const uniforms = [
166
169
  "projection",
167
170
  "mainColor",
168
171
  "lineColor",
@@ -176,7 +179,11 @@ export class GridMaterial extends PushMaterial {
176
179
  "vOpacityInfos",
177
180
  "visibility",
178
181
  "logarithmicDepthConstant",
179
- ], ["opacitySampler"], join, undefined, this.onCompiled, this.onError), defines, this._materialContext);
182
+ ];
183
+ // Defines
184
+ const join = defines.toString();
185
+ addClipPlaneUniforms(uniforms);
186
+ subMesh.setEffect(scene.getEngine().createEffect("grid", attribs, uniforms, ["opacitySampler"], join, undefined, this.onCompiled, this.onError), defines, this._materialContext);
180
187
  }
181
188
  if (!subMesh.effect || !subMesh.effect.isReady()) {
182
189
  return false;
@@ -219,6 +226,8 @@ export class GridMaterial extends PushMaterial {
219
226
  this._activeEffect.setFloat2("vOpacityInfos", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);
220
227
  this._activeEffect.setMatrix("opacityMatrix", this._opacityTexture.getTextureMatrix());
221
228
  }
229
+ // Clip plane
230
+ bindClipPlane(effect, this, scene);
222
231
  // Log. depth
223
232
  if (this._useLogarithmicDepth) {
224
233
  BindLogDepth(defines, effect, scene);
@@ -1 +1 @@
1
- {"version":3,"file":"gridMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/gridMaterial.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,2CAA6B;AAC9H,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,6CAA+B;AAC1D,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,aAAa,EAAE,mDAAqC;AAC7D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAKnD,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,iBAAiB,CAAC;AACzB,OAAO,eAAe,CAAC;AACvB,OAAO,EACH,iBAAiB,EACjB,YAAY,EACZ,6BAA6B,EAC7B,2BAA2B,EAC3B,iCAAiC,EACjC,qBAAqB,GACxB,8DAAgD;AAEjD,MAAM,mBAAoB,SAAQ,eAAe;IAe7C;QACI,KAAK,EAAE,CAAC;QAfL,YAAO,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mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY;QACxB,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACJ;AAjSU;IADN,iBAAiB,EAAE;+CACc;AAM3B;IADN,iBAAiB,EAAE;+CACa;AAM1B;IADN,SAAS,EAAE;+CACW;AAMhB;IADN,kBAAkB,EAAE;gDACc;AAM5B;IADN,SAAS,EAAE;wDACmB;AAMxB;IADN,SAAS,EAAE;yDACsB;AAM3B;IADN,SAAS,EAAE;6CACS;AAMd;IADN,SAAS,EAAE;+CACY;AAMjB;IADN,SAAS,EAAE;sDACoB;AAMzB;IADN,SAAS,EAAE;gDACc;AAGlB;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAK9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AAqOvC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector4, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\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\n\r\nimport \"./grid.fragment\";\r\nimport \"./grid.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n} from \"core/Materials/materialHelper.functions\";\r\n\r\nclass GridMaterialDefines extends MaterialDefines {\r\n public OPACITY = false;\r\n public ANTIALIAS = false;\r\n public TRANSPARENT = false;\r\n public FOG = false;\r\n public PREMULTIPLYALPHA = false;\r\n public MAX_LINE = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public INSTANCES = false;\r\n public THIN_INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * The grid materials allows you to wrap any shape with a grid.\r\n * Colors are customizable.\r\n */\r\nexport class GridMaterial extends PushMaterial {\r\n /**\r\n * Main color of the grid (e.g. between lines)\r\n */\r\n @serializeAsColor3()\r\n public mainColor = Color3.Black();\r\n\r\n /**\r\n * Color of the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public lineColor = Color3.Teal();\r\n\r\n /**\r\n * The scale of the grid compared to unit.\r\n */\r\n @serialize()\r\n public gridRatio = 1.0;\r\n\r\n /**\r\n * Allows setting an offset for the grid lines.\r\n */\r\n @serializeAsVector3()\r\n public gridOffset = Vector3.Zero();\r\n\r\n /**\r\n * The frequency of thicker lines.\r\n */\r\n @serialize()\r\n public majorUnitFrequency = 10;\r\n\r\n /**\r\n * The visibility of minor units in the grid.\r\n */\r\n @serialize()\r\n public minorUnitVisibility = 0.33;\r\n\r\n /**\r\n * The grid opacity outside of the lines.\r\n */\r\n @serialize()\r\n public opacity = 1.0;\r\n\r\n /**\r\n * Whether to antialias the grid\r\n */\r\n @serialize()\r\n public antialias = true;\r\n\r\n /**\r\n * Determine RBG output is premultiplied by alpha value.\r\n */\r\n @serialize()\r\n public preMultiplyAlpha = false;\r\n\r\n /**\r\n * Determines if the max line value will be used instead of the sum wherever grid lines intersect.\r\n */\r\n @serialize()\r\n public useMaxLine = false;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: BaseTexture;\r\n /**\r\n * Texture to define opacity of the grid\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: BaseTexture;\r\n\r\n private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);\r\n\r\n /**\r\n * constructor\r\n * @param name The name given to the material in order to identify it afterwards.\r\n * @param scene The scene the material is used in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * @returns whether or not the grid requires alpha blending.\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return this.opacity < 1.0 || (this._opacityTexture && this._opacityTexture.isReady());\r\n }\r\n\r\n public override needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return mesh.visibility < 1.0 || this.needAlphaBlending();\r\n }\r\n\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GridMaterialDefines();\r\n }\r\n\r\n const defines = <GridMaterialDefines>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 if (defines.TRANSPARENT !== this.opacity < 1.0) {\r\n defines.TRANSPARENT = !defines.TRANSPARENT;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.PREMULTIPLYALPHA != this.preMultiplyAlpha) {\r\n defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.MAX_LINE !== this.useMaxLine) {\r\n defines.MAX_LINE = !defines.MAX_LINE;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.ANTIALIAS !== this.antialias) {\r\n defines.ANTIALIAS = !defines.ANTIALIAS;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.OPACITY = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, false, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, scene.getEngine(), this, defines, !!useInstances);\r\n\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 PrepareDefinesForAttributes(mesh, defines, false, false);\r\n const attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n // Defines\r\n const join = defines.toString();\r\n subMesh.setEffect(\r\n scene\r\n .getEngine()\r\n .createEffect(\r\n \"grid\",\r\n attribs,\r\n [\r\n \"projection\",\r\n \"mainColor\",\r\n \"lineColor\",\r\n \"gridControl\",\r\n \"gridOffset\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"world\",\r\n \"view\",\r\n \"opacityMatrix\",\r\n \"vOpacityInfos\",\r\n \"visibility\",\r\n \"logarithmicDepthConstant\",\r\n ],\r\n [\"opacitySampler\"],\r\n join,\r\n undefined,\r\n this.onCompiled,\r\n this.onError\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 drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GridMaterialDefines>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 this._activeEffect.setFloat(\"visibility\", mesh.visibility);\r\n\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCE) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"projection\", scene.getProjectionMatrix());\r\n\r\n // Uniforms\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor3(\"mainColor\", this.mainColor);\r\n this._activeEffect.setColor3(\"lineColor\", this.lineColor);\r\n\r\n this._activeEffect.setVector3(\"gridOffset\", this.gridOffset);\r\n\r\n this._gridControl.x = this.gridRatio;\r\n this._gridControl.y = Math.round(this.majorUnitFrequency);\r\n this._gridControl.z = this.minorUnitVisibility;\r\n this._gridControl.w = this.opacity;\r\n this._activeEffect.setVector4(\"gridControl\", this._gridControl);\r\n\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n this._activeEffect.setFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n this._activeEffect.setMatrix(\"opacityMatrix\", this._opacityTexture.getTextureMatrix());\r\n }\r\n\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n }\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Dispose the material and its associated resources.\r\n * @param forceDisposeEffect will also dispose the used effect when true\r\n */\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): GridMaterial {\r\n return SerializationHelper.Clone(() => new GridMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GridMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"GridMaterial\";\r\n }\r\n\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {\r\n return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GridMaterial\", GridMaterial);\r\n"]}
1
+ {"version":3,"file":"gridMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/grid/gridMaterial.ts"],"names":[],"mappings":";AAAA,yDAAyD;AACzD,OAAO,EAAE,kBAAk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Q,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAC1F,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,sBAAsB,CAAC;QACxD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY;QACxB,OAAO,cAAc,CAAC;IAC1B,CAAC;IAEM,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACzG,CAAC;CACJ;AA1RU;IADN,iBAAiB,EAAE;+CACc;AAM3B;IADN,iBAAiB,EAAE;+CACa;AAM1B;IADN,SAAS,EAAE;+CACW;AAMhB;IADN,kBAAkB,EAAE;gDACc;AAM5B;IADN,SAAS,EAAE;wDACmB;AAMxB;IADN,SAAS,EAAE;yDACsB;AAM3B;IADN,SAAS,EAAE;6CACS;AAMd;IADN,SAAS,EAAE;+CACY;AAMjB;IADN,SAAS,EAAE;sDACoB;AAMzB;IADN,SAAS,EAAE;gDACc;AAGlB;IADP,kBAAkB,CAAC,gBAAgB,CAAC;qDACA;AAK9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;oDAClB;AA8NvC,aAAa,CAAC,sBAAsB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { serializeAsTexture, serialize, expandToProperty, serializeAsColor3, serializeAsVector3 } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector4, Vector3 } from \"core/Maths/math.vector\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\r\nimport { PushMaterial } from \"core/Materials/pushMaterial\";\r\nimport { MaterialFlags } from \"core/Materials/materialFlags\";\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\n\r\nimport \"./grid.fragment\";\r\nimport \"./grid.vertex\";\r\nimport {\r\n BindFogParameters,\r\n BindLogDepth,\r\n PrepareAttributesForInstances,\r\n PrepareDefinesForAttributes,\r\n PrepareDefinesForFrameBoundValues,\r\n PrepareDefinesForMisc,\r\n} from \"core/Materials/materialHelper.functions\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\n\r\nclass GridMaterialDefines extends MaterialDefines {\r\n public CLIPPLANE = false;\r\n public CLIPPLANE2 = false;\r\n public CLIPPLANE3 = false;\r\n public CLIPPLANE4 = false;\r\n public CLIPPLANE5 = false;\r\n public CLIPPLANE6 = false;\r\n public OPACITY = false;\r\n public ANTIALIAS = false;\r\n public TRANSPARENT = false;\r\n public FOG = false;\r\n public PREMULTIPLYALPHA = false;\r\n public MAX_LINE = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public INSTANCES = false;\r\n public THIN_INSTANCES = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public LOGARITHMICDEPTH = false;\r\n\r\n constructor() {\r\n super();\r\n this.rebuild();\r\n }\r\n}\r\n\r\n/**\r\n * The grid materials allows you to wrap any shape with a grid.\r\n * Colors are customizable.\r\n */\r\nexport class GridMaterial extends PushMaterial {\r\n /**\r\n * Main color of the grid (e.g. between lines)\r\n */\r\n @serializeAsColor3()\r\n public mainColor = Color3.Black();\r\n\r\n /**\r\n * Color of the grid lines.\r\n */\r\n @serializeAsColor3()\r\n public lineColor = Color3.Teal();\r\n\r\n /**\r\n * The scale of the grid compared to unit.\r\n */\r\n @serialize()\r\n public gridRatio = 1.0;\r\n\r\n /**\r\n * Allows setting an offset for the grid lines.\r\n */\r\n @serializeAsVector3()\r\n public gridOffset = Vector3.Zero();\r\n\r\n /**\r\n * The frequency of thicker lines.\r\n */\r\n @serialize()\r\n public majorUnitFrequency = 10;\r\n\r\n /**\r\n * The visibility of minor units in the grid.\r\n */\r\n @serialize()\r\n public minorUnitVisibility = 0.33;\r\n\r\n /**\r\n * The grid opacity outside of the lines.\r\n */\r\n @serialize()\r\n public opacity = 1.0;\r\n\r\n /**\r\n * Whether to antialias the grid\r\n */\r\n @serialize()\r\n public antialias = true;\r\n\r\n /**\r\n * Determine RBG output is premultiplied by alpha value.\r\n */\r\n @serialize()\r\n public preMultiplyAlpha = false;\r\n\r\n /**\r\n * Determines if the max line value will be used instead of the sum wherever grid lines intersect.\r\n */\r\n @serialize()\r\n public useMaxLine = false;\r\n\r\n @serializeAsTexture(\"opacityTexture\")\r\n private _opacityTexture: BaseTexture;\r\n /**\r\n * Texture to define opacity of the grid\r\n */\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public opacityTexture: BaseTexture;\r\n\r\n private _gridControl: Vector4 = new Vector4(this.gridRatio, this.majorUnitFrequency, this.minorUnitVisibility, this.opacity);\r\n\r\n /**\r\n * constructor\r\n * @param name The name given to the material in order to identify it afterwards.\r\n * @param scene The scene the material is used in.\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * @returns whether or not the grid requires alpha blending.\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return this.opacity < 1.0 || (this._opacityTexture && this._opacityTexture.isReady());\r\n }\r\n\r\n public override needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return mesh.visibility < 1.0 || this.needAlphaBlending();\r\n }\r\n\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady && drawWrapper._wasPreviouslyUsingInstances === useInstances) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new GridMaterialDefines();\r\n }\r\n\r\n const defines = <GridMaterialDefines>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 if (defines.TRANSPARENT !== this.opacity < 1.0) {\r\n defines.TRANSPARENT = !defines.TRANSPARENT;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.PREMULTIPLYALPHA != this.preMultiplyAlpha) {\r\n defines.PREMULTIPLYALPHA = !defines.PREMULTIPLYALPHA;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.MAX_LINE !== this.useMaxLine) {\r\n defines.MAX_LINE = !defines.MAX_LINE;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n if (defines.ANTIALIAS !== this.antialias) {\r\n defines.ANTIALIAS = !defines.ANTIALIAS;\r\n defines.markAsUnprocessed();\r\n }\r\n\r\n // Textures\r\n if (defines._areTexturesDirty) {\r\n defines._needUVs = false;\r\n if (scene.texturesEnabled) {\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n if (!this._opacityTexture.isReady()) {\r\n return false;\r\n } else {\r\n defines._needUVs = true;\r\n defines.OPACITY = true;\r\n }\r\n }\r\n }\r\n }\r\n\r\n PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, false, this.fogEnabled, false, defines);\r\n\r\n // Values that need to be evaluated on every frame\r\n PrepareDefinesForFrameBoundValues(scene, scene.getEngine(), this, defines, !!useInstances);\r\n\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 PrepareDefinesForAttributes(mesh, defines, false, false);\r\n const attribs = [VertexBuffer.PositionKind, VertexBuffer.NormalKind];\r\n\r\n if (defines.UV1) {\r\n attribs.push(VertexBuffer.UVKind);\r\n }\r\n if (defines.UV2) {\r\n attribs.push(VertexBuffer.UV2Kind);\r\n }\r\n\r\n defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const uniforms = [\r\n \"projection\",\r\n \"mainColor\",\r\n \"lineColor\",\r\n \"gridControl\",\r\n \"gridOffset\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"world\",\r\n \"view\",\r\n \"opacityMatrix\",\r\n \"vOpacityInfos\",\r\n \"visibility\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n // Defines\r\n const join = defines.toString();\r\n addClipPlaneUniforms(uniforms);\r\n subMesh.setEffect(\r\n scene.getEngine().createEffect(\"grid\", attribs, uniforms, [\"opacitySampler\"], join, undefined, this.onCompiled, this.onError),\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 drawWrapper._wasPreviouslyUsingInstances = !!useInstances;\r\n\r\n return true;\r\n }\r\n\r\n public override bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void {\r\n const scene = this.getScene();\r\n\r\n const defines = <GridMaterialDefines>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 this._activeEffect.setFloat(\"visibility\", mesh.visibility);\r\n\r\n // Matrices\r\n if (!defines.INSTANCES || defines.THIN_INSTANCE) {\r\n this.bindOnlyWorldMatrix(world);\r\n }\r\n this._activeEffect.setMatrix(\"view\", scene.getViewMatrix());\r\n this._activeEffect.setMatrix(\"projection\", scene.getProjectionMatrix());\r\n\r\n // Uniforms\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n this._activeEffect.setColor3(\"mainColor\", this.mainColor);\r\n this._activeEffect.setColor3(\"lineColor\", this.lineColor);\r\n\r\n this._activeEffect.setVector3(\"gridOffset\", this.gridOffset);\r\n\r\n this._gridControl.x = this.gridRatio;\r\n this._gridControl.y = Math.round(this.majorUnitFrequency);\r\n this._gridControl.z = this.minorUnitVisibility;\r\n this._gridControl.w = this.opacity;\r\n this._activeEffect.setVector4(\"gridControl\", this._gridControl);\r\n\r\n if (this._opacityTexture && MaterialFlags.OpacityTextureEnabled) {\r\n this._activeEffect.setTexture(\"opacitySampler\", this._opacityTexture);\r\n this._activeEffect.setFloat2(\"vOpacityInfos\", this._opacityTexture.coordinatesIndex, this._opacityTexture.level);\r\n this._activeEffect.setMatrix(\"opacityMatrix\", this._opacityTexture.getTextureMatrix());\r\n }\r\n\r\n // Clip plane\r\n bindClipPlane(effect, this, scene);\r\n // Log. depth\r\n if (this._useLogarithmicDepth) {\r\n BindLogDepth(defines, effect, scene);\r\n }\r\n }\r\n // Fog\r\n BindFogParameters(scene, mesh, this._activeEffect);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Dispose the material and its associated resources.\r\n * @param forceDisposeEffect will also dispose the used effect when true\r\n */\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): GridMaterial {\r\n return SerializationHelper.Clone(() => new GridMaterial(name, this.getScene()), this);\r\n }\r\n\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.GridMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"GridMaterial\";\r\n }\r\n\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {\r\n return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.GridMaterial\", GridMaterial);\r\n"]}