module:extras/fragmentshaderlib

Back to documentation index.

### module:extras/fragmentshaderlib()

The extras/fragmentshaderlib.js module. To import all symbols in this module, either of the following can be used:

import * from "extras/fragmentshaderlib.js";
// -- or --
import * as CustomModuleName from "extras/fragmentshaderlib.js";

Methods

### (static) module:extras/fragmentshaderlib.fragmentShaderLib()

Returns GLSL shader code for several useful functions for shaders, especially fragment shaders. TODO: Not documented fully yet. Contains the following functions:<ul>

  • float rand(float seed): Generates a randomized hash of a number, in the interval [0, 1).
  • float rand(vec2 seed): Generates a randomized hash of a two-number vector, in the interval [0, 1).
  • float rand(vec3 seed): Generates a randomized hash of a three-number vector, in the interval [0, 1).
  • float signedrand(float seed): Generates a randomized hash of a number, in the interval [-1, 1).
  • float signedrand(vec2 seed): Generates a randomized hash of a two-number vector, in the interval [-1, 1).
  • float signedrand(vec3 seed): Generates a randomized hash of a three-number vector, in the interval [-1, 1). </ul> #### Return Value The GLSL shader code. (Type: string) [Back to documentation index.](index.html)