@firecms/neat 0.7.0 → 0.8.0
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/README.md +1 -1
- package/dist/NeatGradient.d.ts +32 -55
- package/dist/NeatGradient.js +145 -2
- package/dist/NeatGradient.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +401 -224
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +113 -27
- package/dist/index.umd.js.map +1 -1
- package/dist/shaders.d.ts +2 -2
- package/dist/shaders.js +101 -15
- package/dist/shaders.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
- package/src/NeatGradient.ts +172 -63
- package/src/index.ts +1 -0
- package/src/shaders.ts +101 -15
- package/src/types.ts +27 -0
package/dist/shaders.js
CHANGED
|
@@ -72,7 +72,10 @@ export const vertexShaderSource = `void main() {
|
|
|
72
72
|
|
|
73
73
|
v_color = color;
|
|
74
74
|
|
|
75
|
-
// 4.
|
|
75
|
+
// 4. FRESNEL (rim glow)
|
|
76
|
+
// (Calculated in fragment shader using displacement slope approximation)
|
|
77
|
+
|
|
78
|
+
// 5. VERTEX POSITION
|
|
76
79
|
vec3 newPosition = position + normal * v_displacement_amount * u_wave_amplitude;
|
|
77
80
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
|
|
78
81
|
v_new_position = gl_Position;
|
|
@@ -94,31 +97,32 @@ float fbm(vec3 x) {
|
|
|
94
97
|
return value;
|
|
95
98
|
}
|
|
96
99
|
|
|
100
|
+
// Branchless HSL to RGB for iridescence
|
|
101
|
+
vec3 hsl2rgb(float h, float s, float l) {
|
|
102
|
+
vec3 rgb = clamp(abs(mod(h * 6.0 + vec3(0.0, 4.0, 2.0), 6.0) - 3.0) - 1.0, 0.0, 1.0);
|
|
103
|
+
return l + s * (rgb - 0.5) * (1.0 - abs(2.0 * l - 1.0));
|
|
104
|
+
}
|
|
105
|
+
|
|
97
106
|
void main() {
|
|
98
107
|
vec2 finalUv = vFlowUv;
|
|
99
108
|
|
|
100
109
|
vec3 baseColor;
|
|
101
110
|
|
|
102
111
|
if (u_enable_procedural_texture > 0.5) {
|
|
103
|
-
// Calculate flow field distance for ease effect
|
|
104
112
|
vec2 ppp = -1.0 + 2.0 * finalUv;
|
|
105
113
|
ppp += 0.1 * cos((1.5 * u_flow_scale) * ppp.yx + 1.1 * u_time + vec2(0.1, 1.1));
|
|
106
114
|
ppp += 0.1 * cos((2.3 * u_flow_scale) * ppp.yx + 1.3 * u_time + vec2(3.2, 3.4));
|
|
107
115
|
ppp += 0.1 * cos((2.2 * u_flow_scale) * ppp.yx + 1.7 * u_time + vec2(1.8, 5.2));
|
|
108
116
|
ppp += u_flow_distortion_a * cos((u_flow_distortion_b * u_flow_scale) * ppp.yx + 1.4 * u_time + vec2(6.3, 3.9));
|
|
109
|
-
float r = length(ppp);
|
|
117
|
+
float r = length(ppp);
|
|
110
118
|
|
|
111
|
-
// Ease blending: 0 = topographic (flow), 1 = image (UV)
|
|
112
119
|
float vx = (finalUv.x * u_texture_ease) + (r * (1.0 - u_texture_ease));
|
|
113
120
|
float vy = (finalUv.y * u_texture_ease) + (0.0 * (1.0 - u_texture_ease));
|
|
114
121
|
vec2 texUv = vec2(vx, vy);
|
|
115
122
|
|
|
116
|
-
|
|
117
|
-
// We manually apply a smaller offset here to make the texture lag behind
|
|
118
|
-
float parallaxFactor = 0.25; // 25% speed of the color mixing
|
|
123
|
+
float parallaxFactor = 0.25;
|
|
119
124
|
texUv.y -= (u_y_offset * u_y_offset_color_multiplier / u_plane_height) * parallaxFactor;
|
|
120
|
-
|
|
121
|
-
texUv *= 1.5; // Tiling scale
|
|
125
|
+
texUv *= 1.5;
|
|
122
126
|
|
|
123
127
|
vec4 texSample = texture2D(u_procedural_texture, texUv);
|
|
124
128
|
baseColor = texSample.rgb;
|
|
@@ -128,24 +132,70 @@ void main() {
|
|
|
128
132
|
|
|
129
133
|
vec3 color = baseColor;
|
|
130
134
|
|
|
135
|
+
// === DOMAIN WARPING (simplified: 3 fbm calls instead of 5) ===
|
|
136
|
+
if (u_domain_warp_enabled > 0.5) {
|
|
137
|
+
vec3 p = vec3(finalUv * u_domain_warp_scale, u_time * 0.15);
|
|
138
|
+
vec2 q = vec2(fbm(p), fbm(p + vec3(5.2, 1.3, 0.0)));
|
|
139
|
+
float f = fbm(p + vec3(4.0 * q, 0.0));
|
|
140
|
+
vec3 warpColor = color * (1.0 + f * 0.8 * u_domain_warp_intensity);
|
|
141
|
+
float pattern = clamp(f * f * f + 0.6 * f * f + 0.5 * f, 0.0, 1.0);
|
|
142
|
+
color = mix(color, warpColor * (0.6 + pattern * 0.8), u_domain_warp_intensity * 0.7);
|
|
143
|
+
}
|
|
144
|
+
|
|
131
145
|
// Post-processing
|
|
132
146
|
color += v_displacement_amount * u_highlights;
|
|
133
|
-
// Replace pow() with direct multiplication to avoid negative base undefined behavior in GLSL
|
|
134
147
|
float shadowFactor = 1.0 - v_displacement_amount;
|
|
135
148
|
color -= shadowFactor * shadowFactor * u_shadows;
|
|
136
149
|
color = saturation(color, 1.0 + u_saturation);
|
|
137
150
|
color = color * u_brightness;
|
|
138
151
|
|
|
139
|
-
//
|
|
140
|
-
|
|
152
|
+
// === IRIDESCENCE ===
|
|
153
|
+
if (u_iridescence_enabled > 0.5) {
|
|
154
|
+
float hue = fract(v_displacement_amount * 0.5 + 0.5 + u_time * u_iridescence_speed * 0.05);
|
|
155
|
+
vec3 iriColor = hsl2rgb(hue, 0.8, 0.6);
|
|
156
|
+
color = mix(color, iriColor, u_iridescence_intensity * abs(v_displacement_amount) * 0.6);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// === FRESNEL (Rim glow) ===
|
|
160
|
+
if (u_fresnel_enabled > 0.5) {
|
|
161
|
+
float slope = 1.0 - abs(v_displacement_amount);
|
|
162
|
+
float fresnel = pow(max(slope, 0.0), u_fresnel_power);
|
|
163
|
+
color += u_fresnel_color * fresnel * u_fresnel_intensity;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// === VIGNETTE ===
|
|
167
|
+
if (u_vignette_intensity > 0.0) {
|
|
168
|
+
float dist = length(vUv - vec2(0.5));
|
|
169
|
+
float vig = smoothstep(u_vignette_radius, u_vignette_radius * 0.3, dist);
|
|
170
|
+
color *= mix(1.0, vig, u_vignette_intensity);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// === FAKE BLOOM ===
|
|
174
|
+
if (u_bloom_intensity > 0.0) {
|
|
175
|
+
float luma = dot(color, vec3(0.2126, 0.7152, 0.0722));
|
|
176
|
+
float bloomMask = smoothstep(u_bloom_threshold, 1.0, luma);
|
|
177
|
+
color += color * bloomMask * u_bloom_intensity;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// === CHROMATIC ABERRATION ===
|
|
181
|
+
if (u_chromatic_aberration > 0.0) {
|
|
182
|
+
float caAmount = u_chromatic_aberration * 0.008;
|
|
183
|
+
float dist = length(vUv - vec2(0.5));
|
|
184
|
+
float rShift = v_displacement_amount + caAmount * dist;
|
|
185
|
+
float bShift = v_displacement_amount - caAmount * dist;
|
|
186
|
+
color.r *= 1.0 + rShift * caAmount * 10.0;
|
|
187
|
+
color.b *= 1.0 - bShift * caAmount * 10.0;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Grain (use cheap hash noise instead of expensive fbm when static)
|
|
141
191
|
float grain = 0.0;
|
|
142
|
-
|
|
143
|
-
// Completely bypass expensive noise generation if grain is disabled
|
|
144
192
|
if (u_grain_intensity > 0.0) {
|
|
193
|
+
vec2 noiseCoords = gl_FragCoord.xy / u_grain_scale;
|
|
145
194
|
if (u_grain_speed != 0.0) {
|
|
146
195
|
grain = fbm(vec3(noiseCoords, u_time * u_grain_speed));
|
|
147
196
|
} else {
|
|
148
|
-
grain
|
|
197
|
+
// Static grain: use cheap hash instead of fbm
|
|
198
|
+
grain = random(noiseCoords) - 0.5;
|
|
149
199
|
}
|
|
150
200
|
|
|
151
201
|
grain = grain * 0.5 + 0.5;
|
|
@@ -204,6 +254,12 @@ uniform float u_flow_distortion_b;
|
|
|
204
254
|
uniform float u_flow_scale;
|
|
205
255
|
uniform float u_flow_ease;
|
|
206
256
|
uniform float u_flow_enabled;
|
|
257
|
+
|
|
258
|
+
// Fresnel uniforms
|
|
259
|
+
uniform float u_fresnel_enabled;
|
|
260
|
+
uniform float u_fresnel_power;
|
|
261
|
+
uniform float u_fresnel_intensity;
|
|
262
|
+
uniform vec3 u_fresnel_color;
|
|
207
263
|
`;
|
|
208
264
|
}
|
|
209
265
|
export function buildFragUniforms() {
|
|
@@ -215,6 +271,7 @@ varying vec3 v_color;
|
|
|
215
271
|
varying float v_displacement_amount;
|
|
216
272
|
|
|
217
273
|
uniform float u_time;
|
|
274
|
+
uniform vec2 u_resolution;
|
|
218
275
|
uniform float u_plane_height;
|
|
219
276
|
|
|
220
277
|
uniform float u_shadows;
|
|
@@ -238,6 +295,35 @@ uniform float u_flow_scale;
|
|
|
238
295
|
uniform sampler2D u_procedural_texture;
|
|
239
296
|
uniform float u_enable_procedural_texture;
|
|
240
297
|
uniform float u_texture_ease;
|
|
298
|
+
|
|
299
|
+
// Domain warping uniforms
|
|
300
|
+
uniform float u_domain_warp_enabled;
|
|
301
|
+
uniform float u_domain_warp_intensity;
|
|
302
|
+
uniform float u_domain_warp_scale;
|
|
303
|
+
|
|
304
|
+
// Vignette uniforms
|
|
305
|
+
uniform float u_vignette_intensity;
|
|
306
|
+
uniform float u_vignette_radius;
|
|
307
|
+
|
|
308
|
+
// Fresnel uniforms (fragment side)
|
|
309
|
+
uniform float u_fresnel_enabled;
|
|
310
|
+
uniform float u_fresnel_power;
|
|
311
|
+
uniform float u_fresnel_intensity;
|
|
312
|
+
uniform vec3 u_fresnel_color;
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
// Iridescence uniforms
|
|
317
|
+
uniform float u_iridescence_enabled;
|
|
318
|
+
uniform float u_iridescence_intensity;
|
|
319
|
+
uniform float u_iridescence_speed;
|
|
320
|
+
|
|
321
|
+
// Bloom uniforms
|
|
322
|
+
uniform float u_bloom_intensity;
|
|
323
|
+
uniform float u_bloom_threshold;
|
|
324
|
+
|
|
325
|
+
// Chromatic aberration
|
|
326
|
+
uniform float u_chromatic_aberration;
|
|
241
327
|
`;
|
|
242
328
|
}
|
|
243
329
|
export function buildNoise() {
|
package/dist/shaders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shaders.js","sourceRoot":"","sources":["../src/shaders.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG
|
|
1
|
+
{"version":3,"file":"shaders.js","sourceRoot":"","sources":["../src/shaders.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFjC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+HnC,CAAC;AAEF,MAAM,UAAU,iBAAiB;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDV,CAAC;AACF,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6DV,CAAC;AACF,CAAC;AAED,MAAM,UAAU,UAAU;IACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJV,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB;IAC/B,OAAO;;;;;;CAMV,CAAC;AACF,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,21 @@ export type NeatConfig = {
|
|
|
41
41
|
textureShapeCircles?: number;
|
|
42
42
|
textureShapeBars?: number;
|
|
43
43
|
textureShapeSquiggles?: number;
|
|
44
|
+
domainWarpEnabled?: boolean;
|
|
45
|
+
domainWarpIntensity?: number;
|
|
46
|
+
domainWarpScale?: number;
|
|
47
|
+
vignetteIntensity?: number;
|
|
48
|
+
vignetteRadius?: number;
|
|
49
|
+
fresnelEnabled?: boolean;
|
|
50
|
+
fresnelPower?: number;
|
|
51
|
+
fresnelIntensity?: number;
|
|
52
|
+
fresnelColor?: string;
|
|
53
|
+
iridescenceEnabled?: boolean;
|
|
54
|
+
iridescenceIntensity?: number;
|
|
55
|
+
iridescenceSpeed?: number;
|
|
56
|
+
bloomIntensity?: number;
|
|
57
|
+
bloomThreshold?: number;
|
|
58
|
+
chromaticAberration?: number;
|
|
44
59
|
};
|
|
45
60
|
export type NeatColor = {
|
|
46
61
|
color: string;
|
package/package.json
CHANGED
package/src/NeatGradient.ts
CHANGED
|
@@ -35,67 +35,7 @@ export interface WebGLState {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
export type NeatConfig = {
|
|
40
|
-
resolution?: number;
|
|
41
|
-
speed?: number;
|
|
42
|
-
horizontalPressure?: number;
|
|
43
|
-
verticalPressure?: number;
|
|
44
|
-
waveFrequencyX?: number;
|
|
45
|
-
waveFrequencyY?: number;
|
|
46
|
-
waveAmplitude?: number;
|
|
47
|
-
highlights?: number;
|
|
48
|
-
shadows?: number;
|
|
49
|
-
colorSaturation?: number;
|
|
50
|
-
colorBrightness?: number;
|
|
51
|
-
colors: NeatColor[];
|
|
52
|
-
colorBlending?: number;
|
|
53
|
-
grainScale?: number;
|
|
54
|
-
grainIntensity?: number;
|
|
55
|
-
grainSparsity?: number;
|
|
56
|
-
grainSpeed?: number;
|
|
57
|
-
wireframe?: boolean;
|
|
58
|
-
backgroundColor?: string;
|
|
59
|
-
backgroundAlpha?: number;
|
|
60
|
-
yOffset?: number;
|
|
61
|
-
yOffsetWaveMultiplier?: number;
|
|
62
|
-
yOffsetColorMultiplier?: number;
|
|
63
|
-
yOffsetFlowMultiplier?: number;
|
|
64
|
-
// Flow field parameters
|
|
65
|
-
flowDistortionA?: number;
|
|
66
|
-
flowDistortionB?: number;
|
|
67
|
-
flowScale?: number;
|
|
68
|
-
flowEase?: number;
|
|
69
|
-
flowEnabled?: boolean;
|
|
70
|
-
|
|
71
|
-
// Texture generation
|
|
72
|
-
enableProceduralTexture?: boolean;
|
|
73
|
-
textureVoidLikelihood?: number;
|
|
74
|
-
textureVoidWidthMin?: number;
|
|
75
|
-
textureVoidWidthMax?: number;
|
|
76
|
-
textureBandDensity?: number;
|
|
77
|
-
textureColorBlending?: number;
|
|
78
|
-
textureSeed?: number;
|
|
79
|
-
textureEase?: number;
|
|
80
|
-
proceduralBackgroundColor?: string;
|
|
81
|
-
textureShapeTriangles?: number;
|
|
82
|
-
textureShapeCircles?: number;
|
|
83
|
-
textureShapeBars?: number;
|
|
84
|
-
textureShapeSquiggles?: number;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export type NeatColor = {
|
|
88
|
-
color: string;
|
|
89
|
-
enabled: boolean;
|
|
90
|
-
/**
|
|
91
|
-
* Value from 0 to 1
|
|
92
|
-
*/
|
|
93
|
-
influence?: number;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export type NeatController = {
|
|
97
|
-
destroy: () => void;
|
|
98
|
-
}
|
|
38
|
+
import { NeatConfig, NeatColor, NeatController } from "./types";
|
|
99
39
|
|
|
100
40
|
export class NeatGradient implements NeatController {
|
|
101
41
|
|
|
@@ -147,6 +87,29 @@ export class NeatGradient implements NeatController {
|
|
|
147
87
|
private _textureColorBlending: number = 0.01;
|
|
148
88
|
private _textureSeed: number = 333;
|
|
149
89
|
private _textureEase: number = 0.5;
|
|
90
|
+
|
|
91
|
+
// New effects
|
|
92
|
+
private _domainWarpEnabled: boolean = false;
|
|
93
|
+
private _domainWarpIntensity: number = 0.5;
|
|
94
|
+
private _domainWarpScale: number = 1.0;
|
|
95
|
+
|
|
96
|
+
private _vignetteIntensity: number = 0.5;
|
|
97
|
+
private _vignetteRadius: number = 0.8;
|
|
98
|
+
|
|
99
|
+
private _fresnelEnabled: boolean = false;
|
|
100
|
+
private _fresnelPower: number = 2.0;
|
|
101
|
+
private _fresnelIntensity: number = 0.5;
|
|
102
|
+
private _fresnelColor: string = "#FFFFFF";
|
|
103
|
+
private _fresnelColorRgb: [number, number, number] = [1, 1, 1];
|
|
104
|
+
|
|
105
|
+
private _iridescenceEnabled: boolean = false;
|
|
106
|
+
private _iridescenceIntensity: number = 0.5;
|
|
107
|
+
private _iridescenceSpeed: number = 1.0;
|
|
108
|
+
|
|
109
|
+
private _bloomIntensity: number = 0;
|
|
110
|
+
private _bloomThreshold: number = 0.7;
|
|
111
|
+
private _chromaticAberration: number = 0;
|
|
112
|
+
|
|
150
113
|
private _proceduralTexture: WebGLTexture | null = null;
|
|
151
114
|
private _proceduralBackgroundColor: string = "#000000";
|
|
152
115
|
|
|
@@ -225,6 +188,22 @@ export class NeatGradient implements NeatController {
|
|
|
225
188
|
textureShapeCircles = 15,
|
|
226
189
|
textureShapeBars = 15,
|
|
227
190
|
textureShapeSquiggles = 10,
|
|
191
|
+
|
|
192
|
+
domainWarpEnabled = false,
|
|
193
|
+
domainWarpIntensity = 0.5,
|
|
194
|
+
domainWarpScale = 1.0,
|
|
195
|
+
vignetteIntensity = 0.5,
|
|
196
|
+
vignetteRadius = 0.8,
|
|
197
|
+
fresnelEnabled = false,
|
|
198
|
+
fresnelPower = 2.0,
|
|
199
|
+
fresnelIntensity = 0.5,
|
|
200
|
+
fresnelColor = "#FFFFFF",
|
|
201
|
+
iridescenceEnabled = false,
|
|
202
|
+
iridescenceIntensity = 0.5,
|
|
203
|
+
iridescenceSpeed = 1.0,
|
|
204
|
+
bloomIntensity = 0.0,
|
|
205
|
+
bloomThreshold = 0.7,
|
|
206
|
+
chromaticAberration = 0.0,
|
|
228
207
|
} = config;
|
|
229
208
|
|
|
230
209
|
|
|
@@ -282,6 +261,21 @@ export class NeatGradient implements NeatController {
|
|
|
282
261
|
this._textureShapeBars = textureShapeBars;
|
|
283
262
|
this._textureShapeSquiggles = textureShapeSquiggles;
|
|
284
263
|
|
|
264
|
+
this.domainWarpEnabled = domainWarpEnabled;
|
|
265
|
+
this.domainWarpIntensity = domainWarpIntensity;
|
|
266
|
+
this.domainWarpScale = domainWarpScale;
|
|
267
|
+
this.vignetteIntensity = vignetteIntensity;
|
|
268
|
+
this.vignetteRadius = vignetteRadius;
|
|
269
|
+
this.fresnelEnabled = fresnelEnabled;
|
|
270
|
+
this.fresnelPower = fresnelPower;
|
|
271
|
+
this.fresnelIntensity = fresnelIntensity;
|
|
272
|
+
this.fresnelColor = fresnelColor;
|
|
273
|
+
this.iridescenceEnabled = iridescenceEnabled;
|
|
274
|
+
this.iridescenceIntensity = iridescenceIntensity;
|
|
275
|
+
this.iridescenceSpeed = iridescenceSpeed;
|
|
276
|
+
this.bloomIntensity = bloomIntensity;
|
|
277
|
+
this.bloomThreshold = bloomThreshold;
|
|
278
|
+
this.chromaticAberration = chromaticAberration;
|
|
285
279
|
|
|
286
280
|
this.glState = this._initScene(resolution);
|
|
287
281
|
|
|
@@ -342,6 +336,26 @@ export class NeatGradient implements NeatController {
|
|
|
342
336
|
gl.uniform1f(locations.uniforms['u_enable_procedural_texture'], this._enableProceduralTexture ? 1.0 : 0.0);
|
|
343
337
|
gl.uniform1f(locations.uniforms['u_texture_ease'], this._textureEase);
|
|
344
338
|
|
|
339
|
+
gl.uniform1f(locations.uniforms['u_domain_warp_enabled'], this._domainWarpEnabled ? 1.0 : 0.0);
|
|
340
|
+
gl.uniform1f(locations.uniforms['u_domain_warp_intensity'], this._domainWarpIntensity);
|
|
341
|
+
gl.uniform1f(locations.uniforms['u_domain_warp_scale'], this._domainWarpScale);
|
|
342
|
+
|
|
343
|
+
gl.uniform1f(locations.uniforms['u_vignette_intensity'], this._vignetteIntensity);
|
|
344
|
+
gl.uniform1f(locations.uniforms['u_vignette_radius'], this._vignetteRadius);
|
|
345
|
+
|
|
346
|
+
gl.uniform1f(locations.uniforms['u_fresnel_enabled'], this._fresnelEnabled ? 1.0 : 0.0);
|
|
347
|
+
gl.uniform1f(locations.uniforms['u_fresnel_power'], this._fresnelPower);
|
|
348
|
+
gl.uniform1f(locations.uniforms['u_fresnel_intensity'], this._fresnelIntensity);
|
|
349
|
+
gl.uniform3fv(locations.uniforms['u_fresnel_color'], this._fresnelColorRgb);
|
|
350
|
+
|
|
351
|
+
gl.uniform1f(locations.uniforms['u_iridescence_enabled'], this._iridescenceEnabled ? 1.0 : 0.0);
|
|
352
|
+
gl.uniform1f(locations.uniforms['u_iridescence_intensity'], this._iridescenceIntensity);
|
|
353
|
+
gl.uniform1f(locations.uniforms['u_iridescence_speed'], this._iridescenceSpeed);
|
|
354
|
+
|
|
355
|
+
gl.uniform1f(locations.uniforms['u_bloom_intensity'], this._bloomIntensity);
|
|
356
|
+
gl.uniform1f(locations.uniforms['u_bloom_threshold'], this._bloomThreshold);
|
|
357
|
+
gl.uniform1f(locations.uniforms['u_chromatic_aberration'], this._chromaticAberration);
|
|
358
|
+
|
|
345
359
|
this._uniformsDirty = false;
|
|
346
360
|
}
|
|
347
361
|
|
|
@@ -893,7 +907,12 @@ export class NeatGradient implements NeatController {
|
|
|
893
907
|
"u_flow_distortion_a", "u_flow_distortion_b", "u_flow_scale", "u_flow_ease", "u_flow_enabled",
|
|
894
908
|
"u_y_offset", "u_y_offset_wave_multiplier", "u_y_offset_color_multiplier", "u_y_offset_flow_multiplier",
|
|
895
909
|
|
|
896
|
-
"u_procedural_texture", "u_enable_procedural_texture", "u_texture_ease", "u_saturation", "u_brightness", "u_color_blending"
|
|
910
|
+
"u_procedural_texture", "u_enable_procedural_texture", "u_texture_ease", "u_saturation", "u_brightness", "u_color_blending",
|
|
911
|
+
"u_domain_warp_enabled", "u_domain_warp_intensity", "u_domain_warp_scale",
|
|
912
|
+
"u_vignette_intensity", "u_vignette_radius",
|
|
913
|
+
"u_fresnel_enabled", "u_fresnel_power", "u_fresnel_intensity", "u_fresnel_color",
|
|
914
|
+
"u_iridescence_enabled", "u_iridescence_intensity", "u_iridescence_speed",
|
|
915
|
+
"u_bloom_intensity", "u_bloom_threshold", "u_chromatic_aberration"
|
|
897
916
|
];
|
|
898
917
|
|
|
899
918
|
const locations: WebGLState["locations"] = {
|
|
@@ -1135,7 +1154,97 @@ export class NeatGradient implements NeatController {
|
|
|
1135
1154
|
return tex;
|
|
1136
1155
|
}
|
|
1137
1156
|
|
|
1138
|
-
|
|
1157
|
+
set domainWarpEnabled(enabled: boolean) {
|
|
1158
|
+
if (this._domainWarpEnabled !== enabled) {
|
|
1159
|
+
this._domainWarpEnabled = enabled;
|
|
1160
|
+
this._uniformsDirty = true;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
set domainWarpIntensity(intensity: number) {
|
|
1164
|
+
if (this._domainWarpIntensity !== intensity) {
|
|
1165
|
+
this._domainWarpIntensity = intensity;
|
|
1166
|
+
this._uniformsDirty = true;
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
set domainWarpScale(scale: number) {
|
|
1170
|
+
if (this._domainWarpScale !== scale) {
|
|
1171
|
+
this._domainWarpScale = scale;
|
|
1172
|
+
this._uniformsDirty = true;
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
set vignetteIntensity(intensity: number) {
|
|
1176
|
+
if (this._vignetteIntensity !== intensity) {
|
|
1177
|
+
this._vignetteIntensity = intensity;
|
|
1178
|
+
this._uniformsDirty = true;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
set vignetteRadius(radius: number) {
|
|
1182
|
+
if (this._vignetteRadius !== radius) {
|
|
1183
|
+
this._vignetteRadius = radius;
|
|
1184
|
+
this._uniformsDirty = true;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
set fresnelEnabled(enabled: boolean) {
|
|
1188
|
+
if (this._fresnelEnabled !== enabled) {
|
|
1189
|
+
this._fresnelEnabled = enabled;
|
|
1190
|
+
this._uniformsDirty = true;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
set fresnelPower(power: number) {
|
|
1194
|
+
if (this._fresnelPower !== power) {
|
|
1195
|
+
this._fresnelPower = power;
|
|
1196
|
+
this._uniformsDirty = true;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
set fresnelIntensity(intensity: number) {
|
|
1200
|
+
if (this._fresnelIntensity !== intensity) {
|
|
1201
|
+
this._fresnelIntensity = intensity;
|
|
1202
|
+
this._uniformsDirty = true;
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
set fresnelColor(fresnelColor: string) {
|
|
1206
|
+
if (this._fresnelColor !== fresnelColor) {
|
|
1207
|
+
this._fresnelColor = fresnelColor;
|
|
1208
|
+
this._fresnelColorRgb = this._hexToRgb(fresnelColor);
|
|
1209
|
+
this._uniformsDirty = true;
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
set iridescenceEnabled(enabled: boolean) {
|
|
1213
|
+
if (this._iridescenceEnabled !== enabled) {
|
|
1214
|
+
this._iridescenceEnabled = enabled;
|
|
1215
|
+
this._uniformsDirty = true;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
set iridescenceIntensity(intensity: number) {
|
|
1219
|
+
if (this._iridescenceIntensity !== intensity) {
|
|
1220
|
+
this._iridescenceIntensity = intensity;
|
|
1221
|
+
this._uniformsDirty = true;
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
set iridescenceSpeed(speed: number) {
|
|
1225
|
+
if (this._iridescenceSpeed !== speed) {
|
|
1226
|
+
this._iridescenceSpeed = speed;
|
|
1227
|
+
this._uniformsDirty = true;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
set bloomIntensity(intensity: number) {
|
|
1231
|
+
if (this._bloomIntensity !== intensity) {
|
|
1232
|
+
this._bloomIntensity = intensity;
|
|
1233
|
+
this._uniformsDirty = true;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
set bloomThreshold(threshold: number) {
|
|
1237
|
+
if (this._bloomThreshold !== threshold) {
|
|
1238
|
+
this._bloomThreshold = threshold;
|
|
1239
|
+
this._uniformsDirty = true;
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
set chromaticAberration(aberration: number) {
|
|
1243
|
+
if (this._chromaticAberration !== aberration) {
|
|
1244
|
+
this._chromaticAberration = aberration;
|
|
1245
|
+
this._uniformsDirty = true;
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1139
1248
|
}
|
|
1140
1249
|
|
|
1141
1250
|
|
package/src/index.ts
CHANGED