You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
467 B
27 lines
467 B
#ifndef COMMON_INCLUDE
|
|
#define COMMON_INCLUDE
|
|
|
|
// #include <builtin/uniforms/cc-global>
|
|
|
|
float saturate(float x) {
|
|
return clamp(x, 0.0, 1.0);
|
|
}
|
|
|
|
vec2 saturate(vec2 x) {
|
|
return clamp(x, vec2(0.0), vec2(1.0));
|
|
}
|
|
|
|
vec3 saturate(vec3 x) {
|
|
return clamp(x, vec3(0.0), vec3(1.0));
|
|
}
|
|
|
|
vec4 saturate(vec4 x) {
|
|
return clamp(x, vec4(0.0), vec4(1.0));
|
|
}
|
|
|
|
float nrand(float x, float y) {
|
|
return fract(sin(dot(vec2(x, y), vec2(12.9898, 78.233))) * 43758.5453);
|
|
}
|
|
|
|
|
|
#endif |