@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":"normalMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normalMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC1G,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAI/C,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;AAEpD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,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,qBAAsB,SAAQ,eAAe;IAgE/C;QACI,KAAK,EAAE,CAAC;QAhEL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,cAAS,GAAG,KAAK,CAAC;QAClB,iBAAY,GAAG,KAAK,CAAC;QACrB,cAAS,GAAG,KAAK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QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AAtTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;uDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDAClB;AAG5B;IADN,iBAAiB,EAAE;oDACsB;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;wDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;uDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;8DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;6DACd;AAySzC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 { 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 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\n\r\nimport \"./normal.fragment\";\r\nimport \"./normal.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 NormalMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public LIGHTING = 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 NormalMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\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 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;\r\n }\r\n\r\n public override needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending() || mesh.visibility < 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 // 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 NormalMaterialDefines();\r\n }\r\n\r\n const defines = <NormalMaterialDefines>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 defines._needUVs = false;\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 }\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 = true;\r\n 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 defines.LIGHTING = !this._disableLighting;\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);\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"normal\";\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 \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\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 = <NormalMaterialDefines>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 // 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 this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines);\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._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 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 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 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 super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): NormalMaterial {\r\n return SerializationHelper.Clone(() => new NormalMaterial(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.NormalMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"NormalMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {\r\n return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NormalMaterial\", NormalMaterial);\r\n"]}
1
+ {"version":3,"file":"normalMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/normal/normalMaterial.ts"],"names":[],"mappings":";AAEA,OA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CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAC1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY;QACxB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACH,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AAtTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;uDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDAClB;AAG5B;IADN,iBAAiB,EAAE;oDACsB;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;wDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;uDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;8DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;6DACd;AAySzC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 { 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 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\n\r\nimport \"./normal.fragment\";\r\nimport \"./normal.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 NormalMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 LIGHT0 = false;\r\n public LIGHT1 = false;\r\n public LIGHT2 = false;\r\n public LIGHT3 = false;\r\n public SPOTLIGHT0 = false;\r\n public SPOTLIGHT1 = false;\r\n public SPOTLIGHT2 = false;\r\n public SPOTLIGHT3 = false;\r\n public HEMILIGHT0 = false;\r\n public HEMILIGHT1 = false;\r\n public HEMILIGHT2 = false;\r\n public HEMILIGHT3 = false;\r\n public DIRLIGHT0 = false;\r\n public DIRLIGHT1 = false;\r\n public DIRLIGHT2 = false;\r\n public DIRLIGHT3 = false;\r\n public POINTLIGHT0 = false;\r\n public POINTLIGHT1 = false;\r\n public POINTLIGHT2 = false;\r\n public POINTLIGHT3 = false;\r\n public SHADOW0 = false;\r\n public SHADOW1 = false;\r\n public SHADOW2 = false;\r\n public SHADOW3 = false;\r\n public SHADOWS = false;\r\n public SHADOWESM0 = false;\r\n public SHADOWESM1 = false;\r\n public SHADOWESM2 = false;\r\n public SHADOWESM3 = false;\r\n public SHADOWPOISSON0 = false;\r\n public SHADOWPOISSON1 = false;\r\n public SHADOWPOISSON2 = false;\r\n public SHADOWPOISSON3 = false;\r\n public SHADOWPCF0 = false;\r\n public SHADOWPCF1 = false;\r\n public SHADOWPCF2 = false;\r\n public SHADOWPCF3 = false;\r\n public SHADOWPCSS0 = false;\r\n public SHADOWPCSS1 = false;\r\n public SHADOWPCSS2 = false;\r\n public SHADOWPCSS3 = false;\r\n public NORMAL = false;\r\n public UV1 = false;\r\n public UV2 = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public INSTANCES = false;\r\n public LIGHTING = 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 NormalMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3()\r\n public diffuseColor = new Color3(1, 1, 1);\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 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;\r\n }\r\n\r\n public override needAlphaBlendingForMesh(mesh: AbstractMesh): boolean {\r\n return this.needAlphaBlending() || mesh.visibility < 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 // 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 NormalMaterialDefines();\r\n }\r\n\r\n const defines = <NormalMaterialDefines>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 defines._needUVs = false;\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 }\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 = true;\r\n 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 defines.LIGHTING = !this._disableLighting;\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);\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"normal\";\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 \"vDiffuseColor\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"vDiffuseInfos\",\r\n \"mBones\",\r\n \"diffuseMatrix\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\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 = <NormalMaterialDefines>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 // 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 this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\r\n if (scene.lightsEnabled && !this.disableLighting) {\r\n BindLights(scene, mesh, this._activeEffect, defines);\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._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 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 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 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 super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): NormalMaterial {\r\n return SerializationHelper.Clone(() => new NormalMaterial(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.NormalMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"NormalMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {\r\n return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.NormalMaterial\", NormalMaterial);\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/materials",
3
- "version": "7.34.4",
3
+ "version": "7.35.1",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "postcompile": "build-tools -c add-js-to-es6"
19
19
  },
