Skip to content

Commit a0b1405

Browse files
docs(shader-ast-stdlib): add fbmNoiseVec34 docs
1 parent efa1f8d commit a0b1405

File tree

1 file changed

+30
-0
lines changed
  • packages/shader-ast-stdlib/src/noise

1 file changed

+30
-0
lines changed

packages/shader-ast-stdlib/src/noise/fbm.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,36 @@ import { texture } from "@thi.ng/shader-ast/builtin/texture";
2323
* @remarks
2424
* Not compatible with WebGL 1.0 (texture type not natively supported).
2525
*
26+
* The texture should be configured to use linear filtering and texture repeat
27+
* mode.
28+
*
29+
* Using thi.ng/webgl (for example), the 3D noise texture can be initialized as
30+
* follows:
31+
*
32+
* @example
33+
* ```ts
34+
* import { repeatedly } from "@thi.ng/transducers";
35+
* import {
36+
* defTexture,
37+
* TextureFilter, TextureFormat, TextureRepeat, TextureTarget
38+
* } from "@thi.ng/webgl";
39+
*
40+
* // (GL context creation omitted here)
41+
*
42+
* const noiseTex = defTexture(gl, {
43+
* width: 32,
44+
* height: 32,
45+
* depth: 32,
46+
* target: TextureTarget.TEXTURE_3D,
47+
* format: TextureFormat.RGB,
48+
* filter: TextureFilter.LINEAR,
49+
* wrap: TextureRepeat.REPEAT,
50+
* image: new Uint8Array(
51+
* repeatedly(() => Math.random() * 255.5, 32 * 32 * 32 * 3)
52+
* )
53+
* });
54+
* ```
55+
*
2656
* @param octaves
2757
* @param decay
2858
*/

0 commit comments

Comments
 (0)