New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

babylonjs-materials

Package Overview
Dependencies
Maintainers
0
Versions
661
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babylonjs-materials - npm Package Compare versions

Comparing version 7.21.0 to 7.21.1

2

babylon.customMaterial.min.js

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-materials"]=e(require("babylonjs")):t.MATERIALS=e(t.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>S});var s={};n.r(s),n.d(s,{CustomMaterial:()=>f,CustomShaderStructure:()=>m,PBRCustomMaterial:()=>d,ShaderAlbedoParts:()=>c,ShaderAlebdoParts:()=>p,ShaderSpecialParts:()=>h});var i={};n.r(i),n.d(i,{CustomMaterial:()=>f,CustomShaderStructure:()=>m,PBRCustomMaterial:()=>d,ShaderAlbedoParts:()=>c,ShaderAlebdoParts:()=>p,ShaderSpecialParts:()=>h});var a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},a(t,e)};function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var _=n(597),m=function(){},h=function(){},f=function(t){function e(r,n){var o=t.call(this,r,n)||this;return o.CustomParts=new h,o.customShaderNameResolve=o.Builder,o.FragmentShader=_.Effect.ShadersStore.defaultPixelShader,o.VertexShader=_.Effect.ShadersStore.defaultVertexShader,e.ShaderIndexer++,o._createdShaderName="custom_"+e.ShaderIndexer,o}return u(e,t),e.prototype.AttachAfterBind=function(t,e){if(this._newUniformInstances)for(var r in this._newUniformInstances)"vec2"==(n=r.toString().split("-"))[0]?e.setVector2(n[1],this._newUniformInstances[r]):"vec3"==n[0]?this._newUniformInstances[r]instanceof _.Color3?e.setColor3(n[1],this._newUniformInstances[r]):e.setVector3(n[1],this._newUniformInstances[r]):"vec4"==n[0]?(this._newUniformInstances[r]instanceof _.Color4?e.setDirectColor4(n[1],this._newUniformInstances[r]):e.setVector4(n[1],this._newUniformInstances[r]),e.setVector4(n[1],this._newUniformInstances[r])):"mat4"==n[0]?e.setMatrix(n[1],this._newUniformInstances[r]):"float"==n[0]&&e.setFloat(n[1],this._newUniformInstances[r]);if(this._newSamplerInstances)for(var r in this._newSamplerInstances){var n;"sampler2D"==(n=r.toString().split("-"))[0]&&this._newSamplerInstances[r].isReady&&this._newSamplerInstances[r].isReady()&&e.setTexture(n[1],this._newSamplerInstances[r])}},e.prototype.ReviewUniform=function(t,e){if("uniform"==t&&this._newUniforms)for(var r=0;r<this._newUniforms.length;r++)-1==this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));if("sampler"==t&&this._newUniforms)for(r=0;r<this._newUniforms.length;r++)-1!=this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));return e},e.prototype.Builder=function(t,e,r,n,o,s){s&&this._customAttributes&&this._customAttributes.length>0&&s.push.apply(s,this._customAttributes),this.ReviewUniform("uniform",e),this.ReviewUniform("sampler",n);var i=this._createdShaderName;return _.Effect.ShadersStore[i+"VertexShader"]&&_.Effect.ShadersStore[i+"PixelShader"]||(_.Effect.ShadersStore[i+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),_.Effect.ShadersStore[i+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),i},e.prototype._injectCustomCode=function(t,e){var r=this._getCustomCode(e);for(var n in r){var o=r[n];if(o&&o.length>0){var s="#define "+n;t=t.replace(s,"\n"+o+"\n"+s)}}return t},e.prototype._getCustomCode=function(t){var e,r;return"vertex"===t?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(e=this._customUniform)||void 0===e?void 0:e.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(r=this._customUniform)||void 0===r?void 0:r.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_UPDATE_DIFFUSE:this.CustomParts.Fragment_Custom_Diffuse,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},e.prototype._afterBind=function(e,r,n){if(void 0===r&&(r=null),r){this.AttachAfterBind(e,r);try{t.prototype._afterBind.call(this,e,r,n)}catch(t){}}},e.prototype.AddUniform=function(t,e,r){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances={},this._newUniformInstances={}),r&&(-1!=e.indexOf("sampler")?this._newSamplerInstances[e+"-"+t]=r:this._newUniformInstances[e+"-"+t]=r),this._customUniform.push("uniform "+e+" "+t+";"),this._newUniforms.push(t),this},e.prototype.AddAttribute=function(t){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(t),this},e.prototype.Fragment_Begin=function(t){return this.CustomParts.Fragment_Begin=t,this},e.prototype.Fragment_Definitions=function(t){return this.CustomParts.Fragment_Definitions=t,this},e.prototype.Fragment_MainBegin=function(t){return this.CustomParts.Fragment_MainBegin=t,this},e.prototype.Fragment_MainEnd=function(t){return this.CustomParts.Fragment_MainEnd=t,this},e.prototype.Fragment_Custom_Diffuse=function(t){return this.CustomParts.Fragment_Custom_Diffuse=t.replace("result","diffuseColor"),this},e.prototype.Fragment_Custom_Alpha=function(t){return this.CustomParts.Fragment_Custom_Alpha=t.replace("result","alpha"),this},e.prototype.Fragment_Before_Lights=function(t){return this.CustomParts.Fragment_Before_Lights=t,this},e.prototype.Fragment_Before_Fog=function(t){return this.CustomParts.Fragment_Before_Fog=t,this},e.prototype.Fragment_Before_FragColor=function(t){return this.CustomParts.Fragment_Before_FragColor=t.replace("result","color"),this},e.prototype.Vertex_Begin=function(t){return this.CustomParts.Vertex_Begin=t,this},e.prototype.Vertex_Definitions=function(t){return this.CustomParts.Vertex_Definitions=t,this},e.prototype.Vertex_MainBegin=function(t){return this.CustomParts.Vertex_MainBegin=t,this},e.prototype.Vertex_Before_PositionUpdated=function(t){return this.CustomParts.Vertex_Before_PositionUpdated=t.replace("result","positionUpdated"),this},e.prototype.Vertex_Before_NormalUpdated=function(t){return this.CustomParts.Vertex_Before_NormalUpdated=t.replace("result","normalUpdated"),this},e.prototype.Vertex_After_WorldPosComputed=function(t){return this.CustomParts.Vertex_After_WorldPosComputed=t,this},e.prototype.Vertex_MainEnd=function(t){return this.CustomParts.Vertex_MainEnd=t,this},e.ShaderIndexer=1,e}(_.StandardMaterial);(0,_.RegisterClass)("BABYLON.CustomMaterial",f);var c=function(){},p=c,d=function(t){function e(r,n){var o=t.call(this,r,n,!0)||this;return o.CustomParts=new c,o.customShaderNameResolve=o.Builder,o.FragmentShader=_.Effect.ShadersStore.pbrPixelShader,o.VertexShader=_.Effect.ShadersStore.pbrVertexShader,o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,_.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,_.Effect.IncludesShadersStore.pbrBlockReflectivity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,_.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),e.ShaderIndexer++,o._createdShaderName="custompbr_"+e.ShaderIndexer,o}return u(e,t),e.prototype.AttachAfterBind=function(t,e){if(this._newUniformInstances)for(var r in this._newUniformInstances)"vec2"==(n=r.toString().split("-"))[0]?e.setVector2(n[1],this._newUniformInstances[r]):"vec3"==n[0]?this._newUniformInstances[r]instanceof _.Color3?e.setColor3(n[1],this._newUniformInstances[r]):e.setVector3(n[1],this._newUniformInstances[r]):"vec4"==n[0]?(this._newUniformInstances[r]instanceof _.Color4?e.setDirectColor4(n[1],this._newUniformInstances[r]):e.setVector4(n[1],this._newUniformInstances[r]),e.setVector4(n[1],this._newUniformInstances[r])):"mat4"==n[0]?e.setMatrix(n[1],this._newUniformInstances[r]):"float"==n[0]&&e.setFloat(n[1],this._newUniformInstances[r]);if(this._newSamplerInstances)for(var r in this._newSamplerInstances){var n;"sampler2D"==(n=r.toString().split("-"))[0]&&this._newSamplerInstances[r].isReady&&this._newSamplerInstances[r].isReady()&&e.setTexture(n[1],this._newSamplerInstances[r])}},e.prototype.ReviewUniform=function(t,e){if("uniform"==t&&this._newUniforms)for(var r=0;r<this._newUniforms.length;r++)-1==this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));if("sampler"==t&&this._newUniforms)for(r=0;r<this._newUniforms.length;r++)-1!=this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));return e},e.prototype.Builder=function(t,e,r,n,o,s,i){if(i){var a=i.processFinalCode;i.processFinalCode=function(t,e){if("vertex"===t)return a?a(t,e):e;var r=new _.ShaderCodeInliner(e);return r.inlineToken="#define pbr_inline",r.processCode(),a?a(t,r.code):r.code}}s&&this._customAttributes&&this._customAttributes.length>0&&s.push.apply(s,this._customAttributes),this.ReviewUniform("uniform",e),this.ReviewUniform("sampler",n);var u=this._createdShaderName;return _.Effect.ShadersStore[u+"VertexShader"]&&_.Effect.ShadersStore[u+"PixelShader"]||(_.Effect.ShadersStore[u+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),_.Effect.ShadersStore[u+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),u},e.prototype._injectCustomCode=function(t,e){var r=this._getCustomCode(e);for(var n in r){var o=r[n];if(o&&o.length>0){var s="#define "+n;t=t.replace(s,"\n"+o+"\n"+s)}}return t},e.prototype._getCustomCode=function(t){var e,r;return"vertex"===t?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(e=this._customUniform)||void 0===e?void 0:e.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(r=this._customUniform)||void 0===r?void 0:r.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_UPDATE_ALBEDO:this.CustomParts.Fragment_Custom_Albedo,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS:this.CustomParts.Fragment_Custom_MetallicRoughness,CUSTOM_FRAGMENT_UPDATE_MICROSURFACE:this.CustomParts.Fragment_Custom_MicroSurface,CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION:this.CustomParts.Fragment_Before_FinalColorComposition,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},e.prototype._afterBind=function(e,r,n){if(void 0===r&&(r=null),r){this.AttachAfterBind(e,r);try{t.prototype._afterBind.call(this,e,r,n)}catch(t){}}},e.prototype.AddUniform=function(t,e,r){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances={},this._newUniformInstances={}),r&&(-1!=e.indexOf("sampler")?this._newSamplerInstances[e+"-"+t]=r:this._newUniformInstances[e+"-"+t]=r),this._customUniform.push("uniform "+e+" "+t+";"),this._newUniforms.push(t),this},e.prototype.AddAttribute=function(t){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(t),this},e.prototype.Fragment_Begin=function(t){return this.CustomParts.Fragment_Begin=t,this},e.prototype.Fragment_Definitions=function(t){return this.CustomParts.Fragment_Definitions=t,this},e.prototype.Fragment_MainBegin=function(t){return this.CustomParts.Fragment_MainBegin=t,this},e.prototype.Fragment_Custom_Albedo=function(t){return this.CustomParts.Fragment_Custom_Albedo=t.replace("result","surfaceAlbedo"),this},e.prototype.Fragment_Custom_Alpha=function(t){return this.CustomParts.Fragment_Custom_Alpha=t.replace("result","alpha"),this},e.prototype.Fragment_Before_Lights=function(t){return this.CustomParts.Fragment_Before_Lights=t,this},e.prototype.Fragment_Custom_MetallicRoughness=function(t){return this.CustomParts.Fragment_Custom_MetallicRoughness=t,this},e.prototype.Fragment_Custom_MicroSurface=function(t){return this.CustomParts.Fragment_Custom_MicroSurface=t,this},e.prototype.Fragment_Before_Fog=function(t){return this.CustomParts.Fragment_Before_Fog=t,this},e.prototype.Fragment_Before_FinalColorComposition=function(t){return this.CustomParts.Fragment_Before_FinalColorComposition=t,this},e.prototype.Fragment_Before_FragColor=function(t){return this.CustomParts.Fragment_Before_FragColor=t.replace("result","color"),this},e.prototype.Fragment_MainEnd=function(t){return this.CustomParts.Fragment_MainEnd=t,this},e.prototype.Vertex_Begin=function(t){return this.CustomParts.Vertex_Begin=t,this},e.prototype.Vertex_Definitions=function(t){return this.CustomParts.Vertex_Definitions=t,this},e.prototype.Vertex_MainBegin=function(t){return this.CustomParts.Vertex_MainBegin=t,this},e.prototype.Vertex_Before_PositionUpdated=function(t){return this.CustomParts.Vertex_Before_PositionUpdated=t.replace("result","positionUpdated"),this},e.prototype.Vertex_Before_NormalUpdated=function(t){return this.CustomParts.Vertex_Before_NormalUpdated=t.replace("result","normalUpdated"),this},e.prototype.Vertex_After_WorldPosComputed=function(t){return this.CustomParts.Vertex_After_WorldPosComputed=t,this},e.prototype.Vertex_MainEnd=function(t){return this.CustomParts.Vertex_MainEnd=t,this},e.ShaderIndexer=1,e}(_.PBRMaterial);(0,_.RegisterClass)("BABYLON.PBRCustomMaterial",d);var l=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==l)for(var C in s)l.BABYLON[C]=s[C];const S=i;return o.default})()));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("babylonjs")):"function"==typeof define&&define.amd?define("babylonjs-materials",["babylonjs"],e):"object"==typeof exports?exports["babylonjs-materials"]=e(require("babylonjs")):t.MATERIALS=e(t.BABYLON)}("undefined"!=typeof self?self:"undefined"!=typeof global?global:this,(t=>(()=>{"use strict";var e={597:e=>{e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var s=r[t]={exports:{}};return e[t](s,s.exports,n),s.exports}n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var o={};n.d(o,{default:()=>S});var s={};n.r(s),n.d(s,{CustomMaterial:()=>f,CustomShaderStructure:()=>m,PBRCustomMaterial:()=>d,ShaderAlbedoParts:()=>c,ShaderAlebdoParts:()=>p,ShaderSpecialParts:()=>h});var i={};n.r(i),n.d(i,{CustomMaterial:()=>f,CustomShaderStructure:()=>m,PBRCustomMaterial:()=>d,ShaderAlbedoParts:()=>c,ShaderAlebdoParts:()=>p,ShaderSpecialParts:()=>h});var a=function(t,e){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},a(t,e)};function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;var _=n(597),m=function(){},h=function(){},f=function(t){function e(r,n){var o=t.call(this,r,n,!0)||this;return o.CustomParts=new h,o.customShaderNameResolve=o.Builder,o.FragmentShader=_.Effect.ShadersStore.defaultPixelShader,o.VertexShader=_.Effect.ShadersStore.defaultVertexShader,e.ShaderIndexer++,o._createdShaderName="custom_"+e.ShaderIndexer,o}return u(e,t),e.prototype.AttachAfterBind=function(t,e){if(this._newUniformInstances)for(var r in this._newUniformInstances)"vec2"==(n=r.toString().split("-"))[0]?e.setVector2(n[1],this._newUniformInstances[r]):"vec3"==n[0]?this._newUniformInstances[r]instanceof _.Color3?e.setColor3(n[1],this._newUniformInstances[r]):e.setVector3(n[1],this._newUniformInstances[r]):"vec4"==n[0]?(this._newUniformInstances[r]instanceof _.Color4?e.setDirectColor4(n[1],this._newUniformInstances[r]):e.setVector4(n[1],this._newUniformInstances[r]),e.setVector4(n[1],this._newUniformInstances[r])):"mat4"==n[0]?e.setMatrix(n[1],this._newUniformInstances[r]):"float"==n[0]&&e.setFloat(n[1],this._newUniformInstances[r]);if(this._newSamplerInstances)for(var r in this._newSamplerInstances){var n;"sampler2D"==(n=r.toString().split("-"))[0]&&this._newSamplerInstances[r].isReady&&this._newSamplerInstances[r].isReady()&&e.setTexture(n[1],this._newSamplerInstances[r])}},e.prototype.ReviewUniform=function(t,e){if("uniform"==t&&this._newUniforms)for(var r=0;r<this._newUniforms.length;r++)-1==this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));if("sampler"==t&&this._newUniforms)for(r=0;r<this._newUniforms.length;r++)-1!=this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));return e},e.prototype.Builder=function(t,e,r,n,o,s){s&&this._customAttributes&&this._customAttributes.length>0&&s.push.apply(s,this._customAttributes),this.ReviewUniform("uniform",e),this.ReviewUniform("sampler",n);var i=this._createdShaderName;return _.Effect.ShadersStore[i+"VertexShader"]&&_.Effect.ShadersStore[i+"PixelShader"]||(_.Effect.ShadersStore[i+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),_.Effect.ShadersStore[i+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),i},e.prototype._injectCustomCode=function(t,e){var r=this._getCustomCode(e);for(var n in r){var o=r[n];if(o&&o.length>0){var s="#define "+n;t=t.replace(s,"\n"+o+"\n"+s)}}return t},e.prototype._getCustomCode=function(t){var e,r;return"vertex"===t?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(e=this._customUniform)||void 0===e?void 0:e.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(r=this._customUniform)||void 0===r?void 0:r.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_UPDATE_DIFFUSE:this.CustomParts.Fragment_Custom_Diffuse,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},e.prototype._afterBind=function(e,r,n){if(void 0===r&&(r=null),r){this.AttachAfterBind(e,r);try{t.prototype._afterBind.call(this,e,r,n)}catch(t){}}},e.prototype.AddUniform=function(t,e,r){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances={},this._newUniformInstances={}),r&&(-1!=e.indexOf("sampler")?this._newSamplerInstances[e+"-"+t]=r:this._newUniformInstances[e+"-"+t]=r),this._customUniform.push("uniform "+e+" "+t+";"),this._newUniforms.push(t),this},e.prototype.AddAttribute=function(t){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(t),this},e.prototype.Fragment_Begin=function(t){return this.CustomParts.Fragment_Begin=t,this},e.prototype.Fragment_Definitions=function(t){return this.CustomParts.Fragment_Definitions=t,this},e.prototype.Fragment_MainBegin=function(t){return this.CustomParts.Fragment_MainBegin=t,this},e.prototype.Fragment_MainEnd=function(t){return this.CustomParts.Fragment_MainEnd=t,this},e.prototype.Fragment_Custom_Diffuse=function(t){return this.CustomParts.Fragment_Custom_Diffuse=t.replace("result","diffuseColor"),this},e.prototype.Fragment_Custom_Alpha=function(t){return this.CustomParts.Fragment_Custom_Alpha=t.replace("result","alpha"),this},e.prototype.Fragment_Before_Lights=function(t){return this.CustomParts.Fragment_Before_Lights=t,this},e.prototype.Fragment_Before_Fog=function(t){return this.CustomParts.Fragment_Before_Fog=t,this},e.prototype.Fragment_Before_FragColor=function(t){return this.CustomParts.Fragment_Before_FragColor=t.replace("result","color"),this},e.prototype.Vertex_Begin=function(t){return this.CustomParts.Vertex_Begin=t,this},e.prototype.Vertex_Definitions=function(t){return this.CustomParts.Vertex_Definitions=t,this},e.prototype.Vertex_MainBegin=function(t){return this.CustomParts.Vertex_MainBegin=t,this},e.prototype.Vertex_Before_PositionUpdated=function(t){return this.CustomParts.Vertex_Before_PositionUpdated=t.replace("result","positionUpdated"),this},e.prototype.Vertex_Before_NormalUpdated=function(t){return this.CustomParts.Vertex_Before_NormalUpdated=t.replace("result","normalUpdated"),this},e.prototype.Vertex_After_WorldPosComputed=function(t){return this.CustomParts.Vertex_After_WorldPosComputed=t,this},e.prototype.Vertex_MainEnd=function(t){return this.CustomParts.Vertex_MainEnd=t,this},e.ShaderIndexer=1,e}(_.StandardMaterial);(0,_.RegisterClass)("BABYLON.CustomMaterial",f);var c=function(){},p=c,d=function(t){function e(r,n){var o=t.call(this,r,n,!0)||this;return o.CustomParts=new c,o.customShaderNameResolve=o.Builder,o.FragmentShader=_.Effect.ShadersStore.pbrPixelShader,o.VertexShader=_.Effect.ShadersStore.pbrVertexShader,o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g,_.Effect.IncludesShadersStore.pbrBlockAlbedoOpacity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockReflectivity>/g,_.Effect.IncludesShadersStore.pbrBlockReflectivity),o.FragmentShader=o.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g,_.Effect.IncludesShadersStore.pbrBlockFinalColorComposition),e.ShaderIndexer++,o._createdShaderName="custompbr_"+e.ShaderIndexer,o}return u(e,t),e.prototype.AttachAfterBind=function(t,e){if(this._newUniformInstances)for(var r in this._newUniformInstances)"vec2"==(n=r.toString().split("-"))[0]?e.setVector2(n[1],this._newUniformInstances[r]):"vec3"==n[0]?this._newUniformInstances[r]instanceof _.Color3?e.setColor3(n[1],this._newUniformInstances[r]):e.setVector3(n[1],this._newUniformInstances[r]):"vec4"==n[0]?(this._newUniformInstances[r]instanceof _.Color4?e.setDirectColor4(n[1],this._newUniformInstances[r]):e.setVector4(n[1],this._newUniformInstances[r]),e.setVector4(n[1],this._newUniformInstances[r])):"mat4"==n[0]?e.setMatrix(n[1],this._newUniformInstances[r]):"float"==n[0]&&e.setFloat(n[1],this._newUniformInstances[r]);if(this._newSamplerInstances)for(var r in this._newSamplerInstances){var n;"sampler2D"==(n=r.toString().split("-"))[0]&&this._newSamplerInstances[r].isReady&&this._newSamplerInstances[r].isReady()&&e.setTexture(n[1],this._newSamplerInstances[r])}},e.prototype.ReviewUniform=function(t,e){if("uniform"==t&&this._newUniforms)for(var r=0;r<this._newUniforms.length;r++)-1==this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));if("sampler"==t&&this._newUniforms)for(r=0;r<this._newUniforms.length;r++)-1!=this._customUniform[r].indexOf("sampler")&&e.push(this._newUniforms[r].replace(/\[\d*\]/g,""));return e},e.prototype.Builder=function(t,e,r,n,o,s,i){if(i){var a=i.processFinalCode;i.processFinalCode=function(t,e){if("vertex"===t)return a?a(t,e):e;var r=new _.ShaderCodeInliner(e);return r.inlineToken="#define pbr_inline",r.processCode(),a?a(t,r.code):r.code}}s&&this._customAttributes&&this._customAttributes.length>0&&s.push.apply(s,this._customAttributes),this.ReviewUniform("uniform",e),this.ReviewUniform("sampler",n);var u=this._createdShaderName;return _.Effect.ShadersStore[u+"VertexShader"]&&_.Effect.ShadersStore[u+"PixelShader"]||(_.Effect.ShadersStore[u+"VertexShader"]=this._injectCustomCode(this.VertexShader,"vertex"),_.Effect.ShadersStore[u+"PixelShader"]=this._injectCustomCode(this.FragmentShader,"fragment")),u},e.prototype._injectCustomCode=function(t,e){var r=this._getCustomCode(e);for(var n in r){var o=r[n];if(o&&o.length>0){var s="#define "+n;t=t.replace(s,"\n"+o+"\n"+s)}}return t},e.prototype._getCustomCode=function(t){var e,r;return"vertex"===t?{CUSTOM_VERTEX_BEGIN:this.CustomParts.Vertex_Begin,CUSTOM_VERTEX_DEFINITIONS:((null===(e=this._customUniform)||void 0===e?void 0:e.join("\n"))||"")+(this.CustomParts.Vertex_Definitions||""),CUSTOM_VERTEX_MAIN_BEGIN:this.CustomParts.Vertex_MainBegin,CUSTOM_VERTEX_UPDATE_POSITION:this.CustomParts.Vertex_Before_PositionUpdated,CUSTOM_VERTEX_UPDATE_NORMAL:this.CustomParts.Vertex_Before_NormalUpdated,CUSTOM_VERTEX_MAIN_END:this.CustomParts.Vertex_MainEnd,CUSTOM_VERTEX_UPDATE_WORLDPOS:this.CustomParts.Vertex_After_WorldPosComputed}:{CUSTOM_FRAGMENT_BEGIN:this.CustomParts.Fragment_Begin,CUSTOM_FRAGMENT_MAIN_BEGIN:this.CustomParts.Fragment_MainBegin,CUSTOM_FRAGMENT_DEFINITIONS:((null===(r=this._customUniform)||void 0===r?void 0:r.join("\n"))||"")+(this.CustomParts.Fragment_Definitions||""),CUSTOM_FRAGMENT_UPDATE_ALBEDO:this.CustomParts.Fragment_Custom_Albedo,CUSTOM_FRAGMENT_UPDATE_ALPHA:this.CustomParts.Fragment_Custom_Alpha,CUSTOM_FRAGMENT_BEFORE_LIGHTS:this.CustomParts.Fragment_Before_Lights,CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS:this.CustomParts.Fragment_Custom_MetallicRoughness,CUSTOM_FRAGMENT_UPDATE_MICROSURFACE:this.CustomParts.Fragment_Custom_MicroSurface,CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION:this.CustomParts.Fragment_Before_FinalColorComposition,CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR:this.CustomParts.Fragment_Before_FragColor,CUSTOM_FRAGMENT_MAIN_END:this.CustomParts.Fragment_MainEnd,CUSTOM_FRAGMENT_BEFORE_FOG:this.CustomParts.Fragment_Before_Fog}},e.prototype._afterBind=function(e,r,n){if(void 0===r&&(r=null),r){this.AttachAfterBind(e,r);try{t.prototype._afterBind.call(this,e,r,n)}catch(t){}}},e.prototype.AddUniform=function(t,e,r){return this._customUniform||(this._customUniform=new Array,this._newUniforms=new Array,this._newSamplerInstances={},this._newUniformInstances={}),r&&(-1!=e.indexOf("sampler")?this._newSamplerInstances[e+"-"+t]=r:this._newUniformInstances[e+"-"+t]=r),this._customUniform.push("uniform "+e+" "+t+";"),this._newUniforms.push(t),this},e.prototype.AddAttribute=function(t){return this._customAttributes||(this._customAttributes=[]),this._customAttributes.push(t),this},e.prototype.Fragment_Begin=function(t){return this.CustomParts.Fragment_Begin=t,this},e.prototype.Fragment_Definitions=function(t){return this.CustomParts.Fragment_Definitions=t,this},e.prototype.Fragment_MainBegin=function(t){return this.CustomParts.Fragment_MainBegin=t,this},e.prototype.Fragment_Custom_Albedo=function(t){return this.CustomParts.Fragment_Custom_Albedo=t.replace("result","surfaceAlbedo"),this},e.prototype.Fragment_Custom_Alpha=function(t){return this.CustomParts.Fragment_Custom_Alpha=t.replace("result","alpha"),this},e.prototype.Fragment_Before_Lights=function(t){return this.CustomParts.Fragment_Before_Lights=t,this},e.prototype.Fragment_Custom_MetallicRoughness=function(t){return this.CustomParts.Fragment_Custom_MetallicRoughness=t,this},e.prototype.Fragment_Custom_MicroSurface=function(t){return this.CustomParts.Fragment_Custom_MicroSurface=t,this},e.prototype.Fragment_Before_Fog=function(t){return this.CustomParts.Fragment_Before_Fog=t,this},e.prototype.Fragment_Before_FinalColorComposition=function(t){return this.CustomParts.Fragment_Before_FinalColorComposition=t,this},e.prototype.Fragment_Before_FragColor=function(t){return this.CustomParts.Fragment_Before_FragColor=t.replace("result","color"),this},e.prototype.Fragment_MainEnd=function(t){return this.CustomParts.Fragment_MainEnd=t,this},e.prototype.Vertex_Begin=function(t){return this.CustomParts.Vertex_Begin=t,this},e.prototype.Vertex_Definitions=function(t){return this.CustomParts.Vertex_Definitions=t,this},e.prototype.Vertex_MainBegin=function(t){return this.CustomParts.Vertex_MainBegin=t,this},e.prototype.Vertex_Before_PositionUpdated=function(t){return this.CustomParts.Vertex_Before_PositionUpdated=t.replace("result","positionUpdated"),this},e.prototype.Vertex_Before_NormalUpdated=function(t){return this.CustomParts.Vertex_Before_NormalUpdated=t.replace("result","normalUpdated"),this},e.prototype.Vertex_After_WorldPosComputed=function(t){return this.CustomParts.Vertex_After_WorldPosComputed=t,this},e.prototype.Vertex_MainEnd=function(t){return this.CustomParts.Vertex_MainEnd=t,this},e.ShaderIndexer=1,e}(_.PBRMaterial);(0,_.RegisterClass)("BABYLON.PBRCustomMaterial",d);var l=void 0!==n.g?n.g:"undefined"!=typeof window?window:void 0;if(void 0!==l)for(var C in s)l.BABYLON[C]=s[C];const S=i;return o.default})()));
//# sourceMappingURL=babylon.customMaterial.min.js.map
{
"name": "babylonjs-materials",
"version": "7.21.0",
"version": "7.21.1",
"main": "babylonjs.materials.js",

@@ -18,3 +18,3 @@ "types": "babylonjs.materials.module.d.ts",

"dependencies": {
"babylonjs": "^7.21.0"
"babylonjs": "^7.21.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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc