@babylonjs/materials 5.0.0-alpha.61 → 5.0.0-alpha.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cell/cell.fragment.js +1 -1
- package/cell/cell.fragment.js.map +1 -1
- package/cell/cell.vertex.js +1 -1
- package/cell/cell.vertex.js.map +1 -1
- package/custom/customMaterial.d.ts +2 -0
- package/custom/customMaterial.js +6 -1
- package/custom/customMaterial.js.map +1 -1
- package/custom/pbrCustomMaterial.d.ts +2 -0
- package/custom/pbrCustomMaterial.js +6 -1
- package/custom/pbrCustomMaterial.js.map +1 -1
- package/fire/fire.fragment.js +1 -1
- package/fire/fire.fragment.js.map +1 -1
- package/fire/fire.vertex.js +1 -1
- package/fire/fire.vertex.js.map +1 -1
- package/fur/fur.fragment.js +1 -1
- package/fur/fur.fragment.js.map +1 -1
- package/fur/fur.vertex.js +1 -1
- package/fur/fur.vertex.js.map +1 -1
- package/gradient/gradient.fragment.js +1 -1
- package/gradient/gradient.fragment.js.map +1 -1
- package/gradient/gradient.vertex.js +1 -1
- package/gradient/gradient.vertex.js.map +1 -1
- package/grid/grid.fragment.js +1 -1
- package/grid/grid.fragment.js.map +1 -1
- package/grid/grid.vertex.js +1 -1
- package/grid/grid.vertex.js.map +1 -1
- package/grid/gridMaterial.d.ts +4 -0
- package/grid/gridMaterial.js +12 -0
- package/grid/gridMaterial.js.map +1 -1
- package/lava/lava.fragment.js +1 -1
- package/lava/lava.fragment.js.map +1 -1
- package/lava/lava.vertex.js +1 -1
- package/lava/lava.vertex.js.map +1 -1
- package/mix/mix.fragment.js +1 -1
- package/mix/mix.fragment.js.map +1 -1
- package/mix/mix.vertex.js +1 -1
- package/mix/mix.vertex.js.map +1 -1
- package/normal/normal.fragment.js +1 -1
- package/normal/normal.fragment.js.map +1 -1
- package/normal/normal.vertex.js +1 -1
- package/normal/normal.vertex.js.map +1 -1
- package/package.json +2 -2
- package/shadowOnly/shadowOnly.fragment.js +1 -1
- package/shadowOnly/shadowOnly.fragment.js.map +1 -1
- package/shadowOnly/shadowOnly.vertex.js +1 -1
- package/shadowOnly/shadowOnly.vertex.js.map +1 -1
- package/simple/simple.fragment.js +1 -1
- package/simple/simple.fragment.js.map +1 -1
- package/simple/simple.vertex.js +1 -1
- package/simple/simple.vertex.js.map +1 -1
- package/sky/sky.fragment.js +1 -1
- package/sky/sky.fragment.js.map +1 -1
- package/sky/sky.vertex.js +1 -1
- package/sky/sky.vertex.js.map +1 -1
- package/terrain/terrain.fragment.js +1 -1
- package/terrain/terrain.fragment.js.map +1 -1
- package/terrain/terrain.vertex.js +1 -1
- package/terrain/terrain.vertex.js.map +1 -1
- package/triPlanar/triplanar.fragment.js +1 -1
- package/triPlanar/triplanar.fragment.js.map +1 -1
- package/triPlanar/triplanar.vertex.js +1 -1
- package/triPlanar/triplanar.vertex.js.map +1 -1
- package/water/water.fragment.js +1 -1
- package/water/water.fragment.js.map +1 -1
- package/water/water.vertex.js +1 -1
- package/water/water.vertex.js.map +1 -1
package/cell/cell.fragment.js
CHANGED
@@ -12,7 +12,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
|
|
12
12
|
import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
|
14
14
|
var name = 'cellPixelShader';
|
15
|
-
var shader = "precision highp float;\n\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\nvoid main(void)\n{\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n}";
|
15
|
+
var shader = "precision highp float;\n\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
|
16
16
|
ShaderStore.ShadersStore[name] = shader;
|
17
17
|
/** @hidden */
|
18
18
|
export var cellPixelShader = { name: name, shader: shader };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cell.fragment.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/cell/cell.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,wDAAwD,CAAC;AAChE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,gEAAgE,CAAC;AACxE,OAAO,iEAAiE,CAAC;AACzE,OAAO,qEAAqE,CAAC;AAC7E,OAAO,+DAA+D,CAAC;AACvE,OAAO,0DAA0D,CAAC;AAClE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,qEAAqE,CAAC;AAE7E,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"cell.fragment.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/cell/cell.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,wDAAwD,CAAC;AAChE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,gEAAgE,CAAC;AACxE,OAAO,iEAAiE,CAAC;AACzE,OAAO,qEAAqE,CAAC;AAC7E,OAAO,+DAA+D,CAAC;AACvE,OAAO,0DAA0D,CAAC;AAClE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,qEAAqE,CAAC;AAE7E,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,snFAuHX,CAAC;AAEH,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAI,eAAe,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["import { ShaderStore } from \"@babylonjs/core/Engines/shaderStore\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/helperFunctions\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/depthPrePass\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nlet name = 'cellPixelShader';\nlet shader = `precision highp float;\n\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\n\nvec3 computeCustomDiffuseLighting(lightingInfo info,vec3 diffuseBase,float shadow)\n{\ndiffuseBase=info.diffuse*shadow;\n#ifdef CELLBASIC\nfloat level=1.0;\nif (info.ndl<0.5)\nlevel=0.5;\ndiffuseBase.rgb*vec3(level,level,level);\n#else\nfloat ToonThresholds[4];\nToonThresholds[0]=0.95;\nToonThresholds[1]=0.5;\nToonThresholds[2]=0.2;\nToonThresholds[3]=0.03;\nfloat ToonBrightnessLevels[5];\nToonBrightnessLevels[0]=1.0;\nToonBrightnessLevels[1]=0.8;\nToonBrightnessLevels[2]=0.6;\nToonBrightnessLevels[3]=0.35;\nToonBrightnessLevels[4]=0.2;\nif (info.ndl>ToonThresholds[0])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[0];\n}\nelse if (info.ndl>ToonThresholds[1])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[1];\n}\nelse if (info.ndl>ToonThresholds[2])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[2];\n}\nelse if (info.ndl>ToonThresholds[3])\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[3];\n}\nelse\n{\ndiffuseBase.rgb*=ToonBrightnessLevels[4];\n}\n#endif\nreturn max(diffuseBase,vec3(0.2));\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n\nlightingInfo info;\nvec3 diffuseBase=vec3(0.,0.,0.);\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor,0.0,1.0)*baseColor.rgb;\n\nvec4 color=vec4(finalDiffuse,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport var cellPixelShader = { name, shader };\n"]}
|
package/cell/cell.vertex.js
CHANGED
@@ -13,7 +13,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
|
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
14
14
|
import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
|
15
15
|
var name = 'cellVertexShader';
|
16
|
-
var shader = "precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";
|
16
|
+
var shader = "precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";
|
17
17
|
ShaderStore.ShadersStore[name] = shader;
|
18
18
|
/** @hidden */
|
19
19
|
export var cellVertexShader = { name: name, shader: shader };
|
package/cell/cell.vertex.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"cell.vertex.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/cell/cell.vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wEAAwE,CAAC;AAChF,OAAO,6DAA6D,CAAC;AACrE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,6DAA6D,CAAC;AACrE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,wDAAwD,CAAC;AAChE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAE9D,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"cell.vertex.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/cell/cell.vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wEAAwE,CAAC;AAChF,OAAO,6DAA6D,CAAC;AACrE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,6DAA6D,CAAC;AACrE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,wDAAwD,CAAC;AAChE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAE9D,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,2nDAoFZ,CAAC;AAEF,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAI,gBAAgB,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["import { ShaderStore } from \"@babylonjs/core/Engines/shaderStore\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/instancesVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bonesVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'cellVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport var cellVertexShader = { name, shader };\n"]}
|
@@ -14,6 +14,7 @@ export declare class ShaderSpecialParts {
|
|
14
14
|
Fragment_Begin: string;
|
15
15
|
Fragment_Definitions: string;
|
16
16
|
Fragment_MainBegin: string;
|
17
|
+
Fragment_MainEnd: string;
|
17
18
|
Fragment_Custom_Diffuse: string;
|
18
19
|
Fragment_Before_Lights: string;
|
19
20
|
Fragment_Before_Fog: string;
|
@@ -52,6 +53,7 @@ export declare class CustomMaterial extends StandardMaterial {
|
|
52
53
|
Fragment_Begin(shaderPart: string): CustomMaterial;
|
53
54
|
Fragment_Definitions(shaderPart: string): CustomMaterial;
|
54
55
|
Fragment_MainBegin(shaderPart: string): CustomMaterial;
|
56
|
+
Fragment_MainEnd(shaderPart: string): CustomMaterial;
|
55
57
|
Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
|
56
58
|
Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
|
57
59
|
Fragment_Before_Lights(shaderPart: string): CustomMaterial;
|
package/custom/customMaterial.js
CHANGED
@@ -112,7 +112,8 @@ var CustomMaterial = /** @class */ (function (_super) {
|
|
112
112
|
.replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : ""))
|
113
113
|
.replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
|
114
114
|
.replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : ""))
|
115
|
-
.replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""))
|
115
|
+
.replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""))
|
116
|
+
.replace('#define CUSTOM_FRAGMENT_MAIN_END', (this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : ""));
|
116
117
|
if (this.CustomParts.Fragment_Before_Fog) {
|
117
118
|
Effect.ShadersStore[name + "PixelShader"] = Effect.ShadersStore[name + "PixelShader"].replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', this.CustomParts.Fragment_Before_Fog);
|
118
119
|
}
|
@@ -158,6 +159,10 @@ var CustomMaterial = /** @class */ (function (_super) {
|
|
158
159
|
this.CustomParts.Fragment_MainBegin = shaderPart;
|
159
160
|
return this;
|
160
161
|
};
|
162
|
+
CustomMaterial.prototype.Fragment_MainEnd = function (shaderPart) {
|
163
|
+
this.CustomParts.Fragment_MainEnd = shaderPart;
|
164
|
+
return this;
|
165
|
+
};
|
161
166
|
CustomMaterial.prototype.Fragment_Custom_Diffuse = function (shaderPart) {
|
162
167
|
this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace("result", "diffuseColor");
|
163
168
|
return this;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"customMaterial.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/custom/customMaterial.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,EAAE,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D,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,sDAA6B,GAApC,UAAqC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uCAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAzOa,4BAAa,GAAG,CAAC,CAAC;IA0OpC,qBAAC;CAAA,AA3OD,CAAoC,gBAAgB,GA2OnD;SA3OY,cAAc;AA6O3B,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\nimport { MaterialDefines } from \"@babylonjs/core/Materials/materialDefines\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { RegisterClass } from '@babylonjs/core/Misc/typeStore';\n\nexport class CustomShaderStructure {\n\n public FragmentStore: string;\n public VertexStore: string;\n\n constructor() { }\n}\n\nexport class ShaderSpecialParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n\n // diffuseColor\n public Fragment_Custom_Diffuse: string;\n // lights\n public Fragment_Before_Lights: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // worldPosComputed\n public Vertex_After_WorldPosComputed: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class CustomMaterial extends StandardMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderSpecialParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: { [name: string]: any };\n _newSamplerInstances: { [name: string]: Texture };\n _customAttributes: string[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\n if (this._newUniformInstances) {\n for (let el in this._newUniformInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n }\n if (this._newSamplerInstances) {\n for (let el in this._newSamplerInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string {\n\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\n attributes.push(...this._customAttributes);\n }\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n CustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + CustomMaterial.ShaderIndexer;\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n if (this.CustomParts.Vertex_After_WorldPosComputed) {\n Effect.ShadersStore[name + \"VertexShader\"] = Effect.ShadersStore[name + \"VertexShader\"].replace('#define CUSTOM_VERTEX_UPDATE_WORLDPOS', this.CustomParts.Vertex_After_WorldPosComputed);\n }\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"));\n\n if (this.CustomParts.Fragment_Before_Fog) {\n Effect.ShadersStore[name + \"PixelShader\"] = Effect.ShadersStore[name + \"PixelShader\"].replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', this.CustomParts.Fragment_Before_Fog);\n }\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderSpecialParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"defaultPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"defaultVertexShader\"];\n }\n\n public AddUniform(name: string, kind: string, param: any): CustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = {};\n this._newUniformInstances = {};\n }\n if (param) {\n if (kind.indexOf(\"sampler\") != -1) {\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\n }\n else {\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public AddAttribute(name: string): CustomMaterial {\n if (!this._customAttributes) {\n this._customAttributes = [];\n }\n\n this._customAttributes.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace(\"result\", \"diffuseColor\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\nRegisterClass(\"BABYLON.CustomMaterial\", CustomMaterial);\n"]}
|
1
|
+
{"version":3,"file":"customMaterial.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/custom/customMaterial.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D;IAKI;IAAgB,CAAC;IACrB,4BAAC;AAAD,CAAC,AAND,IAMC;;AAED;IAEI;IAAgB,CAAC;IAiCrB,yBAAC;AAAD,CAAC,AAnCD,IAmCC;;AAED;IAAoC,kCAAgB;IA0HhD,wBAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAMrB;QALG,KAAI,CAAC,WAAW,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAC5C,KAAI,CAAC,uBAAuB,GAAG,KAAI,CAAC,OAAO,CAAC;QAE5C,KAAI,CAAC,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;QAChE,KAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,qBA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C5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uCAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IA/Oa,4BAAa,GAAG,CAAC,CAAC;IAgPpC,qBAAC;CAAA,AAjPD,CAAoC,gBAAgB,GAiPnD;SAjPY,cAAc;AAmP3B,aAAa,CAAC,wBAAwB,EAAE,cAAc,CAAC,CAAC","sourcesContent":["import { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\nimport { MaterialDefines } from \"@babylonjs/core/Materials/materialDefines\";\nimport { StandardMaterial } from \"@babylonjs/core/Materials/standardMaterial\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { RegisterClass } from '@babylonjs/core/Misc/typeStore';\n\nexport class CustomShaderStructure {\n\n public FragmentStore: string;\n public VertexStore: string;\n\n constructor() { }\n}\n\nexport class ShaderSpecialParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n public Fragment_MainEnd: string;\n\n // diffuseColor\n public Fragment_Custom_Diffuse: string;\n // lights\n public Fragment_Before_Lights: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // worldPosComputed\n public Vertex_After_WorldPosComputed: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class CustomMaterial extends StandardMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderSpecialParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: { [name: string]: any };\n _newSamplerInstances: { [name: string]: Texture };\n _customAttributes: string[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\n if (this._newUniformInstances) {\n for (let el in this._newUniformInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n }\n if (this._newSamplerInstances) {\n for (let el in this._newSamplerInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[]): string {\n\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\n attributes.push(...this._customAttributes);\n }\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n CustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + CustomMaterial.ShaderIndexer;\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n if (this.CustomParts.Vertex_After_WorldPosComputed) {\n Effect.ShadersStore[name + \"VertexShader\"] = Effect.ShadersStore[name + \"VertexShader\"].replace('#define CUSTOM_VERTEX_UPDATE_WORLDPOS', this.CustomParts.Vertex_After_WorldPosComputed);\n }\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_END', (this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : \"\"));\n\n if (this.CustomParts.Fragment_Before_Fog) {\n Effect.ShadersStore[name + \"PixelShader\"] = Effect.ShadersStore[name + \"PixelShader\"].replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', this.CustomParts.Fragment_Before_Fog);\n }\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderSpecialParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"defaultPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"defaultVertexShader\"];\n }\n\n public AddUniform(name: string, kind: string, param: any): CustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = {};\n this._newUniformInstances = {};\n }\n if (param) {\n if (kind.indexOf(\"sampler\") != -1) {\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\n }\n else {\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public AddAttribute(name: string): CustomMaterial {\n if (!this._customAttributes) {\n this._customAttributes = [];\n }\n\n this._customAttributes.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_MainEnd(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_MainEnd = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Diffuse = shaderPart.replace(\"result\", \"diffuseColor\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): CustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_After_WorldPosComputed(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): CustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\nRegisterClass(\"BABYLON.CustomMaterial\", CustomMaterial);\n"]}
|
@@ -10,6 +10,7 @@ export declare class ShaderAlebdoParts {
|
|
10
10
|
Fragment_Begin: string;
|
11
11
|
Fragment_Definitions: string;
|
12
12
|
Fragment_MainBegin: string;
|
13
|
+
Fragment_MainEnd: string;
|
13
14
|
Fragment_Custom_Albedo: string;
|
14
15
|
Fragment_Before_Lights: string;
|
15
16
|
Fragment_Custom_MetallicRoughness: string;
|
@@ -59,6 +60,7 @@ export declare class PBRCustomMaterial extends PBRMaterial {
|
|
59
60
|
Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
|
60
61
|
Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial;
|
61
62
|
Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
|
63
|
+
Fragment_MainEnd(shaderPart: string): PBRCustomMaterial;
|
62
64
|
Vertex_Begin(shaderPart: string): PBRCustomMaterial;
|
63
65
|
Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
|
64
66
|
Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
|
@@ -125,7 +125,8 @@ var PBRCustomMaterial = /** @class */ (function (_super) {
|
|
125
125
|
.replace('#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS', (this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : ""))
|
126
126
|
.replace('#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE', (this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : ""))
|
127
127
|
.replace('#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION', (this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : ""))
|
128
|
-
.replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""))
|
128
|
+
.replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""))
|
129
|
+
.replace('#define CUSTOM_FRAGMENT_MAIN_END', (this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : ""));
|
129
130
|
if (this.CustomParts.Fragment_Before_Fog) {
|
130
131
|
Effect.ShadersStore[name + "PixelShader"] = Effect.ShadersStore[name + "PixelShader"].replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', this.CustomParts.Fragment_Before_Fog);
|
131
132
|
}
|
@@ -203,6 +204,10 @@ var PBRCustomMaterial = /** @class */ (function (_super) {
|
|
203
204
|
this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
|
204
205
|
return this;
|
205
206
|
};
|
207
|
+
PBRCustomMaterial.prototype.Fragment_MainEnd = function (shaderPart) {
|
208
|
+
this.CustomParts.Fragment_MainEnd = shaderPart;
|
209
|
+
return this;
|
210
|
+
};
|
206
211
|
PBRCustomMaterial.prototype.Vertex_Begin = function (shaderPart) {
|
207
212
|
this.CustomParts.Vertex_Begin = shaderPart;
|
208
213
|
return this;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pbrCustomMaterial.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/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7QD,CAAuC,WAAW,GA6QjD;SA7QY,iBAAiB;AA+Q9B,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\nimport { MaterialDefines } from \"@babylonjs/core/Materials/materialDefines\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { RegisterClass } from '@babylonjs/core/Misc/typeStore';\nimport { ShaderCodeInliner } from \"@babylonjs/core/Engines/Processors/shaderCodeInliner\";\nimport { ICustomShaderNameResolveOptions } from \"@babylonjs/core/Materials/material\";\n\nexport class ShaderAlebdoParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n\n // albedoColor\n public Fragment_Custom_Albedo: string;\n // lights\n public Fragment_Before_Lights: string;\n // roughness\n public Fragment_Custom_MetallicRoughness: string;\n // microsurface\n public Fragment_Custom_MicroSurface: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n // color composition\n public Fragment_Before_FinalColorComposition: string;\n // frag color\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // worldPosComputed\n public Vertex_After_WorldPosComputed: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class PBRCustomMaterial extends PBRMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderAlebdoParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: { [name: string]: any };\n _newSamplerInstances: { [name: string]: Texture };\n _customAttributes: string[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\n if (this._newUniformInstances) {\n for (let el in this._newUniformInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n }\n if (this._newSamplerInstances) {\n for (let el in this._newSamplerInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions): string {\n if (options) {\n const currentProcessing = options.processFinalCode;\n options.processFinalCode = (type: string, code: string) => {\n if (type === \"vertex\") {\n return currentProcessing ? currentProcessing(type, code) : code;\n }\n const sci = new ShaderCodeInliner(code);\n sci.inlineToken = \"#define pbr_inline\";\n sci.processCode();\n return currentProcessing ? currentProcessing(type, sci.code) : sci.code;\n };\n }\n\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\n attributes.push(...this._customAttributes);\n }\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n PBRCustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + PBRCustomMaterial.ShaderIndexer;\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n if (this.CustomParts.Vertex_After_WorldPosComputed) {\n Effect.ShadersStore[name + \"VertexShader\"] = Effect.ShadersStore[name + \"VertexShader\"].replace('#define CUSTOM_VERTEX_UPDATE_WORLDPOS', this.CustomParts.Vertex_After_WorldPosComputed);\n }\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALBEDO', (this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS', (this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE', (this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION', (this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"));\n\n if (this.CustomParts.Fragment_Before_Fog) {\n Effect.ShadersStore[name + \"PixelShader\"] = Effect.ShadersStore[name + \"PixelShader\"].replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', this.CustomParts.Fragment_Before_Fog);\n }\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderAlebdoParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\n\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore[\"pbrBlockAlbedoOpacity\"]);\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore[\"pbrBlockReflectivity\"]);\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore[\"pbrBlockFinalColorComposition\"]);\n }\n\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = {};\n this._newUniformInstances = {};\n }\n if (param) {\n if (kind.indexOf(\"sampler\") != -1) {\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\n }\n else {\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public AddAttribute(name: string): PBRCustomMaterial {\n if (!this._customAttributes) {\n this._customAttributes = [];\n }\n\n this._customAttributes.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\nRegisterClass(\"BABYLON.PBRCustomMaterial\", PBRCustomMaterial);\n"]}
|
1
|
+
{"version":3,"file":"pbrCustomMaterial.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/custom/pbrCustomMaterial.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF;IAEI;IAAgB,CAAC;IAuCrB,wBAAC;AAAD,CAAC,AAzCD,IAyCC;;AAED;IAAuC,qCAAW;IAyI9C,2BAAY,IAAY,EAAE,KAAY;QAAtC,YACI,kBAAM,IAAI,EAAE,KAAK,CAAC,SAUrB;QATG,KAAI,CAAC,WAAW,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAC3C,KAAI,CAAC,uBAAuB,GAAG,KAAI,CAAC,OAAO,CAAC;QAE5C,KAAI,CAAC,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;QAC5D,KAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAE3D,KAAI,CAAC,cAAc,GAAG,KAAI,CAAC,cAAc,CAAC,OAAO,CAAC,kCAAkC,EAAE,MAAM,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,CAAC;QAC5I,KAAI,CAAC,cAAc,GAAG,KAAI,CAAC,cAAc,CAAC,OAAO,CAAC,iCAAiC,EAAE,MAAM,CAAC,oBAAoB,CAAC,sBAAsB,C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6B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACjG,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,uDAA2B,GAAlC,UAAmC,UAAkB;QACjD,IAAI,CAAC,WAAW,CAAC,2BAA2B,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;QAC7F,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,yDAA6B,GAApC,UAAqC,UAAkB;QACnD,IAAI,CAAC,WAAW,CAAC,6BAA6B,GAAG,UAAU,CAAC;QAC5D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,0CAAc,GAArB,UAAsB,UAAkB;QACpC,IAAI,CAAC,WAAW,CAAC,cAAc,GAAG,UAAU,CAAC;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAjRa,+BAAa,GAAG,CAAC,CAAC;IAkRpC,wBAAC;CAAA,AAnRD,CAAuC,WAAW,GAmRjD;SAnRY,iBAAiB;AAqR9B,aAAa,CAAC,2BAA2B,EAAE,iBAAiB,CAAC,CAAC","sourcesContent":["import { Texture } from \"@babylonjs/core/Materials/Textures/texture\";\nimport { Effect } from \"@babylonjs/core/Materials/effect\";\nimport { MaterialDefines } from \"@babylonjs/core/Materials/materialDefines\";\nimport { PBRMaterial } from \"@babylonjs/core/Materials/PBR/pbrMaterial\";\nimport { Mesh } from \"@babylonjs/core/Meshes/mesh\";\nimport { Scene } from \"@babylonjs/core/scene\";\nimport { RegisterClass } from '@babylonjs/core/Misc/typeStore';\nimport { ShaderCodeInliner } from \"@babylonjs/core/Engines/Processors/shaderCodeInliner\";\nimport { ICustomShaderNameResolveOptions } from \"@babylonjs/core/Materials/material\";\n\nexport class ShaderAlebdoParts {\n\n constructor() { }\n\n public Fragment_Begin: string;\n public Fragment_Definitions: string;\n public Fragment_MainBegin: string;\n public Fragment_MainEnd: string;\n\n // albedoColor\n public Fragment_Custom_Albedo: string;\n // lights\n public Fragment_Before_Lights: string;\n // roughness\n public Fragment_Custom_MetallicRoughness: string;\n // microsurface\n public Fragment_Custom_MicroSurface: string;\n // fog\n public Fragment_Before_Fog: string;\n // alpha\n public Fragment_Custom_Alpha: string;\n // color composition\n public Fragment_Before_FinalColorComposition: string;\n // frag color\n public Fragment_Before_FragColor: string;\n\n public Vertex_Begin: string;\n public Vertex_Definitions: string;\n public Vertex_MainBegin: string;\n\n // positionUpdated\n public Vertex_Before_PositionUpdated: string;\n\n // normalUpdated\n public Vertex_Before_NormalUpdated: string;\n\n // worldPosComputed\n public Vertex_After_WorldPosComputed: string;\n\n // mainEnd\n public Vertex_MainEnd: string;\n}\n\nexport class PBRCustomMaterial extends PBRMaterial {\n public static ShaderIndexer = 1;\n public CustomParts: ShaderAlebdoParts;\n _isCreatedShader: boolean;\n _createdShaderName: string;\n _customUniform: string[];\n _newUniforms: string[];\n _newUniformInstances: { [name: string]: any };\n _newSamplerInstances: { [name: string]: Texture };\n _customAttributes: string[];\n\n public FragmentShader: string;\n public VertexShader: string;\n\n public AttachAfterBind(mesh: Mesh | undefined, effect: Effect) {\n if (this._newUniformInstances) {\n for (let el in this._newUniformInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'vec2') {\n effect.setVector2(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec3') {\n effect.setVector3(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'vec4') {\n effect.setVector4(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'mat4') {\n effect.setMatrix(ea[1], this._newUniformInstances[el]);\n }\n else if (ea[0] == 'float') {\n effect.setFloat(ea[1], this._newUniformInstances[el]);\n }\n }\n }\n if (this._newSamplerInstances) {\n for (let el in this._newSamplerInstances) {\n const ea = el.toString().split('-');\n if (ea[0] == 'sampler2D' && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {\n effect.setTexture(ea[1], this._newSamplerInstances[el]);\n }\n }\n }\n }\n\n public ReviewUniform(name: string, arr: string[]): string[] {\n if (name == \"uniform\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') == -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n if (name == \"sampler\" && this._newUniforms) {\n for (var ind = 0; ind < this._newUniforms.length; ind++) {\n if (this._customUniform[ind].indexOf('sampler') != -1) {\n arr.push(this._newUniforms[ind]);\n }\n }\n }\n return arr;\n }\n\n public Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions): string {\n if (options) {\n const currentProcessing = options.processFinalCode;\n options.processFinalCode = (type: string, code: string) => {\n if (type === \"vertex\") {\n return currentProcessing ? currentProcessing(type, code) : code;\n }\n const sci = new ShaderCodeInliner(code);\n sci.inlineToken = \"#define pbr_inline\";\n sci.processCode();\n return currentProcessing ? currentProcessing(type, sci.code) : sci.code;\n };\n }\n\n if (attributes && this._customAttributes && this._customAttributes.length > 0) {\n attributes.push(...this._customAttributes);\n }\n\n this.ReviewUniform(\"uniform\", uniforms);\n this.ReviewUniform(\"sampler\", samplers);\n\n if (this._isCreatedShader) {\n return this._createdShaderName;\n }\n this._isCreatedShader = false;\n\n PBRCustomMaterial.ShaderIndexer++;\n var name: string = \"custom_\" + PBRCustomMaterial.ShaderIndexer;\n\n var fn_afterBind = this._afterBind.bind(this);\n this._afterBind = (m, e) => {\n if (!e) {\n return;\n }\n this.AttachAfterBind(m, e);\n try { fn_afterBind(m, e); }\n catch (e) { }\n };\n\n Effect.ShadersStore[name + \"VertexShader\"] = this.VertexShader\n .replace('#define CUSTOM_VERTEX_BEGIN', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : \"\"))\n .replace('#define CUSTOM_VERTEX_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_BEGIN', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_POSITION', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_UPDATE_NORMAL', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : \"\"))\n .replace('#define CUSTOM_VERTEX_MAIN_END', (this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : \"\"));\n\n if (this.CustomParts.Vertex_After_WorldPosComputed) {\n Effect.ShadersStore[name + \"VertexShader\"] = Effect.ShadersStore[name + \"VertexShader\"].replace('#define CUSTOM_VERTEX_UPDATE_WORLDPOS', this.CustomParts.Vertex_After_WorldPosComputed);\n }\n\n Effect.ShadersStore[name + \"PixelShader\"] = this.FragmentShader\n .replace('#define CUSTOM_FRAGMENT_BEGIN', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_BEGIN', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : \"\"))\n .replace('#define CUSTOM_FRAGMENT_DEFINITIONS', (this._customUniform ? this._customUniform.join(\"\\n\") : \"\") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALBEDO', (this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_ALPHA', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_LIGHTS', (this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS', (this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : \"\"))\n .replace('#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE', (this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION', (this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : \"\"))\n .replace('#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : \"\"))\n .replace('#define CUSTOM_FRAGMENT_MAIN_END', (this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : \"\"));\n\n if (this.CustomParts.Fragment_Before_Fog) {\n Effect.ShadersStore[name + \"PixelShader\"] = Effect.ShadersStore[name + \"PixelShader\"].replace('#define CUSTOM_FRAGMENT_BEFORE_FOG', this.CustomParts.Fragment_Before_Fog);\n }\n\n this._isCreatedShader = true;\n this._createdShaderName = name;\n\n return name;\n }\n\n constructor(name: string, scene: Scene) {\n super(name, scene);\n this.CustomParts = new ShaderAlebdoParts();\n this.customShaderNameResolve = this.Builder;\n\n this.FragmentShader = Effect.ShadersStore[\"pbrPixelShader\"];\n this.VertexShader = Effect.ShadersStore[\"pbrVertexShader\"];\n\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore[\"pbrBlockAlbedoOpacity\"]);\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore[\"pbrBlockReflectivity\"]);\n this.FragmentShader = this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore[\"pbrBlockFinalColorComposition\"]);\n }\n\n public AddUniform(name: string, kind: string, param: any): PBRCustomMaterial {\n if (!this._customUniform) {\n this._customUniform = new Array();\n this._newUniforms = new Array();\n this._newSamplerInstances = {};\n this._newUniformInstances = {};\n }\n if (param) {\n if (kind.indexOf(\"sampler\") != -1) {\n (<any>this._newSamplerInstances)[kind + \"-\" + name] = param;\n }\n else {\n (<any>this._newUniformInstances)[kind + \"-\" + name] = param;\n }\n }\n this._customUniform.push(\"uniform \" + kind + \" \" + name + \";\");\n this._newUniforms.push(name);\n\n return this;\n }\n\n public AddAttribute(name: string): PBRCustomMaterial {\n if (!this._customAttributes) {\n this._customAttributes = [];\n }\n\n this._customAttributes.push(name);\n\n return this;\n }\n\n public Fragment_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Begin = shaderPart;\n return this;\n }\n\n public Fragment_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Definitions = shaderPart;\n return this;\n }\n\n public Fragment_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_MainBegin = shaderPart;\n return this;\n }\n\n public Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace(\"result\", \"surfaceAlbedo\");\n return this;\n }\n\n public Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace(\"result\", \"alpha\");\n return this;\n }\n\n public Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Lights = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;\n return this;\n }\n\n public Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;\n return this;\n }\n\n public Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_Fog = shaderPart;\n return this;\n }\n\n public Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;\n return this;\n }\n\n public Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_Before_FragColor = shaderPart.replace(\"result\", \"color\");\n return this;\n }\n\n public Fragment_MainEnd(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Fragment_MainEnd = shaderPart;\n return this;\n }\n\n public Vertex_Begin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Begin = shaderPart;\n return this;\n }\n\n public Vertex_Definitions(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Definitions = shaderPart;\n return this;\n }\n\n public Vertex_MainBegin(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainBegin = shaderPart;\n return this;\n }\n\n public Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace(\"result\", \"positionUpdated\");\n return this;\n }\n\n public Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace(\"result\", \"normalUpdated\");\n return this;\n }\n\n public Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;\n return this;\n }\n\n public Vertex_MainEnd(shaderPart: string): PBRCustomMaterial {\n this.CustomParts.Vertex_MainEnd = shaderPart;\n return this;\n }\n}\n\nRegisterClass(\"BABYLON.PBRCustomMaterial\", PBRCustomMaterial);\n"]}
|
package/fire/fire.fragment.js
CHANGED
@@ -6,7 +6,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/depthPrePass.js";
|
|
6
6
|
import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
|
7
7
|
import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
|
8
8
|
var name = 'firePixelShader';
|
9
|
-
var shader = "precision highp float;\n\nuniform vec4 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\nvoid main(void) {\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n}";
|
9
|
+
var shader = "precision highp float;\n\nuniform vec4 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
|
10
10
|
ShaderStore.ShadersStore[name] = shader;
|
11
11
|
/** @hidden */
|
12
12
|
export var firePixelShader = { name: name, shader: shader };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fire.fragment.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fire/fire.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,qEAAqE,CAAC;AAC7E,OAAO,+DAA+D,CAAC;AACvE,OAAO,0DAA0D,CAAC;AAClE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,qEAAqE,CAAC;AAE7E,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"fire.fragment.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fire/fire.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,qEAAqE,CAAC;AAC7E,OAAO,+DAA+D,CAAC;AACvE,OAAO,0DAA0D,CAAC;AAClE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,qEAAqE,CAAC;AAE7E,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,s8DA0EX,CAAC;AAEH,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAI,eAAe,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["import { ShaderStore } from \"@babylonjs/core/Engines/shaderStore\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/depthPrePass\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nlet name = 'firePixelShader';\nlet shader = `precision highp float;\n\nuniform vec4 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\nuniform sampler2D distortionSampler;\nuniform sampler2D opacitySampler;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\nvec4 bx2(vec4 x)\n{\nreturn vec4(2.0)*x-vec4(1.0);\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\n\nfloat alpha=1.0;\n#ifdef DIFFUSE\n\nconst float distortionAmount0=0.092;\nconst float distortionAmount1=0.092;\nconst float distortionAmount2=0.092;\nvec2 heightAttenuation=vec2(0.3,0.39);\nvec4 noise0=texture2D(distortionSampler,vDistortionCoords1);\nvec4 noise1=texture2D(distortionSampler,vDistortionCoords2);\nvec4 noise2=texture2D(distortionSampler,vDistortionCoords3);\nvec4 noiseSum=bx2(noise0)*distortionAmount0+bx2(noise1)*distortionAmount1+bx2(noise2)*distortionAmount2;\nvec4 perturbedBaseCoords=vec4(vDiffuseUV,0.0,1.0)+noiseSum*(vDiffuseUV.y*heightAttenuation.x+heightAttenuation.y);\nvec4 opacityColor=texture2D(opacitySampler,perturbedBaseCoords.xy);\n#ifdef ALPHATEST\nif (opacityColor.r<0.1)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor=texture2D(diffuseSampler,perturbedBaseCoords.xy)*2.0;\nbaseColor*=opacityColor;\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\nvec3 diffuseBase=vec3(1.0,1.0,1.0);\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n\nvec4 color=vec4(baseColor.rgb,alpha);\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport var firePixelShader = { name, shader };\n"]}
|
package/fire/fire.vertex.js
CHANGED
@@ -10,7 +10,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation.js";
|
|
10
10
|
import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
|
11
11
|
import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
12
12
|
var name = 'fireVertexShader';
|
13
|
-
var shader = "precision highp float;\n\nattribute vec3 position;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n}\n";
|
13
|
+
var shader = "precision highp float;\n\nattribute vec3 position;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";
|
14
14
|
ShaderStore.ShadersStore[name] = shader;
|
15
15
|
/** @hidden */
|
16
16
|
export var fireVertexShader = { name: name, shader: shader };
|
package/fire/fire.vertex.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fire.vertex.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fire/fire.vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wEAAwE,CAAC;AAChF,OAAO,6DAA6D,CAAC;AACrE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAE1D,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"fire.vertex.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fire/fire.vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wEAAwE,CAAC;AAChF,OAAO,6DAA6D,CAAC;AACrE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAE1D,IAAI,IAAI,GAAG,kBAAkB,CAAC;AAC9B,IAAI,MAAM,GAAG,skDA6EZ,CAAC;AAEF,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAI,gBAAgB,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["import { ShaderStore } from \"@babylonjs/core/Engines/shaderStore\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/instancesVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bonesVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogVertex\";\n\nlet name = 'fireVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n\nuniform float time;\nuniform float speed;\n#ifdef DIFFUSE\nvarying vec2 vDistortionCoords1;\nvarying vec2 vDistortionCoords2;\nvarying vec2 vDistortionCoords3;\n#endif\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\nvec4 worldPos=finalWorld*vec4(position,1.0);\ngl_Position=viewProjection*worldPos;\nvPositionW=vec3(worldPos);\n\n#ifdef DIFFUSE\nvDiffuseUV=uv;\nvDiffuseUV.y-=0.2;\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#ifdef DIFFUSE\n\nvec3 layerSpeed=vec3(-0.2,-0.52,-0.1)*speed;\nvDistortionCoords1.x=uv.x;\nvDistortionCoords1.y=uv.y+layerSpeed.x*time/1000.0;\nvDistortionCoords2.x=uv.x;\nvDistortionCoords2.y=uv.y+layerSpeed.y*time/1000.0;\nvDistortionCoords3.x=uv.x;\nvDistortionCoords3.y=uv.y+layerSpeed.z*time/1000.0;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport var fireVertexShader = { name, shader };\n"]}
|
package/fur/fur.fragment.js
CHANGED
@@ -12,7 +12,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/lightFragment.js";
|
|
12
12
|
import "@babylonjs/core/Shaders/ShadersInclude/fogFragment.js";
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility.js";
|
14
14
|
var name = 'furPixelShader';
|
15
|
-
var shader = "precision highp float;\n\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {\ndiscard;\n}\nfloat occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);\nbaseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n}";
|
15
|
+
var shader = "precision highp float;\n\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {\ndiscard;\n}\nfloat occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);\nbaseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
|
16
16
|
ShaderStore.ShadersStore[name] = shader;
|
17
17
|
/** @hidden */
|
18
18
|
export var furPixelShader = { name: name, shader: shader };
|
package/fur/fur.fragment.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fur.fragment.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fur/fur.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,wDAAwD,CAAC;AAChE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,gEAAgE,CAAC;AACxE,OAAO,iEAAiE,CAAC;AACzE,OAAO,+DAA+D,CAAC;AACvE,OAAO,qEAAqE,CAAC;AAC7E,OAAO,0DAA0D,CAAC;AAClE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,qEAAqE,CAAC;AAE7E,IAAI,IAAI,GAAG,gBAAgB,CAAC;AAC5B,IAAI,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"fur.fragment.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fur/fur.fragment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,wDAAwD,CAAC;AAChE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,gEAAgE,CAAC;AACxE,OAAO,iEAAiE,CAAC;AACzE,OAAO,+DAA+D,CAAC;AACvE,OAAO,qEAAqE,CAAC;AAC7E,OAAO,0DAA0D,CAAC;AAClE,OAAO,qDAAqD,CAAC;AAC7D,OAAO,sDAAsD,CAAC;AAC9D,OAAO,oDAAoD,CAAC;AAC5D,OAAO,qEAAqE,CAAC;AAE7E,IAAI,IAAI,GAAG,gBAAgB,CAAC;AAC5B,IAAI,MAAM,GAAG,22EAsGX,CAAC;AAEH,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAI,cAAc,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["import { ShaderStore } from \"@babylonjs/core/Engines/shaderStore\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/helperFunctions\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightsFragmentFunctions\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/shadowsFragmentFunctions\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/depthPrePass\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogFragment\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/imageProcessingCompatibility\";\n\nlet name = 'furPixelShader';\nlet shader = `precision highp float;\n\nuniform vec4 vEyePosition;\nuniform vec4 vDiffuseColor;\n\nuniform vec4 furColor;\nuniform float furLength;\nvarying vec3 vPositionW;\nvarying float vfur_length;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform sampler2D diffuseSampler;\nuniform vec2 vDiffuseInfos;\n#endif\n\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform float furOcclusion;\nuniform sampler2D furTexture;\nvarying vec2 vFurUV;\n#endif\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<fogFragmentDeclaration>\n#include<clipPlaneFragmentDeclaration>\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n\nvec4 baseColor=furColor;\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n#ifdef DIFFUSE\nbaseColor*=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\n#include<depthPrePass>\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(1.0,1.0,1.0);\n#endif\n#ifdef HIGHLEVEL\n\nvec4 furTextureColor=texture2D(furTexture,vec2(vFurUV.x,vFurUV.y));\nif (furTextureColor.a<=0.0 || furTextureColor.g<furOffset) {\ndiscard;\n}\nfloat occlusion=mix(0.0,furTextureColor.b*1.2,furOffset);\nbaseColor=vec4(baseColor.xyz*max(occlusion,furOcclusion),1.1-furOffset);\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\nfloat shadow=1.;\nfloat glossiness=0.;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\nvec3 finalDiffuse=clamp(diffuseBase.rgb*baseColor.rgb,0.0,1.0);\n\n#ifdef HIGHLEVEL\nvec4 color=vec4(finalDiffuse,alpha);\n#else\nfloat r=vfur_length/furLength*0.5;\nvec4 color=vec4(finalDiffuse*(0.5+r),alpha);\n#endif\n#include<fogFragment>\ngl_FragColor=color;\n#include<imageProcessingCompatibility>\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport var furPixelShader = { name, shader };\n"]}
|
package/fur/fur.vertex.js
CHANGED
@@ -13,7 +13,7 @@ import "@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex.js";
|
|
13
13
|
import "@babylonjs/core/Shaders/ShadersInclude/fogVertex.js";
|
14
14
|
import "@babylonjs/core/Shaders/ShadersInclude/shadowsVertex.js";
|
15
15
|
var name = 'furVertexShader';
|
16
|
-
var shader = "precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n";
|
16
|
+
var shader = "precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n";
|
17
17
|
ShaderStore.ShadersStore[name] = shader;
|
18
18
|
/** @hidden */
|
19
19
|
export var furVertexShader = { name: name, shader: shader };
|
package/fur/fur.vertex.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fur.vertex.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fur/fur.vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wEAAwE,CAAC;AAChF,OAAO,6DAA6D,CAAC;AACrE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,6DAA6D,CAAC;AACrE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,wDAAwD,CAAC;AAChE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAE9D,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,
|
1
|
+
{"version":3,"file":"fur.vertex.js","sourceRoot":"","sources":["../../../sourceES6/materialsLibrary/src/fur/fur.vertex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,yDAAyD,CAAC;AACjE,OAAO,wEAAwE,CAAC;AAChF,OAAO,6DAA6D,CAAC;AACrE,OAAO,mEAAmE,CAAC;AAC3E,OAAO,6DAA6D,CAAC;AACrE,OAAO,iEAAiE,CAAC;AACzE,OAAO,4DAA4D,CAAC;AACpE,OAAO,wDAAwD,CAAC;AAChE,OAAO,oDAAoD,CAAC;AAC5D,OAAO,6DAA6D,CAAC;AACrE,OAAO,wDAAwD,CAAC;AAChE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,sDAAsD,CAAC;AAE9D,IAAI,IAAI,GAAG,iBAAiB,CAAC;AAC7B,IAAI,MAAM,GAAG,2vGAgJZ,CAAC;AAEF,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAI,eAAe,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["import { ShaderStore } from \"@babylonjs/core/Engines/shaderStore\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bonesDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimationDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/instancesDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertexDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogVertexDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightFragmentDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/lightUboDeclaration\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/instancesVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bonesVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/bakedVertexAnimation\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/clipPlaneVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/fogVertex\";\nimport \"@babylonjs/core/Shaders/ShadersInclude/shadowsVertex\";\n\nlet name = 'furVertexShader';\nlet shader = `precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n#include<bakedVertexAnimationDeclaration>\n\nuniform float furLength;\nuniform float furAngle;\n#ifdef HIGHLEVEL\nuniform float furOffset;\nuniform vec3 furGravity;\nuniform float furTime;\nuniform float furSpacing;\nuniform float furDensity;\n#endif\n#ifdef HEIGHTMAP\nuniform sampler2D heightTexture;\n#endif\n#ifdef HIGHLEVEL\nvarying vec2 vFurUV;\n#endif\n#include<instancesDeclaration>\nuniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef DIFFUSE\nvarying vec2 vDiffuseUV;\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\nvarying float vfur_length;\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\nfloat Rand(vec3 rv) {\nfloat x=dot(rv,vec3(12.9898,78.233,24.65487));\nreturn fract(sin(x)*43758.5453);\n}\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\n#include<instancesVertex>\n#include<bonesVertex>\n#include<bakedVertexAnimation>\n\nfloat r=Rand(position);\n#ifdef HEIGHTMAP\n#if __VERSION__>100\nvfur_length=furLength*texture(heightTexture,uv).x;\n#else\nvfur_length=furLength*texture2D(heightTexture,uv).r;\n#endif\n#else\nvfur_length=(furLength*r);\n#endif\nvec3 tangent1=vec3(normal.y,-normal.x,0);\nvec3 tangent2=vec3(-normal.z,0,normal.x);\nr=Rand(tangent1*r);\nfloat J=(2.0+4.0*r);\nr=Rand(tangent2*r);\nfloat K=(2.0+2.0*r);\ntangent1=tangent1*J+tangent2*K;\ntangent1=normalize(tangent1);\nvec3 newPosition=position+normal*vfur_length*cos(furAngle)+tangent1*vfur_length*sin(furAngle);\n#ifdef HIGHLEVEL\n\nvec3 forceDirection=vec3(0.0,0.0,0.0);\nforceDirection.x=sin(furTime+position.x*0.05)*0.2;\nforceDirection.y=cos(furTime*0.7+position.y*0.04)*0.2;\nforceDirection.z=sin(furTime*0.7+position.z*0.04)*0.2;\nvec3 displacement=vec3(0.0,0.0,0.0);\ndisplacement=furGravity+forceDirection;\nfloat displacementFactor=pow(furOffset,3.0);\nvec3 aNormal=normal;\naNormal.xyz+=displacement*displacementFactor;\nnewPosition=vec3(newPosition.x,newPosition.y,newPosition.z)+(normalize(aNormal)*furOffset*furSpacing);\n#endif\n#ifdef NORMAL\nvNormalW=normalize(vec3(finalWorld*vec4(normal,0.0)));\n#endif\n\ngl_Position=viewProjection*finalWorld*vec4(newPosition,1.0);\nvec4 worldPos=finalWorld*vec4(newPosition,1.0);\nvPositionW=vec3(worldPos);\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef DIFFUSE\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#ifdef HIGHLEVEL\nvFurUV=vDiffuseUV*furDensity;\n#endif\n#else\n#ifdef HIGHLEVEL\nvFurUV=uv*furDensity;\n#endif\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n#define CUSTOM_VERTEX_MAIN_END\n}\n`;\n\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport var furVertexShader = { name, shader };\n"]}
|