babylonjs-procedural-textures 6.10.0 → 6.11.1
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/babylon.brickProceduralTexture.js +128 -115
- package/babylon.brickProceduralTexture.js.map +1 -1
- package/babylon.brickProceduralTexture.min.js +1 -1
- package/babylon.brickProceduralTexture.min.js.map +1 -1
- package/babylon.cloudProceduralTexture.js +126 -115
- package/babylon.cloudProceduralTexture.js.map +1 -1
- package/babylon.cloudProceduralTexture.min.js +1 -1
- package/babylon.cloudProceduralTexture.min.js.map +1 -1
- package/babylon.fireProceduralTexture.js +146 -162
- package/babylon.fireProceduralTexture.js.map +1 -1
- package/babylon.fireProceduralTexture.min.js +1 -1
- package/babylon.fireProceduralTexture.min.js.map +1 -1
- package/babylon.grassProceduralTexture.js +103 -86
- package/babylon.grassProceduralTexture.js.map +1 -1
- package/babylon.grassProceduralTexture.min.js +1 -1
- package/babylon.grassProceduralTexture.min.js.map +1 -1
- package/babylon.marbleProceduralTexture.js +115 -115
- package/babylon.marbleProceduralTexture.js.map +1 -1
- package/babylon.marbleProceduralTexture.min.js +1 -1
- package/babylon.marbleProceduralTexture.min.js.map +1 -1
- package/babylon.normalMapProceduralTexture.js +94 -78
- package/babylon.normalMapProceduralTexture.js.map +1 -1
- package/babylon.normalMapProceduralTexture.min.js +1 -1
- package/babylon.normalMapProceduralTexture.min.js.map +1 -1
- package/babylon.perlinNoiseProceduralTexture.js +130 -76
- package/babylon.perlinNoiseProceduralTexture.js.map +1 -1
- package/babylon.perlinNoiseProceduralTexture.min.js +1 -1
- package/babylon.perlinNoiseProceduralTexture.min.js.map +1 -1
- package/babylon.roadProceduralTexture.js +92 -70
- package/babylon.roadProceduralTexture.js.map +1 -1
- package/babylon.roadProceduralTexture.min.js +1 -1
- package/babylon.roadProceduralTexture.min.js.map +1 -1
- package/babylon.starfieldProceduralTexture.js +212 -225
- package/babylon.starfieldProceduralTexture.js.map +1 -1
- package/babylon.starfieldProceduralTexture.min.js +1 -1
- package/babylon.starfieldProceduralTexture.min.js.map +1 -1
- package/babylon.woodProceduralTexture.js +102 -85
- package/babylon.woodProceduralTexture.js.map +1 -1
- package/babylon.woodProceduralTexture.min.js +1 -1
- package/babylon.woodProceduralTexture.min.js.map +1 -1
- package/babylonjs.proceduralTextures.d.ts +20 -20
- package/babylonjs.proceduralTextures.js +959 -1038
- package/babylonjs.proceduralTextures.js.map +1 -1
- package/babylonjs.proceduralTextures.min.js +1 -1
- package/babylonjs.proceduralTextures.min.js.map +1 -1
- package/babylonjs.proceduralTextures.module.d.ts +64 -64
- package/config.json +1 -1
- package/package.json +3 -3
- package/src/brick.ts +3 -14
- package/src/cloud.ts +3 -14
- package/src/fire.ts +3 -14
- package/src/grass.ts +3 -14
- package/src/index.ts +1 -1
- package/src/marble.ts +3 -14
- package/src/normalMap.ts +3 -14
- package/src/perlinNoise.ts +3 -14
- package/src/road.ts +3 -14
- package/src/starfield.ts +3 -14
- package/src/wood.ts +3 -14
- package/tsconfig.build.json +6 -3
- package/tsconfig.json +2 -1
- package/webpack.config.js +4 -0
|
@@ -7,39 +7,52 @@
|
|
|
7
7
|
exports["babylonjs-procedural-textures"] = factory(require("babylonjs"));
|
|
8
8
|
else
|
|
9
9
|
root["PROCEDURALTEXTURES"] = factory(root["BABYLON"]);
|
|
10
|
-
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (
|
|
10
|
+
})((typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : this), (__WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__) => {
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ "use strict";
|
|
13
13
|
/******/ var __webpack_modules__ = ({
|
|
14
14
|
|
|
15
|
-
/***/ "../../../
|
|
16
|
-
|
|
17
|
-
!*** ../../../
|
|
18
|
-
|
|
15
|
+
/***/ "../../../dev/proceduralTextures/src/brick/brickProceduralTexture.fragment.ts":
|
|
16
|
+
/*!************************************************************************************!*\
|
|
17
|
+
!*** ../../../dev/proceduralTextures/src/brick/brickProceduralTexture.fragment.ts ***!
|
|
18
|
+
\************************************************************************************/
|
|
19
19
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20
20
|
|
|
21
21
|
__webpack_require__.r(__webpack_exports__);
|
|
22
22
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
23
23
|
/* harmony export */ brickProceduralTexturePixelShader: () => (/* binding */ brickProceduralTexturePixelShader)
|
|
24
24
|
/* harmony export */ });
|
|
25
|
-
/* harmony import */ var
|
|
26
|
-
/* harmony import */ var
|
|
25
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
26
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
27
27
|
// Do not edit.
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const name = "brickProceduralTexturePixelShader";
|
|
30
|
+
const shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float numberOfBricksHeight;uniform float numberOfBricksWidth;uniform vec3 brickColor;uniform vec3 jointColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
|
|
31
|
+
float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
|
|
32
|
+
float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
|
|
33
|
+
return total;}
|
|
34
|
+
float roundF(float number){return sign(number)*floor(abs(number)+0.5);}
|
|
35
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
36
|
+
void main(void)
|
|
37
|
+
{float brickW=1.0/numberOfBricksWidth;float brickH=1.0/numberOfBricksHeight;float jointWPercentage=0.01;float jointHPercentage=0.05;vec3 color=brickColor;float yi=vUV.y/brickH;float nyi=roundF(yi);float xi=vUV.x/brickW;if (mod(floor(yi),2.0)==0.0){xi=xi-0.5;}
|
|
38
|
+
float nxi=roundF(xi);vec2 brickvUV=vec2((xi-floor(xi))/brickH,(yi-floor(yi))/ brickW);if (yi<nyi+jointHPercentage && yi>nyi-jointHPercentage){color=mix(jointColor,vec3(0.37,0.25,0.25),(yi-nyi)/jointHPercentage+0.2);}
|
|
39
|
+
else if (xi<nxi+jointWPercentage && xi>nxi-jointWPercentage){color=mix(jointColor,vec3(0.44,0.44,0.44),(xi-nxi)/jointWPercentage+0.2);}
|
|
40
|
+
else {float brickColorSwitch=mod(floor(yi)+floor(xi),3.0);if (brickColorSwitch==0.0)
|
|
41
|
+
color=mix(color,vec3(0.33,0.33,0.33),0.3);else if (brickColorSwitch==2.0)
|
|
42
|
+
color=mix(color,vec3(0.11,0.11,0.11),0.3);}
|
|
43
|
+
gl_FragColor=vec4(color,1.0);}`;
|
|
31
44
|
// Sideeffect
|
|
32
|
-
|
|
45
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
33
46
|
/** @internal */
|
|
34
|
-
|
|
47
|
+
const brickProceduralTexturePixelShader = { name, shader };
|
|
35
48
|
|
|
36
49
|
|
|
37
50
|
/***/ }),
|
|
38
51
|
|
|
39
|
-
/***/ "../../../
|
|
40
|
-
|
|
41
|
-
!*** ../../../
|
|
42
|
-
|
|
52
|
+
/***/ "../../../dev/proceduralTextures/src/brick/brickProceduralTexture.ts":
|
|
53
|
+
/*!***************************************************************************!*\
|
|
54
|
+
!*** ../../../dev/proceduralTextures/src/brick/brickProceduralTexture.ts ***!
|
|
55
|
+
\***************************************************************************/
|
|
43
56
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
44
57
|
|
|
45
58
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -47,86 +60,67 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
47
60
|
/* harmony export */ BrickProceduralTexture: () => (/* binding */ BrickProceduralTexture)
|
|
48
61
|
/* harmony export */ });
|
|
49
62
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
50
|
-
/* harmony import */ var
|
|
51
|
-
/* harmony import */ var
|
|
52
|
-
/* harmony import */ var _brickProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./brickProceduralTexture.fragment */ "../../../
|
|
63
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
64
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
65
|
+
/* harmony import */ var _brickProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./brickProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/brick/brickProceduralTexture.fragment.ts");
|
|
53
66
|
|
|
54
67
|
|
|
55
68
|
|
|
56
69
|
|
|
57
70
|
|
|
58
71
|
|
|
59
|
-
|
|
60
|
-
(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
_this._brickColor = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.77, 0.47, 0.4);
|
|
68
|
-
_this.updateShaderUniforms();
|
|
69
|
-
return _this;
|
|
72
|
+
class BrickProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
73
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
74
|
+
super(name, size, "brickProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
75
|
+
this._numberOfBricksHeight = 15;
|
|
76
|
+
this._numberOfBricksWidth = 5;
|
|
77
|
+
this._jointColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.72, 0.72, 0.72);
|
|
78
|
+
this._brickColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.77, 0.47, 0.4);
|
|
79
|
+
this.updateShaderUniforms();
|
|
70
80
|
}
|
|
71
|
-
|
|
81
|
+
updateShaderUniforms() {
|
|
72
82
|
this.setFloat("numberOfBricksHeight", this._numberOfBricksHeight);
|
|
73
83
|
this.setFloat("numberOfBricksWidth", this._numberOfBricksWidth);
|
|
74
84
|
this.setColor3("brickColor", this._brickColor);
|
|
75
85
|
this.setColor3("jointColor", this._jointColor);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
this.updateShaderUniforms();
|
|
106
|
-
},
|
|
107
|
-
enumerable: false,
|
|
108
|
-
configurable: true
|
|
109
|
-
});
|
|
110
|
-
Object.defineProperty(BrickProceduralTexture.prototype, "brickColor", {
|
|
111
|
-
get: function () {
|
|
112
|
-
return this._brickColor;
|
|
113
|
-
},
|
|
114
|
-
set: function (value) {
|
|
115
|
-
this._brickColor = value;
|
|
116
|
-
this.updateShaderUniforms();
|
|
117
|
-
},
|
|
118
|
-
enumerable: false,
|
|
119
|
-
configurable: true
|
|
120
|
-
});
|
|
86
|
+
}
|
|
87
|
+
get numberOfBricksHeight() {
|
|
88
|
+
return this._numberOfBricksHeight;
|
|
89
|
+
}
|
|
90
|
+
set numberOfBricksHeight(value) {
|
|
91
|
+
this._numberOfBricksHeight = value;
|
|
92
|
+
this.updateShaderUniforms();
|
|
93
|
+
}
|
|
94
|
+
get numberOfBricksWidth() {
|
|
95
|
+
return this._numberOfBricksWidth;
|
|
96
|
+
}
|
|
97
|
+
set numberOfBricksWidth(value) {
|
|
98
|
+
this._numberOfBricksWidth = value;
|
|
99
|
+
this.updateShaderUniforms();
|
|
100
|
+
}
|
|
101
|
+
get jointColor() {
|
|
102
|
+
return this._jointColor;
|
|
103
|
+
}
|
|
104
|
+
set jointColor(value) {
|
|
105
|
+
this._jointColor = value;
|
|
106
|
+
this.updateShaderUniforms();
|
|
107
|
+
}
|
|
108
|
+
get brickColor() {
|
|
109
|
+
return this._brickColor;
|
|
110
|
+
}
|
|
111
|
+
set brickColor(value) {
|
|
112
|
+
this._brickColor = value;
|
|
113
|
+
this.updateShaderUniforms();
|
|
114
|
+
}
|
|
121
115
|
/**
|
|
122
116
|
* Serializes this brick procedural texture
|
|
123
117
|
* @returns a serialized brick procedural texture object
|
|
124
118
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
serialize() {
|
|
120
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
127
121
|
serializationObject.customType = "BABYLON.BrickProceduralTexture";
|
|
128
122
|
return serializationObject;
|
|
129
|
-
}
|
|
123
|
+
}
|
|
130
124
|
/**
|
|
131
125
|
* Creates a Brick Procedural Texture from parsed brick procedural texture data
|
|
132
126
|
* @param parsedTexture defines parsed texture data
|
|
@@ -134,73 +128,83 @@ var BrickProceduralTexture = /** @class */ (function (_super) {
|
|
|
134
128
|
* @param rootUrl defines the root URL containing brick procedural texture information
|
|
135
129
|
* @returns a parsed Brick Procedural Texture
|
|
136
130
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
131
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
132
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new BrickProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
139
133
|
return texture;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.BrickProceduralTexture", BrickProceduralTexture);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
137
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
138
|
+
], BrickProceduralTexture.prototype, "numberOfBricksHeight", null);
|
|
139
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
140
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
141
|
+
], BrickProceduralTexture.prototype, "numberOfBricksWidth", null);
|
|
142
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
143
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
|
|
144
|
+
], BrickProceduralTexture.prototype, "jointColor", null);
|
|
145
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
146
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
|
|
147
|
+
], BrickProceduralTexture.prototype, "brickColor", null);
|
|
148
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.BrickProceduralTexture", BrickProceduralTexture);
|
|
156
149
|
|
|
157
150
|
|
|
158
151
|
/***/ }),
|
|
159
152
|
|
|
160
|
-
/***/ "../../../
|
|
161
|
-
|
|
162
|
-
!*** ../../../
|
|
163
|
-
|
|
153
|
+
/***/ "../../../dev/proceduralTextures/src/brick/index.ts":
|
|
154
|
+
/*!**********************************************************!*\
|
|
155
|
+
!*** ../../../dev/proceduralTextures/src/brick/index.ts ***!
|
|
156
|
+
\**********************************************************/
|
|
164
157
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
165
158
|
|
|
166
159
|
__webpack_require__.r(__webpack_exports__);
|
|
167
160
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
168
161
|
/* harmony export */ BrickProceduralTexture: () => (/* reexport safe */ _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.BrickProceduralTexture)
|
|
169
162
|
/* harmony export */ });
|
|
170
|
-
/* harmony import */ var _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brickProceduralTexture */ "../../../
|
|
163
|
+
/* harmony import */ var _brickProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brickProceduralTexture */ "../../../dev/proceduralTextures/src/brick/brickProceduralTexture.ts");
|
|
171
164
|
|
|
172
165
|
|
|
173
166
|
|
|
174
167
|
/***/ }),
|
|
175
168
|
|
|
176
|
-
/***/ "../../../
|
|
177
|
-
|
|
178
|
-
!*** ../../../
|
|
179
|
-
|
|
169
|
+
/***/ "../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.fragment.ts":
|
|
170
|
+
/*!************************************************************************************!*\
|
|
171
|
+
!*** ../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.fragment.ts ***!
|
|
172
|
+
\************************************************************************************/
|
|
180
173
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
181
174
|
|
|
182
175
|
__webpack_require__.r(__webpack_exports__);
|
|
183
176
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
184
177
|
/* harmony export */ cloudProceduralTexturePixelShader: () => (/* binding */ cloudProceduralTexturePixelShader)
|
|
185
178
|
/* harmony export */ });
|
|
186
|
-
/* harmony import */ var
|
|
187
|
-
/* harmony import */ var
|
|
179
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
180
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
188
181
|
// Do not edit.
|
|
189
182
|
|
|
190
|
-
|
|
191
|
-
|
|
183
|
+
const name = "cloudProceduralTexturePixelShader";
|
|
184
|
+
const shader = `precision highp float;varying vec2 vUV;uniform vec4 skyColor;uniform vec4 cloudColor;uniform float amplitude;uniform int numOctaves;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
|
|
185
|
+
float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
|
|
186
|
+
float fbm(vec2 n) {float total=0.0,ampl=amplitude;
|
|
187
|
+
#ifdef WEBGL2
|
|
188
|
+
for (int i=0; i<numOctaves; i++) {
|
|
189
|
+
#else
|
|
190
|
+
for (int i=0; i<4; i++) {
|
|
191
|
+
#endif
|
|
192
|
+
total+=noise(n)*ampl;n+=n;ampl*=0.5;}
|
|
193
|
+
return total;}
|
|
194
|
+
void main() {vec2 p=vUV*12.0;vec4 c=mix(skyColor,cloudColor,fbm(p));gl_FragColor=c;}
|
|
195
|
+
`;
|
|
192
196
|
// Sideeffect
|
|
193
|
-
|
|
197
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
194
198
|
/** @internal */
|
|
195
|
-
|
|
199
|
+
const cloudProceduralTexturePixelShader = { name, shader };
|
|
196
200
|
|
|
197
201
|
|
|
198
202
|
/***/ }),
|
|
199
203
|
|
|
200
|
-
/***/ "../../../
|
|
201
|
-
|
|
202
|
-
!*** ../../../
|
|
203
|
-
|
|
204
|
+
/***/ "../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.ts":
|
|
205
|
+
/*!***************************************************************************!*\
|
|
206
|
+
!*** ../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.ts ***!
|
|
207
|
+
\***************************************************************************/
|
|
204
208
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
205
209
|
|
|
206
210
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -208,86 +212,67 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
208
212
|
/* harmony export */ CloudProceduralTexture: () => (/* binding */ CloudProceduralTexture)
|
|
209
213
|
/* harmony export */ });
|
|
210
214
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
211
|
-
/* harmony import */ var
|
|
212
|
-
/* harmony import */ var
|
|
213
|
-
/* harmony import */ var _cloudProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cloudProceduralTexture.fragment */ "../../../
|
|
215
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
216
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
217
|
+
/* harmony import */ var _cloudProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cloudProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.fragment.ts");
|
|
214
218
|
|
|
215
219
|
|
|
216
220
|
|
|
217
221
|
|
|
218
222
|
|
|
219
223
|
|
|
220
|
-
|
|
221
|
-
(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
_this._numOctaves = 4;
|
|
229
|
-
_this.updateShaderUniforms();
|
|
230
|
-
return _this;
|
|
224
|
+
class CloudProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
225
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
226
|
+
super(name, size, "cloudProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
227
|
+
this._skyColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color4(0.15, 0.68, 1.0, 1.0);
|
|
228
|
+
this._cloudColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color4(1, 1, 1, 1.0);
|
|
229
|
+
this._amplitude = 1;
|
|
230
|
+
this._numOctaves = 4;
|
|
231
|
+
this.updateShaderUniforms();
|
|
231
232
|
}
|
|
232
|
-
|
|
233
|
+
updateShaderUniforms() {
|
|
233
234
|
this.setColor4("skyColor", this._skyColor);
|
|
234
235
|
this.setColor4("cloudColor", this._cloudColor);
|
|
235
236
|
this.setFloat("amplitude", this._amplitude);
|
|
236
237
|
this.setInt("numOctaves", this._numOctaves);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
this.updateShaderUniforms();
|
|
267
|
-
},
|
|
268
|
-
enumerable: false,
|
|
269
|
-
configurable: true
|
|
270
|
-
});
|
|
271
|
-
Object.defineProperty(CloudProceduralTexture.prototype, "numOctaves", {
|
|
272
|
-
get: function () {
|
|
273
|
-
return this._numOctaves;
|
|
274
|
-
},
|
|
275
|
-
set: function (value) {
|
|
276
|
-
this._numOctaves = value;
|
|
277
|
-
this.updateShaderUniforms();
|
|
278
|
-
},
|
|
279
|
-
enumerable: false,
|
|
280
|
-
configurable: true
|
|
281
|
-
});
|
|
238
|
+
}
|
|
239
|
+
get skyColor() {
|
|
240
|
+
return this._skyColor;
|
|
241
|
+
}
|
|
242
|
+
set skyColor(value) {
|
|
243
|
+
this._skyColor = value;
|
|
244
|
+
this.updateShaderUniforms();
|
|
245
|
+
}
|
|
246
|
+
get cloudColor() {
|
|
247
|
+
return this._cloudColor;
|
|
248
|
+
}
|
|
249
|
+
set cloudColor(value) {
|
|
250
|
+
this._cloudColor = value;
|
|
251
|
+
this.updateShaderUniforms();
|
|
252
|
+
}
|
|
253
|
+
get amplitude() {
|
|
254
|
+
return this._amplitude;
|
|
255
|
+
}
|
|
256
|
+
set amplitude(value) {
|
|
257
|
+
this._amplitude = value;
|
|
258
|
+
this.updateShaderUniforms();
|
|
259
|
+
}
|
|
260
|
+
get numOctaves() {
|
|
261
|
+
return this._numOctaves;
|
|
262
|
+
}
|
|
263
|
+
set numOctaves(value) {
|
|
264
|
+
this._numOctaves = value;
|
|
265
|
+
this.updateShaderUniforms();
|
|
266
|
+
}
|
|
282
267
|
/**
|
|
283
268
|
* Serializes this cloud procedural texture
|
|
284
269
|
* @returns a serialized cloud procedural texture object
|
|
285
270
|
*/
|
|
286
|
-
|
|
287
|
-
|
|
271
|
+
serialize() {
|
|
272
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
288
273
|
serializationObject.customType = "BABYLON.CloudProceduralTexture";
|
|
289
274
|
return serializationObject;
|
|
290
|
-
}
|
|
275
|
+
}
|
|
291
276
|
/**
|
|
292
277
|
* Creates a Cloud Procedural Texture from parsed cloud procedural texture data
|
|
293
278
|
* @param parsedTexture defines parsed texture data
|
|
@@ -295,73 +280,76 @@ var CloudProceduralTexture = /** @class */ (function (_super) {
|
|
|
295
280
|
* @param rootUrl defines the root URL containing cloud procedural texture information
|
|
296
281
|
* @returns a parsed Cloud Procedural Texture
|
|
297
282
|
*/
|
|
298
|
-
|
|
299
|
-
|
|
283
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
284
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new CloudProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
300
285
|
return texture;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.CloudProceduralTexture", CloudProceduralTexture);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
289
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor4)()
|
|
290
|
+
], CloudProceduralTexture.prototype, "skyColor", null);
|
|
291
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
292
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor4)()
|
|
293
|
+
], CloudProceduralTexture.prototype, "cloudColor", null);
|
|
294
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
295
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
296
|
+
], CloudProceduralTexture.prototype, "amplitude", null);
|
|
297
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
298
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
299
|
+
], CloudProceduralTexture.prototype, "numOctaves", null);
|
|
300
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.CloudProceduralTexture", CloudProceduralTexture);
|
|
317
301
|
|
|
318
302
|
|
|
319
303
|
/***/ }),
|
|
320
304
|
|
|
321
|
-
/***/ "../../../
|
|
322
|
-
|
|
323
|
-
!*** ../../../
|
|
324
|
-
|
|
305
|
+
/***/ "../../../dev/proceduralTextures/src/cloud/index.ts":
|
|
306
|
+
/*!**********************************************************!*\
|
|
307
|
+
!*** ../../../dev/proceduralTextures/src/cloud/index.ts ***!
|
|
308
|
+
\**********************************************************/
|
|
325
309
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
326
310
|
|
|
327
311
|
__webpack_require__.r(__webpack_exports__);
|
|
328
312
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
329
313
|
/* harmony export */ CloudProceduralTexture: () => (/* reexport safe */ _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.CloudProceduralTexture)
|
|
330
314
|
/* harmony export */ });
|
|
331
|
-
/* harmony import */ var _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cloudProceduralTexture */ "../../../
|
|
315
|
+
/* harmony import */ var _cloudProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cloudProceduralTexture */ "../../../dev/proceduralTextures/src/cloud/cloudProceduralTexture.ts");
|
|
332
316
|
|
|
333
317
|
|
|
334
318
|
|
|
335
319
|
/***/ }),
|
|
336
320
|
|
|
337
|
-
/***/ "../../../
|
|
338
|
-
|
|
339
|
-
!*** ../../../
|
|
340
|
-
|
|
321
|
+
/***/ "../../../dev/proceduralTextures/src/fire/fireProceduralTexture.fragment.ts":
|
|
322
|
+
/*!**********************************************************************************!*\
|
|
323
|
+
!*** ../../../dev/proceduralTextures/src/fire/fireProceduralTexture.fragment.ts ***!
|
|
324
|
+
\**********************************************************************************/
|
|
341
325
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
342
326
|
|
|
343
327
|
__webpack_require__.r(__webpack_exports__);
|
|
344
328
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
345
329
|
/* harmony export */ fireProceduralTexturePixelShader: () => (/* binding */ fireProceduralTexturePixelShader)
|
|
346
330
|
/* harmony export */ });
|
|
347
|
-
/* harmony import */ var
|
|
348
|
-
/* harmony import */ var
|
|
331
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
332
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
349
333
|
// Do not edit.
|
|
350
334
|
|
|
351
|
-
|
|
352
|
-
|
|
335
|
+
const name = "fireProceduralTexturePixelShader";
|
|
336
|
+
const shader = `precision highp float;uniform float time;uniform vec3 c1;uniform vec3 c2;uniform vec3 c3;uniform vec3 c4;uniform vec3 c5;uniform vec3 c6;uniform vec2 speed;uniform float shift;uniform float alphaThreshold;varying vec2 vUV;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
|
|
337
|
+
float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
|
|
338
|
+
float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
|
|
339
|
+
return total;}
|
|
340
|
+
void main() {vec2 p=vUV*8.0;float q=fbm(p-time*0.1);vec2 r=vec2(fbm(p+q+time*speed.x-p.x-p.y),fbm(p+q-time*speed.y));vec3 c=mix(c1,c2,fbm(p+r))+mix(c3,c4,r.x)-mix(c5,c6,r.y);vec3 color=c*cos(shift*vUV.y);float luminance=dot(color.rgb,vec3(0.3,0.59,0.11));gl_FragColor=vec4(color,luminance*alphaThreshold+(1.0-alphaThreshold));}`;
|
|
353
341
|
// Sideeffect
|
|
354
|
-
|
|
342
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
355
343
|
/** @internal */
|
|
356
|
-
|
|
344
|
+
const fireProceduralTexturePixelShader = { name, shader };
|
|
357
345
|
|
|
358
346
|
|
|
359
347
|
/***/ }),
|
|
360
348
|
|
|
361
|
-
/***/ "../../../
|
|
362
|
-
|
|
363
|
-
!*** ../../../
|
|
364
|
-
|
|
349
|
+
/***/ "../../../dev/proceduralTextures/src/fire/fireProceduralTexture.ts":
|
|
350
|
+
/*!*************************************************************************!*\
|
|
351
|
+
!*** ../../../dev/proceduralTextures/src/fire/fireProceduralTexture.ts ***!
|
|
352
|
+
\*************************************************************************/
|
|
365
353
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
366
354
|
|
|
367
355
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -369,9 +357,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
369
357
|
/* harmony export */ FireProceduralTexture: () => (/* binding */ FireProceduralTexture)
|
|
370
358
|
/* harmony export */ });
|
|
371
359
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
372
|
-
/* harmony import */ var
|
|
373
|
-
/* harmony import */ var
|
|
374
|
-
/* harmony import */ var _fireProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fireProceduralTexture.fragment */ "../../../
|
|
360
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
361
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
362
|
+
/* harmony import */ var _fireProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fireProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/fire/fireProceduralTexture.fragment.ts");
|
|
375
363
|
|
|
376
364
|
|
|
377
365
|
|
|
@@ -379,20 +367,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
379
367
|
|
|
380
368
|
|
|
381
369
|
|
|
382
|
-
|
|
383
|
-
(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
_this._fireColors = FireProceduralTexture.RedFireColors;
|
|
392
|
-
_this.updateShaderUniforms();
|
|
393
|
-
return _this;
|
|
370
|
+
class FireProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
371
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
372
|
+
super(name, size, "fireProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
373
|
+
this._time = 0.0;
|
|
374
|
+
this._speed = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Vector2(0.5, 0.3);
|
|
375
|
+
this._autoGenerateTime = true;
|
|
376
|
+
this._alphaThreshold = 0.5;
|
|
377
|
+
this._fireColors = FireProceduralTexture.RedFireColors;
|
|
378
|
+
this.updateShaderUniforms();
|
|
394
379
|
}
|
|
395
|
-
|
|
380
|
+
updateShaderUniforms() {
|
|
396
381
|
this.setFloat("time", this._time);
|
|
397
382
|
this.setVector2("speed", this._speed);
|
|
398
383
|
this.setColor3("c1", this._fireColors[0]);
|
|
@@ -402,110 +387,74 @@ var FireProceduralTexture = /** @class */ (function (_super) {
|
|
|
402
387
|
this.setColor3("c5", this._fireColors[4]);
|
|
403
388
|
this.setColor3("c6", this._fireColors[5]);
|
|
404
389
|
this.setFloat("alphaThreshold", this._alphaThreshold);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
390
|
+
}
|
|
391
|
+
render(useCameraPostProcess) {
|
|
392
|
+
const scene = this.getScene();
|
|
408
393
|
if (this._autoGenerateTime && scene) {
|
|
409
394
|
this._time += scene.getAnimationRatio() * 0.03;
|
|
410
395
|
this.updateShaderUniforms();
|
|
411
396
|
}
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
enumerable: false,
|
|
461
|
-
configurable: true
|
|
462
|
-
});
|
|
463
|
-
Object.defineProperty(FireProceduralTexture.prototype, "time", {
|
|
464
|
-
get: function () {
|
|
465
|
-
return this._time;
|
|
466
|
-
},
|
|
467
|
-
set: function (value) {
|
|
468
|
-
this._time = value;
|
|
469
|
-
this.updateShaderUniforms();
|
|
470
|
-
},
|
|
471
|
-
enumerable: false,
|
|
472
|
-
configurable: true
|
|
473
|
-
});
|
|
474
|
-
Object.defineProperty(FireProceduralTexture.prototype, "speed", {
|
|
475
|
-
get: function () {
|
|
476
|
-
return this._speed;
|
|
477
|
-
},
|
|
478
|
-
set: function (value) {
|
|
479
|
-
this._speed = value;
|
|
480
|
-
this.updateShaderUniforms();
|
|
481
|
-
},
|
|
482
|
-
enumerable: false,
|
|
483
|
-
configurable: true
|
|
484
|
-
});
|
|
485
|
-
Object.defineProperty(FireProceduralTexture.prototype, "alphaThreshold", {
|
|
486
|
-
get: function () {
|
|
487
|
-
return this._alphaThreshold;
|
|
488
|
-
},
|
|
489
|
-
set: function (value) {
|
|
490
|
-
this._alphaThreshold = value;
|
|
491
|
-
this.updateShaderUniforms();
|
|
492
|
-
},
|
|
493
|
-
enumerable: false,
|
|
494
|
-
configurable: true
|
|
495
|
-
});
|
|
397
|
+
super.render(useCameraPostProcess);
|
|
398
|
+
}
|
|
399
|
+
static get PurpleFireColors() {
|
|
400
|
+
return [new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.5, 0.0, 1.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.9, 0.0, 1.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.2, 0.0, 1.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(1.0, 0.9, 1.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.1, 1.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.9, 0.9, 1.0)];
|
|
401
|
+
}
|
|
402
|
+
static get GreenFireColors() {
|
|
403
|
+
return [new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.5, 1.0, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.5, 1.0, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.3, 0.4, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.5, 1.0, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.2, 0.0, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.5, 1.0, 0.0)];
|
|
404
|
+
}
|
|
405
|
+
static get RedFireColors() {
|
|
406
|
+
return [new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.5, 0.0, 0.1), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.9, 0.0, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.2, 0.0, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(1.0, 0.9, 0.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.1, 0.1), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.9, 0.9, 0.9)];
|
|
407
|
+
}
|
|
408
|
+
static get BlueFireColors() {
|
|
409
|
+
return [new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.0, 0.5), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.0, 0.0, 0.5), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.0, 0.2), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.0, 0.0, 1.0), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.1, 0.2, 0.3), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.0, 0.2, 0.9)];
|
|
410
|
+
}
|
|
411
|
+
get autoGenerateTime() {
|
|
412
|
+
return this._autoGenerateTime;
|
|
413
|
+
}
|
|
414
|
+
set autoGenerateTime(value) {
|
|
415
|
+
this._autoGenerateTime = value;
|
|
416
|
+
}
|
|
417
|
+
get fireColors() {
|
|
418
|
+
return this._fireColors;
|
|
419
|
+
}
|
|
420
|
+
set fireColors(value) {
|
|
421
|
+
this._fireColors = value;
|
|
422
|
+
this.updateShaderUniforms();
|
|
423
|
+
}
|
|
424
|
+
get time() {
|
|
425
|
+
return this._time;
|
|
426
|
+
}
|
|
427
|
+
set time(value) {
|
|
428
|
+
this._time = value;
|
|
429
|
+
this.updateShaderUniforms();
|
|
430
|
+
}
|
|
431
|
+
get speed() {
|
|
432
|
+
return this._speed;
|
|
433
|
+
}
|
|
434
|
+
set speed(value) {
|
|
435
|
+
this._speed = value;
|
|
436
|
+
this.updateShaderUniforms();
|
|
437
|
+
}
|
|
438
|
+
get alphaThreshold() {
|
|
439
|
+
return this._alphaThreshold;
|
|
440
|
+
}
|
|
441
|
+
set alphaThreshold(value) {
|
|
442
|
+
this._alphaThreshold = value;
|
|
443
|
+
this.updateShaderUniforms();
|
|
444
|
+
}
|
|
496
445
|
/**
|
|
497
446
|
* Serializes this fire procedural texture
|
|
498
447
|
* @returns a serialized fire procedural texture object
|
|
499
448
|
*/
|
|
500
|
-
|
|
501
|
-
|
|
449
|
+
serialize() {
|
|
450
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
502
451
|
serializationObject.customType = "BABYLON.FireProceduralTexture";
|
|
503
452
|
serializationObject.fireColors = [];
|
|
504
|
-
for (
|
|
453
|
+
for (let i = 0; i < this._fireColors.length; i++) {
|
|
505
454
|
serializationObject.fireColors.push(this._fireColors[i].asArray());
|
|
506
455
|
}
|
|
507
456
|
return serializationObject;
|
|
508
|
-
}
|
|
457
|
+
}
|
|
509
458
|
/**
|
|
510
459
|
* Creates a Fire Procedural Texture from parsed fire procedural texture data
|
|
511
460
|
* @param parsedTexture defines parsed texture data
|
|
@@ -513,78 +462,86 @@ var FireProceduralTexture = /** @class */ (function (_super) {
|
|
|
513
462
|
* @param rootUrl defines the root URL containing fire procedural texture information
|
|
514
463
|
* @returns a parsed Fire Procedural Texture
|
|
515
464
|
*/
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
for (
|
|
520
|
-
colors.push(
|
|
465
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
466
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new FireProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
467
|
+
const colors = [];
|
|
468
|
+
for (let i = 0; i < parsedTexture.fireColors.length; i++) {
|
|
469
|
+
colors.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3.FromArray(parsedTexture.fireColors[i]));
|
|
521
470
|
}
|
|
522
471
|
texture.fireColors = colors;
|
|
523
472
|
return texture;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.FireProceduralTexture", FireProceduralTexture);
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
476
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
477
|
+
], FireProceduralTexture.prototype, "autoGenerateTime", null);
|
|
478
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
479
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
480
|
+
], FireProceduralTexture.prototype, "time", null);
|
|
481
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
482
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsVector2)()
|
|
483
|
+
], FireProceduralTexture.prototype, "speed", null);
|
|
484
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
485
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
486
|
+
], FireProceduralTexture.prototype, "alphaThreshold", null);
|
|
487
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.FireProceduralTexture", FireProceduralTexture);
|
|
540
488
|
|
|
541
489
|
|
|
542
490
|
/***/ }),
|
|
543
491
|
|
|
544
|
-
/***/ "../../../
|
|
545
|
-
|
|
546
|
-
!*** ../../../
|
|
547
|
-
|
|
492
|
+
/***/ "../../../dev/proceduralTextures/src/fire/index.ts":
|
|
493
|
+
/*!*********************************************************!*\
|
|
494
|
+
!*** ../../../dev/proceduralTextures/src/fire/index.ts ***!
|
|
495
|
+
\*********************************************************/
|
|
548
496
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
549
497
|
|
|
550
498
|
__webpack_require__.r(__webpack_exports__);
|
|
551
499
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
552
500
|
/* harmony export */ FireProceduralTexture: () => (/* reexport safe */ _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.FireProceduralTexture)
|
|
553
501
|
/* harmony export */ });
|
|
554
|
-
/* harmony import */ var _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fireProceduralTexture */ "../../../
|
|
502
|
+
/* harmony import */ var _fireProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fireProceduralTexture */ "../../../dev/proceduralTextures/src/fire/fireProceduralTexture.ts");
|
|
555
503
|
|
|
556
504
|
|
|
557
505
|
|
|
558
506
|
/***/ }),
|
|
559
507
|
|
|
560
|
-
/***/ "../../../
|
|
561
|
-
|
|
562
|
-
!*** ../../../
|
|
563
|
-
|
|
508
|
+
/***/ "../../../dev/proceduralTextures/src/grass/grassProceduralTexture.fragment.ts":
|
|
509
|
+
/*!************************************************************************************!*\
|
|
510
|
+
!*** ../../../dev/proceduralTextures/src/grass/grassProceduralTexture.fragment.ts ***!
|
|
511
|
+
\************************************************************************************/
|
|
564
512
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
565
513
|
|
|
566
514
|
__webpack_require__.r(__webpack_exports__);
|
|
567
515
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
568
516
|
/* harmony export */ grassProceduralTexturePixelShader: () => (/* binding */ grassProceduralTexturePixelShader)
|
|
569
517
|
/* harmony export */ });
|
|
570
|
-
/* harmony import */ var
|
|
571
|
-
/* harmony import */ var
|
|
518
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
519
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
572
520
|
// Do not edit.
|
|
573
521
|
|
|
574
|
-
|
|
575
|
-
|
|
522
|
+
const name = "grassProceduralTexturePixelShader";
|
|
523
|
+
const shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform vec3 herb1Color;uniform vec3 herb2Color;uniform vec3 herb3Color;uniform vec3 groundColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
|
|
524
|
+
float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
|
|
525
|
+
float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
|
|
526
|
+
return total;}
|
|
527
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
528
|
+
void main(void) {
|
|
529
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
530
|
+
vec3 color=mix(groundColor,herb1Color,rand(gl_FragCoord.xy*4.0));color=mix(color,herb2Color,rand(gl_FragCoord.xy*8.0));color=mix(color,herb3Color,rand(gl_FragCoord.xy));color=mix(color,herb1Color,fbm(gl_FragCoord.xy*16.0));gl_FragColor=vec4(color,1.0);
|
|
531
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
532
|
+
}`;
|
|
576
533
|
// Sideeffect
|
|
577
|
-
|
|
534
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
578
535
|
/** @internal */
|
|
579
|
-
|
|
536
|
+
const grassProceduralTexturePixelShader = { name, shader };
|
|
580
537
|
|
|
581
538
|
|
|
582
539
|
/***/ }),
|
|
583
540
|
|
|
584
|
-
/***/ "../../../
|
|
585
|
-
|
|
586
|
-
!*** ../../../
|
|
587
|
-
|
|
541
|
+
/***/ "../../../dev/proceduralTextures/src/grass/grassProceduralTexture.ts":
|
|
542
|
+
/*!***************************************************************************!*\
|
|
543
|
+
!*** ../../../dev/proceduralTextures/src/grass/grassProceduralTexture.ts ***!
|
|
544
|
+
\***************************************************************************/
|
|
588
545
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
589
546
|
|
|
590
547
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -592,66 +549,55 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
592
549
|
/* harmony export */ GrassProceduralTexture: () => (/* binding */ GrassProceduralTexture)
|
|
593
550
|
/* harmony export */ });
|
|
594
551
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
595
|
-
/* harmony import */ var
|
|
596
|
-
/* harmony import */ var
|
|
597
|
-
/* harmony import */ var _grassProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./grassProceduralTexture.fragment */ "../../../
|
|
552
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
553
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
554
|
+
/* harmony import */ var _grassProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./grassProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/grass/grassProceduralTexture.fragment.ts");
|
|
598
555
|
|
|
599
556
|
|
|
600
557
|
|
|
601
558
|
|
|
602
559
|
|
|
603
560
|
|
|
604
|
-
|
|
605
|
-
(
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
_this._grassColors = [new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.29, 0.38, 0.02), new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.36, 0.49, 0.09), new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.51, 0.6, 0.28)];
|
|
611
|
-
_this.updateShaderUniforms();
|
|
612
|
-
return _this;
|
|
561
|
+
class GrassProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
562
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
563
|
+
super(name, size, "grassProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
564
|
+
this._groundColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(1, 1, 1);
|
|
565
|
+
this._grassColors = [new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.29, 0.38, 0.02), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.36, 0.49, 0.09), new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.51, 0.6, 0.28)];
|
|
566
|
+
this.updateShaderUniforms();
|
|
613
567
|
}
|
|
614
|
-
|
|
568
|
+
updateShaderUniforms() {
|
|
615
569
|
this.setColor3("herb1Color", this._grassColors[0]);
|
|
616
570
|
this.setColor3("herb2Color", this._grassColors[1]);
|
|
617
571
|
this.setColor3("herb3Color", this._grassColors[2]);
|
|
618
572
|
this.setColor3("groundColor", this._groundColor);
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
},
|
|
635
|
-
set: function (value) {
|
|
636
|
-
this._groundColor = value;
|
|
637
|
-
this.updateShaderUniforms();
|
|
638
|
-
},
|
|
639
|
-
enumerable: false,
|
|
640
|
-
configurable: true
|
|
641
|
-
});
|
|
573
|
+
}
|
|
574
|
+
get grassColors() {
|
|
575
|
+
return this._grassColors;
|
|
576
|
+
}
|
|
577
|
+
set grassColors(value) {
|
|
578
|
+
this._grassColors = value;
|
|
579
|
+
this.updateShaderUniforms();
|
|
580
|
+
}
|
|
581
|
+
get groundColor() {
|
|
582
|
+
return this._groundColor;
|
|
583
|
+
}
|
|
584
|
+
set groundColor(value) {
|
|
585
|
+
this._groundColor = value;
|
|
586
|
+
this.updateShaderUniforms();
|
|
587
|
+
}
|
|
642
588
|
/**
|
|
643
589
|
* Serializes this grass procedural texture
|
|
644
590
|
* @returns a serialized grass procedural texture object
|
|
645
591
|
*/
|
|
646
|
-
|
|
647
|
-
|
|
592
|
+
serialize() {
|
|
593
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
648
594
|
serializationObject.customType = "BABYLON.GrassProceduralTexture";
|
|
649
595
|
serializationObject.grassColors = [];
|
|
650
|
-
for (
|
|
596
|
+
for (let i = 0; i < this._grassColors.length; i++) {
|
|
651
597
|
serializationObject.grassColors.push(this._grassColors[i].asArray());
|
|
652
598
|
}
|
|
653
599
|
return serializationObject;
|
|
654
|
-
}
|
|
600
|
+
}
|
|
655
601
|
/**
|
|
656
602
|
* Creates a Grass Procedural Texture from parsed grass procedural texture data
|
|
657
603
|
* @param parsedTexture defines parsed texture data
|
|
@@ -659,45 +605,44 @@ var GrassProceduralTexture = /** @class */ (function (_super) {
|
|
|
659
605
|
* @param rootUrl defines the root URL containing grass procedural texture information
|
|
660
606
|
* @returns a parsed Grass Procedural Texture
|
|
661
607
|
*/
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
for (
|
|
666
|
-
colors.push(
|
|
608
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
609
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new GrassProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
610
|
+
const colors = [];
|
|
611
|
+
for (let i = 0; i < parsedTexture.grassColors.length; i++) {
|
|
612
|
+
colors.push(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3.FromArray(parsedTexture.grassColors[i]));
|
|
667
613
|
}
|
|
668
614
|
texture.grassColors = colors;
|
|
669
615
|
return texture;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.GrassProceduralTexture", GrassProceduralTexture);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
619
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
|
|
620
|
+
], GrassProceduralTexture.prototype, "groundColor", null);
|
|
621
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.GrassProceduralTexture", GrassProceduralTexture);
|
|
677
622
|
|
|
678
623
|
|
|
679
624
|
/***/ }),
|
|
680
625
|
|
|
681
|
-
/***/ "../../../
|
|
682
|
-
|
|
683
|
-
!*** ../../../
|
|
684
|
-
|
|
626
|
+
/***/ "../../../dev/proceduralTextures/src/grass/index.ts":
|
|
627
|
+
/*!**********************************************************!*\
|
|
628
|
+
!*** ../../../dev/proceduralTextures/src/grass/index.ts ***!
|
|
629
|
+
\**********************************************************/
|
|
685
630
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
686
631
|
|
|
687
632
|
__webpack_require__.r(__webpack_exports__);
|
|
688
633
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
689
634
|
/* harmony export */ GrassProceduralTexture: () => (/* reexport safe */ _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.GrassProceduralTexture)
|
|
690
635
|
/* harmony export */ });
|
|
691
|
-
/* harmony import */ var _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./grassProceduralTexture */ "../../../
|
|
636
|
+
/* harmony import */ var _grassProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./grassProceduralTexture */ "../../../dev/proceduralTextures/src/grass/grassProceduralTexture.ts");
|
|
692
637
|
|
|
693
638
|
|
|
694
639
|
|
|
695
640
|
/***/ }),
|
|
696
641
|
|
|
697
|
-
/***/ "../../../
|
|
698
|
-
|
|
699
|
-
!*** ../../../
|
|
700
|
-
|
|
642
|
+
/***/ "../../../dev/proceduralTextures/src/index.ts":
|
|
643
|
+
/*!****************************************************!*\
|
|
644
|
+
!*** ../../../dev/proceduralTextures/src/index.ts ***!
|
|
645
|
+
\****************************************************/
|
|
701
646
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
702
647
|
|
|
703
648
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -713,16 +658,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
713
658
|
/* harmony export */ StarfieldProceduralTexture: () => (/* reexport safe */ _starfield_index__WEBPACK_IMPORTED_MODULE_8__.StarfieldProceduralTexture),
|
|
714
659
|
/* harmony export */ WoodProceduralTexture: () => (/* reexport safe */ _wood_index__WEBPACK_IMPORTED_MODULE_9__.WoodProceduralTexture)
|
|
715
660
|
/* harmony export */ });
|
|
716
|
-
/* harmony import */ var _brick_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brick/index */ "../../../
|
|
717
|
-
/* harmony import */ var _cloud_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cloud/index */ "../../../
|
|
718
|
-
/* harmony import */ var _fire_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fire/index */ "../../../
|
|
719
|
-
/* harmony import */ var _grass_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./grass/index */ "../../../
|
|
720
|
-
/* harmony import */ var _marble_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./marble/index */ "../../../
|
|
721
|
-
/* harmony import */ var _normalMap_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./normalMap/index */ "../../../
|
|
722
|
-
/* harmony import */ var _perlinNoise_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./perlinNoise/index */ "../../../
|
|
723
|
-
/* harmony import */ var _road_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./road/index */ "../../../
|
|
724
|
-
/* harmony import */ var _starfield_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./starfield/index */ "../../../
|
|
725
|
-
/* harmony import */ var _wood_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./wood/index */ "../../../
|
|
661
|
+
/* harmony import */ var _brick_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./brick/index */ "../../../dev/proceduralTextures/src/brick/index.ts");
|
|
662
|
+
/* harmony import */ var _cloud_index__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cloud/index */ "../../../dev/proceduralTextures/src/cloud/index.ts");
|
|
663
|
+
/* harmony import */ var _fire_index__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fire/index */ "../../../dev/proceduralTextures/src/fire/index.ts");
|
|
664
|
+
/* harmony import */ var _grass_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./grass/index */ "../../../dev/proceduralTextures/src/grass/index.ts");
|
|
665
|
+
/* harmony import */ var _marble_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./marble/index */ "../../../dev/proceduralTextures/src/marble/index.ts");
|
|
666
|
+
/* harmony import */ var _normalMap_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./normalMap/index */ "../../../dev/proceduralTextures/src/normalMap/index.ts");
|
|
667
|
+
/* harmony import */ var _perlinNoise_index__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./perlinNoise/index */ "../../../dev/proceduralTextures/src/perlinNoise/index.ts");
|
|
668
|
+
/* harmony import */ var _road_index__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./road/index */ "../../../dev/proceduralTextures/src/road/index.ts");
|
|
669
|
+
/* harmony import */ var _starfield_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./starfield/index */ "../../../dev/proceduralTextures/src/starfield/index.ts");
|
|
670
|
+
/* harmony import */ var _wood_index__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./wood/index */ "../../../dev/proceduralTextures/src/wood/index.ts");
|
|
726
671
|
/* eslint-disable import/no-internal-modules */
|
|
727
672
|
|
|
728
673
|
|
|
@@ -738,90 +683,50 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
738
683
|
|
|
739
684
|
/***/ }),
|
|
740
685
|
|
|
741
|
-
/***/ "../../../
|
|
742
|
-
|
|
743
|
-
!*** ../../../
|
|
744
|
-
|
|
745
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
746
|
-
|
|
747
|
-
__webpack_require__.r(__webpack_exports__);
|
|
748
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
749
|
-
/* harmony export */ BrickProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.BrickProceduralTexture),
|
|
750
|
-
/* harmony export */ CloudProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.CloudProceduralTexture),
|
|
751
|
-
/* harmony export */ FireProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.FireProceduralTexture),
|
|
752
|
-
/* harmony export */ GrassProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.GrassProceduralTexture),
|
|
753
|
-
/* harmony export */ MarbleProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MarbleProceduralTexture),
|
|
754
|
-
/* harmony export */ NormalMapProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.NormalMapProceduralTexture),
|
|
755
|
-
/* harmony export */ PerlinNoiseProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.PerlinNoiseProceduralTexture),
|
|
756
|
-
/* harmony export */ RoadProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.RoadProceduralTexture),
|
|
757
|
-
/* harmony export */ StarfieldProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.StarfieldProceduralTexture),
|
|
758
|
-
/* harmony export */ WoodProceduralTexture: () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.WoodProceduralTexture)
|
|
759
|
-
/* harmony export */ });
|
|
760
|
-
/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../index */ "../../../lts/proceduralTextures/dist/index.js");
|
|
761
|
-
/* eslint-disable import/no-internal-modules */
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* Legacy support, defining window.BABYLON.GridMaterial... (global variable).
|
|
765
|
-
*
|
|
766
|
-
* This is the entry point for the UMD module.
|
|
767
|
-
* The entry point for a future ESM package should be index.ts
|
|
768
|
-
*/
|
|
769
|
-
var globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof window !== "undefined" ? window : undefined;
|
|
770
|
-
if (typeof globalObject !== "undefined") {
|
|
771
|
-
globalObject.BABYLON = globalObject.BABYLON || {};
|
|
772
|
-
for (var mat in _index__WEBPACK_IMPORTED_MODULE_0__) {
|
|
773
|
-
globalObject.BABYLON[mat] = _index__WEBPACK_IMPORTED_MODULE_0__[mat];
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
/***/ }),
|
|
780
|
-
|
|
781
|
-
/***/ "../../../lts/proceduralTextures/dist/marble/index.js":
|
|
782
|
-
/*!************************************************************!*\
|
|
783
|
-
!*** ../../../lts/proceduralTextures/dist/marble/index.js ***!
|
|
784
|
-
\************************************************************/
|
|
686
|
+
/***/ "../../../dev/proceduralTextures/src/marble/index.ts":
|
|
687
|
+
/*!***********************************************************!*\
|
|
688
|
+
!*** ../../../dev/proceduralTextures/src/marble/index.ts ***!
|
|
689
|
+
\***********************************************************/
|
|
785
690
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
786
691
|
|
|
787
692
|
__webpack_require__.r(__webpack_exports__);
|
|
788
693
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
789
694
|
/* harmony export */ MarbleProceduralTexture: () => (/* reexport safe */ _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.MarbleProceduralTexture)
|
|
790
695
|
/* harmony export */ });
|
|
791
|
-
/* harmony import */ var _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./marbleProceduralTexture */ "../../../
|
|
696
|
+
/* harmony import */ var _marbleProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./marbleProceduralTexture */ "../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.ts");
|
|
792
697
|
|
|
793
698
|
|
|
794
699
|
|
|
795
700
|
/***/ }),
|
|
796
701
|
|
|
797
|
-
/***/ "../../../
|
|
798
|
-
|
|
799
|
-
!*** ../../../
|
|
800
|
-
|
|
702
|
+
/***/ "../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.fragment.ts":
|
|
703
|
+
/*!**************************************************************************************!*\
|
|
704
|
+
!*** ../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.fragment.ts ***!
|
|
705
|
+
\**************************************************************************************/
|
|
801
706
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
802
707
|
|
|
803
708
|
__webpack_require__.r(__webpack_exports__);
|
|
804
709
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
805
710
|
/* harmony export */ marbleProceduralTexturePixelShader: () => (/* binding */ marbleProceduralTexturePixelShader)
|
|
806
711
|
/* harmony export */ });
|
|
807
|
-
/* harmony import */ var
|
|
808
|
-
/* harmony import */ var
|
|
712
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
713
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
809
714
|
// Do not edit.
|
|
810
715
|
|
|
811
|
-
|
|
812
|
-
|
|
716
|
+
const name = "marbleProceduralTexturePixelShader";
|
|
717
|
+
const shader = `precision highp float;
|
|
813
718
|
// Sideeffect
|
|
814
|
-
|
|
719
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
815
720
|
/** @internal */
|
|
816
|
-
|
|
721
|
+
const marbleProceduralTexturePixelShader = { name, shader };
|
|
817
722
|
|
|
818
723
|
|
|
819
724
|
/***/ }),
|
|
820
725
|
|
|
821
|
-
/***/ "../../../
|
|
822
|
-
|
|
823
|
-
!*** ../../../
|
|
824
|
-
|
|
726
|
+
/***/ "../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.ts":
|
|
727
|
+
/*!*****************************************************************************!*\
|
|
728
|
+
!*** ../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.ts ***!
|
|
729
|
+
\*****************************************************************************/
|
|
825
730
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
826
731
|
|
|
827
732
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -829,86 +734,67 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
829
734
|
/* harmony export */ MarbleProceduralTexture: () => (/* binding */ MarbleProceduralTexture)
|
|
830
735
|
/* harmony export */ });
|
|
831
736
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
832
|
-
/* harmony import */ var
|
|
833
|
-
/* harmony import */ var
|
|
834
|
-
/* harmony import */ var _marbleProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./marbleProceduralTexture.fragment */ "../../../
|
|
737
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
738
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
739
|
+
/* harmony import */ var _marbleProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./marbleProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/marble/marbleProceduralTexture.fragment.ts");
|
|
835
740
|
|
|
836
741
|
|
|
837
742
|
|
|
838
743
|
|
|
839
744
|
|
|
840
745
|
|
|
841
|
-
|
|
842
|
-
(
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
_this._jointColor = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.72, 0.72, 0.72);
|
|
850
|
-
_this.updateShaderUniforms();
|
|
851
|
-
return _this;
|
|
746
|
+
class MarbleProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
747
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
748
|
+
super(name, size, "marbleProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
749
|
+
this._numberOfTilesHeight = 3;
|
|
750
|
+
this._numberOfTilesWidth = 3;
|
|
751
|
+
this._amplitude = 9.0;
|
|
752
|
+
this._jointColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.72, 0.72, 0.72);
|
|
753
|
+
this.updateShaderUniforms();
|
|
852
754
|
}
|
|
853
|
-
|
|
755
|
+
updateShaderUniforms() {
|
|
854
756
|
this.setFloat("numberOfTilesHeight", this._numberOfTilesHeight);
|
|
855
757
|
this.setFloat("numberOfTilesWidth", this._numberOfTilesWidth);
|
|
856
758
|
this.setFloat("amplitude", this._amplitude);
|
|
857
759
|
this.setColor3("jointColor", this._jointColor);
|
|
858
|
-
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
this.updateShaderUniforms();
|
|
888
|
-
},
|
|
889
|
-
enumerable: false,
|
|
890
|
-
configurable: true
|
|
891
|
-
});
|
|
892
|
-
Object.defineProperty(MarbleProceduralTexture.prototype, "jointColor", {
|
|
893
|
-
get: function () {
|
|
894
|
-
return this._jointColor;
|
|
895
|
-
},
|
|
896
|
-
set: function (value) {
|
|
897
|
-
this._jointColor = value;
|
|
898
|
-
this.updateShaderUniforms();
|
|
899
|
-
},
|
|
900
|
-
enumerable: false,
|
|
901
|
-
configurable: true
|
|
902
|
-
});
|
|
760
|
+
}
|
|
761
|
+
get numberOfTilesHeight() {
|
|
762
|
+
return this._numberOfTilesHeight;
|
|
763
|
+
}
|
|
764
|
+
set numberOfTilesHeight(value) {
|
|
765
|
+
this._numberOfTilesHeight = value;
|
|
766
|
+
this.updateShaderUniforms();
|
|
767
|
+
}
|
|
768
|
+
get amplitude() {
|
|
769
|
+
return this._amplitude;
|
|
770
|
+
}
|
|
771
|
+
set amplitude(value) {
|
|
772
|
+
this._amplitude = value;
|
|
773
|
+
this.updateShaderUniforms();
|
|
774
|
+
}
|
|
775
|
+
get numberOfTilesWidth() {
|
|
776
|
+
return this._numberOfTilesWidth;
|
|
777
|
+
}
|
|
778
|
+
set numberOfTilesWidth(value) {
|
|
779
|
+
this._numberOfTilesWidth = value;
|
|
780
|
+
this.updateShaderUniforms();
|
|
781
|
+
}
|
|
782
|
+
get jointColor() {
|
|
783
|
+
return this._jointColor;
|
|
784
|
+
}
|
|
785
|
+
set jointColor(value) {
|
|
786
|
+
this._jointColor = value;
|
|
787
|
+
this.updateShaderUniforms();
|
|
788
|
+
}
|
|
903
789
|
/**
|
|
904
790
|
* Serializes this marble procedural texture
|
|
905
791
|
* @returns a serialized marble procedural texture object
|
|
906
792
|
*/
|
|
907
|
-
|
|
908
|
-
|
|
793
|
+
serialize() {
|
|
794
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
909
795
|
serializationObject.customType = "BABYLON.MarbleProceduralTexture";
|
|
910
796
|
return serializationObject;
|
|
911
|
-
}
|
|
797
|
+
}
|
|
912
798
|
/**
|
|
913
799
|
* Creates a Marble Procedural Texture from parsed marble procedural texture data
|
|
914
800
|
* @param parsedTexture defines parsed texture data
|
|
@@ -916,73 +802,76 @@ var MarbleProceduralTexture = /** @class */ (function (_super) {
|
|
|
916
802
|
* @param rootUrl defines the root URL containing marble procedural texture information
|
|
917
803
|
* @returns a parsed Marble Procedural Texture
|
|
918
804
|
*/
|
|
919
|
-
|
|
920
|
-
|
|
805
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
806
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new MarbleProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
921
807
|
return texture;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.MarbleProceduralTexture", MarbleProceduralTexture);
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
811
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
812
|
+
], MarbleProceduralTexture.prototype, "numberOfTilesHeight", null);
|
|
813
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
814
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
815
|
+
], MarbleProceduralTexture.prototype, "amplitude", null);
|
|
816
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
817
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
818
|
+
], MarbleProceduralTexture.prototype, "numberOfTilesWidth", null);
|
|
819
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
820
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
821
|
+
], MarbleProceduralTexture.prototype, "jointColor", null);
|
|
822
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.MarbleProceduralTexture", MarbleProceduralTexture);
|
|
938
823
|
|
|
939
824
|
|
|
940
825
|
/***/ }),
|
|
941
826
|
|
|
942
|
-
/***/ "../../../
|
|
943
|
-
|
|
944
|
-
!*** ../../../
|
|
945
|
-
|
|
827
|
+
/***/ "../../../dev/proceduralTextures/src/normalMap/index.ts":
|
|
828
|
+
/*!**************************************************************!*\
|
|
829
|
+
!*** ../../../dev/proceduralTextures/src/normalMap/index.ts ***!
|
|
830
|
+
\**************************************************************/
|
|
946
831
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
947
832
|
|
|
948
833
|
__webpack_require__.r(__webpack_exports__);
|
|
949
834
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
950
835
|
/* harmony export */ NormalMapProceduralTexture: () => (/* reexport safe */ _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.NormalMapProceduralTexture)
|
|
951
836
|
/* harmony export */ });
|
|
952
|
-
/* harmony import */ var _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./normalMapProceduralTexture */ "../../../
|
|
837
|
+
/* harmony import */ var _normalMapProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./normalMapProceduralTexture */ "../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.ts");
|
|
953
838
|
|
|
954
839
|
|
|
955
840
|
|
|
956
841
|
/***/ }),
|
|
957
842
|
|
|
958
|
-
/***/ "../../../
|
|
959
|
-
|
|
960
|
-
!*** ../../../
|
|
961
|
-
|
|
843
|
+
/***/ "../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.fragment.ts":
|
|
844
|
+
/*!********************************************************************************************!*\
|
|
845
|
+
!*** ../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.fragment.ts ***!
|
|
846
|
+
\********************************************************************************************/
|
|
962
847
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
963
848
|
|
|
964
849
|
__webpack_require__.r(__webpack_exports__);
|
|
965
850
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
966
851
|
/* harmony export */ normalMapProceduralTexturePixelShader: () => (/* binding */ normalMapProceduralTexturePixelShader)
|
|
967
852
|
/* harmony export */ });
|
|
968
|
-
/* harmony import */ var
|
|
969
|
-
/* harmony import */ var
|
|
853
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
854
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
970
855
|
// Do not edit.
|
|
971
856
|
|
|
972
|
-
|
|
973
|
-
|
|
857
|
+
const name = "normalMapProceduralTexturePixelShader";
|
|
858
|
+
const shader = `precision highp float;uniform sampler2D baseSampler;uniform float size;varying vec2 vUV;const vec3 LUMA_COEFFICIENT=vec3(0.2126,0.7152,0.0722);float lumaAtCoord(vec2 coord)
|
|
859
|
+
{vec3 pixel=texture2D(baseSampler,coord).rgb;float luma=dot(pixel,LUMA_COEFFICIENT);return luma;}
|
|
860
|
+
void main()
|
|
861
|
+
{float lumaU0=lumaAtCoord(vUV+vec2(-1.0, 0.0)/size);float lumaU1=lumaAtCoord(vUV+vec2( 1.0, 0.0)/size);float lumaV0=lumaAtCoord(vUV+vec2( 0.0,-1.0)/size);float lumaV1=lumaAtCoord(vUV+vec2( 0.0, 1.0)/size);vec2 slope=(vec2(lumaU0-lumaU1,lumaV0-lumaV1)+1.0)*0.5;gl_FragColor=vec4(slope,1.0,1.0);}
|
|
862
|
+
`;
|
|
974
863
|
// Sideeffect
|
|
975
|
-
|
|
864
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
976
865
|
/** @internal */
|
|
977
|
-
|
|
866
|
+
const normalMapProceduralTexturePixelShader = { name, shader };
|
|
978
867
|
|
|
979
868
|
|
|
980
869
|
/***/ }),
|
|
981
870
|
|
|
982
|
-
/***/ "../../../
|
|
983
|
-
|
|
984
|
-
!*** ../../../
|
|
985
|
-
|
|
871
|
+
/***/ "../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.ts":
|
|
872
|
+
/*!***********************************************************************************!*\
|
|
873
|
+
!*** ../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.ts ***!
|
|
874
|
+
\***********************************************************************************/
|
|
986
875
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
987
876
|
|
|
988
877
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -990,60 +879,53 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
990
879
|
/* harmony export */ NormalMapProceduralTexture: () => (/* binding */ NormalMapProceduralTexture)
|
|
991
880
|
/* harmony export */ });
|
|
992
881
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
993
|
-
/* harmony import */ var
|
|
994
|
-
/* harmony import */ var
|
|
995
|
-
/* harmony import */ var _normalMapProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./normalMapProceduralTexture.fragment */ "../../../
|
|
882
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
883
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
884
|
+
/* harmony import */ var _normalMapProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./normalMapProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/normalMap/normalMapProceduralTexture.fragment.ts");
|
|
996
885
|
|
|
997
886
|
|
|
998
887
|
|
|
999
888
|
|
|
1000
889
|
|
|
1001
|
-
|
|
1002
|
-
(
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
var _this = _super.call(this, name, size, "normalMapProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
1006
|
-
_this.updateShaderUniforms();
|
|
1007
|
-
return _this;
|
|
890
|
+
class NormalMapProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
891
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
892
|
+
super(name, size, "normalMapProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
893
|
+
this.updateShaderUniforms();
|
|
1008
894
|
}
|
|
1009
|
-
|
|
895
|
+
updateShaderUniforms() {
|
|
1010
896
|
this.setTexture("baseSampler", this._baseTexture);
|
|
1011
897
|
this.setFloat("size", this.getRenderSize());
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
|
|
898
|
+
}
|
|
899
|
+
render(useCameraPostProcess) {
|
|
900
|
+
super.render(useCameraPostProcess);
|
|
901
|
+
}
|
|
902
|
+
resize(size, generateMipMaps) {
|
|
903
|
+
super.resize(size, generateMipMaps);
|
|
1018
904
|
// We need to update the "size" uniform
|
|
1019
905
|
this.updateShaderUniforms();
|
|
1020
|
-
}
|
|
1021
|
-
|
|
906
|
+
}
|
|
907
|
+
isReady() {
|
|
1022
908
|
if (!this._baseTexture || !this._baseTexture.isReady()) {
|
|
1023
909
|
return false;
|
|
1024
910
|
}
|
|
1025
|
-
return
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
},
|
|
1035
|
-
enumerable: false,
|
|
1036
|
-
configurable: true
|
|
1037
|
-
});
|
|
911
|
+
return super.isReady();
|
|
912
|
+
}
|
|
913
|
+
get baseTexture() {
|
|
914
|
+
return this._baseTexture;
|
|
915
|
+
}
|
|
916
|
+
set baseTexture(texture) {
|
|
917
|
+
this._baseTexture = texture;
|
|
918
|
+
this.updateShaderUniforms();
|
|
919
|
+
}
|
|
1038
920
|
/**
|
|
1039
921
|
* Serializes this normal map procedural texture
|
|
1040
922
|
* @returns a serialized normal map procedural texture object
|
|
1041
923
|
*/
|
|
1042
|
-
|
|
1043
|
-
|
|
924
|
+
serialize() {
|
|
925
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
1044
926
|
serializationObject.customType = "BABYLON.NormalMapProceduralTexture";
|
|
1045
927
|
return serializationObject;
|
|
1046
|
-
}
|
|
928
|
+
}
|
|
1047
929
|
/**
|
|
1048
930
|
* Creates a Normal Map Procedural Texture from parsed normal map procedural texture data
|
|
1049
931
|
* @param parsedTexture defines parsed texture data
|
|
@@ -1051,64 +933,101 @@ var NormalMapProceduralTexture = /** @class */ (function (_super) {
|
|
|
1051
933
|
* @param rootUrl defines the root URL containing normal map procedural texture information
|
|
1052
934
|
* @returns a parsed Normal Map Procedural Texture
|
|
1053
935
|
*/
|
|
1054
|
-
|
|
1055
|
-
|
|
936
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
937
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new NormalMapProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
1056
938
|
return texture;
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.NormalMapProceduralTexture", NormalMapProceduralTexture);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
942
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsTexture)()
|
|
943
|
+
], NormalMapProceduralTexture.prototype, "baseTexture", null);
|
|
944
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.NormalMapProceduralTexture", NormalMapProceduralTexture);
|
|
1064
945
|
|
|
1065
946
|
|
|
1066
947
|
/***/ }),
|
|
1067
948
|
|
|
1068
|
-
/***/ "../../../
|
|
1069
|
-
|
|
1070
|
-
!*** ../../../
|
|
1071
|
-
|
|
949
|
+
/***/ "../../../dev/proceduralTextures/src/perlinNoise/index.ts":
|
|
950
|
+
/*!****************************************************************!*\
|
|
951
|
+
!*** ../../../dev/proceduralTextures/src/perlinNoise/index.ts ***!
|
|
952
|
+
\****************************************************************/
|
|
1072
953
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1073
954
|
|
|
1074
955
|
__webpack_require__.r(__webpack_exports__);
|
|
1075
956
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1076
957
|
/* harmony export */ PerlinNoiseProceduralTexture: () => (/* reexport safe */ _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.PerlinNoiseProceduralTexture)
|
|
1077
958
|
/* harmony export */ });
|
|
1078
|
-
/* harmony import */ var _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture */ "../../../
|
|
959
|
+
/* harmony import */ var _perlinNoiseProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture */ "../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.ts");
|
|
1079
960
|
|
|
1080
961
|
|
|
1081
962
|
|
|
1082
963
|
/***/ }),
|
|
1083
964
|
|
|
1084
|
-
/***/ "../../../
|
|
1085
|
-
|
|
1086
|
-
!*** ../../../
|
|
1087
|
-
|
|
965
|
+
/***/ "../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.fragment.ts":
|
|
966
|
+
/*!************************************************************************************************!*\
|
|
967
|
+
!*** ../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.fragment.ts ***!
|
|
968
|
+
\************************************************************************************************/
|
|
1088
969
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1089
970
|
|
|
1090
971
|
__webpack_require__.r(__webpack_exports__);
|
|
1091
972
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1092
973
|
/* harmony export */ perlinNoiseProceduralTexturePixelShader: () => (/* binding */ perlinNoiseProceduralTexturePixelShader)
|
|
1093
974
|
/* harmony export */ });
|
|
1094
|
-
/* harmony import */ var
|
|
1095
|
-
/* harmony import */ var
|
|
975
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
976
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
1096
977
|
// Do not edit.
|
|
1097
978
|
|
|
1098
|
-
|
|
1099
|
-
|
|
979
|
+
const name = "perlinNoiseProceduralTexturePixelShader";
|
|
980
|
+
const shader = `precision highp float;uniform float size;uniform float time;uniform float translationSpeed;varying vec2 vUV;float r(float n)
|
|
981
|
+
{return fract(cos(n*89.42)*343.42);}
|
|
982
|
+
vec2 r(vec2 n)
|
|
983
|
+
{return vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89)); }
|
|
984
|
+
float worley(vec2 n,float s)
|
|
985
|
+
{float dis=1.0;for(int x=-1; x<=1; x++)
|
|
986
|
+
{for(int y=-1; y<=1; y++)
|
|
987
|
+
{vec2 p=floor(n/s)+vec2(x,y);float d=length(r(p)+vec2(x,y)-fract(n/s));if (dis>d)
|
|
988
|
+
dis=d;}}
|
|
989
|
+
return 1.0-dis;}
|
|
990
|
+
vec3 hash33(vec3 p3)
|
|
991
|
+
{p3=fract(p3*vec3(0.1031,0.11369,0.13787));p3+=dot(p3,p3.yxz+19.19);return -1.0+2.0*fract(vec3((p3.x+p3.y)*p3.z,(p3.x+p3.z)*p3.y,(p3.y+p3.z)*p3.x));}
|
|
992
|
+
float perlinNoise(vec3 p)
|
|
993
|
+
{vec3 pi=floor(p);vec3 pf=p-pi;vec3 w=pf*pf*(3.0-2.0*pf);return mix(
|
|
994
|
+
mix(
|
|
995
|
+
mix(
|
|
996
|
+
dot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),
|
|
997
|
+
dot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),w.x
|
|
998
|
+
),mix(
|
|
999
|
+
dot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),
|
|
1000
|
+
dot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),w.x
|
|
1001
|
+
),w.z
|
|
1002
|
+
),mix(
|
|
1003
|
+
mix(
|
|
1004
|
+
dot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),
|
|
1005
|
+
dot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),w.x
|
|
1006
|
+
),mix(
|
|
1007
|
+
dot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),
|
|
1008
|
+
dot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),w.x
|
|
1009
|
+
),w.z
|
|
1010
|
+
),w.y
|
|
1011
|
+
);}
|
|
1012
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
1013
|
+
void main(void)
|
|
1014
|
+
{vec2 uv=gl_FragCoord.xy+translationSpeed;float dis=(
|
|
1015
|
+
1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))
|
|
1016
|
+
* (1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))
|
|
1017
|
+
);gl_FragColor=vec4(vec3(dis/4.0),1.0);}
|
|
1018
|
+
`;
|
|
1100
1019
|
// Sideeffect
|
|
1101
|
-
|
|
1020
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
1102
1021
|
/** @internal */
|
|
1103
|
-
|
|
1022
|
+
const perlinNoiseProceduralTexturePixelShader = { name, shader };
|
|
1104
1023
|
|
|
1105
1024
|
|
|
1106
1025
|
/***/ }),
|
|
1107
1026
|
|
|
1108
|
-
/***/ "../../../
|
|
1109
|
-
|
|
1110
|
-
!*** ../../../
|
|
1111
|
-
|
|
1027
|
+
/***/ "../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.ts":
|
|
1028
|
+
/*!***************************************************************************************!*\
|
|
1029
|
+
!*** ../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.ts ***!
|
|
1030
|
+
\***************************************************************************************/
|
|
1112
1031
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1113
1032
|
|
|
1114
1033
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1116,54 +1035,51 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1116
1035
|
/* harmony export */ PerlinNoiseProceduralTexture: () => (/* binding */ PerlinNoiseProceduralTexture)
|
|
1117
1036
|
/* harmony export */ });
|
|
1118
1037
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
1119
|
-
/* harmony import */ var
|
|
1120
|
-
/* harmony import */ var
|
|
1121
|
-
/* harmony import */ var _perlinNoiseProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture.fragment */ "../../../
|
|
1038
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
1039
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
1040
|
+
/* harmony import */ var _perlinNoiseProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./perlinNoiseProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/perlinNoise/perlinNoiseProceduralTexture.fragment.ts");
|
|
1122
1041
|
|
|
1123
1042
|
|
|
1124
1043
|
|
|
1125
1044
|
|
|
1126
1045
|
|
|
1127
|
-
|
|
1128
|
-
(
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
_this._currentTranslation = 0;
|
|
1136
|
-
_this.updateShaderUniforms();
|
|
1137
|
-
return _this;
|
|
1046
|
+
class PerlinNoiseProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
1047
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
1048
|
+
super(name, size, "perlinNoiseProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
1049
|
+
this.time = 0.0;
|
|
1050
|
+
this.timeScale = 1.0;
|
|
1051
|
+
this.translationSpeed = 1.0;
|
|
1052
|
+
this._currentTranslation = 0;
|
|
1053
|
+
this.updateShaderUniforms();
|
|
1138
1054
|
}
|
|
1139
|
-
|
|
1055
|
+
updateShaderUniforms() {
|
|
1140
1056
|
this.setFloat("size", this.getRenderSize());
|
|
1141
|
-
|
|
1057
|
+
const scene = this.getScene();
|
|
1142
1058
|
if (!scene) {
|
|
1143
1059
|
return;
|
|
1144
1060
|
}
|
|
1145
|
-
|
|
1061
|
+
const deltaTime = scene.getEngine().getDeltaTime();
|
|
1146
1062
|
this.time += deltaTime;
|
|
1147
1063
|
this.setFloat("time", (this.time * this.timeScale) / 1000);
|
|
1148
1064
|
this._currentTranslation += (deltaTime * this.translationSpeed) / 1000.0;
|
|
1149
1065
|
this.setFloat("translationSpeed", this._currentTranslation);
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1066
|
+
}
|
|
1067
|
+
render(useCameraPostProcess) {
|
|
1152
1068
|
this.updateShaderUniforms();
|
|
1153
|
-
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
}
|
|
1069
|
+
super.render(useCameraPostProcess);
|
|
1070
|
+
}
|
|
1071
|
+
resize(size, generateMipMaps) {
|
|
1072
|
+
super.resize(size, generateMipMaps);
|
|
1073
|
+
}
|
|
1158
1074
|
/**
|
|
1159
1075
|
* Serializes this perlin noise procedural texture
|
|
1160
1076
|
* @returns a serialized perlin noise procedural texture object
|
|
1161
1077
|
*/
|
|
1162
|
-
|
|
1163
|
-
|
|
1078
|
+
serialize() {
|
|
1079
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
1164
1080
|
serializationObject.customType = "BABYLON.PerlinNoiseProceduralTexture";
|
|
1165
1081
|
return serializationObject;
|
|
1166
|
-
}
|
|
1082
|
+
}
|
|
1167
1083
|
/**
|
|
1168
1084
|
* Creates a Perlin Noise Procedural Texture from parsed perlin noise procedural texture data
|
|
1169
1085
|
* @param parsedTexture defines parsed texture data
|
|
@@ -1171,70 +1087,79 @@ var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
|
|
|
1171
1087
|
* @param rootUrl defines the root URL containing perlin noise procedural texture information
|
|
1172
1088
|
* @returns a parsed Perlin Noise Procedural Texture
|
|
1173
1089
|
*/
|
|
1174
|
-
|
|
1175
|
-
|
|
1090
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
1091
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new PerlinNoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
1176
1092
|
return texture;
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.PerlinNoiseProceduralTexture", PerlinNoiseProceduralTexture);
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1096
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1097
|
+
], PerlinNoiseProceduralTexture.prototype, "time", void 0);
|
|
1098
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1099
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1100
|
+
], PerlinNoiseProceduralTexture.prototype, "timeScale", void 0);
|
|
1101
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1102
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1103
|
+
], PerlinNoiseProceduralTexture.prototype, "translationSpeed", void 0);
|
|
1104
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.PerlinNoiseProceduralTexture", PerlinNoiseProceduralTexture);
|
|
1190
1105
|
|
|
1191
1106
|
|
|
1192
1107
|
/***/ }),
|
|
1193
1108
|
|
|
1194
|
-
/***/ "../../../
|
|
1195
|
-
|
|
1196
|
-
!*** ../../../
|
|
1197
|
-
|
|
1109
|
+
/***/ "../../../dev/proceduralTextures/src/road/index.ts":
|
|
1110
|
+
/*!*********************************************************!*\
|
|
1111
|
+
!*** ../../../dev/proceduralTextures/src/road/index.ts ***!
|
|
1112
|
+
\*********************************************************/
|
|
1198
1113
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1199
1114
|
|
|
1200
1115
|
__webpack_require__.r(__webpack_exports__);
|
|
1201
1116
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1202
1117
|
/* harmony export */ RoadProceduralTexture: () => (/* reexport safe */ _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.RoadProceduralTexture)
|
|
1203
1118
|
/* harmony export */ });
|
|
1204
|
-
/* harmony import */ var _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./roadProceduralTexture */ "../../../
|
|
1119
|
+
/* harmony import */ var _roadProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./roadProceduralTexture */ "../../../dev/proceduralTextures/src/road/roadProceduralTexture.ts");
|
|
1205
1120
|
|
|
1206
1121
|
|
|
1207
1122
|
|
|
1208
1123
|
/***/ }),
|
|
1209
1124
|
|
|
1210
|
-
/***/ "../../../
|
|
1211
|
-
|
|
1212
|
-
!*** ../../../
|
|
1213
|
-
|
|
1125
|
+
/***/ "../../../dev/proceduralTextures/src/road/roadProceduralTexture.fragment.ts":
|
|
1126
|
+
/*!**********************************************************************************!*\
|
|
1127
|
+
!*** ../../../dev/proceduralTextures/src/road/roadProceduralTexture.fragment.ts ***!
|
|
1128
|
+
\**********************************************************************************/
|
|
1214
1129
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1215
1130
|
|
|
1216
1131
|
__webpack_require__.r(__webpack_exports__);
|
|
1217
1132
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1218
1133
|
/* harmony export */ roadProceduralTexturePixelShader: () => (/* binding */ roadProceduralTexturePixelShader)
|
|
1219
1134
|
/* harmony export */ });
|
|
1220
|
-
/* harmony import */ var
|
|
1221
|
-
/* harmony import */ var
|
|
1135
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
1136
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
1222
1137
|
// Do not edit.
|
|
1223
1138
|
|
|
1224
|
-
|
|
1225
|
-
|
|
1139
|
+
const name = "roadProceduralTexturePixelShader";
|
|
1140
|
+
const shader = `precision highp float;varying vec2 vUV;
|
|
1141
|
+
uniform vec3 roadColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
|
|
1142
|
+
float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
|
|
1143
|
+
float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
|
|
1144
|
+
return total;}
|
|
1145
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
1146
|
+
void main(void) {
|
|
1147
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
1148
|
+
float ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));vec3 color=roadColor*ratioy;gl_FragColor=vec4(color,1.0);
|
|
1149
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
1150
|
+
}`;
|
|
1226
1151
|
// Sideeffect
|
|
1227
|
-
|
|
1152
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
1228
1153
|
/** @internal */
|
|
1229
|
-
|
|
1154
|
+
const roadProceduralTexturePixelShader = { name, shader };
|
|
1230
1155
|
|
|
1231
1156
|
|
|
1232
1157
|
/***/ }),
|
|
1233
1158
|
|
|
1234
|
-
/***/ "../../../
|
|
1235
|
-
|
|
1236
|
-
!*** ../../../
|
|
1237
|
-
|
|
1159
|
+
/***/ "../../../dev/proceduralTextures/src/road/roadProceduralTexture.ts":
|
|
1160
|
+
/*!*************************************************************************!*\
|
|
1161
|
+
!*** ../../../dev/proceduralTextures/src/road/roadProceduralTexture.ts ***!
|
|
1162
|
+
\*************************************************************************/
|
|
1238
1163
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1239
1164
|
|
|
1240
1165
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1242,47 +1167,40 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1242
1167
|
/* harmony export */ RoadProceduralTexture: () => (/* binding */ RoadProceduralTexture)
|
|
1243
1168
|
/* harmony export */ });
|
|
1244
1169
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
1245
|
-
/* harmony import */ var
|
|
1246
|
-
/* harmony import */ var
|
|
1247
|
-
/* harmony import */ var _roadProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./roadProceduralTexture.fragment */ "../../../
|
|
1170
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
1171
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
1172
|
+
/* harmony import */ var _roadProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./roadProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/road/roadProceduralTexture.fragment.ts");
|
|
1248
1173
|
|
|
1249
1174
|
|
|
1250
1175
|
|
|
1251
1176
|
|
|
1252
1177
|
|
|
1253
1178
|
|
|
1254
|
-
|
|
1255
|
-
(
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
_this._roadColor = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.53, 0.53, 0.53);
|
|
1260
|
-
_this.updateShaderUniforms();
|
|
1261
|
-
return _this;
|
|
1179
|
+
class RoadProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
1180
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
1181
|
+
super(name, size, "roadProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
1182
|
+
this._roadColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.53, 0.53, 0.53);
|
|
1183
|
+
this.updateShaderUniforms();
|
|
1262
1184
|
}
|
|
1263
|
-
|
|
1185
|
+
updateShaderUniforms() {
|
|
1264
1186
|
this.setColor3("roadColor", this._roadColor);
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
},
|
|
1274
|
-
enumerable: false,
|
|
1275
|
-
configurable: true
|
|
1276
|
-
});
|
|
1187
|
+
}
|
|
1188
|
+
get roadColor() {
|
|
1189
|
+
return this._roadColor;
|
|
1190
|
+
}
|
|
1191
|
+
set roadColor(value) {
|
|
1192
|
+
this._roadColor = value;
|
|
1193
|
+
this.updateShaderUniforms();
|
|
1194
|
+
}
|
|
1277
1195
|
/**
|
|
1278
1196
|
* Serializes this road procedural texture
|
|
1279
1197
|
* @returns a serialized road procedural texture object
|
|
1280
1198
|
*/
|
|
1281
|
-
|
|
1282
|
-
|
|
1199
|
+
serialize() {
|
|
1200
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
1283
1201
|
serializationObject.customType = "BABYLON.RoadProceduralTexture";
|
|
1284
1202
|
return serializationObject;
|
|
1285
|
-
}
|
|
1203
|
+
}
|
|
1286
1204
|
/**
|
|
1287
1205
|
* Creates a Road Procedural Texture from parsed road procedural texture data
|
|
1288
1206
|
* @param parsedTexture defines parsed texture data
|
|
@@ -1290,64 +1208,78 @@ var RoadProceduralTexture = /** @class */ (function (_super) {
|
|
|
1290
1208
|
* @param rootUrl defines the root URL containing road procedural texture information
|
|
1291
1209
|
* @returns a parsed Road Procedural Texture
|
|
1292
1210
|
*/
|
|
1293
|
-
|
|
1294
|
-
|
|
1211
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
1212
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new RoadProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
1295
1213
|
return texture;
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.RoadProceduralTexture", RoadProceduralTexture);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1217
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
|
|
1218
|
+
], RoadProceduralTexture.prototype, "roadColor", null);
|
|
1219
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.RoadProceduralTexture", RoadProceduralTexture);
|
|
1303
1220
|
|
|
1304
1221
|
|
|
1305
1222
|
/***/ }),
|
|
1306
1223
|
|
|
1307
|
-
/***/ "../../../
|
|
1308
|
-
|
|
1309
|
-
!*** ../../../
|
|
1310
|
-
|
|
1224
|
+
/***/ "../../../dev/proceduralTextures/src/starfield/index.ts":
|
|
1225
|
+
/*!**************************************************************!*\
|
|
1226
|
+
!*** ../../../dev/proceduralTextures/src/starfield/index.ts ***!
|
|
1227
|
+
\**************************************************************/
|
|
1311
1228
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1312
1229
|
|
|
1313
1230
|
__webpack_require__.r(__webpack_exports__);
|
|
1314
1231
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1315
1232
|
/* harmony export */ StarfieldProceduralTexture: () => (/* reexport safe */ _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.StarfieldProceduralTexture)
|
|
1316
1233
|
/* harmony export */ });
|
|
1317
|
-
/* harmony import */ var _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./starfieldProceduralTexture */ "../../../
|
|
1234
|
+
/* harmony import */ var _starfieldProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./starfieldProceduralTexture */ "../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.ts");
|
|
1318
1235
|
|
|
1319
1236
|
|
|
1320
1237
|
|
|
1321
1238
|
/***/ }),
|
|
1322
1239
|
|
|
1323
|
-
/***/ "../../../
|
|
1324
|
-
|
|
1325
|
-
!*** ../../../
|
|
1326
|
-
|
|
1240
|
+
/***/ "../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.fragment.ts":
|
|
1241
|
+
/*!********************************************************************************************!*\
|
|
1242
|
+
!*** ../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.fragment.ts ***!
|
|
1243
|
+
\********************************************************************************************/
|
|
1327
1244
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1328
1245
|
|
|
1329
1246
|
__webpack_require__.r(__webpack_exports__);
|
|
1330
1247
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1331
1248
|
/* harmony export */ starfieldProceduralTexturePixelShader: () => (/* binding */ starfieldProceduralTexturePixelShader)
|
|
1332
1249
|
/* harmony export */ });
|
|
1333
|
-
/* harmony import */ var
|
|
1334
|
-
/* harmony import */ var
|
|
1250
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
1251
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
1335
1252
|
// Do not edit.
|
|
1336
1253
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1254
|
+
const name = "starfieldProceduralTexturePixelShader";
|
|
1255
|
+
const shader = `precision highp float;
|
|
1256
|
+
#define volsteps 20
|
|
1257
|
+
#define iterations 15
|
|
1258
|
+
varying vec2 vPosition;varying vec2 vUV;uniform float time;uniform float alpha;uniform float beta;uniform float zoom;uniform float formuparam;uniform float stepsize;uniform float tile;uniform float brightness;uniform float darkmatter;uniform float distfading;uniform float saturation;void main()
|
|
1259
|
+
{vec3 dir=vec3(vUV*zoom,1.);float localTime=time*0.0001;mat2 rot1=mat2(cos(alpha),sin(alpha),-sin(alpha),cos(alpha));mat2 rot2=mat2(cos(beta),sin(beta),-sin(beta),cos(beta));dir.xz*=rot1;dir.xy*=rot2;vec3 from_=vec3(1.,.5,0.5);from_+=vec3(-2.,localTime*2.,localTime);from_.xz*=rot1;from_.xy*=rot2;float s=0.1,fade=1.;vec3 v=vec3(0.);for (int r=0; r<volsteps; r++) {vec3 p=from_+s*dir*.5;p=abs(vec3(tile)-mod(p,vec3(tile*2.)));
|
|
1260
|
+
float pa,a=pa=0.;for (int i=0; i<iterations; i++) {p=abs(p)/dot(p,p)-formuparam;
|
|
1261
|
+
a+=abs(length(p)-pa);
|
|
1262
|
+
pa=length(p);}
|
|
1263
|
+
float dm=max(0.,darkmatter-a*a*.001);
|
|
1264
|
+
a*=a*a;
|
|
1265
|
+
if (r>6) fade*=1.-dm;
|
|
1266
|
+
v+=fade;v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade;
|
|
1267
|
+
fade*=distfading;
|
|
1268
|
+
s+=stepsize;}
|
|
1269
|
+
v=mix(vec3(length(v)),v,saturation);
|
|
1270
|
+
gl_FragColor=vec4(v*.01,1.);}`;
|
|
1339
1271
|
// Sideeffect
|
|
1340
|
-
|
|
1272
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
1341
1273
|
/** @internal */
|
|
1342
|
-
|
|
1274
|
+
const starfieldProceduralTexturePixelShader = { name, shader };
|
|
1343
1275
|
|
|
1344
1276
|
|
|
1345
1277
|
/***/ }),
|
|
1346
1278
|
|
|
1347
|
-
/***/ "../../../
|
|
1348
|
-
|
|
1349
|
-
!*** ../../../
|
|
1350
|
-
|
|
1279
|
+
/***/ "../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.ts":
|
|
1280
|
+
/*!***********************************************************************************!*\
|
|
1281
|
+
!*** ../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.ts ***!
|
|
1282
|
+
\***********************************************************************************/
|
|
1351
1283
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1352
1284
|
|
|
1353
1285
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1355,34 +1287,31 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1355
1287
|
/* harmony export */ StarfieldProceduralTexture: () => (/* binding */ StarfieldProceduralTexture)
|
|
1356
1288
|
/* harmony export */ });
|
|
1357
1289
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
1358
|
-
/* harmony import */ var
|
|
1359
|
-
/* harmony import */ var
|
|
1360
|
-
/* harmony import */ var _starfieldProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./starfieldProceduralTexture.fragment */ "../../../
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
(
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
return _this;
|
|
1384
|
-
}
|
|
1385
|
-
StarfieldProceduralTexture.prototype.updateShaderUniforms = function () {
|
|
1290
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
1291
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
1292
|
+
/* harmony import */ var _starfieldProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./starfieldProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/starfield/starfieldProceduralTexture.fragment.ts");
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
class StarfieldProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
1299
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
1300
|
+
super(name, size, "starfieldProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
1301
|
+
this._time = 1;
|
|
1302
|
+
this._alpha = 0.5;
|
|
1303
|
+
this._beta = 0.8;
|
|
1304
|
+
this._zoom = 0.8;
|
|
1305
|
+
this._formuparam = 0.53;
|
|
1306
|
+
this._stepsize = 0.1;
|
|
1307
|
+
this._tile = 0.85;
|
|
1308
|
+
this._brightness = 0.0015;
|
|
1309
|
+
this._darkmatter = 0.4;
|
|
1310
|
+
this._distfading = 0.73;
|
|
1311
|
+
this._saturation = 0.85;
|
|
1312
|
+
this.updateShaderUniforms();
|
|
1313
|
+
}
|
|
1314
|
+
updateShaderUniforms() {
|
|
1386
1315
|
this.setFloat("time", this._time);
|
|
1387
1316
|
this.setFloat("alpha", this._alpha);
|
|
1388
1317
|
this.setFloat("beta", this._beta);
|
|
@@ -1394,137 +1323,93 @@ var StarfieldProceduralTexture = /** @class */ (function (_super) {
|
|
|
1394
1323
|
this.setFloat("darkmatter", this._darkmatter);
|
|
1395
1324
|
this.setFloat("distfading", this._distfading);
|
|
1396
1325
|
this.setFloat("saturation", this._saturation);
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
}
|
|
1475
|
-
Object.defineProperty(StarfieldProceduralTexture.prototype, "brightness", {
|
|
1476
|
-
get: function () {
|
|
1477
|
-
return this._brightness;
|
|
1478
|
-
},
|
|
1479
|
-
set: function (value) {
|
|
1480
|
-
this._brightness = value;
|
|
1481
|
-
this.updateShaderUniforms();
|
|
1482
|
-
},
|
|
1483
|
-
enumerable: false,
|
|
1484
|
-
configurable: true
|
|
1485
|
-
});
|
|
1486
|
-
Object.defineProperty(StarfieldProceduralTexture.prototype, "darkmatter", {
|
|
1487
|
-
get: function () {
|
|
1488
|
-
return this._darkmatter;
|
|
1489
|
-
},
|
|
1490
|
-
set: function (value) {
|
|
1491
|
-
this._darkmatter = value;
|
|
1492
|
-
this.updateShaderUniforms();
|
|
1493
|
-
},
|
|
1494
|
-
enumerable: false,
|
|
1495
|
-
configurable: true
|
|
1496
|
-
});
|
|
1497
|
-
Object.defineProperty(StarfieldProceduralTexture.prototype, "distfading", {
|
|
1498
|
-
get: function () {
|
|
1499
|
-
return this._distfading;
|
|
1500
|
-
},
|
|
1501
|
-
set: function (value) {
|
|
1502
|
-
this._distfading = value;
|
|
1503
|
-
this.updateShaderUniforms();
|
|
1504
|
-
},
|
|
1505
|
-
enumerable: false,
|
|
1506
|
-
configurable: true
|
|
1507
|
-
});
|
|
1508
|
-
Object.defineProperty(StarfieldProceduralTexture.prototype, "saturation", {
|
|
1509
|
-
get: function () {
|
|
1510
|
-
return this._saturation;
|
|
1511
|
-
},
|
|
1512
|
-
set: function (value) {
|
|
1513
|
-
this._saturation = value;
|
|
1514
|
-
this.updateShaderUniforms();
|
|
1515
|
-
},
|
|
1516
|
-
enumerable: false,
|
|
1517
|
-
configurable: true
|
|
1518
|
-
});
|
|
1326
|
+
}
|
|
1327
|
+
get time() {
|
|
1328
|
+
return this._time;
|
|
1329
|
+
}
|
|
1330
|
+
set time(value) {
|
|
1331
|
+
this._time = value;
|
|
1332
|
+
this.updateShaderUniforms();
|
|
1333
|
+
}
|
|
1334
|
+
get alpha() {
|
|
1335
|
+
return this._alpha;
|
|
1336
|
+
}
|
|
1337
|
+
set alpha(value) {
|
|
1338
|
+
this._alpha = value;
|
|
1339
|
+
this.updateShaderUniforms();
|
|
1340
|
+
}
|
|
1341
|
+
get beta() {
|
|
1342
|
+
return this._beta;
|
|
1343
|
+
}
|
|
1344
|
+
set beta(value) {
|
|
1345
|
+
this._beta = value;
|
|
1346
|
+
this.updateShaderUniforms();
|
|
1347
|
+
}
|
|
1348
|
+
get formuparam() {
|
|
1349
|
+
return this._formuparam;
|
|
1350
|
+
}
|
|
1351
|
+
set formuparam(value) {
|
|
1352
|
+
this._formuparam = value;
|
|
1353
|
+
this.updateShaderUniforms();
|
|
1354
|
+
}
|
|
1355
|
+
get stepsize() {
|
|
1356
|
+
return this._stepsize;
|
|
1357
|
+
}
|
|
1358
|
+
set stepsize(value) {
|
|
1359
|
+
this._stepsize = value;
|
|
1360
|
+
this.updateShaderUniforms();
|
|
1361
|
+
}
|
|
1362
|
+
get zoom() {
|
|
1363
|
+
return this._zoom;
|
|
1364
|
+
}
|
|
1365
|
+
set zoom(value) {
|
|
1366
|
+
this._zoom = value;
|
|
1367
|
+
this.updateShaderUniforms();
|
|
1368
|
+
}
|
|
1369
|
+
get tile() {
|
|
1370
|
+
return this._tile;
|
|
1371
|
+
}
|
|
1372
|
+
set tile(value) {
|
|
1373
|
+
this._tile = value;
|
|
1374
|
+
this.updateShaderUniforms();
|
|
1375
|
+
}
|
|
1376
|
+
get brightness() {
|
|
1377
|
+
return this._brightness;
|
|
1378
|
+
}
|
|
1379
|
+
set brightness(value) {
|
|
1380
|
+
this._brightness = value;
|
|
1381
|
+
this.updateShaderUniforms();
|
|
1382
|
+
}
|
|
1383
|
+
get darkmatter() {
|
|
1384
|
+
return this._darkmatter;
|
|
1385
|
+
}
|
|
1386
|
+
set darkmatter(value) {
|
|
1387
|
+
this._darkmatter = value;
|
|
1388
|
+
this.updateShaderUniforms();
|
|
1389
|
+
}
|
|
1390
|
+
get distfading() {
|
|
1391
|
+
return this._distfading;
|
|
1392
|
+
}
|
|
1393
|
+
set distfading(value) {
|
|
1394
|
+
this._distfading = value;
|
|
1395
|
+
this.updateShaderUniforms();
|
|
1396
|
+
}
|
|
1397
|
+
get saturation() {
|
|
1398
|
+
return this._saturation;
|
|
1399
|
+
}
|
|
1400
|
+
set saturation(value) {
|
|
1401
|
+
this._saturation = value;
|
|
1402
|
+
this.updateShaderUniforms();
|
|
1403
|
+
}
|
|
1519
1404
|
/**
|
|
1520
1405
|
* Serializes this starfield procedural texture
|
|
1521
1406
|
* @returns a serialized starfield procedural texture object
|
|
1522
1407
|
*/
|
|
1523
|
-
|
|
1524
|
-
|
|
1408
|
+
serialize() {
|
|
1409
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
1525
1410
|
serializationObject.customType = "BABYLON.StarfieldProceduralTexture";
|
|
1526
1411
|
return serializationObject;
|
|
1527
|
-
}
|
|
1412
|
+
}
|
|
1528
1413
|
/**
|
|
1529
1414
|
* Creates a Starfield Procedural Texture from parsed startfield procedural texture data
|
|
1530
1415
|
* @param parsedTexture defines parsed texture data
|
|
@@ -1532,94 +1417,102 @@ var StarfieldProceduralTexture = /** @class */ (function (_super) {
|
|
|
1532
1417
|
* @param rootUrl defines the root URL containing startfield procedural texture information
|
|
1533
1418
|
* @returns a parsed Starfield Procedural Texture
|
|
1534
1419
|
*/
|
|
1535
|
-
|
|
1536
|
-
|
|
1420
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
1421
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new StarfieldProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
1537
1422
|
return texture;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
(0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.StarfieldProceduralTexture", StarfieldProceduralTexture);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1425
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1426
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1427
|
+
], StarfieldProceduralTexture.prototype, "time", null);
|
|
1428
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1429
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1430
|
+
], StarfieldProceduralTexture.prototype, "alpha", null);
|
|
1431
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1432
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1433
|
+
], StarfieldProceduralTexture.prototype, "beta", null);
|
|
1434
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1435
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1436
|
+
], StarfieldProceduralTexture.prototype, "formuparam", null);
|
|
1437
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1438
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1439
|
+
], StarfieldProceduralTexture.prototype, "stepsize", null);
|
|
1440
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1441
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1442
|
+
], StarfieldProceduralTexture.prototype, "zoom", null);
|
|
1443
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1444
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1445
|
+
], StarfieldProceduralTexture.prototype, "tile", null);
|
|
1446
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1447
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1448
|
+
], StarfieldProceduralTexture.prototype, "brightness", null);
|
|
1449
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1450
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1451
|
+
], StarfieldProceduralTexture.prototype, "darkmatter", null);
|
|
1452
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1453
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1454
|
+
], StarfieldProceduralTexture.prototype, "distfading", null);
|
|
1455
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1456
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1457
|
+
], StarfieldProceduralTexture.prototype, "saturation", null);
|
|
1458
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.StarfieldProceduralTexture", StarfieldProceduralTexture);
|
|
1575
1459
|
|
|
1576
1460
|
|
|
1577
1461
|
/***/ }),
|
|
1578
1462
|
|
|
1579
|
-
/***/ "../../../
|
|
1580
|
-
|
|
1581
|
-
!*** ../../../
|
|
1582
|
-
|
|
1463
|
+
/***/ "../../../dev/proceduralTextures/src/wood/index.ts":
|
|
1464
|
+
/*!*********************************************************!*\
|
|
1465
|
+
!*** ../../../dev/proceduralTextures/src/wood/index.ts ***!
|
|
1466
|
+
\*********************************************************/
|
|
1583
1467
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1584
1468
|
|
|
1585
1469
|
__webpack_require__.r(__webpack_exports__);
|
|
1586
1470
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1587
1471
|
/* harmony export */ WoodProceduralTexture: () => (/* reexport safe */ _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__.WoodProceduralTexture)
|
|
1588
1472
|
/* harmony export */ });
|
|
1589
|
-
/* harmony import */ var _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woodProceduralTexture */ "../../../
|
|
1473
|
+
/* harmony import */ var _woodProceduralTexture__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./woodProceduralTexture */ "../../../dev/proceduralTextures/src/wood/woodProceduralTexture.ts");
|
|
1590
1474
|
|
|
1591
1475
|
|
|
1592
1476
|
|
|
1593
1477
|
/***/ }),
|
|
1594
1478
|
|
|
1595
|
-
/***/ "../../../
|
|
1596
|
-
|
|
1597
|
-
!*** ../../../
|
|
1598
|
-
|
|
1479
|
+
/***/ "../../../dev/proceduralTextures/src/wood/woodProceduralTexture.fragment.ts":
|
|
1480
|
+
/*!**********************************************************************************!*\
|
|
1481
|
+
!*** ../../../dev/proceduralTextures/src/wood/woodProceduralTexture.fragment.ts ***!
|
|
1482
|
+
\**********************************************************************************/
|
|
1599
1483
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1600
1484
|
|
|
1601
1485
|
__webpack_require__.r(__webpack_exports__);
|
|
1602
1486
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1603
1487
|
/* harmony export */ woodProceduralTexturePixelShader: () => (/* binding */ woodProceduralTexturePixelShader)
|
|
1604
1488
|
/* harmony export */ });
|
|
1605
|
-
/* harmony import */ var
|
|
1606
|
-
/* harmony import */ var
|
|
1489
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Engines/shaderStore */ "babylonjs/Misc/decorators");
|
|
1490
|
+
/* harmony import */ var babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__);
|
|
1607
1491
|
// Do not edit.
|
|
1608
1492
|
|
|
1609
|
-
|
|
1610
|
-
|
|
1493
|
+
const name = "woodProceduralTexturePixelShader";
|
|
1494
|
+
const shader = `precision highp float;varying vec2 vPosition;varying vec2 vUV;uniform float ampScale;uniform vec3 woodColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}
|
|
1495
|
+
float noise(vec2 n) {const vec2 d=vec2(0.0,1.0);vec2 b=floor(n),f=smoothstep(vec2(0.0),vec2(1.0),fract(n));return mix(mix(rand(b),rand(b+d.yx),f.x),mix(rand(b+d.xy),rand(b+d.yy),f.x),f.y);}
|
|
1496
|
+
float fbm(vec2 n) {float total=0.0,amplitude=1.0;for (int i=0; i<4; i++) {total+=noise(n)*amplitude;n+=n;amplitude*=0.5;}
|
|
1497
|
+
return total;}
|
|
1498
|
+
#define CUSTOM_FRAGMENT_DEFINITIONS
|
|
1499
|
+
void main(void) {
|
|
1500
|
+
#define CUSTOM_FRAGMENT_MAIN_BEGIN
|
|
1501
|
+
float ratioy=mod(vUV.x*ampScale,2.0+fbm(vUV*0.8));vec3 wood=woodColor*ratioy;gl_FragColor=vec4(wood,1.0);
|
|
1502
|
+
#define CUSTOM_FRAGMENT_MAIN_END
|
|
1503
|
+
}`;
|
|
1611
1504
|
// Sideeffect
|
|
1612
|
-
|
|
1505
|
+
babylonjs_Engines_shaderStore__WEBPACK_IMPORTED_MODULE_0__.ShaderStore.ShadersStore[name] = shader;
|
|
1613
1506
|
/** @internal */
|
|
1614
|
-
|
|
1507
|
+
const woodProceduralTexturePixelShader = { name, shader };
|
|
1615
1508
|
|
|
1616
1509
|
|
|
1617
1510
|
/***/ }),
|
|
1618
1511
|
|
|
1619
|
-
/***/ "../../../
|
|
1620
|
-
|
|
1621
|
-
!*** ../../../
|
|
1622
|
-
|
|
1512
|
+
/***/ "../../../dev/proceduralTextures/src/wood/woodProceduralTexture.ts":
|
|
1513
|
+
/*!*************************************************************************!*\
|
|
1514
|
+
!*** ../../../dev/proceduralTextures/src/wood/woodProceduralTexture.ts ***!
|
|
1515
|
+
\*************************************************************************/
|
|
1623
1516
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1624
1517
|
|
|
1625
1518
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -1627,60 +1520,49 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1627
1520
|
/* harmony export */ WoodProceduralTexture: () => (/* binding */ WoodProceduralTexture)
|
|
1628
1521
|
/* harmony export */ });
|
|
1629
1522
|
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.mjs");
|
|
1630
|
-
/* harmony import */ var
|
|
1631
|
-
/* harmony import */ var
|
|
1632
|
-
/* harmony import */ var _woodProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woodProceduralTexture.fragment */ "../../../
|
|
1523
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babylonjs/Misc/typeStore */ "babylonjs/Misc/decorators");
|
|
1524
|
+
/* harmony import */ var babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__);
|
|
1525
|
+
/* harmony import */ var _woodProceduralTexture_fragment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./woodProceduralTexture.fragment */ "../../../dev/proceduralTextures/src/wood/woodProceduralTexture.fragment.ts");
|
|
1633
1526
|
|
|
1634
1527
|
|
|
1635
1528
|
|
|
1636
1529
|
|
|
1637
1530
|
|
|
1638
1531
|
|
|
1639
|
-
|
|
1640
|
-
(
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
_this._woodColor = new core_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.32, 0.17, 0.09);
|
|
1646
|
-
_this.updateShaderUniforms();
|
|
1647
|
-
return _this;
|
|
1532
|
+
class WoodProceduralTexture extends babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.ProceduralTexture {
|
|
1533
|
+
constructor(name, size, scene = null, fallbackTexture, generateMipMaps) {
|
|
1534
|
+
super(name, size, "woodProceduralTexture", scene, fallbackTexture, generateMipMaps);
|
|
1535
|
+
this._ampScale = 100.0;
|
|
1536
|
+
this._woodColor = new babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.Color3(0.32, 0.17, 0.09);
|
|
1537
|
+
this.updateShaderUniforms();
|
|
1648
1538
|
}
|
|
1649
|
-
|
|
1539
|
+
updateShaderUniforms() {
|
|
1650
1540
|
this.setFloat("ampScale", this._ampScale);
|
|
1651
1541
|
this.setColor3("woodColor", this._woodColor);
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
},
|
|
1668
|
-
set: function (value) {
|
|
1669
|
-
this._woodColor = value;
|
|
1670
|
-
this.updateShaderUniforms();
|
|
1671
|
-
},
|
|
1672
|
-
enumerable: false,
|
|
1673
|
-
configurable: true
|
|
1674
|
-
});
|
|
1542
|
+
}
|
|
1543
|
+
get ampScale() {
|
|
1544
|
+
return this._ampScale;
|
|
1545
|
+
}
|
|
1546
|
+
set ampScale(value) {
|
|
1547
|
+
this._ampScale = value;
|
|
1548
|
+
this.updateShaderUniforms();
|
|
1549
|
+
}
|
|
1550
|
+
get woodColor() {
|
|
1551
|
+
return this._woodColor;
|
|
1552
|
+
}
|
|
1553
|
+
set woodColor(value) {
|
|
1554
|
+
this._woodColor = value;
|
|
1555
|
+
this.updateShaderUniforms();
|
|
1556
|
+
}
|
|
1675
1557
|
/**
|
|
1676
1558
|
* Serializes this wood procedural texture
|
|
1677
1559
|
* @returns a serialized wood procedural texture object
|
|
1678
1560
|
*/
|
|
1679
|
-
|
|
1680
|
-
|
|
1561
|
+
serialize() {
|
|
1562
|
+
const serializationObject = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Serialize(this, super.serialize());
|
|
1681
1563
|
serializationObject.customType = "BABYLON.WoodProceduralTexture";
|
|
1682
1564
|
return serializationObject;
|
|
1683
|
-
}
|
|
1565
|
+
}
|
|
1684
1566
|
/**
|
|
1685
1567
|
* Creates a Wood Procedural Texture from parsed wood procedural texture data
|
|
1686
1568
|
* @param parsedTexture defines parsed texture data
|
|
@@ -1688,30 +1570,69 @@ var WoodProceduralTexture = /** @class */ (function (_super) {
|
|
|
1688
1570
|
* @param rootUrl defines the root URL containing wood procedural texture information
|
|
1689
1571
|
* @returns a parsed Wood Procedural Texture
|
|
1690
1572
|
*/
|
|
1691
|
-
|
|
1692
|
-
|
|
1573
|
+
static Parse(parsedTexture, scene, rootUrl) {
|
|
1574
|
+
const texture = babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.SerializationHelper.Parse(() => new WoodProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps), parsedTexture, scene, rootUrl);
|
|
1693
1575
|
return texture;
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1579
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serialize)()
|
|
1580
|
+
], WoodProceduralTexture.prototype, "ampScale", null);
|
|
1581
|
+
(0,tslib__WEBPACK_IMPORTED_MODULE_2__.__decorate)([
|
|
1582
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.serializeAsColor3)()
|
|
1583
|
+
], WoodProceduralTexture.prototype, "woodColor", null);
|
|
1584
|
+
(0,babylonjs_Misc_decorators__WEBPACK_IMPORTED_MODULE_0__.RegisterClass)("BABYLON.WoodProceduralTexture", WoodProceduralTexture);
|
|
1585
|
+
|
|
1586
|
+
|
|
1587
|
+
/***/ }),
|
|
1588
|
+
|
|
1589
|
+
/***/ "../../../lts/proceduralTextures/src/legacy/legacy.ts":
|
|
1590
|
+
/*!************************************************************!*\
|
|
1591
|
+
!*** ../../../lts/proceduralTextures/src/legacy/legacy.ts ***!
|
|
1592
|
+
\************************************************************/
|
|
1593
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1594
|
+
|
|
1595
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1596
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1597
|
+
/* harmony export */ BrickProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.BrickProceduralTexture),
|
|
1598
|
+
/* harmony export */ CloudProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.CloudProceduralTexture),
|
|
1599
|
+
/* harmony export */ FireProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.FireProceduralTexture),
|
|
1600
|
+
/* harmony export */ GrassProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.GrassProceduralTexture),
|
|
1601
|
+
/* harmony export */ MarbleProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.MarbleProceduralTexture),
|
|
1602
|
+
/* harmony export */ NormalMapProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.NormalMapProceduralTexture),
|
|
1603
|
+
/* harmony export */ PerlinNoiseProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.PerlinNoiseProceduralTexture),
|
|
1604
|
+
/* harmony export */ RoadProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.RoadProceduralTexture),
|
|
1605
|
+
/* harmony export */ StarfieldProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.StarfieldProceduralTexture),
|
|
1606
|
+
/* harmony export */ WoodProceduralTexture: () => (/* reexport safe */ procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__.WoodProceduralTexture)
|
|
1607
|
+
/* harmony export */ });
|
|
1608
|
+
/* harmony import */ var procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! procedural-textures/index */ "../../../dev/proceduralTextures/src/index.ts");
|
|
1609
|
+
/* eslint-disable import/no-internal-modules */
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Legacy support, defining window.BABYLON.GridMaterial... (global variable).
|
|
1613
|
+
*
|
|
1614
|
+
* This is the entry point for the UMD module.
|
|
1615
|
+
* The entry point for a future ESM package should be index.ts
|
|
1616
|
+
*/
|
|
1617
|
+
const globalObject = typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof window !== "undefined" ? window : undefined;
|
|
1618
|
+
if (typeof globalObject !== "undefined") {
|
|
1619
|
+
globalObject.BABYLON = globalObject.BABYLON || {};
|
|
1620
|
+
for (const mat in procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__) {
|
|
1621
|
+
globalObject.BABYLON[mat] = procedural_textures_index__WEBPACK_IMPORTED_MODULE_0__[mat];
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1704
1625
|
|
|
1705
1626
|
|
|
1706
1627
|
/***/ }),
|
|
1707
1628
|
|
|
1708
|
-
/***/ "
|
|
1629
|
+
/***/ "babylonjs/Misc/decorators":
|
|
1709
1630
|
/*!****************************************************************************************************!*\
|
|
1710
1631
|
!*** external {"root":"BABYLON","commonjs":"babylonjs","commonjs2":"babylonjs","amd":"babylonjs"} ***!
|
|
1711
1632
|
\****************************************************************************************************/
|
|
1712
1633
|
/***/ ((module) => {
|
|
1713
1634
|
|
|
1714
|
-
module.exports =
|
|
1635
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_babylonjs_Misc_decorators__;
|
|
1715
1636
|
|
|
1716
1637
|
/***/ }),
|
|
1717
1638
|
|
|
@@ -2168,12 +2089,12 @@ var __webpack_exports__ = {};
|
|
|
2168
2089
|
__webpack_require__.r(__webpack_exports__);
|
|
2169
2090
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2170
2091
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__),
|
|
2171
|
-
/* harmony export */ proceduralTextures: () => (/* reexport module object */
|
|
2092
|
+
/* harmony export */ proceduralTextures: () => (/* reexport module object */ _lts_procedural_textures_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__)
|
|
2172
2093
|
/* harmony export */ });
|
|
2173
|
-
/* harmony import */ var
|
|
2094
|
+
/* harmony import */ var _lts_procedural_textures_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @lts/procedural-textures/legacy/legacy */ "../../../lts/proceduralTextures/src/legacy/legacy.ts");
|
|
2174
2095
|
|
|
2175
2096
|
|
|
2176
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (
|
|
2097
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_lts_procedural_textures_legacy_legacy__WEBPACK_IMPORTED_MODULE_0__);
|
|
2177
2098
|
|
|
2178
2099
|
})();
|
|
2179
2100
|
|