@babylonjs/procedural-textures 5.0.0-beta.9 → 5.0.0-rc.10
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/brick/brickProceduralTexture.d.ts +35 -35
- package/brick/brickProceduralTexture.fragment.d.ts +5 -5
- package/brick/brickProceduralTexture.fragment.js +8 -6
- package/brick/brickProceduralTexture.fragment.js.map +1 -1
- package/brick/brickProceduralTexture.js +104 -104
- package/brick/brickProceduralTexture.js.map +1 -1
- package/brick/index.d.ts +1 -1
- package/brick/index.js +1 -1
- package/brick/index.js.map +1 -1
- package/cloud/cloudProceduralTexture.d.ts +35 -35
- package/cloud/cloudProceduralTexture.fragment.d.ts +5 -5
- package/cloud/cloudProceduralTexture.fragment.js +8 -6
- package/cloud/cloudProceduralTexture.fragment.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +104 -104
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/cloud/index.d.ts +1 -1
- package/cloud/index.js +1 -1
- package/cloud/index.js.map +1 -1
- package/fire/fireProceduralTexture.d.ts +44 -44
- package/fire/fireProceduralTexture.fragment.d.ts +5 -5
- package/fire/fireProceduralTexture.fragment.js +8 -6
- package/fire/fireProceduralTexture.fragment.js.map +1 -1
- package/fire/fireProceduralTexture.js +166 -194
- package/fire/fireProceduralTexture.js.map +1 -1
- package/fire/index.d.ts +1 -1
- package/fire/index.js +1 -1
- package/fire/index.js.map +1 -1
- package/grass/grassProceduralTexture.d.ts +29 -29
- package/grass/grassProceduralTexture.fragment.d.ts +5 -5
- package/grass/grassProceduralTexture.fragment.js +8 -6
- package/grass/grassProceduralTexture.fragment.js.map +1 -1
- package/grass/grassProceduralTexture.js +80 -84
- package/grass/grassProceduralTexture.js.map +1 -1
- package/grass/index.d.ts +1 -1
- package/grass/index.js +1 -1
- package/grass/index.js.map +1 -1
- package/index.d.ts +10 -10
- package/index.js +11 -10
- package/index.js.map +1 -1
- package/legacy/legacy-brick.d.ts +1 -1
- package/legacy/legacy-brick.js +13 -12
- package/legacy/legacy-brick.js.map +1 -1
- package/legacy/legacy-cloud.d.ts +1 -1
- package/legacy/legacy-cloud.js +13 -12
- package/legacy/legacy-cloud.js.map +1 -1
- package/legacy/legacy-fire.d.ts +1 -1
- package/legacy/legacy-fire.js +13 -12
- package/legacy/legacy-fire.js.map +1 -1
- package/legacy/legacy-grass.d.ts +1 -1
- package/legacy/legacy-grass.js +13 -12
- package/legacy/legacy-grass.js.map +1 -1
- package/legacy/legacy-marble.d.ts +1 -1
- package/legacy/legacy-marble.js +13 -12
- package/legacy/legacy-marble.js.map +1 -1
- package/legacy/legacy-normalMap.d.ts +1 -1
- package/legacy/legacy-normalMap.js +13 -12
- package/legacy/legacy-normalMap.js.map +1 -1
- package/legacy/legacy-perlinNoise.d.ts +1 -1
- package/legacy/legacy-perlinNoise.js +13 -12
- package/legacy/legacy-perlinNoise.js.map +1 -1
- package/legacy/legacy-road.d.ts +1 -1
- package/legacy/legacy-road.js +13 -12
- package/legacy/legacy-road.js.map +1 -1
- package/legacy/legacy-starfield.d.ts +1 -1
- package/legacy/legacy-starfield.js +13 -12
- package/legacy/legacy-starfield.js.map +1 -1
- package/legacy/legacy-wood.d.ts +1 -1
- package/legacy/legacy-wood.js +13 -12
- package/legacy/legacy-wood.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +16 -15
- package/legacy/legacy.js.map +1 -1
- package/marble/index.d.ts +1 -1
- package/marble/index.js +1 -1
- package/marble/index.js.map +1 -1
- package/marble/marbleProceduralTexture.d.ts +35 -35
- package/marble/marbleProceduralTexture.fragment.d.ts +5 -5
- package/marble/marbleProceduralTexture.fragment.js +8 -6
- package/marble/marbleProceduralTexture.fragment.js.map +1 -1
- package/marble/marbleProceduralTexture.js +104 -104
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/index.d.ts +1 -1
- package/normalMap/index.js +1 -1
- package/normalMap/index.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.d.ts +28 -28
- package/normalMap/normalMapProceduralTexture.fragment.d.ts +5 -5
- package/normalMap/normalMapProceduralTexture.fragment.js +8 -6
- package/normalMap/normalMapProceduralTexture.fragment.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +69 -69
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +22 -152
- package/perlinNoise/index.d.ts +1 -1
- package/perlinNoise/index.js +1 -1
- package/perlinNoise/index.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.d.ts +28 -28
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.d.ts +5 -5
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +8 -6
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.js +69 -69
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/readme.md +2 -2
- package/road/index.d.ts +1 -1
- package/road/index.js +1 -1
- package/road/index.js.map +1 -1
- package/road/roadProceduralTexture.d.ts +26 -26
- package/road/roadProceduralTexture.fragment.d.ts +5 -5
- package/road/roadProceduralTexture.fragment.js +8 -6
- package/road/roadProceduralTexture.fragment.js.map +1 -1
- package/road/roadProceduralTexture.js +56 -56
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/index.d.ts +1 -1
- package/starfield/index.js +1 -1
- package/starfield/index.js.map +1 -1
- package/starfield/starfieldProceduralTexture.d.ts +55 -55
- package/starfield/starfieldProceduralTexture.fragment.d.ts +5 -5
- package/starfield/starfieldProceduralTexture.fragment.js +8 -6
- package/starfield/starfieldProceduralTexture.fragment.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +215 -215
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/index.d.ts +1 -1
- package/wood/index.js +1 -1
- package/wood/index.js.map +1 -1
- package/wood/woodProceduralTexture.d.ts +29 -29
- package/wood/woodProceduralTexture.fragment.d.ts +5 -5
- package/wood/woodProceduralTexture.fragment.js +8 -6
- package/wood/woodProceduralTexture.fragment.js.map +1 -1
- package/wood/woodProceduralTexture.js +72 -72
- package/wood/woodProceduralTexture.js.map +1 -1
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { __decorate, __extends } from "tslib";
|
|
2
|
-
import { serialize, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
-
import { RegisterClass } from
|
|
5
|
-
import "./perlinNoiseProceduralTexture.fragment
|
|
6
|
-
var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
|
|
7
|
-
__extends(PerlinNoiseProceduralTexture, _super);
|
|
8
|
-
function PerlinNoiseProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
|
|
9
|
-
if (scene === void 0) { scene = null; }
|
|
10
|
-
var _this = _super.call(this, name, size, "perlinNoiseProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
11
|
-
_this.time = 0.0;
|
|
12
|
-
_this.timeScale = 1.0;
|
|
13
|
-
_this.translationSpeed = 1.0;
|
|
14
|
-
_this._currentTranslation = 0;
|
|
15
|
-
_this.updateShaderUniforms();
|
|
16
|
-
return _this;
|
|
17
|
-
}
|
|
18
|
-
PerlinNoiseProceduralTexture.prototype.updateShaderUniforms = function () {
|
|
19
|
-
this.setFloat("size", this.getRenderSize());
|
|
20
|
-
var scene = this.getScene();
|
|
21
|
-
if (!scene) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
var deltaTime = scene.getEngine().getDeltaTime();
|
|
25
|
-
this.time += deltaTime;
|
|
26
|
-
this.setFloat("time", this.time * this.timeScale / 1000);
|
|
27
|
-
this._currentTranslation += deltaTime * this.translationSpeed / 1000.0;
|
|
28
|
-
this.setFloat("translationSpeed", this._currentTranslation);
|
|
29
|
-
};
|
|
30
|
-
PerlinNoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {
|
|
31
|
-
this.updateShaderUniforms();
|
|
32
|
-
_super.prototype.render.call(this, useCameraPostProcess);
|
|
33
|
-
};
|
|
34
|
-
PerlinNoiseProceduralTexture.prototype.resize = function (size, generateMipMaps) {
|
|
35
|
-
_super.prototype.resize.call(this, size, generateMipMaps);
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Serializes this perlin noise procedural texture
|
|
39
|
-
* @returns a serialized perlin noise procedural texture object
|
|
40
|
-
*/
|
|
41
|
-
PerlinNoiseProceduralTexture.prototype.serialize = function () {
|
|
42
|
-
var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
|
|
43
|
-
serializationObject.customType = "BABYLON.PerlinNoiseProceduralTexture";
|
|
44
|
-
return serializationObject;
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Creates a Perlin Noise Procedural Texture from parsed perlin noise procedural texture data
|
|
48
|
-
* @param parsedTexture defines parsed texture data
|
|
49
|
-
* @param scene defines the current scene
|
|
50
|
-
* @param rootUrl defines the root URL containing perlin noise procedural texture information
|
|
51
|
-
* @returns a parsed Perlin Noise Procedural Texture
|
|
52
|
-
*/
|
|
53
|
-
PerlinNoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
|
|
54
|
-
var texture = SerializationHelper.Parse(function () { return new PerlinNoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
|
|
55
|
-
return texture;
|
|
56
|
-
};
|
|
57
|
-
__decorate([
|
|
58
|
-
serialize()
|
|
59
|
-
], PerlinNoiseProceduralTexture.prototype, "time", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
serialize()
|
|
62
|
-
], PerlinNoiseProceduralTexture.prototype, "timeScale", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
serialize()
|
|
65
|
-
], PerlinNoiseProceduralTexture.prototype, "translationSpeed", void 0);
|
|
66
|
-
return PerlinNoiseProceduralTexture;
|
|
67
|
-
}(ProceduralTexture));
|
|
68
|
-
export { PerlinNoiseProceduralTexture };
|
|
69
|
-
RegisterClass("BABYLON.PerlinNoiseProceduralTexture", PerlinNoiseProceduralTexture);
|
|
1
|
+
import { __decorate, __extends } from "tslib";
|
|
2
|
+
import { serialize, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
|
+
import "./perlinNoiseProceduralTexture.fragment";
|
|
6
|
+
var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
|
|
7
|
+
__extends(PerlinNoiseProceduralTexture, _super);
|
|
8
|
+
function PerlinNoiseProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
|
|
9
|
+
if (scene === void 0) { scene = null; }
|
|
10
|
+
var _this = _super.call(this, name, size, "perlinNoiseProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
11
|
+
_this.time = 0.0;
|
|
12
|
+
_this.timeScale = 1.0;
|
|
13
|
+
_this.translationSpeed = 1.0;
|
|
14
|
+
_this._currentTranslation = 0;
|
|
15
|
+
_this.updateShaderUniforms();
|
|
16
|
+
return _this;
|
|
17
|
+
}
|
|
18
|
+
PerlinNoiseProceduralTexture.prototype.updateShaderUniforms = function () {
|
|
19
|
+
this.setFloat("size", this.getRenderSize());
|
|
20
|
+
var scene = this.getScene();
|
|
21
|
+
if (!scene) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
var deltaTime = scene.getEngine().getDeltaTime();
|
|
25
|
+
this.time += deltaTime;
|
|
26
|
+
this.setFloat("time", (this.time * this.timeScale) / 1000);
|
|
27
|
+
this._currentTranslation += (deltaTime * this.translationSpeed) / 1000.0;
|
|
28
|
+
this.setFloat("translationSpeed", this._currentTranslation);
|
|
29
|
+
};
|
|
30
|
+
PerlinNoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {
|
|
31
|
+
this.updateShaderUniforms();
|
|
32
|
+
_super.prototype.render.call(this, useCameraPostProcess);
|
|
33
|
+
};
|
|
34
|
+
PerlinNoiseProceduralTexture.prototype.resize = function (size, generateMipMaps) {
|
|
35
|
+
_super.prototype.resize.call(this, size, generateMipMaps);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Serializes this perlin noise procedural texture
|
|
39
|
+
* @returns a serialized perlin noise procedural texture object
|
|
40
|
+
*/
|
|
41
|
+
PerlinNoiseProceduralTexture.prototype.serialize = function () {
|
|
42
|
+
var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
|
|
43
|
+
serializationObject.customType = "BABYLON.PerlinNoiseProceduralTexture";
|
|
44
|
+
return serializationObject;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Creates a Perlin Noise Procedural Texture from parsed perlin noise procedural texture data
|
|
48
|
+
* @param parsedTexture defines parsed texture data
|
|
49
|
+
* @param scene defines the current scene
|
|
50
|
+
* @param rootUrl defines the root URL containing perlin noise procedural texture information
|
|
51
|
+
* @returns a parsed Perlin Noise Procedural Texture
|
|
52
|
+
*/
|
|
53
|
+
PerlinNoiseProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
|
|
54
|
+
var texture = SerializationHelper.Parse(function () { return new PerlinNoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
|
|
55
|
+
return texture;
|
|
56
|
+
};
|
|
57
|
+
__decorate([
|
|
58
|
+
serialize()
|
|
59
|
+
], PerlinNoiseProceduralTexture.prototype, "time", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
serialize()
|
|
62
|
+
], PerlinNoiseProceduralTexture.prototype, "timeScale", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
serialize()
|
|
65
|
+
], PerlinNoiseProceduralTexture.prototype, "translationSpeed", void 0);
|
|
66
|
+
return PerlinNoiseProceduralTexture;
|
|
67
|
+
}(ProceduralTexture));
|
|
68
|
+
export { PerlinNoiseProceduralTexture };
|
|
69
|
+
RegisterClass("BABYLON.PerlinNoiseProceduralTexture", PerlinNoiseProceduralTexture);
|
|
70
70
|
//# sourceMappingURL=perlinNoiseProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perlinNoiseProceduralTexture.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"perlinNoiseProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/perlinNoise/perlinNoiseProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,2CAA6B;AAEtE,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,yCAAyC,CAAC;AAEjD;IAAkD,gDAAiB;IAY/D,sCAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAE7F;QAbM,UAAI,GAAW,GAAG,CAAC;QAGnB,eAAS,GAAW,GAAG,CAAC;QAGxB,sBAAgB,GAAW,GAAG,CAAC;QAE9B,yBAAmB,GAAW,CAAC,CAAC;QAIpC,KAAI,CAAC,oBAAoB,EAAE,CAAC;;IAChC,CAAC;IAEM,2DAAoB,GAA3B;QACI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAY,CAAC,CAAC;QAEtD,IAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAE9B,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,IAAM,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC;QAEnD,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;QAE3D,IAAI,CAAC,mBAAmB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,gBAAgB,CAAC,GAAG,MAAM,CAAC;QACzE,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAChE,CAAC;IAEM,6CAAM,GAAb,UAAc,oBAA8B;QACxC,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,iBAAM,MAAM,YAAC,oBAAoB,CAAC,CAAC;IACvC,CAAC;IAEM,6CAAM,GAAb,UAAc,IAAS,EAAE,eAAoB;QACzC,iBAAM,MAAM,YAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,gDAAS,GAAhB;QACI,IAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,iBAAM,SAAS,WAAE,CAAC,CAAC;QACnF,mBAAmB,CAAC,UAAU,GAAG,sCAAsC,CAAC;QAExE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACW,kCAAK,GAAnB,UAAoB,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,cAAM,OAAA,IAAI,4BAA4B,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAA3H,CAA2H,EACjI,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IApED;QADC,SAAS,EAAE;8DACc;IAG1B;QADC,SAAS,EAAE;mEACmB;IAG/B;QADC,SAAS,EAAE;0EAC0B;IA+D1C,mCAAC;CAAA,AAvED,CAAkD,iBAAiB,GAuElE;SAvEY,4BAA4B;AAyEzC,aAAa,CAAC,sCAAsC,EAAE,4BAA4B,CAAC,CAAC","sourcesContent":["import { serialize, SerializationHelper } from \"core/Misc/decorators\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport \"./perlinNoiseProceduralTexture.fragment\";\r\n\r\nexport class PerlinNoiseProceduralTexture extends ProceduralTexture {\r\n @serialize()\r\n public time: number = 0.0;\r\n\r\n @serialize()\r\n public timeScale: number = 1.0;\r\n\r\n @serialize()\r\n public translationSpeed: number = 1.0;\r\n\r\n private _currentTranslation: number = 0;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"perlinNoiseProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"size\", this.getRenderSize() as number);\r\n\r\n const scene = this.getScene();\r\n\r\n if (!scene) {\r\n return;\r\n }\r\n const deltaTime = scene.getEngine().getDeltaTime();\r\n\r\n this.time += deltaTime;\r\n this.setFloat(\"time\", (this.time * this.timeScale) / 1000);\r\n\r\n this._currentTranslation += (deltaTime * this.translationSpeed) / 1000.0;\r\n this.setFloat(\"translationSpeed\", this._currentTranslation);\r\n }\r\n\r\n public render(useCameraPostProcess?: boolean) {\r\n this.updateShaderUniforms();\r\n super.render(useCameraPostProcess);\r\n }\r\n\r\n public resize(size: any, generateMipMaps: any): void {\r\n super.resize(size, generateMipMaps);\r\n }\r\n\r\n /**\r\n * Serializes this perlin noise procedural texture\r\n * @returns a serialized perlin noise procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.PerlinNoiseProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Perlin Noise Procedural Texture from parsed perlin noise procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing perlin noise procedural texture information\r\n * @returns a parsed Perlin Noise Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): PerlinNoiseProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new PerlinNoiseProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.PerlinNoiseProceduralTexture\", PerlinNoiseProceduralTexture);\r\n"]}
|
package/readme.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install --save @babylonjs/core @babylonjs/procedural-textures
|
|
|
13
13
|
|
|
14
14
|
# How to use
|
|
15
15
|
|
|
16
|
-
Afterwards it can be imported to
|
|
16
|
+
Afterwards it can be imported to your project using:
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
import { StandardMaterial } from '@babylonjs/core/Materials/standardMaterial';
|
|
@@ -31,4 +31,4 @@ fireMaterial.opacityTexture = fireTexture;
|
|
|
31
31
|
// Some more awesome code
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
For more information you can have a look at our [
|
|
34
|
+
For more information you can have a look at our [ES6 dedicated documentation](https://doc.babylonjs.com/features/es6_support).
|
package/road/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./roadProceduralTexture";
|
|
1
|
+
export * from "./roadProceduralTexture";
|
package/road/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./roadProceduralTexture
|
|
1
|
+
export * from "./roadProceduralTexture";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/road/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/road/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from \"./roadProceduralTexture\";\r\n"]}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color";
|
|
2
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
3
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture";
|
|
4
|
-
import { Scene } from "@babylonjs/core/scene";
|
|
5
|
-
import { Nullable } from "@babylonjs/core/types";
|
|
6
|
-
import "./roadProceduralTexture.fragment";
|
|
7
|
-
export declare class RoadProceduralTexture extends ProceduralTexture {
|
|
8
|
-
private _roadColor;
|
|
9
|
-
constructor(name: string, size: number, scene?: Nullable<Scene>, fallbackTexture?: Texture, generateMipMaps?: boolean);
|
|
10
|
-
updateShaderUniforms(): void;
|
|
11
|
-
get roadColor(): Color3;
|
|
12
|
-
set roadColor(value: Color3);
|
|
13
|
-
/**
|
|
14
|
-
* Serializes this road procedural texture
|
|
15
|
-
* @returns a serialized road procedural texture object
|
|
16
|
-
*/
|
|
17
|
-
serialize(): any;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a Road Procedural Texture from parsed road procedural texture data
|
|
20
|
-
* @param parsedTexture defines parsed texture data
|
|
21
|
-
* @param scene defines the current scene
|
|
22
|
-
* @param rootUrl defines the root URL containing road procedural texture information
|
|
23
|
-
* @returns a parsed Road Procedural Texture
|
|
24
|
-
*/
|
|
25
|
-
static Parse(parsedTexture: any, scene: Scene, rootUrl: string): RoadProceduralTexture;
|
|
26
|
-
}
|
|
1
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
|
+
import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import type { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
6
|
+
import "./roadProceduralTexture.fragment";
|
|
7
|
+
export declare class RoadProceduralTexture extends ProceduralTexture {
|
|
8
|
+
private _roadColor;
|
|
9
|
+
constructor(name: string, size: number, scene?: Nullable<Scene>, fallbackTexture?: Texture, generateMipMaps?: boolean);
|
|
10
|
+
updateShaderUniforms(): void;
|
|
11
|
+
get roadColor(): Color3;
|
|
12
|
+
set roadColor(value: Color3);
|
|
13
|
+
/**
|
|
14
|
+
* Serializes this road procedural texture
|
|
15
|
+
* @returns a serialized road procedural texture object
|
|
16
|
+
*/
|
|
17
|
+
serialize(): any;
|
|
18
|
+
/**
|
|
19
|
+
* Creates a Road Procedural Texture from parsed road procedural texture data
|
|
20
|
+
* @param parsedTexture defines parsed texture data
|
|
21
|
+
* @param scene defines the current scene
|
|
22
|
+
* @param rootUrl defines the root URL containing road procedural texture information
|
|
23
|
+
* @returns a parsed Road Procedural Texture
|
|
24
|
+
*/
|
|
25
|
+
static Parse(parsedTexture: any, scene: Scene, rootUrl: string): RoadProceduralTexture;
|
|
26
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** @hidden */
|
|
2
|
-
export declare
|
|
3
|
-
name: string;
|
|
4
|
-
shader: string;
|
|
5
|
-
};
|
|
1
|
+
/** @hidden */
|
|
2
|
+
export declare const roadProceduralTexturePixelShader: {
|
|
3
|
+
name: string;
|
|
4
|
+
shader: string;
|
|
5
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
3
|
+
var name = "roadProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;varying vec2 vUV; \nuniform vec3 roadColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat 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);}\nfloat 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;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));vec3 color=roadColor*ratioy;gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
|
|
5
|
+
// Sideeffect
|
|
6
|
+
ShaderStore.ShadersStore[name] = shader;
|
|
7
|
+
/** @hidden */
|
|
8
|
+
export var roadProceduralTexturePixelShader = { name: name, shader: shader };
|
|
7
9
|
//# sourceMappingURL=roadProceduralTexture.fragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"roadProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/road/roadProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,kCAAkC,CAAC;AAChD,IAAM,MAAM,GAAG,6sBAUb,CAAC;AACH,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,gCAAgC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"roadProceduralTexturePixelShader\";\nconst shader = `precision highp float;varying vec2 vUV; \nuniform vec3 roadColor;float rand(vec2 n) {return fract(cos(dot(n,vec2(12.9898,4.1414)))*43758.5453);}\nfloat 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);}\nfloat 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;}\nreturn total;}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\nfloat ratioy=mod(gl_FragCoord.y*100.0 ,fbm(vUV*2.0));vec3 color=roadColor*ratioy;gl_FragColor=vec4(color,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const roadProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { __decorate, __extends } from "tslib";
|
|
2
|
-
import { serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
-
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
-
import { RegisterClass } from
|
|
6
|
-
import "./roadProceduralTexture.fragment
|
|
7
|
-
var RoadProceduralTexture = /** @class */ (function (_super) {
|
|
8
|
-
__extends(RoadProceduralTexture, _super);
|
|
9
|
-
function RoadProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
|
|
10
|
-
if (scene === void 0) { scene = null; }
|
|
11
|
-
var _this = _super.call(this, name, size, "roadProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
12
|
-
_this._roadColor = new Color3(0.53, 0.53, 0.53);
|
|
13
|
-
_this.updateShaderUniforms();
|
|
14
|
-
return _this;
|
|
15
|
-
}
|
|
16
|
-
RoadProceduralTexture.prototype.updateShaderUniforms = function () {
|
|
17
|
-
this.setColor3("roadColor", this._roadColor);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(RoadProceduralTexture.prototype, "roadColor", {
|
|
20
|
-
get: function () {
|
|
21
|
-
return this._roadColor;
|
|
22
|
-
},
|
|
23
|
-
set: function (value) {
|
|
24
|
-
this._roadColor = value;
|
|
25
|
-
this.updateShaderUniforms();
|
|
26
|
-
},
|
|
27
|
-
enumerable: false,
|
|
28
|
-
configurable: true
|
|
29
|
-
});
|
|
30
|
-
/**
|
|
31
|
-
* Serializes this road procedural texture
|
|
32
|
-
* @returns a serialized road procedural texture object
|
|
33
|
-
*/
|
|
34
|
-
RoadProceduralTexture.prototype.serialize = function () {
|
|
35
|
-
var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
|
|
36
|
-
serializationObject.customType = "BABYLON.RoadProceduralTexture";
|
|
37
|
-
return serializationObject;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Creates a Road Procedural Texture from parsed road procedural texture data
|
|
41
|
-
* @param parsedTexture defines parsed texture data
|
|
42
|
-
* @param scene defines the current scene
|
|
43
|
-
* @param rootUrl defines the root URL containing road procedural texture information
|
|
44
|
-
* @returns a parsed Road Procedural Texture
|
|
45
|
-
*/
|
|
46
|
-
RoadProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
|
|
47
|
-
var texture = SerializationHelper.Parse(function () { return new RoadProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
|
|
48
|
-
return texture;
|
|
49
|
-
};
|
|
50
|
-
__decorate([
|
|
51
|
-
serializeAsColor3()
|
|
52
|
-
], RoadProceduralTexture.prototype, "roadColor", null);
|
|
53
|
-
return RoadProceduralTexture;
|
|
54
|
-
}(ProceduralTexture));
|
|
55
|
-
export { RoadProceduralTexture };
|
|
56
|
-
RegisterClass("BABYLON.RoadProceduralTexture", RoadProceduralTexture);
|
|
1
|
+
import { __decorate, __extends } from "tslib";
|
|
2
|
+
import { serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
|
+
import "./roadProceduralTexture.fragment";
|
|
7
|
+
var RoadProceduralTexture = /** @class */ (function (_super) {
|
|
8
|
+
__extends(RoadProceduralTexture, _super);
|
|
9
|
+
function RoadProceduralTexture(name, size, scene, fallbackTexture, generateMipMaps) {
|
|
10
|
+
if (scene === void 0) { scene = null; }
|
|
11
|
+
var _this = _super.call(this, name, size, "roadProceduralTexture", scene, fallbackTexture, generateMipMaps) || this;
|
|
12
|
+
_this._roadColor = new Color3(0.53, 0.53, 0.53);
|
|
13
|
+
_this.updateShaderUniforms();
|
|
14
|
+
return _this;
|
|
15
|
+
}
|
|
16
|
+
RoadProceduralTexture.prototype.updateShaderUniforms = function () {
|
|
17
|
+
this.setColor3("roadColor", this._roadColor);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(RoadProceduralTexture.prototype, "roadColor", {
|
|
20
|
+
get: function () {
|
|
21
|
+
return this._roadColor;
|
|
22
|
+
},
|
|
23
|
+
set: function (value) {
|
|
24
|
+
this._roadColor = value;
|
|
25
|
+
this.updateShaderUniforms();
|
|
26
|
+
},
|
|
27
|
+
enumerable: false,
|
|
28
|
+
configurable: true
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Serializes this road procedural texture
|
|
32
|
+
* @returns a serialized road procedural texture object
|
|
33
|
+
*/
|
|
34
|
+
RoadProceduralTexture.prototype.serialize = function () {
|
|
35
|
+
var serializationObject = SerializationHelper.Serialize(this, _super.prototype.serialize.call(this));
|
|
36
|
+
serializationObject.customType = "BABYLON.RoadProceduralTexture";
|
|
37
|
+
return serializationObject;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Creates a Road Procedural Texture from parsed road procedural texture data
|
|
41
|
+
* @param parsedTexture defines parsed texture data
|
|
42
|
+
* @param scene defines the current scene
|
|
43
|
+
* @param rootUrl defines the root URL containing road procedural texture information
|
|
44
|
+
* @returns a parsed Road Procedural Texture
|
|
45
|
+
*/
|
|
46
|
+
RoadProceduralTexture.Parse = function (parsedTexture, scene, rootUrl) {
|
|
47
|
+
var texture = SerializationHelper.Parse(function () { return new RoadProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps); }, parsedTexture, scene, rootUrl);
|
|
48
|
+
return texture;
|
|
49
|
+
};
|
|
50
|
+
__decorate([
|
|
51
|
+
serializeAsColor3()
|
|
52
|
+
], RoadProceduralTexture.prototype, "roadColor", null);
|
|
53
|
+
return RoadProceduralTexture;
|
|
54
|
+
}(ProceduralTexture));
|
|
55
|
+
export { RoadProceduralTexture };
|
|
56
|
+
RegisterClass("BABYLON.RoadProceduralTexture", RoadProceduralTexture);
|
|
57
57
|
//# sourceMappingURL=roadProceduralTexture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roadProceduralTexture.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"roadProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/road/roadProceduralTexture.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,2CAA6B;AAC9E,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,iBAAiB,EAAE,4EAA8D;AAE1F,OAAO,EAAE,aAAa,EAAE,0CAA4B;AAEpD,OAAO,kCAAkC,CAAC;AAE1C;IAA2C,yCAAiB;IAGxD,+BAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAEtF;QALO,gBAAU,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAI9C,KAAI,CAAC,oBAAoB,EAAE,CAAC;;IAChC,CAAC;IAEM,oDAAoB,GAA3B;QACI,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IACjD,CAAC;IAGD,sBAAW,4CAAS;aAApB;YACI,OAAO,IAAI,CAAC,UAAU,CAAC;QAC3B,CAAC;aAED,UAAqB,KAAa;YAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;YACxB,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC;;;OALA;IAOD;;;OAGG;IACI,yCAAS,GAAhB;QACI,IAAM,mBAAmB,GAAG,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,iBAAM,SAAS,WAAE,CAAC,CAAC;QACnF,mBAAmB,CAAC,UAAU,GAAG,+BAA+B,CAAC;QAEjE,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAED;;;;;;OAMG;IACW,2BAAK,GAAnB,UAAoB,aAAkB,EAAE,KAAY,EAAE,OAAe;QACjE,IAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CACrC,cAAM,OAAA,IAAI,qBAAqB,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAApH,CAAoH,EAC1H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IApCD;QADC,iBAAiB,EAAE;0DAGnB;IAmCL,4BAAC;CAAA,AAlDD,CAA2C,iBAAiB,GAkD3D;SAlDY,qBAAqB;AAoDlC,aAAa,CAAC,+BAA+B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["import { serializeAsColor3, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport type { Nullable } from \"core/types\";\r\nimport \"./roadProceduralTexture.fragment\";\r\n\r\nexport class RoadProceduralTexture extends ProceduralTexture {\r\n private _roadColor = new Color3(0.53, 0.53, 0.53);\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"roadProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setColor3(\"roadColor\", this._roadColor);\r\n }\r\n\r\n @serializeAsColor3()\r\n public get roadColor(): Color3 {\r\n return this._roadColor;\r\n }\r\n\r\n public set roadColor(value: Color3) {\r\n this._roadColor = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this road procedural texture\r\n * @returns a serialized road procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.RoadProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Road Procedural Texture from parsed road procedural texture data\r\n * @param parsedTexture defines parsed texture data\r\n * @param scene defines the current scene\r\n * @param rootUrl defines the root URL containing road procedural texture information\r\n * @returns a parsed Road Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): RoadProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new RoadProceduralTexture(parsedTexture.name, parsedTexture._size, scene, undefined, parsedTexture._generateMipMaps),\r\n parsedTexture,\r\n scene,\r\n rootUrl\r\n );\r\n\r\n return texture;\r\n }\r\n}\r\n\r\nRegisterClass(\"BABYLON.RoadProceduralTexture\", RoadProceduralTexture);\r\n"]}
|
package/starfield/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./starfieldProceduralTexture";
|
|
1
|
+
export * from "./starfieldProceduralTexture";
|
package/starfield/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./starfieldProceduralTexture
|
|
1
|
+
export * from "./starfieldProceduralTexture";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/starfield/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/starfield/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC","sourcesContent":["export * from \"./starfieldProceduralTexture\";\r\n"]}
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { Texture } from "@babylonjs/core/Materials/Textures/texture";
|
|
2
|
-
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture";
|
|
3
|
-
import { Scene } from "@babylonjs/core/scene";
|
|
4
|
-
import { Nullable } from "@babylonjs/core/types";
|
|
5
|
-
import "./starfieldProceduralTexture.fragment";
|
|
6
|
-
export declare class StarfieldProceduralTexture extends ProceduralTexture {
|
|
7
|
-
private _time;
|
|
8
|
-
private _alpha;
|
|
9
|
-
private _beta;
|
|
10
|
-
private _zoom;
|
|
11
|
-
private _formuparam;
|
|
12
|
-
private _stepsize;
|
|
13
|
-
private _tile;
|
|
14
|
-
private _brightness;
|
|
15
|
-
private _darkmatter;
|
|
16
|
-
private _distfading;
|
|
17
|
-
private _saturation;
|
|
18
|
-
constructor(name: string, size: number, scene?: Nullable<Scene>, fallbackTexture?: Texture, generateMipMaps?: boolean);
|
|
19
|
-
updateShaderUniforms(): void;
|
|
20
|
-
get time(): number;
|
|
21
|
-
set time(value: number);
|
|
22
|
-
get alpha(): number;
|
|
23
|
-
set alpha(value: number);
|
|
24
|
-
get beta(): number;
|
|
25
|
-
set beta(value: number);
|
|
26
|
-
get formuparam(): number;
|
|
27
|
-
set formuparam(value: number);
|
|
28
|
-
get stepsize(): number;
|
|
29
|
-
set stepsize(value: number);
|
|
30
|
-
get zoom(): number;
|
|
31
|
-
set zoom(value: number);
|
|
32
|
-
get tile(): number;
|
|
33
|
-
set tile(value: number);
|
|
34
|
-
get brightness(): number;
|
|
35
|
-
set brightness(value: number);
|
|
36
|
-
get darkmatter(): number;
|
|
37
|
-
set darkmatter(value: number);
|
|
38
|
-
get distfading(): number;
|
|
39
|
-
set distfading(value: number);
|
|
40
|
-
get saturation(): number;
|
|
41
|
-
set saturation(value: number);
|
|
42
|
-
/**
|
|
43
|
-
* Serializes this starfield procedural texture
|
|
44
|
-
* @returns a serialized starfield procedural texture object
|
|
45
|
-
*/
|
|
46
|
-
serialize(): any;
|
|
47
|
-
/**
|
|
48
|
-
* Creates a Starfield Procedural Texture from parsed startfield procedural texture data
|
|
49
|
-
* @param parsedTexture defines parsed texture data
|
|
50
|
-
* @param scene defines the current scene
|
|
51
|
-
* @param rootUrl defines the root URL containing startfield procedural texture information
|
|
52
|
-
* @returns a parsed Starfield Procedural Texture
|
|
53
|
-
*/
|
|
54
|
-
static Parse(parsedTexture: any, scene: Scene, rootUrl: string): StarfieldProceduralTexture;
|
|
55
|
-
}
|
|
1
|
+
import type { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
2
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
3
|
+
import type { Scene } from "@babylonjs/core/scene.js";
|
|
4
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
5
|
+
import "./starfieldProceduralTexture.fragment";
|
|
6
|
+
export declare class StarfieldProceduralTexture extends ProceduralTexture {
|
|
7
|
+
private _time;
|
|
8
|
+
private _alpha;
|
|
9
|
+
private _beta;
|
|
10
|
+
private _zoom;
|
|
11
|
+
private _formuparam;
|
|
12
|
+
private _stepsize;
|
|
13
|
+
private _tile;
|
|
14
|
+
private _brightness;
|
|
15
|
+
private _darkmatter;
|
|
16
|
+
private _distfading;
|
|
17
|
+
private _saturation;
|
|
18
|
+
constructor(name: string, size: number, scene?: Nullable<Scene>, fallbackTexture?: Texture, generateMipMaps?: boolean);
|
|
19
|
+
updateShaderUniforms(): void;
|
|
20
|
+
get time(): number;
|
|
21
|
+
set time(value: number);
|
|
22
|
+
get alpha(): number;
|
|
23
|
+
set alpha(value: number);
|
|
24
|
+
get beta(): number;
|
|
25
|
+
set beta(value: number);
|
|
26
|
+
get formuparam(): number;
|
|
27
|
+
set formuparam(value: number);
|
|
28
|
+
get stepsize(): number;
|
|
29
|
+
set stepsize(value: number);
|
|
30
|
+
get zoom(): number;
|
|
31
|
+
set zoom(value: number);
|
|
32
|
+
get tile(): number;
|
|
33
|
+
set tile(value: number);
|
|
34
|
+
get brightness(): number;
|
|
35
|
+
set brightness(value: number);
|
|
36
|
+
get darkmatter(): number;
|
|
37
|
+
set darkmatter(value: number);
|
|
38
|
+
get distfading(): number;
|
|
39
|
+
set distfading(value: number);
|
|
40
|
+
get saturation(): number;
|
|
41
|
+
set saturation(value: number);
|
|
42
|
+
/**
|
|
43
|
+
* Serializes this starfield procedural texture
|
|
44
|
+
* @returns a serialized starfield procedural texture object
|
|
45
|
+
*/
|
|
46
|
+
serialize(): any;
|
|
47
|
+
/**
|
|
48
|
+
* Creates a Starfield Procedural Texture from parsed startfield procedural texture data
|
|
49
|
+
* @param parsedTexture defines parsed texture data
|
|
50
|
+
* @param scene defines the current scene
|
|
51
|
+
* @param rootUrl defines the root URL containing startfield procedural texture information
|
|
52
|
+
* @returns a parsed Starfield Procedural Texture
|
|
53
|
+
*/
|
|
54
|
+
static Parse(parsedTexture: any, scene: Scene, rootUrl: string): StarfieldProceduralTexture;
|
|
55
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/** @hidden */
|
|
2
|
-
export declare
|
|
3
|
-
name: string;
|
|
4
|
-
shader: string;
|
|
5
|
-
};
|
|
1
|
+
/** @hidden */
|
|
2
|
+
export declare const starfieldProceduralTexturePixelShader: {
|
|
3
|
+
name: string;
|
|
4
|
+
shader: string;
|
|
5
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// Do not edit.
|
|
2
|
+
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
3
|
+
var name = "starfieldProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;\n#define volsteps 20\n#define iterations 15\nvarying 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()\n{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.))); \nfloat pa,a=pa=0.;for (int i=0; i<iterations; i++) {p=abs(p)/dot(p,p)-formuparam; \na+=abs(length(p)-pa); \npa=length(p);}\nfloat dm=max(0.,darkmatter-a*a*.001); \na*=a*a; \nif (r>6) fade*=1.-dm; \nv+=fade;v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; \nfade*=distfading; \ns+=stepsize;}\nv=mix(vec3(length(v)),v,saturation); \ngl_FragColor=vec4(v*.01,1.);}";
|
|
5
|
+
// Sideeffect
|
|
6
|
+
ShaderStore.ShadersStore[name] = shader;
|
|
7
|
+
/** @hidden */
|
|
8
|
+
export var starfieldProceduralTexturePixelShader = { name: name, shader: shader };
|
|
7
9
|
//# sourceMappingURL=starfieldProceduralTexture.fragment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"starfieldProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"starfieldProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/starfield/starfieldProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,uCAAuC,CAAC;AACrD,IAAM,MAAM,GAAG,unCAee,CAAC;AAC/B,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,qCAAqC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"starfieldProceduralTexturePixelShader\";\nconst shader = `precision highp float;\n#define volsteps 20\n#define iterations 15\nvarying 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()\n{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.))); \nfloat pa,a=pa=0.;for (int i=0; i<iterations; i++) {p=abs(p)/dot(p,p)-formuparam; \na+=abs(length(p)-pa); \npa=length(p);}\nfloat dm=max(0.,darkmatter-a*a*.001); \na*=a*a; \nif (r>6) fade*=1.-dm; \nv+=fade;v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; \nfade*=distfading; \ns+=stepsize;}\nv=mix(vec3(length(v)),v,saturation); \ngl_FragColor=vec4(v*.01,1.);}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const starfieldProceduralTexturePixelShader = { name, shader };\n"]}
|