[add] polar function. this function calculates polar coordinates.
This commit is contained in:
parent
7552f81aa8
commit
8863f97e4c
14
README.md
14
README.md
@ -9,7 +9,8 @@ npm i git://github.com/ykob/glsl-util.git
|
||||
```
|
||||
|
||||
## convertHsvToRgb and convertRgbToHsv
|
||||
this is the function that convetts RGB to HSV. or is its opposite.
|
||||
|
||||
this function converts RGB to HSV. or is its opposite.
|
||||
|
||||
### Quote source
|
||||
|
||||
@ -29,3 +30,14 @@ http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
|
||||
```
|
||||
#pragma glslify: random = require(glsl-util/random);
|
||||
```
|
||||
|
||||
## polar
|
||||
|
||||
this function calculates polar coordinates.
|
||||
|
||||
### usage
|
||||
|
||||
```
|
||||
#pragma glslify: polar = require(glsl-util/polar);
|
||||
vec3 p = polar(float radian1, float radian2, float radius);
|
||||
```
|
||||
|
8
polar.glsl
Normal file
8
polar.glsl
Normal file
@ -0,0 +1,8 @@
|
||||
vec3 polar(float radian1, float radian2, float radius) {
|
||||
return vec3(
|
||||
cos(radian1) * cos(radian2) * radius,
|
||||
sin(radian1) * radius,
|
||||
cos(radian1) * sin(radian2) * radius,
|
||||
)
|
||||
}
|
||||
#pragma glslify: export(polar)
|
Loading…
Reference in New Issue
Block a user