@babylonjs/procedural-textures 5.0.0-beta.8 → 5.0.0-beta.8-snapshot
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 +5 -5
- package/brick/brickProceduralTexture.fragment.d.ts +1 -1
- package/brick/brickProceduralTexture.fragment.js +4 -2
- package/brick/brickProceduralTexture.fragment.js.map +1 -1
- package/brick/brickProceduralTexture.js +2 -2
- package/brick/brickProceduralTexture.js.map +1 -1
- package/brick/index.js.map +1 -1
- package/cloud/cloudProceduralTexture.d.ts +5 -5
- package/cloud/cloudProceduralTexture.fragment.d.ts +1 -1
- package/cloud/cloudProceduralTexture.fragment.js +4 -2
- package/cloud/cloudProceduralTexture.fragment.js.map +1 -1
- package/cloud/cloudProceduralTexture.js +1 -1
- package/cloud/cloudProceduralTexture.js.map +1 -1
- package/cloud/index.js.map +1 -1
- package/fire/fireProceduralTexture.d.ts +6 -6
- package/fire/fireProceduralTexture.fragment.d.ts +1 -1
- package/fire/fireProceduralTexture.fragment.js +4 -2
- package/fire/fireProceduralTexture.fragment.js.map +1 -1
- package/fire/fireProceduralTexture.js +6 -34
- package/fire/fireProceduralTexture.js.map +1 -1
- package/fire/index.js.map +1 -1
- package/grass/grassProceduralTexture.d.ts +5 -5
- package/grass/grassProceduralTexture.fragment.d.ts +1 -1
- package/grass/grassProceduralTexture.fragment.js +4 -2
- package/grass/grassProceduralTexture.fragment.js.map +1 -1
- package/grass/grassProceduralTexture.js +2 -6
- package/grass/grassProceduralTexture.js.map +1 -1
- package/grass/index.js.map +1 -1
- package/index.js.map +1 -1
- package/legacy/legacy-brick.d.ts +1 -1
- package/legacy/legacy-brick.js +3 -3
- package/legacy/legacy-brick.js.map +1 -1
- package/legacy/legacy-cloud.d.ts +1 -1
- package/legacy/legacy-cloud.js +3 -3
- package/legacy/legacy-cloud.js.map +1 -1
- package/legacy/legacy-fire.d.ts +1 -1
- package/legacy/legacy-fire.js +3 -3
- package/legacy/legacy-fire.js.map +1 -1
- package/legacy/legacy-grass.d.ts +1 -1
- package/legacy/legacy-grass.js +3 -3
- package/legacy/legacy-grass.js.map +1 -1
- package/legacy/legacy-marble.d.ts +1 -1
- package/legacy/legacy-marble.js +3 -3
- package/legacy/legacy-marble.js.map +1 -1
- package/legacy/legacy-normalMap.d.ts +1 -1
- package/legacy/legacy-normalMap.js +3 -3
- package/legacy/legacy-normalMap.js.map +1 -1
- package/legacy/legacy-perlinNoise.d.ts +1 -1
- package/legacy/legacy-perlinNoise.js +3 -3
- package/legacy/legacy-perlinNoise.js.map +1 -1
- package/legacy/legacy-road.d.ts +1 -1
- package/legacy/legacy-road.js +3 -3
- package/legacy/legacy-road.js.map +1 -1
- package/legacy/legacy-starfield.d.ts +1 -1
- package/legacy/legacy-starfield.js +3 -3
- package/legacy/legacy-starfield.js.map +1 -1
- package/legacy/legacy-wood.d.ts +1 -1
- package/legacy/legacy-wood.js +3 -3
- package/legacy/legacy-wood.js.map +1 -1
- package/legacy/legacy.d.ts +1 -1
- package/legacy/legacy.js +3 -3
- package/legacy/legacy.js.map +1 -1
- package/marble/index.js.map +1 -1
- package/marble/marbleProceduralTexture.d.ts +5 -5
- package/marble/marbleProceduralTexture.fragment.d.ts +1 -1
- package/marble/marbleProceduralTexture.fragment.js +4 -2
- package/marble/marbleProceduralTexture.fragment.js.map +1 -1
- package/marble/marbleProceduralTexture.js +1 -1
- package/marble/marbleProceduralTexture.js.map +1 -1
- package/normalMap/index.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.d.ts +4 -4
- package/normalMap/normalMapProceduralTexture.fragment.d.ts +1 -1
- package/normalMap/normalMapProceduralTexture.fragment.js +4 -2
- package/normalMap/normalMapProceduralTexture.fragment.js.map +1 -1
- package/normalMap/normalMapProceduralTexture.js +1 -1
- package/normalMap/normalMapProceduralTexture.js.map +1 -1
- package/package.json +21 -152
- package/perlinNoise/index.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.d.ts +4 -4
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.d.ts +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js +4 -2
- package/perlinNoise/perlinNoiseProceduralTexture.fragment.js.map +1 -1
- package/perlinNoise/perlinNoiseProceduralTexture.js +3 -3
- package/perlinNoise/perlinNoiseProceduralTexture.js.map +1 -1
- package/road/index.js.map +1 -1
- package/road/roadProceduralTexture.d.ts +5 -5
- package/road/roadProceduralTexture.fragment.d.ts +1 -1
- package/road/roadProceduralTexture.fragment.js +4 -2
- package/road/roadProceduralTexture.fragment.js.map +1 -1
- package/road/roadProceduralTexture.js +1 -1
- package/road/roadProceduralTexture.js.map +1 -1
- package/starfield/index.js.map +1 -1
- package/starfield/starfieldProceduralTexture.d.ts +4 -4
- package/starfield/starfieldProceduralTexture.fragment.d.ts +1 -1
- package/starfield/starfieldProceduralTexture.fragment.js +4 -2
- package/starfield/starfieldProceduralTexture.fragment.js.map +1 -1
- package/starfield/starfieldProceduralTexture.js +5 -5
- package/starfield/starfieldProceduralTexture.js.map +1 -1
- package/wood/index.js.map +1 -1
- package/wood/woodProceduralTexture.d.ts +5 -5
- package/wood/woodProceduralTexture.fragment.d.ts +1 -1
- package/wood/woodProceduralTexture.fragment.js +4 -2
- package/wood/woodProceduralTexture.fragment.js.map +1 -1
- package/wood/woodProceduralTexture.js +1 -1
- package/wood/woodProceduralTexture.js.map +1 -1
- package/readme.md +0 -34
package/package.json
CHANGED
|
@@ -1,161 +1,30 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": {
|
|
3
|
-
"name": "David CATUHE"
|
|
4
|
-
},
|
|
5
2
|
"name": "@babylonjs/procedural-textures",
|
|
6
|
-
"
|
|
7
|
-
"version": "5.0.0-beta.8",
|
|
8
|
-
"repository": {
|
|
9
|
-
"type": "git",
|
|
10
|
-
"url": "https://github.com/BabylonJS/Babylon.js.git"
|
|
11
|
-
},
|
|
3
|
+
"version": "5.0.0-beta.8-snapshot",
|
|
12
4
|
"main": "index.js",
|
|
5
|
+
"module": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
13
7
|
"files": [
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"brick/brickProceduralTexture.fragment.js.map",
|
|
18
|
-
"brick/brickProceduralTexture.js",
|
|
19
|
-
"brick/brickProceduralTexture.js.map",
|
|
20
|
-
"brick/index.d.ts",
|
|
21
|
-
"brick/index.js",
|
|
22
|
-
"brick/index.js.map",
|
|
23
|
-
"cloud/cloudProceduralTexture.d.ts",
|
|
24
|
-
"cloud/cloudProceduralTexture.fragment.d.ts",
|
|
25
|
-
"cloud/cloudProceduralTexture.fragment.js",
|
|
26
|
-
"cloud/cloudProceduralTexture.fragment.js.map",
|
|
27
|
-
"cloud/cloudProceduralTexture.js",
|
|
28
|
-
"cloud/cloudProceduralTexture.js.map",
|
|
29
|
-
"cloud/index.d.ts",
|
|
30
|
-
"cloud/index.js",
|
|
31
|
-
"cloud/index.js.map",
|
|
32
|
-
"fire/fireProceduralTexture.d.ts",
|
|
33
|
-
"fire/fireProceduralTexture.fragment.d.ts",
|
|
34
|
-
"fire/fireProceduralTexture.fragment.js",
|
|
35
|
-
"fire/fireProceduralTexture.fragment.js.map",
|
|
36
|
-
"fire/fireProceduralTexture.js",
|
|
37
|
-
"fire/fireProceduralTexture.js.map",
|
|
38
|
-
"fire/index.d.ts",
|
|
39
|
-
"fire/index.js",
|
|
40
|
-
"fire/index.js.map",
|
|
41
|
-
"grass/grassProceduralTexture.d.ts",
|
|
42
|
-
"grass/grassProceduralTexture.fragment.d.ts",
|
|
43
|
-
"grass/grassProceduralTexture.fragment.js",
|
|
44
|
-
"grass/grassProceduralTexture.fragment.js.map",
|
|
45
|
-
"grass/grassProceduralTexture.js",
|
|
46
|
-
"grass/grassProceduralTexture.js.map",
|
|
47
|
-
"grass/index.d.ts",
|
|
48
|
-
"grass/index.js",
|
|
49
|
-
"grass/index.js.map",
|
|
50
|
-
"index.d.ts",
|
|
51
|
-
"index.js",
|
|
52
|
-
"index.js.map",
|
|
53
|
-
"legacy/legacy-brick.d.ts",
|
|
54
|
-
"legacy/legacy-brick.js",
|
|
55
|
-
"legacy/legacy-brick.js.map",
|
|
56
|
-
"legacy/legacy-cloud.d.ts",
|
|
57
|
-
"legacy/legacy-cloud.js",
|
|
58
|
-
"legacy/legacy-cloud.js.map",
|
|
59
|
-
"legacy/legacy-fire.d.ts",
|
|
60
|
-
"legacy/legacy-fire.js",
|
|
61
|
-
"legacy/legacy-fire.js.map",
|
|
62
|
-
"legacy/legacy-grass.d.ts",
|
|
63
|
-
"legacy/legacy-grass.js",
|
|
64
|
-
"legacy/legacy-grass.js.map",
|
|
65
|
-
"legacy/legacy-marble.d.ts",
|
|
66
|
-
"legacy/legacy-marble.js",
|
|
67
|
-
"legacy/legacy-marble.js.map",
|
|
68
|
-
"legacy/legacy-normalMap.d.ts",
|
|
69
|
-
"legacy/legacy-normalMap.js",
|
|
70
|
-
"legacy/legacy-normalMap.js.map",
|
|
71
|
-
"legacy/legacy-perlinNoise.d.ts",
|
|
72
|
-
"legacy/legacy-perlinNoise.js",
|
|
73
|
-
"legacy/legacy-perlinNoise.js.map",
|
|
74
|
-
"legacy/legacy-road.d.ts",
|
|
75
|
-
"legacy/legacy-road.js",
|
|
76
|
-
"legacy/legacy-road.js.map",
|
|
77
|
-
"legacy/legacy-starfield.d.ts",
|
|
78
|
-
"legacy/legacy-starfield.js",
|
|
79
|
-
"legacy/legacy-starfield.js.map",
|
|
80
|
-
"legacy/legacy-wood.d.ts",
|
|
81
|
-
"legacy/legacy-wood.js",
|
|
82
|
-
"legacy/legacy-wood.js.map",
|
|
83
|
-
"legacy/legacy.d.ts",
|
|
84
|
-
"legacy/legacy.js",
|
|
85
|
-
"legacy/legacy.js.map",
|
|
86
|
-
"marble/index.d.ts",
|
|
87
|
-
"marble/index.js",
|
|
88
|
-
"marble/index.js.map",
|
|
89
|
-
"marble/marbleProceduralTexture.d.ts",
|
|
90
|
-
"marble/marbleProceduralTexture.fragment.d.ts",
|
|
91
|
-
"marble/marbleProceduralTexture.fragment.js",
|
|
92
|
-
"marble/marbleProceduralTexture.fragment.js.map",
|
|
93
|
-
"marble/marbleProceduralTexture.js",
|
|
94
|
-
"marble/marbleProceduralTexture.js.map",
|
|
95
|
-
"normalMap/index.d.ts",
|
|
96
|
-
"normalMap/index.js",
|
|
97
|
-
"normalMap/index.js.map",
|
|
98
|
-
"normalMap/normalMapProceduralTexture.d.ts",
|
|
99
|
-
"normalMap/normalMapProceduralTexture.fragment.d.ts",
|
|
100
|
-
"normalMap/normalMapProceduralTexture.fragment.js",
|
|
101
|
-
"normalMap/normalMapProceduralTexture.fragment.js.map",
|
|
102
|
-
"normalMap/normalMapProceduralTexture.js",
|
|
103
|
-
"normalMap/normalMapProceduralTexture.js.map",
|
|
104
|
-
"perlinNoise/index.d.ts",
|
|
105
|
-
"perlinNoise/index.js",
|
|
106
|
-
"perlinNoise/index.js.map",
|
|
107
|
-
"perlinNoise/perlinNoiseProceduralTexture.d.ts",
|
|
108
|
-
"perlinNoise/perlinNoiseProceduralTexture.fragment.d.ts",
|
|
109
|
-
"perlinNoise/perlinNoiseProceduralTexture.fragment.js",
|
|
110
|
-
"perlinNoise/perlinNoiseProceduralTexture.fragment.js.map",
|
|
111
|
-
"perlinNoise/perlinNoiseProceduralTexture.js",
|
|
112
|
-
"perlinNoise/perlinNoiseProceduralTexture.js.map",
|
|
113
|
-
"readme.md",
|
|
114
|
-
"road/index.d.ts",
|
|
115
|
-
"road/index.js",
|
|
116
|
-
"road/index.js.map",
|
|
117
|
-
"road/roadProceduralTexture.d.ts",
|
|
118
|
-
"road/roadProceduralTexture.fragment.d.ts",
|
|
119
|
-
"road/roadProceduralTexture.fragment.js",
|
|
120
|
-
"road/roadProceduralTexture.fragment.js.map",
|
|
121
|
-
"road/roadProceduralTexture.js",
|
|
122
|
-
"road/roadProceduralTexture.js.map",
|
|
123
|
-
"starfield/index.d.ts",
|
|
124
|
-
"starfield/index.js",
|
|
125
|
-
"starfield/index.js.map",
|
|
126
|
-
"starfield/starfieldProceduralTexture.d.ts",
|
|
127
|
-
"starfield/starfieldProceduralTexture.fragment.d.ts",
|
|
128
|
-
"starfield/starfieldProceduralTexture.fragment.js",
|
|
129
|
-
"starfield/starfieldProceduralTexture.fragment.js.map",
|
|
130
|
-
"starfield/starfieldProceduralTexture.js",
|
|
131
|
-
"starfield/starfieldProceduralTexture.js.map",
|
|
132
|
-
"wood/index.d.ts",
|
|
133
|
-
"wood/index.js",
|
|
134
|
-
"wood/index.js.map",
|
|
135
|
-
"wood/woodProceduralTexture.d.ts",
|
|
136
|
-
"wood/woodProceduralTexture.fragment.d.ts",
|
|
137
|
-
"wood/woodProceduralTexture.fragment.js",
|
|
138
|
-
"wood/woodProceduralTexture.fragment.js.map",
|
|
139
|
-
"wood/woodProceduralTexture.js",
|
|
140
|
-
"wood/woodProceduralTexture.js.map"
|
|
8
|
+
"**/*.js",
|
|
9
|
+
"**/*.d.ts",
|
|
10
|
+
"**/*.map"
|
|
141
11
|
],
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
|
|
149
|
-
],
|
|
150
|
-
"license": "Apache-2.0",
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "npm run clean && npm run compile",
|
|
14
|
+
"clean": "rimraf dist && rimraf *.tsbuildinfo && rimraf \"./**/*.!(json|build.json)\"",
|
|
15
|
+
"compile": "tsc -b tsconfig.build.json",
|
|
16
|
+
"postcompile": "build-tools -c add-js-to-es6 --path ./dist/**/*.js",
|
|
17
|
+
"prepublishOnly": "build-tools -c prepare-es6-build"
|
|
18
|
+
},
|
|
151
19
|
"dependencies": {
|
|
152
|
-
"@babylonjs/core": "5.0.0-beta.8",
|
|
20
|
+
"@babylonjs/core": "^5.0.0-beta.8-snapshot",
|
|
153
21
|
"tslib": "^2.3.1"
|
|
154
22
|
},
|
|
155
|
-
"
|
|
156
|
-
"
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@dev/build-tools": "^5.0.0-beta.8-snapshot",
|
|
25
|
+
"@lts/procedural-textures": "^5.0.0-beta.8-snapshot",
|
|
26
|
+
"rimraf": "^3.0.2",
|
|
27
|
+
"typescript": "^4.4.4"
|
|
157
28
|
},
|
|
158
|
-
"
|
|
159
|
-
|
|
160
|
-
"type": "module"
|
|
161
|
-
}
|
|
29
|
+
"sideEffects": true
|
|
30
|
+
}
|
package/perlinNoise/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/perlinNoise/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC","sourcesContent":["export * from \"./perlinNoiseProceduralTexture\";\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
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";
|
|
1
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
2
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
3
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
4
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
5
5
|
import "./perlinNoiseProceduralTexture.fragment";
|
|
6
6
|
export declare class PerlinNoiseProceduralTexture extends ProceduralTexture {
|
|
7
7
|
time: number;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "
|
|
3
|
+
var name = "perlinNoiseProceduralTexturePixelShader";
|
|
4
|
+
var shader = "precision highp float;uniform float size;uniform float time;uniform float translationSpeed;varying vec2 vUV;float r(float n)\n{return fract(cos(n*89.42)*343.42);}\nvec2 r(vec2 n)\n{return vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89)); }\nfloat worley(vec2 n,float s)\n{float dis=1.0;for(int x=-1; x<=1; x++)\n{for(int y=-1; y<=1; y++)\n{vec2 p=floor(n/s)+vec2(x,y);float d=length(r(p)+vec2(x,y)-fract(n/s));if (dis>d)\ndis=d;}}\nreturn 1.0-dis;}\nvec3 hash33(vec3 p3)\n{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));}\nfloat perlinNoise(vec3 p)\n{vec3 pi=floor(p);vec3 pf=p-pi;vec3 w=pf*pf*(3.0-2.0*pf);return mix(\nmix(\nmix(\ndot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),\ndot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),w.x\n),mix(\ndot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),\ndot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),w.x\n),w.z\n),mix(\nmix(\ndot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),\ndot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),w.x\n),mix(\ndot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),\ndot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),w.x\n),w.z\n),w.y\n);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 uv=gl_FragCoord.xy+translationSpeed;float dis=(\n1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))\n* (1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))\n);gl_FragColor=vec4(vec3(dis/4.0),1.0);}\n";
|
|
5
|
+
// Sideeffect
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var perlinNoiseProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"perlinNoiseProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"perlinNoiseProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/perlinNoise/perlinNoiseProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,yCAAyC,CAAC;AACvD,IAAM,MAAM,GAAG,s7CAsCd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACxC,cAAc;AACd,MAAM,CAAC,IAAM,uCAAuC,GAAG,EAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"core/Engines/shaderStore\";\n\nconst name = \"perlinNoiseProceduralTexturePixelShader\";\nconst shader = `precision highp float;uniform float size;uniform float time;uniform float translationSpeed;varying vec2 vUV;float r(float n)\n{return fract(cos(n*89.42)*343.42);}\nvec2 r(vec2 n)\n{return vec2(r(n.x*23.62-300.0+n.y*34.35),r(n.x*45.13+256.0+n.y*38.89)); }\nfloat worley(vec2 n,float s)\n{float dis=1.0;for(int x=-1; x<=1; x++)\n{for(int y=-1; y<=1; y++)\n{vec2 p=floor(n/s)+vec2(x,y);float d=length(r(p)+vec2(x,y)-fract(n/s));if (dis>d)\ndis=d;}}\nreturn 1.0-dis;}\nvec3 hash33(vec3 p3)\n{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));}\nfloat perlinNoise(vec3 p)\n{vec3 pi=floor(p);vec3 pf=p-pi;vec3 w=pf*pf*(3.0-2.0*pf);return mix(\nmix(\nmix(\ndot(pf-vec3(0,0,0),hash33(pi+vec3(0,0,0))),\ndot(pf-vec3(1,0,0),hash33(pi+vec3(1,0,0))),w.x\n),mix(\ndot(pf-vec3(0,0,1),hash33(pi+vec3(0,0,1))),\ndot(pf-vec3(1,0,1),hash33(pi+vec3(1,0,1))),w.x\n),w.z\n),mix(\nmix(\ndot(pf-vec3(0,1,0),hash33(pi+vec3(0,1,0))),\ndot(pf-vec3(1,1,0),hash33(pi+vec3(1,1,0))),w.x\n),mix(\ndot(pf-vec3(0,1,1),hash33(pi+vec3(0,1,1))),\ndot(pf-vec3(1,1,1),hash33(pi+vec3(1,1,1))),w.x\n),w.z\n),w.y\n);}\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void)\n{vec2 uv=gl_FragCoord.xy+translationSpeed;float dis=(\n1.0+perlinNoise(vec3(uv/vec2(size,size),time*0.05)*8.0))\n* (1.0+(worley(uv,32.0)+ 0.5*worley(2.0*uv,32.0)+0.25*worley(4.0*uv,32.0))\n);gl_FragColor=vec4(vec3(dis/4.0),1.0);}\n`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const perlinNoiseProceduralTexturePixelShader = { name, shader };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __extends } from "tslib";
|
|
2
2
|
import { serialize, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
-
import { RegisterClass } from
|
|
4
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
5
|
import "./perlinNoiseProceduralTexture.fragment.js";
|
|
6
6
|
var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
|
|
7
7
|
__extends(PerlinNoiseProceduralTexture, _super);
|
|
@@ -23,8 +23,8 @@ var PerlinNoiseProceduralTexture = /** @class */ (function (_super) {
|
|
|
23
23
|
}
|
|
24
24
|
var deltaTime = scene.getEngine().getDeltaTime();
|
|
25
25
|
this.time += deltaTime;
|
|
26
|
-
this.setFloat("time", this.time * this.timeScale / 1000);
|
|
27
|
-
this._currentTranslation += deltaTime * this.translationSpeed / 1000.0;
|
|
26
|
+
this.setFloat("time", (this.time * this.timeScale) / 1000);
|
|
27
|
+
this._currentTranslation += (deltaTime * this.translationSpeed) / 1000.0;
|
|
28
28
|
this.setFloat("translationSpeed", this._currentTranslation);
|
|
29
29
|
};
|
|
30
30
|
PerlinNoiseProceduralTexture.prototype.render = function (useCameraPostProcess) {
|
|
@@ -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;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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 { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { 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/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,8 +1,8 @@
|
|
|
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";
|
|
1
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
6
6
|
import "./roadProceduralTexture.fragment";
|
|
7
7
|
export declare class RoadProceduralTexture extends ProceduralTexture {
|
|
8
8
|
private _roadColor;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float
|
|
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
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var roadProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -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"]}
|
|
@@ -2,7 +2,7 @@ import { __decorate, __extends } from "tslib";
|
|
|
2
2
|
import { serializeAsColor3, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
4
4
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
5
|
-
import { RegisterClass } from
|
|
5
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
6
6
|
import "./roadProceduralTexture.fragment.js";
|
|
7
7
|
var RoadProceduralTexture = /** @class */ (function (_super) {
|
|
8
8
|
__extends(RoadProceduralTexture, _super);
|
|
@@ -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,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elper } from \"core/Misc/decorators\";\r\nimport { Color3 } from \"core/Maths/math.color\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { 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.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,7 +1,7 @@
|
|
|
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";
|
|
1
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
2
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
3
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
4
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
5
5
|
import "./starfieldProceduralTexture.fragment";
|
|
6
6
|
export declare class StarfieldProceduralTexture extends ProceduralTexture {
|
|
7
7
|
private _time;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float;\n
|
|
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
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var starfieldProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __extends } from "tslib";
|
|
2
2
|
import { serialize, SerializationHelper } from "@babylonjs/core/Misc/decorators.js";
|
|
3
3
|
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
-
import { RegisterClass } from
|
|
4
|
+
import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
|
|
5
5
|
import "./starfieldProceduralTexture.fragment.js";
|
|
6
6
|
var StarfieldProceduralTexture = /** @class */ (function (_super) {
|
|
7
7
|
__extends(StarfieldProceduralTexture, _super);
|
|
@@ -14,11 +14,11 @@ var StarfieldProceduralTexture = /** @class */ (function (_super) {
|
|
|
14
14
|
_this._zoom = 0.8;
|
|
15
15
|
_this._formuparam = 0.53;
|
|
16
16
|
_this._stepsize = 0.1;
|
|
17
|
-
_this._tile = 0.
|
|
17
|
+
_this._tile = 0.85;
|
|
18
18
|
_this._brightness = 0.0015;
|
|
19
|
-
_this._darkmatter = 0.
|
|
20
|
-
_this._distfading = 0.
|
|
21
|
-
_this._saturation = 0.
|
|
19
|
+
_this._darkmatter = 0.4;
|
|
20
|
+
_this._distfading = 0.73;
|
|
21
|
+
_this._saturation = 0.85;
|
|
22
22
|
_this.updateShaderUniforms();
|
|
23
23
|
return _this;
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"starfieldProceduralTexture.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"starfieldProceduralTexture.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/starfield/starfieldProceduralTexture.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,uCAAuC,CAAC;AAE/C;IAAgD,8CAAiB;IAa7D,oCAAY,IAAY,EAAE,IAAY,EAAE,KAA6B,EAAE,eAAyB,EAAE,eAAyB;QAAnF,sBAAA,EAAA,YAA6B;QAArE,YACI,kBAAM,IAAI,EAAE,IAAI,EAAE,4BAA4B,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC,SAE3F;QAfO,WAAK,GAAG,CAAC,CAAC;QACV,YAAM,GAAG,GAAG,CAAC;QACb,WAAK,GAAG,GAAG,CAAC;QAC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AE,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAAzH,CAAyH,EAC/H,aAAa,EACb,KAAK,EACL,OAAO,CACV,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;IAxID;QADC,SAAS,EAAE;0DAGX;IAQD;QADC,SAAS,EAAE;2DAGX;IAQD;QADC,SAAS,EAAE;0DAGX;IAQD;QADC,SAAS,EAAE;gEAGX;IAQD;QADC,SAAS,EAAE;8DAGX;IAQD;QADC,SAAS,EAAE;0DAGX;IAQD;QADC,SAAS,EAAE;0DAGX;IAQD;QADC,SAAS,EAAE;gEAGX;IAQD;QADC,SAAS,EAAE;gEAGX;IAQD;QADC,SAAS,EAAE;gEAGX;IAQD;QADC,SAAS,EAAE;gEAGX;IAmCL,iCAAC;CAAA,AA1KD,CAAgD,iBAAiB,GA0KhE;SA1KY,0BAA0B;AA4KvC,aAAa,CAAC,oCAAoC,EAAE,0BAA0B,CAAC,CAAC","sourcesContent":["import { serialize, SerializationHelper } from \"core/Misc/decorators\";\r\nimport { Texture } from \"core/Materials/Textures/texture\";\r\nimport { ProceduralTexture } from \"core/Materials/Textures/Procedurals/proceduralTexture\";\r\nimport { Scene } from \"core/scene\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { Nullable } from \"core/types\";\r\nimport \"./starfieldProceduralTexture.fragment\";\r\n\r\nexport class StarfieldProceduralTexture extends ProceduralTexture {\r\n private _time = 1;\r\n private _alpha = 0.5;\r\n private _beta = 0.8;\r\n private _zoom = 0.8;\r\n private _formuparam = 0.53;\r\n private _stepsize = 0.1;\r\n private _tile = 0.85;\r\n private _brightness = 0.0015;\r\n private _darkmatter = 0.4;\r\n private _distfading = 0.73;\r\n private _saturation = 0.85;\r\n\r\n constructor(name: string, size: number, scene: Nullable<Scene> = null, fallbackTexture?: Texture, generateMipMaps?: boolean) {\r\n super(name, size, \"starfieldProceduralTexture\", scene, fallbackTexture, generateMipMaps);\r\n this.updateShaderUniforms();\r\n }\r\n\r\n public updateShaderUniforms() {\r\n this.setFloat(\"time\", this._time);\r\n this.setFloat(\"alpha\", this._alpha);\r\n this.setFloat(\"beta\", this._beta);\r\n this.setFloat(\"zoom\", this._zoom);\r\n this.setFloat(\"formuparam\", this._formuparam);\r\n this.setFloat(\"stepsize\", this._stepsize);\r\n this.setFloat(\"tile\", this._tile);\r\n this.setFloat(\"brightness\", this._brightness);\r\n this.setFloat(\"darkmatter\", this._darkmatter);\r\n this.setFloat(\"distfading\", this._distfading);\r\n this.setFloat(\"saturation\", this._saturation);\r\n }\r\n\r\n @serialize()\r\n public get time(): number {\r\n return this._time;\r\n }\r\n\r\n public set time(value: number) {\r\n this._time = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get alpha(): number {\r\n return this._alpha;\r\n }\r\n\r\n public set alpha(value: number) {\r\n this._alpha = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get beta(): number {\r\n return this._beta;\r\n }\r\n\r\n public set beta(value: number) {\r\n this._beta = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get formuparam(): number {\r\n return this._formuparam;\r\n }\r\n\r\n public set formuparam(value: number) {\r\n this._formuparam = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get stepsize(): number {\r\n return this._stepsize;\r\n }\r\n\r\n public set stepsize(value: number) {\r\n this._stepsize = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get zoom(): number {\r\n return this._zoom;\r\n }\r\n\r\n public set zoom(value: number) {\r\n this._zoom = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get tile(): number {\r\n return this._tile;\r\n }\r\n\r\n public set tile(value: number) {\r\n this._tile = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get brightness(): number {\r\n return this._brightness;\r\n }\r\n\r\n public set brightness(value: number) {\r\n this._brightness = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get darkmatter(): number {\r\n return this._darkmatter;\r\n }\r\n\r\n public set darkmatter(value: number) {\r\n this._darkmatter = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get distfading(): number {\r\n return this._distfading;\r\n }\r\n\r\n public set distfading(value: number) {\r\n this._distfading = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n @serialize()\r\n public get saturation(): number {\r\n return this._saturation;\r\n }\r\n\r\n public set saturation(value: number) {\r\n this._saturation = value;\r\n this.updateShaderUniforms();\r\n }\r\n\r\n /**\r\n * Serializes this starfield procedural texture\r\n * @returns a serialized starfield procedural texture object\r\n */\r\n public serialize(): any {\r\n const serializationObject = SerializationHelper.Serialize(this, super.serialize());\r\n serializationObject.customType = \"BABYLON.StarfieldProceduralTexture\";\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Creates a Starfield Procedural Texture from parsed startfield 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 startfield procedural texture information\r\n * @returns a parsed Starfield Procedural Texture\r\n */\r\n public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): StarfieldProceduralTexture {\r\n const texture = SerializationHelper.Parse(\r\n () => new StarfieldProceduralTexture(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.StarfieldProceduralTexture\", StarfieldProceduralTexture);\r\n"]}
|
package/wood/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/wood/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC","sourcesContent":["export * from \"./woodProceduralTexture\";\r\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
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";
|
|
1
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
|
2
|
+
import { Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
3
|
+
import { ProceduralTexture } from "@babylonjs/core/Materials/Textures/Procedurals/proceduralTexture.js";
|
|
4
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
5
|
+
import { Nullable } from "@babylonjs/core/types.js";
|
|
6
6
|
import "./woodProceduralTexture.fragment";
|
|
7
7
|
export declare class WoodProceduralTexture extends ProceduralTexture {
|
|
8
8
|
private _ampScale;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
// Do not edit.
|
|
1
2
|
import { ShaderStore } from "@babylonjs/core/Engines/shaderStore.js";
|
|
2
|
-
var name =
|
|
3
|
-
var shader = "precision highp float
|
|
3
|
+
var name = "woodProceduralTexturePixelShader";
|
|
4
|
+
var 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);}\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(vUV.x*ampScale,2.0+fbm(vUV*0.8));vec3 wood=woodColor*ratioy;gl_FragColor=vec4(wood,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}";
|
|
5
|
+
// Sideeffect
|
|
4
6
|
ShaderStore.ShadersStore[name] = shader;
|
|
5
7
|
/** @hidden */
|
|
6
8
|
export var woodProceduralTexturePixelShader = { name: name, shader: shader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"woodProceduralTexture.fragment.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"woodProceduralTexture.fragment.js","sourceRoot":"","sources":["../../../../../lts/proceduralTextures/generated/wood/woodProceduralTexture.fragment.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,+CAAiC;AAEvD,IAAM,IAAI,GAAG,kCAAkC,CAAC;AAChD,IAAM,MAAM,GAAG,mvBASb,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 = \"woodProceduralTexturePixelShader\";\nconst 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);}\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(vUV.x*ampScale,2.0+fbm(vUV*0.8));vec3 wood=woodColor*ratioy;gl_FragColor=vec4(wood,1.0);\n#define CUSTOM_FRAGMENT_MAIN_END\n}`;\n// Sideeffect\nShaderStore.ShadersStore[name] = shader;\n/** @hidden */\nexport const woodProceduralTexturePixelShader = { name, shader };\n"]}
|