babylonjs-materials
Advanced tools
Comparing version 7.35.0 to 7.35.1
@@ -1,2 +0,2 @@ | ||
!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],i):"object"==typeof exports?exports["babylonjs-materials"]=i(require("babylonjs")):e.MATERIALS=i(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var i={597:i=>{i.exports=e}},t={};function o(e){var r=t[e];if(void 0!==r)return r.exports;var n=t[e]={exports:{}};return i[e](n,n.exports,o),n.exports}o.d=(e,i)=>{for(var t in i)o.o(i,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};o.d(r,{default:()=>v});var n={};o.r(n),o.d(n,{GridMaterial:()=>p});var a={};o.r(a),o.d(a,{GridMaterial:()=>p});var s=function(e,i){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])},s(e,i)};function l(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=e}s(e,i),e.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t)}function f(e,i,t,o){var r,n=arguments.length,a=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,t):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,i,t,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(a=(n<3?r(a):n>3?r(i,t,a):r(i,t))||a);return n>3&&a&&Object.defineProperty(i,t,a),a}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var c=o(597);c.ShaderStore.ShadersStore.gridPixelShader="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;varying vec3 vPosition;varying vec3 vNormal;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform sampler2D opacitySampler;uniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {float majorGridFrequency=gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn gridControl.z;}\nfloat getAnisotropicAttenuation(float differentialLength) {const float maxNumberOfLines=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfloat isPointOnLine(float position,float differentialLength) {float fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);float result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result;\n#else\nreturn abs(fractionPartOfPosition)<SQRT2/4. ? 1. : 0.;\n#endif\n}\nfloat contributionOnAxis(float position) {float differentialLength=length(vec2(dFdx(position),dFdy(position)));differentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);float dynamicVisibility=getDynamicVisibility(position);result*=dynamicVisibility;float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);result*=anisotropicAttenuation;return result;}\nfloat normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";c.ShaderStore.ShadersStore.gridVertexShader="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\nuniform mat4 projection;uniform mat4 view;varying vec3 vPosition;varying vec3 vNormal;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;gl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));}\nelse\n{vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}\n#endif \n#include<logDepthVertex>\nvPosition=position;vNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}";var d=function(e){function i(){var i=e.call(this)||this;return i.OPACITY=!1,i.ANTIALIAS=!1,i.TRANSPARENT=!1,i.FOG=!1,i.PREMULTIPLYALPHA=!1,i.MAX_LINE=!1,i.UV1=!1,i.UV2=!1,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return l(i,e),i}(c.MaterialDefines),p=function(e){function i(i,t){var o=e.call(this,i,t)||this;return o.mainColor=c.Color3.Black(),o.lineColor=c.Color3.Teal(),o.gridRatio=1,o.gridOffset=c.Vector3.Zero(),o.majorUnitFrequency=10,o.minorUnitVisibility=.33,o.opacity=1,o.antialias=!0,o.preMultiplyAlpha=!1,o.useMaxLine=!1,o._gridControl=new c.Vector4(o.gridRatio,o.majorUnitFrequency,o.minorUnitVisibility,o.opacity),o}return l(i,e),i.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},i.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||this.needAlphaBlending()},i.prototype.isReadyForSubMesh=function(e,i,t){var o=i._drawWrapper;if(this.isFrozen&&o.effect&&o._wasPreviouslyReady&&o._wasPreviouslyUsingInstances===t)return!0;i.materialDefines||(i.materialDefines=new d);var r=i.materialDefines,n=this.getScene();if(this._isReadyForSubMesh(i))return!0;if(r.TRANSPARENT!==this.opacity<1&&(r.TRANSPARENT=!r.TRANSPARENT,r.markAsUnprocessed()),r.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(r.PREMULTIPLYALPHA=!r.PREMULTIPLYALPHA,r.markAsUnprocessed()),r.MAX_LINE!==this.useMaxLine&&(r.MAX_LINE=!r.MAX_LINE,r.markAsUnprocessed()),r.ANTIALIAS!==this.antialias&&(r.ANTIALIAS=!r.ANTIALIAS,r.markAsUnprocessed()),r._areTexturesDirty&&(r._needUVs=!1,n.texturesEnabled&&this._opacityTexture&&c.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;r._needUVs=!0,r.OPACITY=!0}if((0,c.PrepareDefinesForMisc)(e,n,this._useLogarithmicDepth,!1,this.fogEnabled,!1,r),(0,c.PrepareDefinesForFrameBoundValues)(n,n.getEngine(),this,r,!!t),r.isDirty){r.markAsProcessed(),n.resetCachedMaterial(),(0,c.PrepareDefinesForAttributes)(e,r,!1,!1);var a=[c.VertexBuffer.PositionKind,c.VertexBuffer.NormalKind];r.UV1&&a.push(c.VertexBuffer.UVKind),r.UV2&&a.push(c.VertexBuffer.UV2Kind),r.IMAGEPROCESSINGPOSTPROCESS=n.imageProcessingConfiguration.applyByPostProcess,(0,c.PrepareAttributesForInstances)(a,r);var s=r.toString();i.setEffect(n.getEngine().createEffect("grid",a,["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility","logarithmicDepthConstant"],["opacitySampler"],s,void 0,this.onCompiled,this.onError),r,this._materialContext)}return!(!i.effect||!i.effect.isReady()||(r._renderId=n.getRenderId(),o._wasPreviouslyReady=!0,o._wasPreviouslyUsingInstances=!!t,0))},i.prototype.bindForSubMesh=function(e,i,t){var o=this.getScene(),r=t.materialDefines;if(r){var n=t.effect;n&&(this._activeEffect=n,this._activeEffect.setFloat("visibility",i.visibility),r.INSTANCES&&!r.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",o.getViewMatrix()),this._activeEffect.setMatrix("projection",o.getProjectionMatrix()),this._mustRebind(o,n,t)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&c.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix())),this._useLogarithmicDepth&&(0,c.BindLogDepth)(r,n,o)),(0,c.BindFogParameters)(o,i,this._activeEffect),this._afterBind(i,this._activeEffect,t))}},i.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},i.prototype.clone=function(e){var t=this;return c.SerializationHelper.Clone((function(){return new i(e,t.getScene())}),this)},i.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.GridMaterial",i},i.prototype.getClassName=function(){return"GridMaterial"},i.Parse=function(e,t,o){return c.SerializationHelper.Parse((function(){return new i(e.name,t)}),e,t,o)},f([(0,c.serializeAsColor3)()],i.prototype,"mainColor",void 0),f([(0,c.serializeAsColor3)()],i.prototype,"lineColor",void 0),f([(0,c.serialize)()],i.prototype,"gridRatio",void 0),f([(0,c.serializeAsVector3)()],i.prototype,"gridOffset",void 0),f([(0,c.serialize)()],i.prototype,"majorUnitFrequency",void 0),f([(0,c.serialize)()],i.prototype,"minorUnitVisibility",void 0),f([(0,c.serialize)()],i.prototype,"opacity",void 0),f([(0,c.serialize)()],i.prototype,"antialias",void 0),f([(0,c.serialize)()],i.prototype,"preMultiplyAlpha",void 0),f([(0,c.serialize)()],i.prototype,"useMaxLine",void 0),f([(0,c.serializeAsTexture)("opacityTexture")],i.prototype,"_opacityTexture",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],i.prototype,"opacityTexture",void 0),i}(c.PushMaterial);(0,c.RegisterClass)("BABYLON.GridMaterial",p);var u=void 0!==o.g?o.g:"undefined"!=typeof window?window:void 0;if(void 0!==u)for(var y in n)u.BABYLON[y]=n[y];const v=a;return r.default})())); | ||
!function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],i):"object"==typeof exports?exports["babylonjs-materials"]=i(require("babylonjs")):e.MATERIALS=i(e.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(e=>(()=>{"use strict";var i={597:i=>{i.exports=e}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var r=t[e]={exports:{}};return i[e](r,r.exports,n),r.exports}n.d=(e,i)=>{for(var t in i)n.o(i,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:i[t]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,i)=>Object.prototype.hasOwnProperty.call(e,i),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>v});var r={};n.r(r),n.d(r,{GridMaterial:()=>p});var a={};n.r(a),n.d(a,{GridMaterial:()=>p});var s=function(e,i){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])},s(e,i)};function l(e,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function t(){this.constructor=e}s(e,i),e.prototype=null===i?Object.create(i):(t.prototype=i.prototype,new t)}function f(e,i,t,n){var o,r=arguments.length,a=r<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,i,t,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(i,t,a):o(i,t))||a);return r>3&&a&&Object.defineProperty(i,t,a),a}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var c=n(597);c.ShaderStore.ShadersStore.gridPixelShader="#extension GL_OES_standard_derivatives : enable\n#define SQRT2 1.41421356\n#define PI 3.14159\nprecision highp float;uniform float visibility;uniform vec3 mainColor;uniform vec3 lineColor;uniform vec4 gridControl;uniform vec3 gridOffset;varying vec3 vPosition;varying vec3 vNormal;\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform sampler2D opacitySampler;uniform vec2 vOpacityInfos;\n#endif\nfloat getDynamicVisibility(float position) {float majorGridFrequency=gridControl.y;if (floor(position+0.5)==floor(position/majorGridFrequency+0.5)*majorGridFrequency)\n{return 1.0;}\nreturn gridControl.z;}\nfloat getAnisotropicAttenuation(float differentialLength) {const float maxNumberOfLines=10.0;return clamp(1.0/(differentialLength+1.0)-1.0/maxNumberOfLines,0.0,1.0);}\nfloat isPointOnLine(float position,float differentialLength) {float fractionPartOfPosition=position-floor(position+0.5); \nfractionPartOfPosition/=differentialLength; \n#ifdef ANTIALIAS\nfractionPartOfPosition=clamp(fractionPartOfPosition,-1.,1.);float result=0.5+0.5*cos(fractionPartOfPosition*PI); \nreturn result;\n#else\nreturn abs(fractionPartOfPosition)<SQRT2/4. ? 1. : 0.;\n#endif\n}\nfloat contributionOnAxis(float position) {float differentialLength=length(vec2(dFdx(position),dFdy(position)));differentialLength*=SQRT2; \nfloat result=isPointOnLine(position,differentialLength);float dynamicVisibility=getDynamicVisibility(position);result*=dynamicVisibility;float anisotropicAttenuation=getAnisotropicAttenuation(differentialLength);result*=anisotropicAttenuation;return result;}\nfloat normalImpactOnAxis(float x) {float normalImpact=clamp(1.0-3.0*abs(x*x*x),0.0,1.0);return normalImpact;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nfloat gridRatio=gridControl.x;vec3 gridPos=(vPosition+gridOffset.xyz)/gridRatio;float x=contributionOnAxis(gridPos.x);float y=contributionOnAxis(gridPos.y);float z=contributionOnAxis(gridPos.z);vec3 normal=normalize(vNormal);x*=normalImpactOnAxis(normal.x);y*=normalImpactOnAxis(normal.y);z*=normalImpactOnAxis(normal.z);\n#ifdef MAX_LINE\nfloat grid=clamp(max(max(x,y),z),0.,1.);\n#else\nfloat grid=clamp(x+y+z,0.,1.);\n#endif\nvec3 color=mix(mainColor,lineColor,grid);\n#ifdef FOG\n#include<fogFragment>\n#endif\nfloat opacity=1.0;\n#ifdef TRANSPARENT\nopacity=clamp(grid,0.08,gridControl.w*grid);\n#endif\n#ifdef OPACITY\nopacity*=texture2D(opacitySampler,vOpacityUV).a;\n#endif\ngl_FragColor=vec4(color.rgb,opacity*visibility);\n#ifdef TRANSPARENT\n#ifdef PREMULTIPLYALPHA\ngl_FragColor.rgb*=opacity;\n#endif\n#else\n#endif\n#include<logDepthFragment>\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}\n";c.ShaderStore.ShadersStore.gridVertexShader="precision highp float;attribute vec3 position;attribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#include<instancesDeclaration>\nuniform mat4 projection;uniform mat4 view;varying vec3 vPosition;varying vec3 vNormal;\n#include<logDepthDeclaration>\n#include<fogVertexDeclaration>\n#ifdef OPACITY\nvarying vec2 vOpacityUV;uniform mat4 opacityMatrix;uniform vec2 vOpacityInfos;\n#endif\n#include<clipPlaneVertexDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\nvec4 worldPos=finalWorld*vec4(position,1.0);\n#include<fogVertex>\nvec4 cameraSpacePosition=view*worldPos;gl_Position=projection*cameraSpacePosition;\n#ifdef OPACITY\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\nif (vOpacityInfos.x==0.)\n{vOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));}\nelse\n{vOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));}\n#endif \n#include<clipPlaneVertex>\n#include<logDepthVertex>\nvPosition=position;vNormal=normal;\n#define CUSTOM_VERTEX_MAIN_END\n}";var d=function(e){function i(){var i=e.call(this)||this;return i.CLIPPLANE=!1,i.CLIPPLANE2=!1,i.CLIPPLANE3=!1,i.CLIPPLANE4=!1,i.CLIPPLANE5=!1,i.CLIPPLANE6=!1,i.OPACITY=!1,i.ANTIALIAS=!1,i.TRANSPARENT=!1,i.FOG=!1,i.PREMULTIPLYALPHA=!1,i.MAX_LINE=!1,i.UV1=!1,i.UV2=!1,i.INSTANCES=!1,i.THIN_INSTANCES=!1,i.IMAGEPROCESSINGPOSTPROCESS=!1,i.SKIPFINALCOLORCLAMP=!1,i.LOGARITHMICDEPTH=!1,i.rebuild(),i}return l(i,e),i}(c.MaterialDefines),p=function(e){function i(i,t){var n=e.call(this,i,t)||this;return n.mainColor=c.Color3.Black(),n.lineColor=c.Color3.Teal(),n.gridRatio=1,n.gridOffset=c.Vector3.Zero(),n.majorUnitFrequency=10,n.minorUnitVisibility=.33,n.opacity=1,n.antialias=!0,n.preMultiplyAlpha=!1,n.useMaxLine=!1,n._gridControl=new c.Vector4(n.gridRatio,n.majorUnitFrequency,n.minorUnitVisibility,n.opacity),n}return l(i,e),i.prototype.needAlphaBlending=function(){return this.opacity<1||this._opacityTexture&&this._opacityTexture.isReady()},i.prototype.needAlphaBlendingForMesh=function(e){return e.visibility<1||this.needAlphaBlending()},i.prototype.isReadyForSubMesh=function(e,i,t){var n=i._drawWrapper;if(this.isFrozen&&n.effect&&n._wasPreviouslyReady&&n._wasPreviouslyUsingInstances===t)return!0;i.materialDefines||(i.materialDefines=new d);var o=i.materialDefines,r=this.getScene();if(this._isReadyForSubMesh(i))return!0;if(o.TRANSPARENT!==this.opacity<1&&(o.TRANSPARENT=!o.TRANSPARENT,o.markAsUnprocessed()),o.PREMULTIPLYALPHA!=this.preMultiplyAlpha&&(o.PREMULTIPLYALPHA=!o.PREMULTIPLYALPHA,o.markAsUnprocessed()),o.MAX_LINE!==this.useMaxLine&&(o.MAX_LINE=!o.MAX_LINE,o.markAsUnprocessed()),o.ANTIALIAS!==this.antialias&&(o.ANTIALIAS=!o.ANTIALIAS,o.markAsUnprocessed()),o._areTexturesDirty&&(o._needUVs=!1,r.texturesEnabled&&this._opacityTexture&&c.MaterialFlags.OpacityTextureEnabled)){if(!this._opacityTexture.isReady())return!1;o._needUVs=!0,o.OPACITY=!0}if((0,c.PrepareDefinesForMisc)(e,r,this._useLogarithmicDepth,!1,this.fogEnabled,!1,o),(0,c.PrepareDefinesForFrameBoundValues)(r,r.getEngine(),this,o,!!t),o.isDirty){o.markAsProcessed(),r.resetCachedMaterial(),(0,c.PrepareDefinesForAttributes)(e,o,!1,!1);var a=[c.VertexBuffer.PositionKind,c.VertexBuffer.NormalKind];o.UV1&&a.push(c.VertexBuffer.UVKind),o.UV2&&a.push(c.VertexBuffer.UV2Kind),o.IMAGEPROCESSINGPOSTPROCESS=r.imageProcessingConfiguration.applyByPostProcess,(0,c.PrepareAttributesForInstances)(a,o);var s=["projection","mainColor","lineColor","gridControl","gridOffset","vFogInfos","vFogColor","world","view","opacityMatrix","vOpacityInfos","visibility","logarithmicDepthConstant"],l=o.toString();(0,c.addClipPlaneUniforms)(s),i.setEffect(r.getEngine().createEffect("grid",a,s,["opacitySampler"],l,void 0,this.onCompiled,this.onError),o,this._materialContext)}return!(!i.effect||!i.effect.isReady()||(o._renderId=r.getRenderId(),n._wasPreviouslyReady=!0,n._wasPreviouslyUsingInstances=!!t,0))},i.prototype.bindForSubMesh=function(e,i,t){var n=this.getScene(),o=t.materialDefines;if(o){var r=t.effect;r&&(this._activeEffect=r,this._activeEffect.setFloat("visibility",i.visibility),o.INSTANCES&&!o.THIN_INSTANCE||this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("view",n.getViewMatrix()),this._activeEffect.setMatrix("projection",n.getProjectionMatrix()),this._mustRebind(n,r,t)&&(this._activeEffect.setColor3("mainColor",this.mainColor),this._activeEffect.setColor3("lineColor",this.lineColor),this._activeEffect.setVector3("gridOffset",this.gridOffset),this._gridControl.x=this.gridRatio,this._gridControl.y=Math.round(this.majorUnitFrequency),this._gridControl.z=this.minorUnitVisibility,this._gridControl.w=this.opacity,this._activeEffect.setVector4("gridControl",this._gridControl),this._opacityTexture&&c.MaterialFlags.OpacityTextureEnabled&&(this._activeEffect.setTexture("opacitySampler",this._opacityTexture),this._activeEffect.setFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),this._activeEffect.setMatrix("opacityMatrix",this._opacityTexture.getTextureMatrix())),(0,c.bindClipPlane)(r,this,n),this._useLogarithmicDepth&&(0,c.BindLogDepth)(o,r,n)),(0,c.BindFogParameters)(n,i,this._activeEffect),this._afterBind(i,this._activeEffect,t))}},i.prototype.dispose=function(i){e.prototype.dispose.call(this,i)},i.prototype.clone=function(e){var t=this;return c.SerializationHelper.Clone((function(){return new i(e,t.getScene())}),this)},i.prototype.serialize=function(){var i=e.prototype.serialize.call(this);return i.customType="BABYLON.GridMaterial",i},i.prototype.getClassName=function(){return"GridMaterial"},i.Parse=function(e,t,n){return c.SerializationHelper.Parse((function(){return new i(e.name,t)}),e,t,n)},f([(0,c.serializeAsColor3)()],i.prototype,"mainColor",void 0),f([(0,c.serializeAsColor3)()],i.prototype,"lineColor",void 0),f([(0,c.serialize)()],i.prototype,"gridRatio",void 0),f([(0,c.serializeAsVector3)()],i.prototype,"gridOffset",void 0),f([(0,c.serialize)()],i.prototype,"majorUnitFrequency",void 0),f([(0,c.serialize)()],i.prototype,"minorUnitVisibility",void 0),f([(0,c.serialize)()],i.prototype,"opacity",void 0),f([(0,c.serialize)()],i.prototype,"antialias",void 0),f([(0,c.serialize)()],i.prototype,"preMultiplyAlpha",void 0),f([(0,c.serialize)()],i.prototype,"useMaxLine",void 0),f([(0,c.serializeAsTexture)("opacityTexture")],i.prototype,"_opacityTexture",void 0),f([(0,c.expandToProperty)("_markAllSubMeshesAsTexturesDirty")],i.prototype,"opacityTexture",void 0),i}(c.PushMaterial);(0,c.RegisterClass)("BABYLON.GridMaterial",p);var u=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==u)for(var y in r)u.BABYLON[y]=r[y];const v=a;return o.default})())); | ||
//# sourceMappingURL=babylon.gridMaterial.min.js.map |
{ | ||
"name": "babylonjs-materials", | ||
"version": "7.35.0", | ||
"version": "7.35.1", | ||
"main": "babylonjs.materials.js", | ||
@@ -18,3 +18,3 @@ "types": "babylonjs.materials.module.d.ts", | ||
"dependencies": { | ||
"babylonjs": "^7.35.0" | ||
"babylonjs": "^7.35.1" | ||
}, | ||
@@ -21,0 +21,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
5007390
29855
81
Updatedbabylonjs@^7.35.1