@babylonjs/materials 5.0.0-rc.7 → 5.0.0-rc.9
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.d.ts +17 -17
- package/cell/cell.fragment.js +20 -20
- package/cell/cell.vertex.d.ts +18 -18
- package/cell/cell.vertex.js +21 -21
- package/cell/cellMaterial.d.ts +37 -37
- package/cell/cellMaterial.js +304 -304
- package/cell/index.d.ts +1 -1
- package/cell/index.js +1 -1
- package/custom/customMaterial.d.ts +69 -69
- package/custom/customMaterial.js +216 -216
- package/custom/index.d.ts +2 -2
- package/custom/index.js +2 -2
- package/custom/pbrCustomMaterial.d.ts +71 -71
- package/custom/pbrCustomMaterial.js +241 -241
- package/fire/fire.fragment.d.ts +11 -11
- package/fire/fire.fragment.js +14 -14
- package/fire/fire.vertex.d.ts +15 -15
- package/fire/fire.vertex.js +18 -18
- package/fire/fireMaterial.d.ts +38 -38
- package/fire/fireMaterial.js +342 -342
- package/fire/index.d.ts +1 -1
- package/fire/index.js +1 -1
- package/fur/fur.fragment.d.ts +17 -17
- package/fur/fur.fragment.js +20 -20
- package/fur/fur.vertex.d.ts +18 -18
- package/fur/fur.vertex.js +21 -21
- package/fur/furMaterial.d.ts +56 -56
- package/fur/furMaterial.js +500 -500
- package/fur/index.d.ts +1 -1
- package/fur/index.js +1 -1
- package/gradient/gradient.fragment.d.ts +17 -17
- package/gradient/gradient.fragment.js +20 -20
- package/gradient/gradient.vertex.d.ts +18 -18
- package/gradient/gradient.vertex.js +21 -21
- package/gradient/gradientMaterial.d.ts +37 -37
- package/gradient/gradientMaterial.js +275 -275
- package/gradient/index.d.ts +1 -1
- package/gradient/index.js +1 -1
- package/grid/grid.fragment.d.ts +8 -8
- package/grid/grid.fragment.js +11 -11
- package/grid/grid.vertex.d.ts +9 -9
- package/grid/grid.vertex.js +12 -12
- package/grid/gridMaterial.d.ts +77 -77
- package/grid/gridMaterial.js +276 -276
- package/grid/index.d.ts +1 -1
- package/grid/index.js +1 -1
- package/index.d.ts +15 -15
- package/index.js +15 -15
- package/lava/index.d.ts +1 -1
- package/lava/index.js +1 -1
- package/lava/lava.fragment.d.ts +17 -17
- package/lava/lava.fragment.js +20 -20
- package/lava/lava.vertex.d.ts +18 -18
- package/lava/lava.vertex.js +21 -21
- package/lava/lavaMaterial.d.ts +45 -45
- package/lava/lavaMaterial.js +394 -394
- package/legacy/legacy-cell.d.ts +1 -1
- package/legacy/legacy-cell.js +12 -12
- package/legacy/legacy-custom.d.ts +1 -1
- package/legacy/legacy-custom.js +12 -12
- package/legacy/legacy-fire.d.ts +1 -1
- package/legacy/legacy-fire.js +12 -12
- package/legacy/legacy-fur.d.ts +1 -1
- package/legacy/legacy-fur.js +12 -12
- package/legacy/legacy-gradient.d.ts +1 -1
- package/legacy/legacy-gradient.js +12 -12
- package/legacy/legacy-grid.d.ts +1 -1
- package/legacy/legacy-grid.js +12 -12
- package/legacy/legacy-lava.d.ts +1 -1
- package/legacy/legacy-lava.js +12 -12
- package/legacy/legacy-mix.d.ts +1 -1
- package/legacy/legacy-mix.js +12 -12
- package/legacy/legacy-normal.d.ts +1 -1
- package/legacy/legacy-normal.js +12 -12
- package/legacy/legacy-shadowOnly.d.ts +1 -1
- package/legacy/legacy-shadowOnly.js +12 -12
- package/legacy/legacy-simple.d.ts +1 -1
- package/legacy/legacy-simple.js +12 -12
- package/legacy/legacy-sky.d.ts +1 -1
- package/legacy/legacy-sky.js +12 -12
- package/legacy/legacy-terrain.d.ts +1 -1
- package/legacy/legacy-terrain.js +12 -12
- package/legacy/legacy-triPlanar.d.ts +1 -1
- package/legacy/legacy-triPlanar.js +12 -12
- package/legacy/legacy-water.d.ts +1 -1
- package/legacy/legacy-water.js +12 -12
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +15 -15
- package/mix/index.d.ts +1 -1
- package/mix/index.js +1 -1
- package/mix/mix.fragment.d.ts +17 -17
- package/mix/mix.fragment.js +20 -20
- package/mix/mix.vertex.d.ts +18 -18
- package/mix/mix.vertex.js +21 -21
- package/mix/mixMaterial.d.ts +65 -65
- package/mix/mixMaterial.js +510 -510
- package/normal/index.d.ts +1 -1
- package/normal/index.js +1 -1
- package/normal/normal.fragment.d.ts +17 -17
- package/normal/normal.fragment.js +20 -20
- package/normal/normal.vertex.d.ts +18 -18
- package/normal/normal.vertex.js +21 -21
- package/normal/normalMaterial.d.ts +36 -36
- package/normal/normalMaterial.js +336 -336
- package/package.json +2 -2
- package/shadowOnly/index.d.ts +1 -1
- package/shadowOnly/index.js +1 -1
- package/shadowOnly/shadowOnly.fragment.d.ts +16 -16
- package/shadowOnly/shadowOnly.fragment.js +19 -19
- package/shadowOnly/shadowOnly.vertex.d.ts +18 -18
- package/shadowOnly/shadowOnly.vertex.js +21 -21
- package/shadowOnly/shadowOnlyMaterial.d.ts +30 -30
- package/shadowOnly/shadowOnlyMaterial.js +254 -254
- package/simple/index.d.ts +1 -1
- package/simple/index.js +1 -1
- package/simple/simple.fragment.d.ts +17 -17
- package/simple/simple.fragment.js +20 -20
- package/simple/simple.vertex.d.ts +18 -18
- package/simple/simple.vertex.js +21 -21
- package/simple/simpleMaterial.d.ts +35 -35
- package/simple/simpleMaterial.js +295 -295
- package/sky/index.d.ts +1 -1
- package/sky/index.js +1 -1
- package/sky/sky.fragment.d.ts +10 -10
- package/sky/sky.fragment.js +13 -13
- package/sky/sky.vertex.d.ts +9 -9
- package/sky/sky.vertex.js +12 -12
- package/sky/skyMaterial.d.ts +146 -146
- package/sky/skyMaterial.js +359 -359
- package/terrain/index.d.ts +1 -1
- package/terrain/index.js +1 -1
- package/terrain/terrain.fragment.d.ts +17 -17
- package/terrain/terrain.fragment.js +20 -20
- package/terrain/terrain.vertex.d.ts +18 -18
- package/terrain/terrain.vertex.js +21 -21
- package/terrain/terrainMaterial.d.ts +50 -50
- package/terrain/terrainMaterial.js +426 -426
- package/triPlanar/index.d.ts +1 -1
- package/triPlanar/index.js +1 -1
- package/triPlanar/triPlanarMaterial.d.ts +49 -49
- package/triPlanar/triPlanarMaterial.js +403 -403
- package/triPlanar/triplanar.fragment.d.ts +17 -17
- package/triPlanar/triplanar.fragment.js +20 -20
- package/triPlanar/triplanar.vertex.d.ts +18 -18
- package/triPlanar/triplanar.vertex.js +21 -21
- package/water/index.d.ts +1 -1
- package/water/index.js +1 -1
- package/water/water.fragment.d.ts +19 -19
- package/water/water.fragment.js +22 -22
- package/water/water.vertex.d.ts +20 -20
- package/water/water.vertex.js +23 -23
- package/water/waterMaterial.d.ts +135 -135
- package/water/waterMaterial.js +736 -736
@@ -1,71 +1,71 @@
|
|
1
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
2
|
-
import { Effect } from "@babylonjs/core/Materials/effect.js";
|
3
|
-
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
4
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
5
|
-
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
6
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
7
|
-
import { ICustomShaderNameResolveOptions } from "@babylonjs/core/Materials/material.js";
|
8
|
-
export declare class ShaderAlebdoParts {
|
9
|
-
constructor();
|
10
|
-
Fragment_Begin: string;
|
11
|
-
Fragment_Definitions: string;
|
12
|
-
Fragment_MainBegin: string;
|
13
|
-
Fragment_MainEnd: string;
|
14
|
-
Fragment_Custom_Albedo: string;
|
15
|
-
Fragment_Before_Lights: string;
|
16
|
-
Fragment_Custom_MetallicRoughness: string;
|
17
|
-
Fragment_Custom_MicroSurface: string;
|
18
|
-
Fragment_Before_Fog: string;
|
19
|
-
Fragment_Custom_Alpha: string;
|
20
|
-
Fragment_Before_FinalColorComposition: string;
|
21
|
-
Fragment_Before_FragColor: string;
|
22
|
-
Vertex_Begin: string;
|
23
|
-
Vertex_Definitions: string;
|
24
|
-
Vertex_MainBegin: string;
|
25
|
-
Vertex_Before_PositionUpdated: string;
|
26
|
-
Vertex_Before_NormalUpdated: string;
|
27
|
-
Vertex_After_WorldPosComputed: string;
|
28
|
-
Vertex_MainEnd: string;
|
29
|
-
}
|
30
|
-
export declare class PBRCustomMaterial extends PBRMaterial {
|
31
|
-
static ShaderIndexer: number;
|
32
|
-
CustomParts: ShaderAlebdoParts;
|
33
|
-
_isCreatedShader: boolean;
|
34
|
-
_createdShaderName: string;
|
35
|
-
_customUniform: string[];
|
36
|
-
_newUniforms: string[];
|
37
|
-
_newUniformInstances: {
|
38
|
-
[name: string]: any;
|
39
|
-
};
|
40
|
-
_newSamplerInstances: {
|
41
|
-
[name: string]: Texture;
|
42
|
-
};
|
43
|
-
_customAttributes: string[];
|
44
|
-
FragmentShader: string;
|
45
|
-
VertexShader: string;
|
46
|
-
AttachAfterBind(mesh: Mesh | undefined, effect: Effect): void;
|
47
|
-
ReviewUniform(name: string, arr: string[]): string[];
|
48
|
-
Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions): string;
|
49
|
-
constructor(name: string, scene?: Scene);
|
50
|
-
AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
|
51
|
-
AddAttribute(name: string): PBRCustomMaterial;
|
52
|
-
Fragment_Begin(shaderPart: string): PBRCustomMaterial;
|
53
|
-
Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
|
54
|
-
Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
|
55
|
-
Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
|
56
|
-
Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
|
57
|
-
Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
|
58
|
-
Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial;
|
59
|
-
Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial;
|
60
|
-
Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
|
61
|
-
Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial;
|
62
|
-
Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
|
63
|
-
Fragment_MainEnd(shaderPart: string): PBRCustomMaterial;
|
64
|
-
Vertex_Begin(shaderPart: string): PBRCustomMaterial;
|
65
|
-
Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
|
66
|
-
Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
|
67
|
-
Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
|
68
|
-
Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
|
69
|
-
Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial;
|
70
|
-
Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
|
71
|
-
}
|
1
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
2
|
+
import { Effect } from "@babylonjs/core/Materials/effect.js";
|
3
|
+
import { MaterialDefines } from "@babylonjs/core/Materials/materialDefines.js";
|
4
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
5
|
+
import { Mesh } from "@babylonjs/core/Meshes/mesh.js";
|
6
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
7
|
+
import { ICustomShaderNameResolveOptions } from "@babylonjs/core/Materials/material.js";
|
8
|
+
export declare class ShaderAlebdoParts {
|
9
|
+
constructor();
|
10
|
+
Fragment_Begin: string;
|
11
|
+
Fragment_Definitions: string;
|
12
|
+
Fragment_MainBegin: string;
|
13
|
+
Fragment_MainEnd: string;
|
14
|
+
Fragment_Custom_Albedo: string;
|
15
|
+
Fragment_Before_Lights: string;
|
16
|
+
Fragment_Custom_MetallicRoughness: string;
|
17
|
+
Fragment_Custom_MicroSurface: string;
|
18
|
+
Fragment_Before_Fog: string;
|
19
|
+
Fragment_Custom_Alpha: string;
|
20
|
+
Fragment_Before_FinalColorComposition: string;
|
21
|
+
Fragment_Before_FragColor: string;
|
22
|
+
Vertex_Begin: string;
|
23
|
+
Vertex_Definitions: string;
|
24
|
+
Vertex_MainBegin: string;
|
25
|
+
Vertex_Before_PositionUpdated: string;
|
26
|
+
Vertex_Before_NormalUpdated: string;
|
27
|
+
Vertex_After_WorldPosComputed: string;
|
28
|
+
Vertex_MainEnd: string;
|
29
|
+
}
|
30
|
+
export declare class PBRCustomMaterial extends PBRMaterial {
|
31
|
+
static ShaderIndexer: number;
|
32
|
+
CustomParts: ShaderAlebdoParts;
|
33
|
+
_isCreatedShader: boolean;
|
34
|
+
_createdShaderName: string;
|
35
|
+
_customUniform: string[];
|
36
|
+
_newUniforms: string[];
|
37
|
+
_newUniformInstances: {
|
38
|
+
[name: string]: any;
|
39
|
+
};
|
40
|
+
_newSamplerInstances: {
|
41
|
+
[name: string]: Texture;
|
42
|
+
};
|
43
|
+
_customAttributes: string[];
|
44
|
+
FragmentShader: string;
|
45
|
+
VertexShader: string;
|
46
|
+
AttachAfterBind(mesh: Mesh | undefined, effect: Effect): void;
|
47
|
+
ReviewUniform(name: string, arr: string[]): string[];
|
48
|
+
Builder(shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions): string;
|
49
|
+
constructor(name: string, scene?: Scene);
|
50
|
+
AddUniform(name: string, kind: string, param: any): PBRCustomMaterial;
|
51
|
+
AddAttribute(name: string): PBRCustomMaterial;
|
52
|
+
Fragment_Begin(shaderPart: string): PBRCustomMaterial;
|
53
|
+
Fragment_Definitions(shaderPart: string): PBRCustomMaterial;
|
54
|
+
Fragment_MainBegin(shaderPart: string): PBRCustomMaterial;
|
55
|
+
Fragment_Custom_Albedo(shaderPart: string): PBRCustomMaterial;
|
56
|
+
Fragment_Custom_Alpha(shaderPart: string): PBRCustomMaterial;
|
57
|
+
Fragment_Before_Lights(shaderPart: string): PBRCustomMaterial;
|
58
|
+
Fragment_Custom_MetallicRoughness(shaderPart: string): PBRCustomMaterial;
|
59
|
+
Fragment_Custom_MicroSurface(shaderPart: string): PBRCustomMaterial;
|
60
|
+
Fragment_Before_Fog(shaderPart: string): PBRCustomMaterial;
|
61
|
+
Fragment_Before_FinalColorComposition(shaderPart: string): PBRCustomMaterial;
|
62
|
+
Fragment_Before_FragColor(shaderPart: string): PBRCustomMaterial;
|
63
|
+
Fragment_MainEnd(shaderPart: string): PBRCustomMaterial;
|
64
|
+
Vertex_Begin(shaderPart: string): PBRCustomMaterial;
|
65
|
+
Vertex_Definitions(shaderPart: string): PBRCustomMaterial;
|
66
|
+
Vertex_MainBegin(shaderPart: string): PBRCustomMaterial;
|
67
|
+
Vertex_Before_PositionUpdated(shaderPart: string): PBRCustomMaterial;
|
68
|
+
Vertex_Before_NormalUpdated(shaderPart: string): PBRCustomMaterial;
|
69
|
+
Vertex_After_WorldPosComputed(shaderPart: string): PBRCustomMaterial;
|
70
|
+
Vertex_MainEnd(shaderPart: string): PBRCustomMaterial;
|
71
|
+
}
|
@@ -1,242 +1,242 @@
|
|
1
|
-
import { __extends } from "tslib";
|
2
|
-
import { Effect } from "@babylonjs/core/Materials/effect.js";
|
3
|
-
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
4
|
-
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
5
|
-
import { ShaderCodeInliner } from "@babylonjs/core/Engines/Processors/shaderCodeInliner.js";
|
6
|
-
var ShaderAlebdoParts = /** @class */ (function () {
|
7
|
-
function ShaderAlebdoParts() {
|
8
|
-
}
|
9
|
-
return ShaderAlebdoParts;
|
10
|
-
}());
|
11
|
-
export { ShaderAlebdoParts };
|
12
|
-
var PBRCustomMaterial = /** @class */ (function (_super) {
|
13
|
-
__extends(PBRCustomMaterial, _super);
|
14
|
-
function PBRCustomMaterial(name, scene) {
|
15
|
-
var _this = _super.call(this, name, scene) || this;
|
16
|
-
_this.CustomParts = new ShaderAlebdoParts();
|
17
|
-
_this.customShaderNameResolve = _this.Builder;
|
18
|
-
_this.FragmentShader = Effect.ShadersStore["pbrPixelShader"];
|
19
|
-
_this.VertexShader = Effect.ShadersStore["pbrVertexShader"];
|
20
|
-
_this.FragmentShader = _this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore["pbrBlockAlbedoOpacity"]);
|
21
|
-
_this.FragmentShader = _this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore["pbrBlockReflectivity"]);
|
22
|
-
_this.FragmentShader = _this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore["pbrBlockFinalColorComposition"]);
|
23
|
-
return _this;
|
24
|
-
}
|
25
|
-
PBRCustomMaterial.prototype.AttachAfterBind = function (mesh, effect) {
|
26
|
-
if (this._newUniformInstances) {
|
27
|
-
for (var el in this._newUniformInstances) {
|
28
|
-
var ea = el.toString().split("-");
|
29
|
-
if (ea[0] == "vec2") {
|
30
|
-
effect.setVector2(ea[1], this._newUniformInstances[el]);
|
31
|
-
}
|
32
|
-
else if (ea[0] == "vec3") {
|
33
|
-
effect.setVector3(ea[1], this._newUniformInstances[el]);
|
34
|
-
}
|
35
|
-
else if (ea[0] == "vec4") {
|
36
|
-
effect.setVector4(ea[1], this._newUniformInstances[el]);
|
37
|
-
}
|
38
|
-
else if (ea[0] == "mat4") {
|
39
|
-
effect.setMatrix(ea[1], this._newUniformInstances[el]);
|
40
|
-
}
|
41
|
-
else if (ea[0] == "float") {
|
42
|
-
effect.setFloat(ea[1], this._newUniformInstances[el]);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
}
|
46
|
-
if (this._newSamplerInstances) {
|
47
|
-
for (var el in this._newSamplerInstances) {
|
48
|
-
var ea = el.toString().split("-");
|
49
|
-
if (ea[0] == "sampler2D" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {
|
50
|
-
effect.setTexture(ea[1], this._newSamplerInstances[el]);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
};
|
55
|
-
PBRCustomMaterial.prototype.ReviewUniform = function (name, arr) {
|
56
|
-
if (name == "uniform" && this._newUniforms) {
|
57
|
-
for (var ind = 0; ind < this._newUniforms.length; ind++) {
|
58
|
-
if (this._customUniform[ind].indexOf("sampler") == -1) {
|
59
|
-
arr.push(this._newUniforms[ind]);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
}
|
63
|
-
if (name == "sampler" && this._newUniforms) {
|
64
|
-
for (var ind = 0; ind < this._newUniforms.length; ind++) {
|
65
|
-
if (this._customUniform[ind].indexOf("sampler") != -1) {
|
66
|
-
arr.push(this._newUniforms[ind]);
|
67
|
-
}
|
68
|
-
}
|
69
|
-
}
|
70
|
-
return arr;
|
71
|
-
};
|
72
|
-
PBRCustomMaterial.prototype.Builder = function (shaderName, uniforms, uniformBuffers, samplers, defines, attributes, options) {
|
73
|
-
var _this = this;
|
74
|
-
if (options) {
|
75
|
-
var currentProcessing_1 = options.processFinalCode;
|
76
|
-
options.processFinalCode = function (type, code) {
|
77
|
-
if (type === "vertex") {
|
78
|
-
return currentProcessing_1 ? currentProcessing_1(type, code) : code;
|
79
|
-
}
|
80
|
-
var sci = new ShaderCodeInliner(code);
|
81
|
-
sci.inlineToken = "#define pbr_inline";
|
82
|
-
sci.processCode();
|
83
|
-
return currentProcessing_1 ? currentProcessing_1(type, sci.code) : sci.code;
|
84
|
-
};
|
85
|
-
}
|
86
|
-
if (attributes && this._customAttributes && this._customAttributes.length > 0) {
|
87
|
-
attributes.push.apply(attributes, this._customAttributes);
|
88
|
-
}
|
89
|
-
this.ReviewUniform("uniform", uniforms);
|
90
|
-
this.ReviewUniform("sampler", samplers);
|
91
|
-
if (this._isCreatedShader) {
|
92
|
-
return this._createdShaderName;
|
93
|
-
}
|
94
|
-
this._isCreatedShader = false;
|
95
|
-
PBRCustomMaterial.ShaderIndexer++;
|
96
|
-
var name = "custom_" + PBRCustomMaterial.ShaderIndexer;
|
97
|
-
var fn_afterBind = this._afterBind.bind(this);
|
98
|
-
this._afterBind = function (m, e) {
|
99
|
-
if (!e) {
|
100
|
-
return;
|
101
|
-
}
|
102
|
-
_this.AttachAfterBind(m, e);
|
103
|
-
try {
|
104
|
-
fn_afterBind(m, e);
|
105
|
-
}
|
106
|
-
catch (e) { }
|
107
|
-
};
|
108
|
-
Effect.ShadersStore[name + "VertexShader"] = this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN", this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : "")
|
109
|
-
.replace("#define CUSTOM_VERTEX_DEFINITIONS", (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
|
110
|
-
.replace("#define CUSTOM_VERTEX_MAIN_BEGIN", this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : "")
|
111
|
-
.replace("#define CUSTOM_VERTEX_UPDATE_POSITION", this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : "")
|
112
|
-
.replace("#define CUSTOM_VERTEX_UPDATE_NORMAL", this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : "")
|
113
|
-
.replace("#define CUSTOM_VERTEX_MAIN_END", this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : "");
|
114
|
-
if (this.CustomParts.Vertex_After_WorldPosComputed) {
|
115
|
-
Effect.ShadersStore[name + "VertexShader"] = Effect.ShadersStore[name + "VertexShader"].replace("#define CUSTOM_VERTEX_UPDATE_WORLDPOS", this.CustomParts.Vertex_After_WorldPosComputed);
|
116
|
-
}
|
117
|
-
Effect.ShadersStore[name + "PixelShader"] = this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN", this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : "")
|
118
|
-
.replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN", this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : "")
|
119
|
-
.replace("#define CUSTOM_FRAGMENT_DEFINITIONS", (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
|
120
|
-
.replace("#define CUSTOM_FRAGMENT_UPDATE_ALBEDO", this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : "")
|
121
|
-
.replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA", this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : "")
|
122
|
-
.replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS", this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : "")
|
123
|
-
.replace("#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS", this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : "")
|
124
|
-
.replace("#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE", this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : "")
|
125
|
-
.replace("#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION", this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : "")
|
126
|
-
.replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR", this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : "")
|
127
|
-
.replace("#define CUSTOM_FRAGMENT_MAIN_END", this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : "");
|
128
|
-
if (this.CustomParts.Fragment_Before_Fog) {
|
129
|
-
Effect.ShadersStore[name + "PixelShader"] = Effect.ShadersStore[name + "PixelShader"].replace("#define CUSTOM_FRAGMENT_BEFORE_FOG", this.CustomParts.Fragment_Before_Fog);
|
130
|
-
}
|
131
|
-
this._isCreatedShader = true;
|
132
|
-
this._createdShaderName = name;
|
133
|
-
return name;
|
134
|
-
};
|
135
|
-
PBRCustomMaterial.prototype.AddUniform = function (name, kind, param) {
|
136
|
-
if (!this._customUniform) {
|
137
|
-
this._customUniform = new Array();
|
138
|
-
this._newUniforms = new Array();
|
139
|
-
this._newSamplerInstances = {};
|
140
|
-
this._newUniformInstances = {};
|
141
|
-
}
|
142
|
-
if (param) {
|
143
|
-
if (kind.indexOf("sampler") != -1) {
|
144
|
-
this._newSamplerInstances[kind + "-" + name] = param;
|
145
|
-
}
|
146
|
-
else {
|
147
|
-
this._newUniformInstances[kind + "-" + name] = param;
|
148
|
-
}
|
149
|
-
}
|
150
|
-
this._customUniform.push("uniform " + kind + " " + name + ";");
|
151
|
-
this._newUniforms.push(name);
|
152
|
-
return this;
|
153
|
-
};
|
154
|
-
PBRCustomMaterial.prototype.AddAttribute = function (name) {
|
155
|
-
if (!this._customAttributes) {
|
156
|
-
this._customAttributes = [];
|
157
|
-
}
|
158
|
-
this._customAttributes.push(name);
|
159
|
-
return this;
|
160
|
-
};
|
161
|
-
PBRCustomMaterial.prototype.Fragment_Begin = function (shaderPart) {
|
162
|
-
this.CustomParts.Fragment_Begin = shaderPart;
|
163
|
-
return this;
|
164
|
-
};
|
165
|
-
PBRCustomMaterial.prototype.Fragment_Definitions = function (shaderPart) {
|
166
|
-
this.CustomParts.Fragment_Definitions = shaderPart;
|
167
|
-
return this;
|
168
|
-
};
|
169
|
-
PBRCustomMaterial.prototype.Fragment_MainBegin = function (shaderPart) {
|
170
|
-
this.CustomParts.Fragment_MainBegin = shaderPart;
|
171
|
-
return this;
|
172
|
-
};
|
173
|
-
PBRCustomMaterial.prototype.Fragment_Custom_Albedo = function (shaderPart) {
|
174
|
-
this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace("result", "surfaceAlbedo");
|
175
|
-
return this;
|
176
|
-
};
|
177
|
-
PBRCustomMaterial.prototype.Fragment_Custom_Alpha = function (shaderPart) {
|
178
|
-
this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace("result", "alpha");
|
179
|
-
return this;
|
180
|
-
};
|
181
|
-
PBRCustomMaterial.prototype.Fragment_Before_Lights = function (shaderPart) {
|
182
|
-
this.CustomParts.Fragment_Before_Lights = shaderPart;
|
183
|
-
return this;
|
184
|
-
};
|
185
|
-
PBRCustomMaterial.prototype.Fragment_Custom_MetallicRoughness = function (shaderPart) {
|
186
|
-
this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;
|
187
|
-
return this;
|
188
|
-
};
|
189
|
-
PBRCustomMaterial.prototype.Fragment_Custom_MicroSurface = function (shaderPart) {
|
190
|
-
this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;
|
191
|
-
return this;
|
192
|
-
};
|
193
|
-
PBRCustomMaterial.prototype.Fragment_Before_Fog = function (shaderPart) {
|
194
|
-
this.CustomParts.Fragment_Before_Fog = shaderPart;
|
195
|
-
return this;
|
196
|
-
};
|
197
|
-
PBRCustomMaterial.prototype.Fragment_Before_FinalColorComposition = function (shaderPart) {
|
198
|
-
this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;
|
199
|
-
return this;
|
200
|
-
};
|
201
|
-
PBRCustomMaterial.prototype.Fragment_Before_FragColor = function (shaderPart) {
|
202
|
-
this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
|
203
|
-
return this;
|
204
|
-
};
|
205
|
-
PBRCustomMaterial.prototype.Fragment_MainEnd = function (shaderPart) {
|
206
|
-
this.CustomParts.Fragment_MainEnd = shaderPart;
|
207
|
-
return this;
|
208
|
-
};
|
209
|
-
PBRCustomMaterial.prototype.Vertex_Begin = function (shaderPart) {
|
210
|
-
this.CustomParts.Vertex_Begin = shaderPart;
|
211
|
-
return this;
|
212
|
-
};
|
213
|
-
PBRCustomMaterial.prototype.Vertex_Definitions = function (shaderPart) {
|
214
|
-
this.CustomParts.Vertex_Definitions = shaderPart;
|
215
|
-
return this;
|
216
|
-
};
|
217
|
-
PBRCustomMaterial.prototype.Vertex_MainBegin = function (shaderPart) {
|
218
|
-
this.CustomParts.Vertex_MainBegin = shaderPart;
|
219
|
-
return this;
|
220
|
-
};
|
221
|
-
PBRCustomMaterial.prototype.Vertex_Before_PositionUpdated = function (shaderPart) {
|
222
|
-
this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace("result", "positionUpdated");
|
223
|
-
return this;
|
224
|
-
};
|
225
|
-
PBRCustomMaterial.prototype.Vertex_Before_NormalUpdated = function (shaderPart) {
|
226
|
-
this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
|
227
|
-
return this;
|
228
|
-
};
|
229
|
-
PBRCustomMaterial.prototype.Vertex_After_WorldPosComputed = function (shaderPart) {
|
230
|
-
this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;
|
231
|
-
return this;
|
232
|
-
};
|
233
|
-
PBRCustomMaterial.prototype.Vertex_MainEnd = function (shaderPart) {
|
234
|
-
this.CustomParts.Vertex_MainEnd = shaderPart;
|
235
|
-
return this;
|
236
|
-
};
|
237
|
-
PBRCustomMaterial.ShaderIndexer = 1;
|
238
|
-
return PBRCustomMaterial;
|
239
|
-
}(PBRMaterial));
|
240
|
-
export { PBRCustomMaterial };
|
241
|
-
RegisterClass("BABYLON.PBRCustomMaterial", PBRCustomMaterial);
|
1
|
+
import { __extends } from "tslib";
|
2
|
+
import { Effect } from "@babylonjs/core/Materials/effect.js";
|
3
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
4
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
5
|
+
import { ShaderCodeInliner } from "@babylonjs/core/Engines/Processors/shaderCodeInliner.js";
|
6
|
+
var ShaderAlebdoParts = /** @class */ (function () {
|
7
|
+
function ShaderAlebdoParts() {
|
8
|
+
}
|
9
|
+
return ShaderAlebdoParts;
|
10
|
+
}());
|
11
|
+
export { ShaderAlebdoParts };
|
12
|
+
var PBRCustomMaterial = /** @class */ (function (_super) {
|
13
|
+
__extends(PBRCustomMaterial, _super);
|
14
|
+
function PBRCustomMaterial(name, scene) {
|
15
|
+
var _this = _super.call(this, name, scene) || this;
|
16
|
+
_this.CustomParts = new ShaderAlebdoParts();
|
17
|
+
_this.customShaderNameResolve = _this.Builder;
|
18
|
+
_this.FragmentShader = Effect.ShadersStore["pbrPixelShader"];
|
19
|
+
_this.VertexShader = Effect.ShadersStore["pbrVertexShader"];
|
20
|
+
_this.FragmentShader = _this.FragmentShader.replace(/#include<pbrBlockAlbedoOpacity>/g, Effect.IncludesShadersStore["pbrBlockAlbedoOpacity"]);
|
21
|
+
_this.FragmentShader = _this.FragmentShader.replace(/#include<pbrBlockReflectivity>/g, Effect.IncludesShadersStore["pbrBlockReflectivity"]);
|
22
|
+
_this.FragmentShader = _this.FragmentShader.replace(/#include<pbrBlockFinalColorComposition>/g, Effect.IncludesShadersStore["pbrBlockFinalColorComposition"]);
|
23
|
+
return _this;
|
24
|
+
}
|
25
|
+
PBRCustomMaterial.prototype.AttachAfterBind = function (mesh, effect) {
|
26
|
+
if (this._newUniformInstances) {
|
27
|
+
for (var el in this._newUniformInstances) {
|
28
|
+
var ea = el.toString().split("-");
|
29
|
+
if (ea[0] == "vec2") {
|
30
|
+
effect.setVector2(ea[1], this._newUniformInstances[el]);
|
31
|
+
}
|
32
|
+
else if (ea[0] == "vec3") {
|
33
|
+
effect.setVector3(ea[1], this._newUniformInstances[el]);
|
34
|
+
}
|
35
|
+
else if (ea[0] == "vec4") {
|
36
|
+
effect.setVector4(ea[1], this._newUniformInstances[el]);
|
37
|
+
}
|
38
|
+
else if (ea[0] == "mat4") {
|
39
|
+
effect.setMatrix(ea[1], this._newUniformInstances[el]);
|
40
|
+
}
|
41
|
+
else if (ea[0] == "float") {
|
42
|
+
effect.setFloat(ea[1], this._newUniformInstances[el]);
|
43
|
+
}
|
44
|
+
}
|
45
|
+
}
|
46
|
+
if (this._newSamplerInstances) {
|
47
|
+
for (var el in this._newSamplerInstances) {
|
48
|
+
var ea = el.toString().split("-");
|
49
|
+
if (ea[0] == "sampler2D" && this._newSamplerInstances[el].isReady && this._newSamplerInstances[el].isReady()) {
|
50
|
+
effect.setTexture(ea[1], this._newSamplerInstances[el]);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
};
|
55
|
+
PBRCustomMaterial.prototype.ReviewUniform = function (name, arr) {
|
56
|
+
if (name == "uniform" && this._newUniforms) {
|
57
|
+
for (var ind = 0; ind < this._newUniforms.length; ind++) {
|
58
|
+
if (this._customUniform[ind].indexOf("sampler") == -1) {
|
59
|
+
arr.push(this._newUniforms[ind]);
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
if (name == "sampler" && this._newUniforms) {
|
64
|
+
for (var ind = 0; ind < this._newUniforms.length; ind++) {
|
65
|
+
if (this._customUniform[ind].indexOf("sampler") != -1) {
|
66
|
+
arr.push(this._newUniforms[ind]);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return arr;
|
71
|
+
};
|
72
|
+
PBRCustomMaterial.prototype.Builder = function (shaderName, uniforms, uniformBuffers, samplers, defines, attributes, options) {
|
73
|
+
var _this = this;
|
74
|
+
if (options) {
|
75
|
+
var currentProcessing_1 = options.processFinalCode;
|
76
|
+
options.processFinalCode = function (type, code) {
|
77
|
+
if (type === "vertex") {
|
78
|
+
return currentProcessing_1 ? currentProcessing_1(type, code) : code;
|
79
|
+
}
|
80
|
+
var sci = new ShaderCodeInliner(code);
|
81
|
+
sci.inlineToken = "#define pbr_inline";
|
82
|
+
sci.processCode();
|
83
|
+
return currentProcessing_1 ? currentProcessing_1(type, sci.code) : sci.code;
|
84
|
+
};
|
85
|
+
}
|
86
|
+
if (attributes && this._customAttributes && this._customAttributes.length > 0) {
|
87
|
+
attributes.push.apply(attributes, this._customAttributes);
|
88
|
+
}
|
89
|
+
this.ReviewUniform("uniform", uniforms);
|
90
|
+
this.ReviewUniform("sampler", samplers);
|
91
|
+
if (this._isCreatedShader) {
|
92
|
+
return this._createdShaderName;
|
93
|
+
}
|
94
|
+
this._isCreatedShader = false;
|
95
|
+
PBRCustomMaterial.ShaderIndexer++;
|
96
|
+
var name = "custom_" + PBRCustomMaterial.ShaderIndexer;
|
97
|
+
var fn_afterBind = this._afterBind.bind(this);
|
98
|
+
this._afterBind = function (m, e) {
|
99
|
+
if (!e) {
|
100
|
+
return;
|
101
|
+
}
|
102
|
+
_this.AttachAfterBind(m, e);
|
103
|
+
try {
|
104
|
+
fn_afterBind(m, e);
|
105
|
+
}
|
106
|
+
catch (e) { }
|
107
|
+
};
|
108
|
+
Effect.ShadersStore[name + "VertexShader"] = this.VertexShader.replace("#define CUSTOM_VERTEX_BEGIN", this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : "")
|
109
|
+
.replace("#define CUSTOM_VERTEX_DEFINITIONS", (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
|
110
|
+
.replace("#define CUSTOM_VERTEX_MAIN_BEGIN", this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : "")
|
111
|
+
.replace("#define CUSTOM_VERTEX_UPDATE_POSITION", this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : "")
|
112
|
+
.replace("#define CUSTOM_VERTEX_UPDATE_NORMAL", this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : "")
|
113
|
+
.replace("#define CUSTOM_VERTEX_MAIN_END", this.CustomParts.Vertex_MainEnd ? this.CustomParts.Vertex_MainEnd : "");
|
114
|
+
if (this.CustomParts.Vertex_After_WorldPosComputed) {
|
115
|
+
Effect.ShadersStore[name + "VertexShader"] = Effect.ShadersStore[name + "VertexShader"].replace("#define CUSTOM_VERTEX_UPDATE_WORLDPOS", this.CustomParts.Vertex_After_WorldPosComputed);
|
116
|
+
}
|
117
|
+
Effect.ShadersStore[name + "PixelShader"] = this.FragmentShader.replace("#define CUSTOM_FRAGMENT_BEGIN", this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : "")
|
118
|
+
.replace("#define CUSTOM_FRAGMENT_MAIN_BEGIN", this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : "")
|
119
|
+
.replace("#define CUSTOM_FRAGMENT_DEFINITIONS", (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
|
120
|
+
.replace("#define CUSTOM_FRAGMENT_UPDATE_ALBEDO", this.CustomParts.Fragment_Custom_Albedo ? this.CustomParts.Fragment_Custom_Albedo : "")
|
121
|
+
.replace("#define CUSTOM_FRAGMENT_UPDATE_ALPHA", this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : "")
|
122
|
+
.replace("#define CUSTOM_FRAGMENT_BEFORE_LIGHTS", this.CustomParts.Fragment_Before_Lights ? this.CustomParts.Fragment_Before_Lights : "")
|
123
|
+
.replace("#define CUSTOM_FRAGMENT_UPDATE_METALLICROUGHNESS", this.CustomParts.Fragment_Custom_MetallicRoughness ? this.CustomParts.Fragment_Custom_MetallicRoughness : "")
|
124
|
+
.replace("#define CUSTOM_FRAGMENT_UPDATE_MICROSURFACE", this.CustomParts.Fragment_Custom_MicroSurface ? this.CustomParts.Fragment_Custom_MicroSurface : "")
|
125
|
+
.replace("#define CUSTOM_FRAGMENT_BEFORE_FINALCOLORCOMPOSITION", this.CustomParts.Fragment_Before_FinalColorComposition ? this.CustomParts.Fragment_Before_FinalColorComposition : "")
|
126
|
+
.replace("#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR", this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : "")
|
127
|
+
.replace("#define CUSTOM_FRAGMENT_MAIN_END", this.CustomParts.Fragment_MainEnd ? this.CustomParts.Fragment_MainEnd : "");
|
128
|
+
if (this.CustomParts.Fragment_Before_Fog) {
|
129
|
+
Effect.ShadersStore[name + "PixelShader"] = Effect.ShadersStore[name + "PixelShader"].replace("#define CUSTOM_FRAGMENT_BEFORE_FOG", this.CustomParts.Fragment_Before_Fog);
|
130
|
+
}
|
131
|
+
this._isCreatedShader = true;
|
132
|
+
this._createdShaderName = name;
|
133
|
+
return name;
|
134
|
+
};
|
135
|
+
PBRCustomMaterial.prototype.AddUniform = function (name, kind, param) {
|
136
|
+
if (!this._customUniform) {
|
137
|
+
this._customUniform = new Array();
|
138
|
+
this._newUniforms = new Array();
|
139
|
+
this._newSamplerInstances = {};
|
140
|
+
this._newUniformInstances = {};
|
141
|
+
}
|
142
|
+
if (param) {
|
143
|
+
if (kind.indexOf("sampler") != -1) {
|
144
|
+
this._newSamplerInstances[kind + "-" + name] = param;
|
145
|
+
}
|
146
|
+
else {
|
147
|
+
this._newUniformInstances[kind + "-" + name] = param;
|
148
|
+
}
|
149
|
+
}
|
150
|
+
this._customUniform.push("uniform " + kind + " " + name + ";");
|
151
|
+
this._newUniforms.push(name);
|
152
|
+
return this;
|
153
|
+
};
|
154
|
+
PBRCustomMaterial.prototype.AddAttribute = function (name) {
|
155
|
+
if (!this._customAttributes) {
|
156
|
+
this._customAttributes = [];
|
157
|
+
}
|
158
|
+
this._customAttributes.push(name);
|
159
|
+
return this;
|
160
|
+
};
|
161
|
+
PBRCustomMaterial.prototype.Fragment_Begin = function (shaderPart) {
|
162
|
+
this.CustomParts.Fragment_Begin = shaderPart;
|
163
|
+
return this;
|
164
|
+
};
|
165
|
+
PBRCustomMaterial.prototype.Fragment_Definitions = function (shaderPart) {
|
166
|
+
this.CustomParts.Fragment_Definitions = shaderPart;
|
167
|
+
return this;
|
168
|
+
};
|
169
|
+
PBRCustomMaterial.prototype.Fragment_MainBegin = function (shaderPart) {
|
170
|
+
this.CustomParts.Fragment_MainBegin = shaderPart;
|
171
|
+
return this;
|
172
|
+
};
|
173
|
+
PBRCustomMaterial.prototype.Fragment_Custom_Albedo = function (shaderPart) {
|
174
|
+
this.CustomParts.Fragment_Custom_Albedo = shaderPart.replace("result", "surfaceAlbedo");
|
175
|
+
return this;
|
176
|
+
};
|
177
|
+
PBRCustomMaterial.prototype.Fragment_Custom_Alpha = function (shaderPart) {
|
178
|
+
this.CustomParts.Fragment_Custom_Alpha = shaderPart.replace("result", "alpha");
|
179
|
+
return this;
|
180
|
+
};
|
181
|
+
PBRCustomMaterial.prototype.Fragment_Before_Lights = function (shaderPart) {
|
182
|
+
this.CustomParts.Fragment_Before_Lights = shaderPart;
|
183
|
+
return this;
|
184
|
+
};
|
185
|
+
PBRCustomMaterial.prototype.Fragment_Custom_MetallicRoughness = function (shaderPart) {
|
186
|
+
this.CustomParts.Fragment_Custom_MetallicRoughness = shaderPart;
|
187
|
+
return this;
|
188
|
+
};
|
189
|
+
PBRCustomMaterial.prototype.Fragment_Custom_MicroSurface = function (shaderPart) {
|
190
|
+
this.CustomParts.Fragment_Custom_MicroSurface = shaderPart;
|
191
|
+
return this;
|
192
|
+
};
|
193
|
+
PBRCustomMaterial.prototype.Fragment_Before_Fog = function (shaderPart) {
|
194
|
+
this.CustomParts.Fragment_Before_Fog = shaderPart;
|
195
|
+
return this;
|
196
|
+
};
|
197
|
+
PBRCustomMaterial.prototype.Fragment_Before_FinalColorComposition = function (shaderPart) {
|
198
|
+
this.CustomParts.Fragment_Before_FinalColorComposition = shaderPart;
|
199
|
+
return this;
|
200
|
+
};
|
201
|
+
PBRCustomMaterial.prototype.Fragment_Before_FragColor = function (shaderPart) {
|
202
|
+
this.CustomParts.Fragment_Before_FragColor = shaderPart.replace("result", "color");
|
203
|
+
return this;
|
204
|
+
};
|
205
|
+
PBRCustomMaterial.prototype.Fragment_MainEnd = function (shaderPart) {
|
206
|
+
this.CustomParts.Fragment_MainEnd = shaderPart;
|
207
|
+
return this;
|
208
|
+
};
|
209
|
+
PBRCustomMaterial.prototype.Vertex_Begin = function (shaderPart) {
|
210
|
+
this.CustomParts.Vertex_Begin = shaderPart;
|
211
|
+
return this;
|
212
|
+
};
|
213
|
+
PBRCustomMaterial.prototype.Vertex_Definitions = function (shaderPart) {
|
214
|
+
this.CustomParts.Vertex_Definitions = shaderPart;
|
215
|
+
return this;
|
216
|
+
};
|
217
|
+
PBRCustomMaterial.prototype.Vertex_MainBegin = function (shaderPart) {
|
218
|
+
this.CustomParts.Vertex_MainBegin = shaderPart;
|
219
|
+
return this;
|
220
|
+
};
|
221
|
+
PBRCustomMaterial.prototype.Vertex_Before_PositionUpdated = function (shaderPart) {
|
222
|
+
this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace("result", "positionUpdated");
|
223
|
+
return this;
|
224
|
+
};
|
225
|
+
PBRCustomMaterial.prototype.Vertex_Before_NormalUpdated = function (shaderPart) {
|
226
|
+
this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
|
227
|
+
return this;
|
228
|
+
};
|
229
|
+
PBRCustomMaterial.prototype.Vertex_After_WorldPosComputed = function (shaderPart) {
|
230
|
+
this.CustomParts.Vertex_After_WorldPosComputed = shaderPart;
|
231
|
+
return this;
|
232
|
+
};
|
233
|
+
PBRCustomMaterial.prototype.Vertex_MainEnd = function (shaderPart) {
|
234
|
+
this.CustomParts.Vertex_MainEnd = shaderPart;
|
235
|
+
return this;
|
236
|
+
};
|
237
|
+
PBRCustomMaterial.ShaderIndexer = 1;
|
238
|
+
return PBRCustomMaterial;
|
239
|
+
}(PBRMaterial));
|
240
|
+
export { PBRCustomMaterial };
|
241
|
+
RegisterClass("BABYLON.PBRCustomMaterial", PBRCustomMaterial);
|
242
242
|
//# sourceMappingURL=pbrCustomMaterial.js.map
|