20
20
  "devDependencies": {
21
- "@babylonjs/core": "^7.34.4",
21
+ "@babylonjs/core": "^7.35.1",
22
22
  "@dev/build-tools": "^1.0.0",
23
23
  "@lts/materials": "^1.0.0"
24
24
  },
@@ -1 +1 @@
1
- {"version":3,"file":"shadowOnlyMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/shadowOnly/shadowOnlyMaterial.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAI/C,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,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,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,qDAAuC;AAEjE,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,yBAA0B,S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CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAEnD,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAEe,KAAK,CAAC,IAAY;QAC9B,OAAO,mBAAmB,CAAC,KAAK,CAAqB,GAAG,EAAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACpH,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,4BAA4B,CAAC;QAC9D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAED,UAAU;IACH,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/G,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\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 { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IShadowLight } from \"core/Lights/shadowLight\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\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 \"./shadowOnly.fragment\";\r\nimport \"./shadowOnly.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport type { CascadedShadowGenerator } from \"core/Lights/Shadows/cascadedShadowGenerator\";\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 ShadowOnlyMaterialDefines 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 POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public 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\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _activeLight: IShadowLight;\r\n private _needAlphaBlending = true;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public shadowColor = Color3.Black();\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this._needAlphaBlending;\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 get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n private _getFirstShadowLightForMesh(mesh: AbstractMesh): Nullable<IShadowLight> {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n return light as IShadowLight;\r\n }\r\n }\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 ShadowOnlyMaterialDefines();\r\n }\r\n\r\n const defines = <ShadowOnlyMaterialDefines>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 // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n const lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\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, 1);\r\n\r\n const shadowGenerator = this._getFirstShadowLightForMesh(mesh)?.getShadowGenerator();\r\n\r\n this._needAlphaBlending = true;\r\n\r\n if (shadowGenerator && (shadowGenerator as any).getClassName && (shadowGenerator as any).getClassName() === \"CascadedShadowGenerator\") {\r\n const csg = shadowGenerator as CascadedShadowGenerator;\r\n\r\n this._needAlphaBlending = !csg.autoCalcDepthBounds;\r\n }\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, 1);\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"shadowOnly\";\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 \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"alpha\",\r\n \"shadowColor\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers: string[] = [];\r\n\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1,\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: 1 },\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 = <ShadowOnlyMaterialDefines>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 // 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 this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\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 // Lights\r\n if (scene.lightsEnabled) {\r\n BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n\r\n const light = this._getFirstShadowLightForMesh(mesh);\r\n\r\n if (light) {\r\n // Make sure the uniforms for this light will be rebound for other materials using this light when rendering the current frame.\r\n // Indeed, there is an optimization in Light that binds the light uniforms only once per frame for a given light (if using ubo).\r\n // Doing this way assumes that all uses of this light are the same, meaning all parameters passed to Light._bindLlight\r\n // are the same, notably useSpecular. However, isReadyForSubMesh (see above) is passing false for this parameter, which may not be\r\n // the value the other materials may pass.\r\n light._renderId = -1;\r\n }\r\n }\r\n\r\n // View\r\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || defines[\"SHADOWCSM0\"]) {\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._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone<ShadowOnlyMaterial>(() => new ShadowOnlyMaterial(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.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ShadowOnlyMaterial\", ShadowOnlyMaterial);\r\n"]}
1
+ {"version":3,"file":"shadowOnlyMaterial.js","sourceRoot":"","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AAE,CAAC,IAAI,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACpH,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,4BAA4B,CAAC;QAC9D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY;QACxB,OAAO,oBAAoB,CAAC;IAChC,CAAC;IAED,UAAU;IACH,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC/G,CAAC;CACJ;AAED,aAAa,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\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 { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { IShadowLight } from \"core/Lights/shadowLight\";\r\nimport type { IEffectCreationOptions } from \"core/Materials/effect\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\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 \"./shadowOnly.fragment\";\r\nimport \"./shadowOnly.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport type { CascadedShadowGenerator } from \"core/Lights/Shadows/cascadedShadowGenerator\";\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 ShadowOnlyMaterialDefines 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 POINTSIZE = false;\r\n public FOG = false;\r\n public NORMAL = false;\r\n public NUM_BONE_INFLUENCERS = 0;\r\n public BonesPerMesh = 0;\r\n public 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\nexport class ShadowOnlyMaterial extends PushMaterial {\r\n private _activeLight: IShadowLight;\r\n private _needAlphaBlending = true;\r\n\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n public shadowColor = Color3.Black();\r\n\r\n public override needAlphaBlending(): boolean {\r\n return this._needAlphaBlending;\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 get activeLight(): IShadowLight {\r\n return this._activeLight;\r\n }\r\n\r\n public set activeLight(light: IShadowLight) {\r\n this._activeLight = light;\r\n }\r\n\r\n private _getFirstShadowLightForMesh(mesh: AbstractMesh): Nullable<IShadowLight> {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n return light as IShadowLight;\r\n }\r\n }\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 ShadowOnlyMaterialDefines();\r\n }\r\n\r\n const defines = <ShadowOnlyMaterialDefines>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 // Ensure that active light is the first shadow light\r\n if (this._activeLight) {\r\n for (const light of mesh.lightSources) {\r\n if (light.shadowEnabled) {\r\n if (this._activeLight === light) {\r\n break; // We are good\r\n }\r\n\r\n const lightPosition = mesh.lightSources.indexOf(this._activeLight);\r\n\r\n if (lightPosition !== -1) {\r\n mesh.lightSources.splice(lightPosition, 1);\r\n mesh.lightSources.splice(0, 0, this._activeLight);\r\n }\r\n break;\r\n }\r\n }\r\n }\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, 1);\r\n\r\n const shadowGenerator = this._getFirstShadowLightForMesh(mesh)?.getShadowGenerator();\r\n\r\n this._needAlphaBlending = true;\r\n\r\n if (shadowGenerator && (shadowGenerator as any).getClassName && (shadowGenerator as any).getClassName() === \"CascadedShadowGenerator\") {\r\n const csg = shadowGenerator as CascadedShadowGenerator;\r\n\r\n this._needAlphaBlending = !csg.autoCalcDepthBounds;\r\n }\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, 1);\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 PrepareAttributesForBones(attribs, mesh, defines, fallbacks);\r\n PrepareAttributesForInstances(attribs, defines);\r\n\r\n const shaderName = \"shadowOnly\";\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 \"vFogInfos\",\r\n \"vFogColor\",\r\n \"pointSize\",\r\n \"alpha\",\r\n \"shadowColor\",\r\n \"mBones\",\r\n \"logarithmicDepthConstant\",\r\n ];\r\n const samplers: string[] = [];\r\n\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\r\n PrepareUniformsAndSamplersList(<IEffectCreationOptions>{\r\n uniformsNames: uniforms,\r\n uniformBuffersNames: uniformBuffers,\r\n samplers: samplers,\r\n defines: defines,\r\n maxSimultaneousLights: 1,\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: 1 },\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 = <ShadowOnlyMaterialDefines>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 // 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 this._activeEffect.setFloat(\"alpha\", this.alpha);\r\n this._activeEffect.setColor3(\"shadowColor\", this.shadowColor);\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 // Lights\r\n if (scene.lightsEnabled) {\r\n BindLights(scene, mesh, this._activeEffect, defines, 1);\r\n\r\n const light = this._getFirstShadowLightForMesh(mesh);\r\n\r\n if (light) {\r\n // Make sure the uniforms for this light will be rebound for other materials using this light when rendering the current frame.\r\n // Indeed, there is an optimization in Light that binds the light uniforms only once per frame for a given light (if using ubo).\r\n // Doing this way assumes that all uses of this light are the same, meaning all parameters passed to Light._bindLlight\r\n // are the same, notably useSpecular. However, isReadyForSubMesh (see above) is passing false for this parameter, which may not be\r\n // the value the other materials may pass.\r\n light._renderId = -1;\r\n }\r\n }\r\n\r\n // View\r\n if ((scene.fogEnabled && mesh.applyFog && scene.fogMode !== Scene.FOGMODE_NONE) || defines[\"SHADOWCSM0\"]) {\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._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n public override clone(name: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Clone<ShadowOnlyMaterial>(() => new ShadowOnlyMaterial(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.ShadowOnlyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"ShadowOnlyMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {\r\n return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.ShadowOnlyMaterial\", ShadowOnlyMaterial);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"simpleMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/simple/simpleMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC1G,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAI/C,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C,CAAC;sDAClB;AAG5B;IADN,iBAAiB,CAAC,SAAS,CAAC;oDACa;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;wDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;uDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;8DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;6DACd;AAoSzC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 { 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 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\n\r\nimport \"./simple.fragment\";\r\nimport \"./simple.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 SimpleMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 SimpleMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\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 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;\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 // 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 SimpleMaterialDefines();\r\n }\r\n\r\n const defines = <SimpleMaterialDefines>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 defines._needUVs = false;\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 }\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 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 const shaderName = \"simple\";\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 ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\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 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 - 1 },\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 = <SimpleMaterialDefines>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 // 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 this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\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._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 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 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 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 super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): SimpleMaterial {\r\n return SerializationHelper.Clone<SimpleMaterial>(() => new SimpleMaterial(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.SimpleMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"SimpleMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial {\r\n return SerializationHelper.Parse(() => new SimpleMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SimpleMaterial\", SimpleMaterial);\r\n"]}
1
+ {"version":3,"file":"simpleMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/simple/simpleMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,2CAA6B;AAC1G,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAI/C,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;AAEpD,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AACzB,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,qBAAsB,SAAQ,eAAe;IAyB/C;QACI,KAAK,EAAE,CAAC;QAzBL,YAAO,GAAG,KAAK,CAAC;QAChB,cAAS,GAAG,KAAK,CAAC;QAClB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,eAAU,GAAG,KAAK,CAAC;QACnB,cAAS,GAAG,KAAK,CAAC;Q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AEe,KAAK,CAAC,IAAY;QAC9B,OAAO,mBAAmB,CAAC,KAAK,CAAiB,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAC5G,CAAC;IAEe,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,wBAAwB,CAAC;QAC1D,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAEe,YAAY;QACxB,OAAO,gBAAgB,CAAC;IAC5B,CAAC;IAED,UAAU;IACH,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3G,CAAC;CACJ;AAjTW;IADP,kBAAkB,CAAC,gBAAgB,CAAC;uDACA;AAE9B;IADN,gBAAgB,CAAC,kCAAkC,CAAC;sDAClB;AAG5B;IADN,iBAAiB,CAAC,SAAS,CAAC;oDACa;AAGlC;IADP,SAAS,CAAC,iBAAiB,CAAC;wDACI;AAE1B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;uDACnB;AAGxB;IADP,SAAS,CAAC,uBAAuB,CAAC;8DACA;AAE5B;IADN,gBAAgB,CAAC,gCAAgC,CAAC;6DACd;AAoSzC,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { 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 { 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 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\n\r\nimport \"./simple.fragment\";\r\nimport \"./simple.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 SimpleMaterialDefines extends MaterialDefines {\r\n public DIFFUSE = 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 SimpleMaterial extends PushMaterial {\r\n @serializeAsTexture(\"diffuseTexture\")\r\n private _diffuseTexture: BaseTexture;\r\n @expandToProperty(\"_markAllSubMeshesAsTexturesDirty\")\r\n public diffuseTexture: BaseTexture;\r\n\r\n @serializeAsColor3(\"diffuse\")\r\n public diffuseColor = new Color3(1, 1, 1);\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 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;\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 // 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 SimpleMaterialDefines();\r\n }\r\n\r\n const defines = <SimpleMaterialDefines>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 defines._needUVs = false;\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 }\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 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 const shaderName = \"simple\";\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 ];\r\n const samplers = [\"diffuseSampler\"];\r\n const uniformBuffers: string[] = [];\r\n\r\n addClipPlaneUniforms(uniforms);\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 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 - 1 },\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 = <SimpleMaterialDefines>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 // 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 this._activeEffect.setColor4(\"vDiffuseColor\", this.diffuseColor, this.alpha * mesh.visibility);\r\n\r\n // Lights\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._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 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 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 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 super.dispose(forceDisposeEffect);\r\n }\r\n\r\n public override clone(name: string): SimpleMaterial {\r\n return SerializationHelper.Clone<SimpleMaterial>(() => new SimpleMaterial(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.SimpleMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n public override getClassName(): string {\r\n return \"SimpleMaterial\";\r\n }\r\n\r\n // Statics\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial {\r\n return SerializationHelper.Parse(() => new SimpleMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SimpleMaterial\", SimpleMaterial);\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"skyMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/sky/skyMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,2CAA6B;AACrE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;AAEzE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,6CAA+B;AAG7D,OAAO,EAAE,eAAe,EAAE,qDAAuC;AACjE,OAAO,EAAE,YAAY,EAAE,kDAAoC;AAC3D,OAAO,EAAE,YAAY,EAAE,0CAA4B;AAInD,OAAO,EAAE,KAAK,EAAE,iCAAmB;AACnC,OAAO,EAAE,aA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AC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;CACJ;AApWU;IADN,SAAS,EAAE;8CACmB;AAMxB;IADN,SAAS,EAAE;8CACoB;AAMzB;IADN,SAAS,EAAE;6CACkB;AAMvB;IADN,SAAS,EAAE;mDAC0B;AAM/B;IADN,SAAS,EAAE;oDACyB;AAM9B;IADN,SAAS,EAAE;6CACkB;AAOvB;IADN,SAAS,EAAE;gDACsB;AAO3B;IADN,SAAS,EAAE;4CACkB;AAOvB;IADN,kBAAkB,EAAE;gDACgC;AAO9C;IADN,SAAS,EAAE;mDAC2B;AAOhC;IADN,kBAAkB,EAAE;iDACyB;AAMvC;IADN,kBAAkB,EAAE;uCACa;AAM3B;IADN,SAAS,EAAE;8CACsB;AAyRtC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsVector3, serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Quaternion } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\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 \"./sky.fragment\";\r\nimport \"./sky.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport { BindFogParameters, BindLogDepth, PrepareDefinesForAttributes, PrepareDefinesForMisc } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass SkyMaterialDefines 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 POINTSIZE = false;\r\n public FOG = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public DITHER = 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 * This is the sky material which allows to create dynamic and texture free effects for skyboxes.\r\n * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat\r\n */\r\nexport class SkyMaterial extends PushMaterial {\r\n /**\r\n * Defines the overall luminance of sky in interval ]0, 1[.\r\n */\r\n @serialize()\r\n public luminance: number = 1.0;\r\n\r\n /**\r\n * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.\r\n */\r\n @serialize()\r\n public turbidity: number = 10.0;\r\n\r\n /**\r\n * Defines the sky appearance (light intensity).\r\n */\r\n @serialize()\r\n public rayleigh: number = 2.0;\r\n\r\n /**\r\n * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.\r\n */\r\n @serialize()\r\n public mieCoefficient: number = 0.005;\r\n\r\n /**\r\n * Defines the amount of haze particles following the Mie scattering theory.\r\n */\r\n @serialize()\r\n public mieDirectionalG: number = 0.8;\r\n\r\n /**\r\n * Defines the distance of the sun according to the active scene camera.\r\n */\r\n @serialize()\r\n public distance: number = 500;\r\n\r\n /**\r\n * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said\r\n * \"inclined\".\r\n */\r\n @serialize()\r\n public inclination: number = 0.49;\r\n\r\n /**\r\n * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between\r\n * an object direction and a reference direction.\r\n */\r\n @serialize()\r\n public azimuth: number = 0.25;\r\n\r\n /**\r\n * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then\r\n * the property is overridden by the inclination and the azimuth and can be read at any moment.\r\n */\r\n @serializeAsVector3()\r\n public sunPosition: Vector3 = new Vector3(0, 100, 0);\r\n\r\n /**\r\n * Defines if the sun position should be computed (inclination and azimuth) according to the given\r\n * .sunPosition property.\r\n */\r\n @serialize()\r\n public useSunPosition: boolean = false;\r\n\r\n /**\r\n * Defines an offset vector used to get a horizon offset.\r\n * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis\r\n */\r\n @serializeAsVector3()\r\n public cameraOffset: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Defines the vector the skyMaterial should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\r\n */\r\n @serializeAsVector3()\r\n public up: Vector3 = Vector3.Up();\r\n\r\n /**\r\n * Defines if sky should be dithered.\r\n */\r\n @serialize()\r\n public dithering: boolean = false;\r\n\r\n // Private members\r\n private _cameraPosition: Vector3 = Vector3.Zero();\r\n private _skyOrientation: Quaternion = new Quaternion();\r\n\r\n /**\r\n * Instantiates a new sky material.\r\n * This material allows to create dynamic and texture free\r\n * effects for skyboxes by taking care of the atmosphere state.\r\n * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns false as the sky material doesn't need alpha testing.\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns null as the sky material has no texture.\r\n */\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new SkyMaterialDefines();\r\n }\r\n\r\n const defines = <SkyMaterialDefines>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 PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, false);\r\n\r\n if (defines.IMAGEPROCESSINGPOSTPROCESS !== scene.imageProcessingConfiguration.applyByPostProcess) {\r\n defines.markAsMiscDirty();\r\n }\r\n\r\n if (defines.DITHER !== this.dithering) {\r\n defines.markAsMiscDirty();\r\n }\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 defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n defines.DITHER = this.dithering;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n const shaderName = \"sky\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"logarithmicDepthConstant\",\r\n \"pointSize\",\r\n \"luminance\",\r\n \"turbidity\",\r\n \"rayleigh\",\r\n \"mieCoefficient\",\r\n \"mieDirectionalG\",\r\n \"sunPosition\",\r\n \"cameraPosition\",\r\n \"cameraOffset\",\r\n \"up\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n const join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName, attribs, uniforms, [], join, fallbacks, this.onCompiled, this.onError), defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\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 = <SkyMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n 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\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 // Sky\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const cameraWorldMatrix = camera.getWorldMatrix();\r\n this._cameraPosition.x = cameraWorldMatrix.m[12];\r\n this._cameraPosition.y = cameraWorldMatrix.m[13];\r\n this._cameraPosition.z = cameraWorldMatrix.m[14];\r\n this._activeEffect.setVector3(\"cameraPosition\", this._cameraPosition);\r\n }\r\n\r\n this._activeEffect.setVector3(\"cameraOffset\", this.cameraOffset);\r\n\r\n this._activeEffect.setVector3(\"up\", this.up);\r\n\r\n if (this.luminance > 0) {\r\n this._activeEffect.setFloat(\"luminance\", this.luminance);\r\n }\r\n\r\n this._activeEffect.setFloat(\"turbidity\", this.turbidity);\r\n this._activeEffect.setFloat(\"rayleigh\", this.rayleigh);\r\n this._activeEffect.setFloat(\"mieCoefficient\", this.mieCoefficient);\r\n this._activeEffect.setFloat(\"mieDirectionalG\", this.mieDirectionalG);\r\n\r\n if (!this.useSunPosition) {\r\n const theta = Math.PI * (this.inclination - 0.5);\r\n const phi = 2 * Math.PI * (this.azimuth - 0.5);\r\n\r\n this.sunPosition.x = this.distance * Math.cos(phi) * Math.cos(theta);\r\n this.sunPosition.y = this.distance * Math.sin(-theta);\r\n this.sunPosition.z = this.distance * Math.sin(phi) * Math.cos(theta);\r\n\r\n Quaternion.FromUnitVectorsToRef(Vector3.UpReadOnly, this.up, this._skyOrientation);\r\n this.sunPosition.rotateByQuaternionToRef(this._skyOrientation, this.sunPosition);\r\n }\r\n\r\n this._activeEffect.setVector3(\"sunPosition\", this.sunPosition);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public override getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n */\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n public override clone(name: string): SkyMaterial {\r\n return SerializationHelper.Clone<SkyMaterial>(() => new SkyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.SkyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the material e.g. \"SkyMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"SkyMaterial\";\r\n }\r\n\r\n /**\r\n * Creates a sky material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new sky material\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial {\r\n return SerializationHelper.Parse(() => new SkyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SkyMaterial\", SkyMaterial);\r\n"]}
1
+ {"version":3,"file":"skyMaterial.js","sourceRoot":"","sources":["../../../../dev/materials/src/sky/skyMaterial.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,2CAA6B;AACrE,OAAO,EAAE,mBAAmB,EAAE,yDAA2C;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E,IAAI,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACtG,CAAC;IAED;;;OAGG;IACa,SAAS;QACrB,MAAM,mBAAmB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QAC9C,mBAAmB,CAAC,UAAU,GAAG,qBAAqB,CAAC;QACvD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;OAIG;IACa,YAAY;QACxB,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAU,KAAK,CAAC,MAAW,EAAE,KAAY,EAAE,OAAe;QACnE,OAAO,mBAAmB,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACxG,CAAC;CACJ;AApWU;IADN,SAAS,EAAE;8CACmB;AAMxB;IADN,SAAS,EAAE;8CACoB;AAMzB;IADN,SAAS,EAAE;6CACkB;AAMvB;IADN,SAAS,EAAE;mDAC0B;AAM/B;IADN,SAAS,EAAE;oDACyB;AAM9B;IADN,SAAS,EAAE;6CACkB;AAOvB;IADN,SAAS,EAAE;gDACsB;AAO3B;IADN,SAAS,EAAE;4CACkB;AAOvB;IADN,kBAAkB,EAAE;gDACgC;AAO9C;IADN,SAAS,EAAE;mDAC2B;AAOhC;IADN,kBAAkB,EAAE;iDACyB;AAMvC;IADN,kBAAkB,EAAE;uCACa;AAM3B;IADN,SAAS,EAAE;8CACsB;AAyRtC,aAAa,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { Nullable } from \"core/types\";\r\nimport { serializeAsVector3, serialize } from \"core/Misc/decorators\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport type { Matrix } from \"core/Maths/math.vector\";\r\nimport { Vector3, Quaternion } from \"core/Maths/math.vector\";\r\nimport type { IAnimatable } from \"core/Animations/animatable.interface\";\r\nimport type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { MaterialDefines } from \"core/Materials/materialDefines\";\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 \"./sky.fragment\";\r\nimport \"./sky.vertex\";\r\nimport { EffectFallbacks } from \"core/Materials/effectFallbacks\";\r\nimport { addClipPlaneUniforms, bindClipPlane } from \"core/Materials/clipPlaneMaterialHelper\";\r\nimport { BindFogParameters, BindLogDepth, PrepareDefinesForAttributes, PrepareDefinesForMisc } from \"core/Materials/materialHelper.functions\";\r\n\r\n/** @internal */\r\nclass SkyMaterialDefines 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 POINTSIZE = false;\r\n public FOG = false;\r\n public VERTEXCOLOR = false;\r\n public VERTEXALPHA = false;\r\n public IMAGEPROCESSINGPOSTPROCESS = false;\r\n public SKIPFINALCOLORCLAMP = false;\r\n public DITHER = 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 * This is the sky material which allows to create dynamic and texture free effects for skyboxes.\r\n * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat\r\n */\r\nexport class SkyMaterial extends PushMaterial {\r\n /**\r\n * Defines the overall luminance of sky in interval ]0, 1[.\r\n */\r\n @serialize()\r\n public luminance: number = 1.0;\r\n\r\n /**\r\n * Defines the amount (scattering) of haze as opposed to molecules in atmosphere.\r\n */\r\n @serialize()\r\n public turbidity: number = 10.0;\r\n\r\n /**\r\n * Defines the sky appearance (light intensity).\r\n */\r\n @serialize()\r\n public rayleigh: number = 2.0;\r\n\r\n /**\r\n * Defines the mieCoefficient in interval [0, 0.1] which affects the property .mieDirectionalG.\r\n */\r\n @serialize()\r\n public mieCoefficient: number = 0.005;\r\n\r\n /**\r\n * Defines the amount of haze particles following the Mie scattering theory.\r\n */\r\n @serialize()\r\n public mieDirectionalG: number = 0.8;\r\n\r\n /**\r\n * Defines the distance of the sun according to the active scene camera.\r\n */\r\n @serialize()\r\n public distance: number = 500;\r\n\r\n /**\r\n * Defines the sun inclination, in interval [-0.5, 0.5]. When the inclination is not 0, the sun is said\r\n * \"inclined\".\r\n */\r\n @serialize()\r\n public inclination: number = 0.49;\r\n\r\n /**\r\n * Defines the solar azimuth in interval [0, 1]. The azimuth is the angle in the horizontal plan between\r\n * an object direction and a reference direction.\r\n */\r\n @serialize()\r\n public azimuth: number = 0.25;\r\n\r\n /**\r\n * Defines the sun position in the sky on (x,y,z). If the property .useSunPosition is set to false, then\r\n * the property is overridden by the inclination and the azimuth and can be read at any moment.\r\n */\r\n @serializeAsVector3()\r\n public sunPosition: Vector3 = new Vector3(0, 100, 0);\r\n\r\n /**\r\n * Defines if the sun position should be computed (inclination and azimuth) according to the given\r\n * .sunPosition property.\r\n */\r\n @serialize()\r\n public useSunPosition: boolean = false;\r\n\r\n /**\r\n * Defines an offset vector used to get a horizon offset.\r\n * @example skyMaterial.cameraOffset.y = camera.globalPosition.y // Set horizon relative to 0 on the Y axis\r\n */\r\n @serializeAsVector3()\r\n public cameraOffset: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Defines the vector the skyMaterial should consider as up. (default is Vector3(0, 1, 0) as returned by Vector3.Up())\r\n */\r\n @serializeAsVector3()\r\n public up: Vector3 = Vector3.Up();\r\n\r\n /**\r\n * Defines if sky should be dithered.\r\n */\r\n @serialize()\r\n public dithering: boolean = false;\r\n\r\n // Private members\r\n private _cameraPosition: Vector3 = Vector3.Zero();\r\n private _skyOrientation: Quaternion = new Quaternion();\r\n\r\n /**\r\n * Instantiates a new sky material.\r\n * This material allows to create dynamic and texture free\r\n * effects for skyboxes by taking care of the atmosphere state.\r\n * @see https://doc.babylonjs.com/toolsAndResources/assetLibraries/materialsLibrary/skyMat\r\n * @param name Define the name of the material in the scene\r\n * @param scene Define the scene the material belong to\r\n */\r\n constructor(name: string, scene?: Scene) {\r\n super(name, scene);\r\n }\r\n\r\n /**\r\n * Specifies if the material will require alpha blending\r\n * @returns a boolean specifying if alpha blending is needed\r\n */\r\n public override needAlphaBlending(): boolean {\r\n return this.alpha < 1.0;\r\n }\r\n\r\n /**\r\n * Specifies if this material should be rendered in alpha test mode\r\n * @returns false as the sky material doesn't need alpha testing.\r\n */\r\n public override needAlphaTesting(): boolean {\r\n return false;\r\n }\r\n\r\n /**\r\n * Get the texture used for alpha test purpose.\r\n * @returns null as the sky material has no texture.\r\n */\r\n public override getAlphaTestTexture(): Nullable<BaseTexture> {\r\n return null;\r\n }\r\n\r\n /**\r\n * Get if the submesh is ready to be used and all its information available.\r\n * Child classes can use it to update shaders\r\n * @param mesh defines the mesh to check\r\n * @param subMesh defines which submesh to check\r\n * @returns a boolean indicating that the submesh is ready or not\r\n */\r\n public override isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean {\r\n const drawWrapper = subMesh._drawWrapper;\r\n\r\n if (this.isFrozen) {\r\n if (drawWrapper.effect && drawWrapper._wasPreviouslyReady) {\r\n return true;\r\n }\r\n }\r\n\r\n if (!subMesh.materialDefines) {\r\n subMesh.materialDefines = new SkyMaterialDefines();\r\n }\r\n\r\n const defines = <SkyMaterialDefines>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 PrepareDefinesForMisc(mesh, scene, this._useLogarithmicDepth, this.pointsCloud, this.fogEnabled, false, defines);\r\n\r\n // Attribs\r\n PrepareDefinesForAttributes(mesh, defines, true, false);\r\n\r\n if (defines.IMAGEPROCESSINGPOSTPROCESS !== scene.imageProcessingConfiguration.applyByPostProcess) {\r\n defines.markAsMiscDirty();\r\n }\r\n\r\n if (defines.DITHER !== this.dithering) {\r\n defines.markAsMiscDirty();\r\n }\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 defines.IMAGEPROCESSINGPOSTPROCESS = scene.imageProcessingConfiguration.applyByPostProcess;\r\n defines.DITHER = this.dithering;\r\n\r\n //Attributes\r\n const attribs = [VertexBuffer.PositionKind];\r\n\r\n if (defines.VERTEXCOLOR) {\r\n attribs.push(VertexBuffer.ColorKind);\r\n }\r\n\r\n const shaderName = \"sky\";\r\n\r\n const uniforms = [\r\n \"world\",\r\n \"viewProjection\",\r\n \"view\",\r\n \"vFogInfos\",\r\n \"vFogColor\",\r\n \"logarithmicDepthConstant\",\r\n \"pointSize\",\r\n \"luminance\",\r\n \"turbidity\",\r\n \"rayleigh\",\r\n \"mieCoefficient\",\r\n \"mieDirectionalG\",\r\n \"sunPosition\",\r\n \"cameraPosition\",\r\n \"cameraOffset\",\r\n \"up\",\r\n ];\r\n addClipPlaneUniforms(uniforms);\r\n const join = defines.toString();\r\n subMesh.setEffect(scene.getEngine().createEffect(shaderName, attribs, uniforms, [], join, fallbacks, this.onCompiled, this.onError), defines, this._materialContext);\r\n }\r\n\r\n if (!subMesh.effect || !subMesh.effect.isReady()) {\r\n return false;\r\n }\r\n\r\n defines._renderId = scene.getRenderId();\r\n drawWrapper._wasPreviouslyReady = true;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Binds the submesh to this material by preparing the effect and shader to draw\r\n * @param world defines the world transformation matrix\r\n * @param mesh defines the mesh containing the submesh\r\n * @param subMesh defines the submesh to bind the material to\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 = <SkyMaterialDefines>subMesh.materialDefines;\r\n if (!defines) {\r\n return;\r\n }\r\n\r\n const effect = subMesh.effect;\r\n if (!effect) {\r\n return;\r\n }\r\n this._activeEffect = effect;\r\n\r\n // Matrices\r\n this.bindOnlyWorldMatrix(world);\r\n this._activeEffect.setMatrix(\"viewProjection\", scene.getTransformMatrix());\r\n\r\n if (this._mustRebind(scene, effect, subMesh)) {\r\n 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\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 // Sky\r\n const camera = scene.activeCamera;\r\n if (camera) {\r\n const cameraWorldMatrix = camera.getWorldMatrix();\r\n this._cameraPosition.x = cameraWorldMatrix.m[12];\r\n this._cameraPosition.y = cameraWorldMatrix.m[13];\r\n this._cameraPosition.z = cameraWorldMatrix.m[14];\r\n this._activeEffect.setVector3(\"cameraPosition\", this._cameraPosition);\r\n }\r\n\r\n this._activeEffect.setVector3(\"cameraOffset\", this.cameraOffset);\r\n\r\n this._activeEffect.setVector3(\"up\", this.up);\r\n\r\n if (this.luminance > 0) {\r\n this._activeEffect.setFloat(\"luminance\", this.luminance);\r\n }\r\n\r\n this._activeEffect.setFloat(\"turbidity\", this.turbidity);\r\n this._activeEffect.setFloat(\"rayleigh\", this.rayleigh);\r\n this._activeEffect.setFloat(\"mieCoefficient\", this.mieCoefficient);\r\n this._activeEffect.setFloat(\"mieDirectionalG\", this.mieDirectionalG);\r\n\r\n if (!this.useSunPosition) {\r\n const theta = Math.PI * (this.inclination - 0.5);\r\n const phi = 2 * Math.PI * (this.azimuth - 0.5);\r\n\r\n this.sunPosition.x = this.distance * Math.cos(phi) * Math.cos(theta);\r\n this.sunPosition.y = this.distance * Math.sin(-theta);\r\n this.sunPosition.z = this.distance * Math.sin(phi) * Math.cos(theta);\r\n\r\n Quaternion.FromUnitVectorsToRef(Vector3.UpReadOnly, this.up, this._skyOrientation);\r\n this.sunPosition.rotateByQuaternionToRef(this._skyOrientation, this.sunPosition);\r\n }\r\n\r\n this._activeEffect.setVector3(\"sunPosition\", this.sunPosition);\r\n\r\n this._afterBind(mesh, this._activeEffect, subMesh);\r\n }\r\n\r\n /**\r\n * Get the list of animatables in the material.\r\n * @returns the list of animatables object used in the material\r\n */\r\n public override getAnimatables(): IAnimatable[] {\r\n return [];\r\n }\r\n\r\n /**\r\n * Disposes the material\r\n * @param forceDisposeEffect specifies if effects should be forcefully disposed\r\n */\r\n public override dispose(forceDisposeEffect?: boolean): void {\r\n super.dispose(forceDisposeEffect);\r\n }\r\n\r\n /**\r\n * Makes a duplicate of the material, and gives it a new name\r\n * @param name defines the new name for the duplicated material\r\n * @returns the cloned material\r\n */\r\n public override clone(name: string): SkyMaterial {\r\n return SerializationHelper.Clone<SkyMaterial>(() => new SkyMaterial(name, this.getScene()), this);\r\n }\r\n\r\n /**\r\n * Serializes this material in a JSON representation\r\n * @returns the serialized material object\r\n */\r\n public override serialize(): any {\r\n const serializationObject = super.serialize();\r\n serializationObject.customType = \"BABYLON.SkyMaterial\";\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the material e.g. \"SkyMaterial\"\r\n * Mainly use in serialization.\r\n * @returns the class name\r\n */\r\n public override getClassName(): string {\r\n return \"SkyMaterial\";\r\n }\r\n\r\n /**\r\n * Creates a sky material from parsed material data\r\n * @param source defines the JSON representation of the material\r\n * @param scene defines the hosting scene\r\n * @param rootUrl defines the root URL to use to load textures and relative dependencies\r\n * @returns a new sky material\r\n */\r\n public static override Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial {\r\n return SerializationHelper.Parse(() => new SkyMaterial(source.name, scene), source, scene, rootUrl);\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.SkyMaterial\", SkyMaterial);\r\n"]}