File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
packages/shader-ast-stdlib/src/noise Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff 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 */
You can’t perform that action at this time.
0 commit comments