Skip to content

Commit 4758399

Browse files
authored
refactor: Reuse sign and sqrt in typegpu-noise (#1212)
1 parent 925cec9 commit 4758399

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

packages/typegpu-noise/src/random.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,11 @@ import {
99
vec3f,
1010
vec4f,
1111
} from 'typegpu/data';
12-
import { cos, dot, mul, sin } from 'typegpu/std';
12+
import { cos, dot, mul, sign, sin, sqrt } from 'typegpu/std';
1313
import { randomGeneratorSlot } from './generator.ts';
1414

1515
const TWO_PI = Math.PI * 2;
1616

17-
// TODO: Contribute back to typegpu/std
18-
const sqrt = tgpu['~unstable'].fn(
19-
[f32],
20-
f32,
21-
)(`(value: f32) -> f32 {
22-
return sqrt(value);
23-
}`);
24-
25-
// TODO: Contribute back to typegpu/std
26-
const sign = tgpu['~unstable'].fn(
27-
[f32],
28-
f32,
29-
)(`(value: f32) -> f32 {
30-
return sign(value);
31-
}`);
32-
3317
export const randSeed: TgpuFn<[F32], undefined> = tgpu['~unstable'].fn([f32])(
3418
(seed) => {
3519
randomGeneratorSlot.value.seed(seed);

0 commit comments

Comments
 (0)