update readme.

This commit is contained in:
ykob 2022-04-21 21:38:42 +09:00
parent fa90b6d2bc
commit 16b29b108d

View File

@ -1,70 +1,70 @@
# glsl-util # glsl-util
utility functions of glsl. Private GLSL utility functions created by @ykob
these functions are dependent by [glslify](https://github.com/glslify/glslify). These functions are dependent on [glslify](https://github.com/glslify/glslify).
## install ## Install
``` ```
yarn add @ykob/glsl-util yarn add @ykob/glsl-util
``` ```
## usage ## Usage
### `convertHsvToRgb(vec3 hsv)` ### `convertHsvToRgb(vec3 hsv)`
convert HSV to RGB. Convert HSV to RGB.
http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
``` ```
#pragma glslify: convertHsvToRgb = require(glsl-util/src/convertHsvToRgb); #pragma glslify: convertHsvToRgb = require(@ykob/glsl-util/src/convertHsvToRgb);
``` ```
### `convertRgbToHsv(vec3 rgb)` ### `convertRgbToHsv(vec3 rgb)`
convert RGB to HSV. Convert RGB to HSV.
http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
``` ```
#pragma glslify: convertRgbToHsv = require(glsl-util/src/convertRgbToHsv); #pragma glslify: convertRgbToHsv = require(@ykob/glsl-util/src/convertRgbToHsv);
``` ```
### `random(vec2 p)` ### `random(vec2 p)`
calculate white noise. Calculate the white noise.
``` ```
#pragma glslify: random = require(glsl-util/src/random); #pragma glslify: random = require(@ykob/glsl-util/src/random);
``` ```
### `polar(float radian1, float radian2, float radius)` ### `polar(float radian1, float radian2, float radius)`
calculate polar coordinates. Calculate the polar coordinates.
``` ```
#pragma glslify: polar = require(glsl-util/src/polar); #pragma glslify: polar = require(@ykob/glsl-util/src/polar);
``` ```
### `gaussianBlur(sampler2D texture, vec2 uv, float radius, vec2 resolution, vec2 direction)` ### `gaussianBlur(sampler2D texture, vec2 uv, float radius, vec2 resolution, vec2 direction)`
calculate the Gaussian blur. Calculate the Gaussian blur.
``` ```
#pragma glslify: gaussianBlur = require(glsl-util/src/gaussianBlur); #pragma glslify: gaussianBlur = require(@ykob/glsl-util/src/gaussianBlur);
``` ```
### `lookAt(vec3 base, vec3 p1, vec3 p2, vec3 up)` ### `lookAt(vec3 base, vec3 p1, vec3 p2, vec3 up)`
rotate a vector in any direction. Rotate a vector in any direction.
``` ```
#pragma glslify: lookAt = require(glsl-util/src/lookAt); #pragma glslify: lookAt = require(@ykob/glsl-util/src/lookAt);
``` ```
### `rotateAxisAngle(vec3 p, vec3 axis, float angle)` ### `rotateAxisAngle(vec3 p, vec3 axis, float angle)`
rotate a vector by any axis and angle. Rotate a vector with axis and angle.
``` ```
#pragma glslify: rotateAxisAngle = require(glsl-util/src/rotateAxisAngle); #pragma glslify: rotateAxisAngle = require(@ykob/glsl-util/src/rotateAxisAngle);
``` ```