@awesome-flow/noise 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/index.cjs +1 -3490
- package/dist/abstract/index.d.cts +2 -2
- package/dist/abstract/index.d.ts +2 -2
- package/dist/abstract/index.js +1 -3522
- package/dist/modules/index.cjs +1 -44
- package/dist/modules/index.js +1 -18
- package/dist/nodes/generators/index.cjs +1 -346
- package/dist/nodes/generators/index.d.cts +7 -7
- package/dist/nodes/generators/index.d.ts +7 -7
- package/dist/nodes/generators/index.js +1 -311
- package/dist/nodes/groups/index.cjs +1 -113
- package/dist/nodes/groups/index.d.cts +2 -2
- package/dist/nodes/groups/index.d.ts +2 -2
- package/dist/nodes/groups/index.js +1 -92
- package/dist/nodes/index.cjs +1 -3425
- package/dist/nodes/index.js +1 -3435
- package/dist/nodes/modifiers/index.cjs +1 -1478
- package/dist/nodes/modifiers/index.d.cts +6 -6
- package/dist/nodes/modifiers/index.d.ts +6 -6
- package/dist/nodes/modifiers/index.js +1 -1491
- package/dist/nodes/output/index.cjs +1 -1344
- package/dist/nodes/output/index.d.cts +3 -3
- package/dist/nodes/output/index.d.ts +3 -3
- package/dist/nodes/output/index.js +1 -1368
- package/dist/nodes/selectors/index.cjs +1 -1322
- package/dist/nodes/selectors/index.d.cts +1 -1
- package/dist/nodes/selectors/index.d.ts +1 -1
- package/dist/nodes/selectors/index.js +1 -1348
- package/dist/nodes/transformers/index.cjs +1 -337
- package/dist/nodes/transformers/index.d.cts +5 -5
- package/dist/nodes/transformers/index.d.ts +5 -5
- package/dist/nodes/transformers/index.js +1 -319
- package/dist/templates/generators/index.cjs +1 -1221
- package/dist/templates/generators/index.d.cts +5 -5
- package/dist/templates/generators/index.d.ts +5 -5
- package/dist/templates/generators/index.js +1 -1239
- package/dist/templates/groups/index.cjs +1 -1203
- package/dist/templates/groups/index.js +1 -1230
- package/dist/templates/index.cjs +1 -1263
- package/dist/templates/index.js +1 -1260
- package/dist/templates/modifiers/index.cjs +1 -1219
- package/dist/templates/modifiers/index.d.cts +9 -9
- package/dist/templates/modifiers/index.d.ts +9 -9
- package/dist/templates/modifiers/index.js +1 -1238
- package/dist/templates/output/index.cjs +1 -1209
- package/dist/templates/output/index.d.cts +3 -3
- package/dist/templates/output/index.d.ts +3 -3
- package/dist/templates/output/index.js +1 -1233
- package/dist/templates/selectors/index.cjs +1 -1205
- package/dist/templates/selectors/index.js +1 -1231
- package/dist/templates/transformers/index.cjs +1 -1211
- package/dist/templates/transformers/index.js +1 -1234
- package/package.json +9 -7
|
@@ -1,319 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { NodeContainer, NodeTrackConnections } from "@awesome-flow/core/layout";
|
|
3
|
-
import { useCallback } from "react";
|
|
4
|
-
import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
|
|
5
|
-
import { Displace } from "libnoise-simplex-ts";
|
|
6
|
-
import { HandlesIncomingDataStatus } from "@awesome-flow/core/components";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
function NoiseDisplaceNode({ id, selected, data, type }) {
|
|
9
|
-
const updateComputedData = useUpdateNodeComputedData();
|
|
10
|
-
const onDataUpdated = useCallback(
|
|
11
|
-
(handleData) => {
|
|
12
|
-
const sourceModule = handleData["source" /* sourceModule */];
|
|
13
|
-
const xModule = handleData["x-module" /* xModule */];
|
|
14
|
-
const yModule = handleData["y-module" /* yModule */];
|
|
15
|
-
const zModule = handleData["z-module" /* zModule */];
|
|
16
|
-
if (sourceModule && xModule && yModule && zModule) {
|
|
17
|
-
const module = new Displace(
|
|
18
|
-
sourceModule[0].module,
|
|
19
|
-
xModule[0].module,
|
|
20
|
-
yModule[0].module,
|
|
21
|
-
zModule[0].module
|
|
22
|
-
);
|
|
23
|
-
updateComputedData(id, { module });
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
[]
|
|
27
|
-
);
|
|
28
|
-
return /* @__PURE__ */ jsxs(NodeContainer, { id, selected, data, type, children: [
|
|
29
|
-
/* @__PURE__ */ jsx(
|
|
30
|
-
HandlesIncomingDataStatus,
|
|
31
|
-
{
|
|
32
|
-
nodeId: id,
|
|
33
|
-
handles: data.handles,
|
|
34
|
-
handleKey: "dataId",
|
|
35
|
-
onDataUpdated,
|
|
36
|
-
type: "target",
|
|
37
|
-
resetComputedData: true
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
/* @__PURE__ */ jsx(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
|
|
41
|
-
] });
|
|
42
|
-
}
|
|
43
|
-
var noise_displace_node_default = NoiseDisplaceNode;
|
|
44
|
-
|
|
45
|
-
// src/nodes/transformers/noise-rotate-point-node.tsx
|
|
46
|
-
import { NodeContainer as NodeContainer2, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
|
|
47
|
-
import { useEffect, useState } from "react";
|
|
48
|
-
import {
|
|
49
|
-
useIncomingComputedData,
|
|
50
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData2,
|
|
51
|
-
useUpdateNodeData
|
|
52
|
-
} from "@awesome-flow/core/hooks";
|
|
53
|
-
import { Group, NumberInput, Stack } from "@mantine/core";
|
|
54
|
-
import { RotatePoint } from "libnoise-simplex-ts";
|
|
55
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
56
|
-
function NoiseRotatePointNode({
|
|
57
|
-
id,
|
|
58
|
-
selected,
|
|
59
|
-
data,
|
|
60
|
-
type
|
|
61
|
-
}) {
|
|
62
|
-
const [xAngle, setXAngle] = useState(data.xAngle);
|
|
63
|
-
const [yAngle, setYAngle] = useState(data.yAngle);
|
|
64
|
-
const [zAngle, setZAngle] = useState(data.zAngle);
|
|
65
|
-
const incoming = useIncomingComputedData(id);
|
|
66
|
-
const updateNodeData = useUpdateNodeData();
|
|
67
|
-
const updateComputedData = useUpdateNodeComputedData2();
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (incoming?.length) {
|
|
70
|
-
const module = new RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
|
|
71
|
-
updateComputedData(id, { module });
|
|
72
|
-
}
|
|
73
|
-
updateNodeData(id, { xAngle, yAngle, zAngle });
|
|
74
|
-
}, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
|
|
75
|
-
return /* @__PURE__ */ jsxs2(NodeContainer2, { id, selected, data, type, children: [
|
|
76
|
-
/* @__PURE__ */ jsxs2(Stack, { children: [
|
|
77
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
78
|
-
"X Angle:",
|
|
79
|
-
/* @__PURE__ */ jsx2(
|
|
80
|
-
NumberInput,
|
|
81
|
-
{
|
|
82
|
-
size: "xs",
|
|
83
|
-
w: 100,
|
|
84
|
-
value: xAngle,
|
|
85
|
-
onChange: (e) => setXAngle(Number(e)),
|
|
86
|
-
step: 0.01
|
|
87
|
-
}
|
|
88
|
-
)
|
|
89
|
-
] }),
|
|
90
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
91
|
-
"Y Angle:",
|
|
92
|
-
/* @__PURE__ */ jsx2(
|
|
93
|
-
NumberInput,
|
|
94
|
-
{
|
|
95
|
-
size: "xs",
|
|
96
|
-
w: 100,
|
|
97
|
-
value: yAngle,
|
|
98
|
-
onChange: (e) => setYAngle(Number(e)),
|
|
99
|
-
step: 0.01
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
] }),
|
|
103
|
-
/* @__PURE__ */ jsxs2(Group, { children: [
|
|
104
|
-
"Z Angle:",
|
|
105
|
-
/* @__PURE__ */ jsx2(
|
|
106
|
-
NumberInput,
|
|
107
|
-
{
|
|
108
|
-
size: "xs",
|
|
109
|
-
w: 100,
|
|
110
|
-
value: zAngle,
|
|
111
|
-
onChange: (e) => setZAngle(Number(e)),
|
|
112
|
-
step: 0.01
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
] })
|
|
116
|
-
] }),
|
|
117
|
-
/* @__PURE__ */ jsx2(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
|
|
118
|
-
] });
|
|
119
|
-
}
|
|
120
|
-
var noise_rotate_point_node_default = NoiseRotatePointNode;
|
|
121
|
-
|
|
122
|
-
// src/nodes/transformers/noise-scale-point-node.tsx
|
|
123
|
-
import { NodeContainer as NodeContainer3, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
|
|
124
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
125
|
-
import {
|
|
126
|
-
useIncomingComputedData as useIncomingComputedData2,
|
|
127
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData3,
|
|
128
|
-
useUpdateNodeData as useUpdateNodeData2
|
|
129
|
-
} from "@awesome-flow/core/hooks";
|
|
130
|
-
import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
|
|
131
|
-
import { ScalePoint } from "libnoise-simplex-ts";
|
|
132
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
133
|
-
function NoiseScalePointNode({
|
|
134
|
-
id,
|
|
135
|
-
selected,
|
|
136
|
-
data,
|
|
137
|
-
type
|
|
138
|
-
}) {
|
|
139
|
-
const [xScale, setXScale] = useState2(data.xScale);
|
|
140
|
-
const [yScale, setYScale] = useState2(data.yScale);
|
|
141
|
-
const [zScale, setZScale] = useState2(data.zScale);
|
|
142
|
-
const incoming = useIncomingComputedData2(id);
|
|
143
|
-
const updateNodeData = useUpdateNodeData2();
|
|
144
|
-
const updateComputedData = useUpdateNodeComputedData3();
|
|
145
|
-
useEffect2(() => {
|
|
146
|
-
if (incoming?.length) {
|
|
147
|
-
const module = new ScalePoint(incoming[0].module, xScale, yScale, zScale);
|
|
148
|
-
updateComputedData(id, { module });
|
|
149
|
-
}
|
|
150
|
-
updateNodeData(id, { xScale, yScale, zScale });
|
|
151
|
-
}, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
|
|
152
|
-
return /* @__PURE__ */ jsxs3(NodeContainer3, { id, selected, data, type, children: [
|
|
153
|
-
/* @__PURE__ */ jsxs3(Stack2, { children: [
|
|
154
|
-
/* @__PURE__ */ jsxs3(Group2, { children: [
|
|
155
|
-
"X Scale:",
|
|
156
|
-
/* @__PURE__ */ jsx3(
|
|
157
|
-
NumberInput2,
|
|
158
|
-
{
|
|
159
|
-
size: "xs",
|
|
160
|
-
w: 100,
|
|
161
|
-
value: xScale,
|
|
162
|
-
onChange: (e) => setXScale(Number(e)),
|
|
163
|
-
step: 0.01
|
|
164
|
-
}
|
|
165
|
-
)
|
|
166
|
-
] }),
|
|
167
|
-
/* @__PURE__ */ jsxs3(Group2, { children: [
|
|
168
|
-
"Y Scale:",
|
|
169
|
-
/* @__PURE__ */ jsx3(
|
|
170
|
-
NumberInput2,
|
|
171
|
-
{
|
|
172
|
-
size: "xs",
|
|
173
|
-
w: 100,
|
|
174
|
-
value: yScale,
|
|
175
|
-
onChange: (e) => setYScale(Number(e)),
|
|
176
|
-
step: 0.01
|
|
177
|
-
}
|
|
178
|
-
)
|
|
179
|
-
] }),
|
|
180
|
-
/* @__PURE__ */ jsxs3(Group2, { children: [
|
|
181
|
-
"Z Scale:",
|
|
182
|
-
/* @__PURE__ */ jsx3(
|
|
183
|
-
NumberInput2,
|
|
184
|
-
{
|
|
185
|
-
size: "xs",
|
|
186
|
-
w: 100,
|
|
187
|
-
value: zScale,
|
|
188
|
-
onChange: (e) => setZScale(Number(e)),
|
|
189
|
-
step: 0.01
|
|
190
|
-
}
|
|
191
|
-
)
|
|
192
|
-
] })
|
|
193
|
-
] }),
|
|
194
|
-
/* @__PURE__ */ jsx3(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
|
|
195
|
-
] });
|
|
196
|
-
}
|
|
197
|
-
var noise_scale_point_node_default = NoiseScalePointNode;
|
|
198
|
-
|
|
199
|
-
// src/nodes/transformers/noise-translate-point-node.tsx
|
|
200
|
-
import { NodeContainer as NodeContainer4, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
|
|
201
|
-
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
202
|
-
import {
|
|
203
|
-
useIncomingComputedData as useIncomingComputedData3,
|
|
204
|
-
useUpdateNodeComputedData as useUpdateNodeComputedData4,
|
|
205
|
-
useUpdateNodeData as useUpdateNodeData3
|
|
206
|
-
} from "@awesome-flow/core/hooks";
|
|
207
|
-
import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
|
|
208
|
-
import { TranslatePoint } from "libnoise-simplex-ts";
|
|
209
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
210
|
-
function NoiseTranslatePointNode({
|
|
211
|
-
id,
|
|
212
|
-
selected,
|
|
213
|
-
data,
|
|
214
|
-
type
|
|
215
|
-
}) {
|
|
216
|
-
const [translateX, setTranslateX] = useState3(data.translateX);
|
|
217
|
-
const [translateY, setTranslateY] = useState3(data.translateY);
|
|
218
|
-
const [translateZ, setTranslateZ] = useState3(data.translateZ);
|
|
219
|
-
const incoming = useIncomingComputedData3(id);
|
|
220
|
-
const updateNodeData = useUpdateNodeData3();
|
|
221
|
-
const updateComputedData = useUpdateNodeComputedData4();
|
|
222
|
-
useEffect3(() => {
|
|
223
|
-
if (incoming?.length) {
|
|
224
|
-
const module = new TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
|
|
225
|
-
updateComputedData(id, { module });
|
|
226
|
-
}
|
|
227
|
-
updateNodeData(id, { translateX, translateY, translateZ });
|
|
228
|
-
}, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
|
|
229
|
-
return /* @__PURE__ */ jsxs4(NodeContainer4, { id, selected, data, type, children: [
|
|
230
|
-
/* @__PURE__ */ jsxs4(Stack3, { children: [
|
|
231
|
-
/* @__PURE__ */ jsxs4(Group3, { children: [
|
|
232
|
-
"Translate X:",
|
|
233
|
-
/* @__PURE__ */ jsx4(
|
|
234
|
-
NumberInput3,
|
|
235
|
-
{
|
|
236
|
-
size: "xs",
|
|
237
|
-
w: 100,
|
|
238
|
-
value: translateX,
|
|
239
|
-
onChange: (e) => setTranslateX(Number(e)),
|
|
240
|
-
step: 1
|
|
241
|
-
}
|
|
242
|
-
)
|
|
243
|
-
] }),
|
|
244
|
-
/* @__PURE__ */ jsxs4(Group3, { children: [
|
|
245
|
-
"Translate Y:",
|
|
246
|
-
/* @__PURE__ */ jsx4(
|
|
247
|
-
NumberInput3,
|
|
248
|
-
{
|
|
249
|
-
size: "xs",
|
|
250
|
-
w: 100,
|
|
251
|
-
value: translateY,
|
|
252
|
-
onChange: (e) => setTranslateY(Number(e)),
|
|
253
|
-
step: 1
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
] }),
|
|
257
|
-
/* @__PURE__ */ jsxs4(Group3, { children: [
|
|
258
|
-
"Translate Z:",
|
|
259
|
-
/* @__PURE__ */ jsx4(
|
|
260
|
-
NumberInput3,
|
|
261
|
-
{
|
|
262
|
-
size: "xs",
|
|
263
|
-
w: 100,
|
|
264
|
-
value: translateZ,
|
|
265
|
-
onChange: (e) => setTranslateZ(Number(e)),
|
|
266
|
-
step: 1
|
|
267
|
-
}
|
|
268
|
-
)
|
|
269
|
-
] })
|
|
270
|
-
] }),
|
|
271
|
-
/* @__PURE__ */ jsx4(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
|
|
272
|
-
] });
|
|
273
|
-
}
|
|
274
|
-
var noise_translate_point_node_default = NoiseTranslatePointNode;
|
|
275
|
-
|
|
276
|
-
// src/nodes/transformers/noise-turbulence-node .tsx
|
|
277
|
-
import { NodeContainer as NodeContainer5, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
|
|
278
|
-
import { useCallback as useCallback2, useEffect as useEffect4, useState as useState4 } from "react";
|
|
279
|
-
import { useIncomingComputedData as useIncomingComputedData4, useUpdateNodeComputedData as useUpdateNodeComputedData5 } from "@awesome-flow/core/hooks";
|
|
280
|
-
import { Turbulence } from "libnoise-simplex-ts";
|
|
281
|
-
import { NodePropertyVariables } from "@awesome-flow/core/components";
|
|
282
|
-
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
283
|
-
function NoiseTurbulenceNode({
|
|
284
|
-
id,
|
|
285
|
-
selected,
|
|
286
|
-
data,
|
|
287
|
-
type
|
|
288
|
-
}) {
|
|
289
|
-
const [properties, setProperties] = useState4(null);
|
|
290
|
-
const incoming = useIncomingComputedData4(id);
|
|
291
|
-
const updateComputedData = useUpdateNodeComputedData5();
|
|
292
|
-
const onPropertiesChange = useCallback2((props) => {
|
|
293
|
-
setProperties(props);
|
|
294
|
-
}, []);
|
|
295
|
-
useEffect4(() => {
|
|
296
|
-
if (incoming?.length && properties) {
|
|
297
|
-
const module = new Turbulence(
|
|
298
|
-
incoming[0].module,
|
|
299
|
-
properties.frequency.value,
|
|
300
|
-
properties.power.value,
|
|
301
|
-
properties.roughness.value,
|
|
302
|
-
properties.seed.value
|
|
303
|
-
);
|
|
304
|
-
updateComputedData(id, { module });
|
|
305
|
-
}
|
|
306
|
-
}, [id, incoming, properties]);
|
|
307
|
-
return /* @__PURE__ */ jsxs5(NodeContainer5, { id, selected, data, type, children: [
|
|
308
|
-
/* @__PURE__ */ jsx5(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
|
|
309
|
-
/* @__PURE__ */ jsx5(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
|
|
310
|
-
] });
|
|
311
|
-
}
|
|
312
|
-
var noise_turbulence_node_default = NoiseTurbulenceNode;
|
|
313
|
-
export {
|
|
314
|
-
noise_displace_node_default as NoiseDisplaceNode,
|
|
315
|
-
noise_rotate_point_node_default as NoiseRotatePointNode,
|
|
316
|
-
noise_scale_point_node_default as NoiseScalePointNode,
|
|
317
|
-
noise_translate_point_node_default as NoiseTranslatePointNode,
|
|
318
|
-
noise_turbulence_node_default as NoiseTurbulenceNode
|
|
319
|
-
};
|
|
1
|
+
import{HandlesIncomingDataStatus as v}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as A}from"@awesome-flow/core/hooks";import{NodeContainer as G,NodeTrackConnections as U}from"@awesome-flow/core/layout";import{Displace as R}from"libnoise-simplex-ts";import{useCallback as X}from"react";import{jsx as w,jsxs as E}from"react/jsx-runtime";function Y({id:e,selected:m,data:o,type:l}){let t=A(),i=X(a=>{let s=a.source,r=a["x-module"],d=a["y-module"],u=a["z-module"];if(s&&r&&d&&u){let p=new R(s[0].module,r[0].module,d[0].module,u[0].module);t(e,{module:p})}},[]);return E(G,{id:e,selected:m,data:o,type:l,children:[w(v,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:i,type:"target",resetComputedData:!0}),w(U,{handles:o.handles,nodeId:e,type:"target"})]})}var Z=Y;import{useIncomingComputedData as V,useUpdateNodeComputedData as B,useUpdateNodeData as q}from"@awesome-flow/core/hooks";import{NodeContainer as K,NodeTrackConnections as F}from"@awesome-flow/core/layout";import{Group as x,NumberInput as M,Stack as J}from"@mantine/core";import{RotatePoint as L}from"libnoise-simplex-ts";import{useEffect as O,useState as S}from"react";import{jsx as D,jsxs as N}from"react/jsx-runtime";function Q({id:e,selected:m,data:o,type:l}){let[t,i]=S(o.xAngle),[a,s]=S(o.yAngle),[r,d]=S(o.zAngle),u=V(e),p=q(),c=B();return O(()=>{if(u?.length){let n=new L(u[0].module,t,a,r);c(e,{module:n})}p(e,{xAngle:t,yAngle:a,zAngle:r})},[e,c,p,u,t,a,r]),N(K,{id:e,selected:m,data:o,type:l,children:[N(J,{children:[N(x,{children:["X Angle:",D(M,{size:"xs",w:100,value:t,onChange:n=>i(Number(n)),step:.01})]}),N(x,{children:["Y Angle:",D(M,{size:"xs",w:100,value:a,onChange:n=>s(Number(n)),step:.01})]}),N(x,{children:["Z Angle:",D(M,{size:"xs",w:100,value:r,onChange:n=>d(Number(n)),step:.01})]})]}),D(F,{handles:o.handles,nodeId:e,type:"target"})]})}var W=Q;import{useIncomingComputedData as _,useUpdateNodeComputedData as $,useUpdateNodeData as H}from"@awesome-flow/core/hooks";import{NodeContainer as j,NodeTrackConnections as ee}from"@awesome-flow/core/layout";import{Group as h,NumberInput as y,Stack as oe}from"@mantine/core";import{ScalePoint as te}from"libnoise-simplex-ts";import{useEffect as ae,useState as b}from"react";import{jsx as g,jsxs as f}from"react/jsx-runtime";function ne({id:e,selected:m,data:o,type:l}){let[t,i]=b(o.xScale),[a,s]=b(o.yScale),[r,d]=b(o.zScale),u=_(e),p=H(),c=$();return ae(()=>{if(u?.length){let n=new te(u[0].module,t,a,r);c(e,{module:n})}p(e,{xScale:t,yScale:a,zScale:r})},[e,u,c,p,t,a,r]),f(j,{id:e,selected:m,data:o,type:l,children:[f(oe,{children:[f(h,{children:["X Scale:",g(y,{size:"xs",w:100,value:t,onChange:n=>i(Number(n)),step:.01})]}),f(h,{children:["Y Scale:",g(y,{size:"xs",w:100,value:a,onChange:n=>s(Number(n)),step:.01})]}),f(h,{children:["Z Scale:",g(y,{size:"xs",w:100,value:r,onChange:n=>d(Number(n)),step:.01})]})]}),g(ee,{handles:o.handles,nodeId:e,type:"target"})]})}var re=ne;import{useIncomingComputedData as ue,useUpdateNodeComputedData as de,useUpdateNodeData as se}from"@awesome-flow/core/hooks";import{NodeContainer as pe,NodeTrackConnections as me}from"@awesome-flow/core/layout";import{Group as I,NumberInput as T,Stack as le}from"@mantine/core";import{TranslatePoint as ie}from"libnoise-simplex-ts";import{useEffect as ce,useState as z}from"react";import{jsx as P,jsxs as C}from"react/jsx-runtime";function Ne({id:e,selected:m,data:o,type:l}){let[t,i]=z(o.translateX),[a,s]=z(o.translateY),[r,d]=z(o.translateZ),u=ue(e),p=se(),c=de();return ce(()=>{if(u?.length){let n=new ie(u[0].module,t,a,r);c(e,{module:n})}p(e,{translateX:t,translateY:a,translateZ:r})},[e,u,t,a,r,c,p]),C(pe,{id:e,selected:m,data:o,type:l,children:[C(le,{children:[C(I,{children:["Translate X:",P(T,{size:"xs",w:100,value:t,onChange:n=>i(Number(n)),step:1})]}),C(I,{children:["Translate Y:",P(T,{size:"xs",w:100,value:a,onChange:n=>s(Number(n)),step:1})]}),C(I,{children:["Translate Z:",P(T,{size:"xs",w:100,value:r,onChange:n=>d(Number(n)),step:1})]})]}),P(me,{handles:o.handles,nodeId:e,type:"target"})]})}var fe=Ne;import{NodePropertyVariables as Ce}from"@awesome-flow/core/components";import{useIncomingComputedData as De,useUpdateNodeComputedData as ge}from"@awesome-flow/core/hooks";import{NodeContainer as Pe,NodeTrackConnections as xe}from"@awesome-flow/core/layout";import{Turbulence as Me}from"libnoise-simplex-ts";import{useCallback as Se,useEffect as he,useState as ye}from"react";import{jsx as k,jsxs as Te}from"react/jsx-runtime";function be({id:e,selected:m,data:o,type:l}){let[t,i]=ye(null),a=De(e),s=ge(),r=Se(d=>{i(d)},[]);return he(()=>{if(a?.length&&t){let d=new Me(a[0].module,t.frequency.value,t.power.value,t.roughness.value,t.seed.value);s(e,{module:d})}},[e,a,t]),Te(Pe,{id:e,selected:m,data:o,type:l,children:[k(Ce,{data:o,nodeId:e,onPropertiesChange:r}),k(xe,{handles:o.handles,nodeId:e,type:"target"})]})}var Ie=be;export{Z as NoiseDisplaceNode,W as NoiseRotatePointNode,re as NoiseScalePointNode,fe as NoiseTranslatePointNode,Ie as NoiseTurbulenceNode};
|