{"_id":"glsl-constants","_rev":"4-d58a976f3a99b856725af9fb68b9ec95","name":"glsl-constants","description":"Common GLSL math constants (with 11 decimals) available both as ES modules strings and as GLSL files for use with glslify.","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"glsl-constants","version":"1.0.0","keywords":["glsl","math","constants","glslify","webgl","shader"],"author":{"name":"Damien Seguin","email":"https://twitter.com/dmnsgn"},"license":"MIT","_id":"glsl-constants@1.0.0","maintainers":[{"name":"dmnsgn","email":"dmnsgn@gmail.com"}],"homepage":"https://github.com/dmnsgn/glsl-constants","bugs":{"url":"https://github.com/dmnsgn/glsl-constants/issues"},"dist":{"shasum":"d6a06571b08c4b4cff8de8c4977e65ec3a06a713","tarball":"https://registry.npmjs.org/glsl-constants/-/glsl-constants-1.0.0.tgz","fileCount":8,"integrity":"sha512-cC/sxTrHutIjeJlPiMLaHCCIkm2MaMgE2VmBjS5uiHzEOS3pCBFFpqWq2TGEhwKRYL73aHKuqHVWHp3ThnJd2A==","signatures":[{"sig":"MEUCIQCUTji215YPyOBpFQcsdj+94cWyOoDrjaQMF8HpQF62YwIgCf1l03Nz/OpIL/tnVkXNbk8e7nIcuhm/TTmh9MtsO0Y=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3031},"main":"PI.glsl","issues":{"url":"https://github.com/dmnsgn/glsl-constants/issues"},"gitHead":"b253f97c0456903aa2197593a5821bd1eba28313","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"dmnsgn","email":"dmnsgn@gmail.com"},"repository":{"url":"git+https://github.com/dmnsgn/glsl-constants.git","type":"git"},"_npmVersion":"5.6.0","description":"Common GLSL math constants (with 11 decimals).","directories":{},"_nodeVersion":"9.4.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/glsl-constants_1.0.0_1522112695204_0.36267775995612106","host":"s3://npm-registry-packages"}},"2.0.0":{"name":"glsl-constants","version":"2.0.0","keywords":["glsl","math","constants","glslify","webgl","shader"],"author":{"url":"https://github.com/dmnsgn","name":"Damien Seguin"},"license":"MIT","_id":"glsl-constants@2.0.0","maintainers":[{"name":"dmnsgn","email":"dmnsgn@gmail.com"}],"homepage":"https://github.com/dmnsgn/glsl-constants","bugs":{"url":"https://github.com/dmnsgn/glsl-constants/issues"},"dist":{"shasum":"596b726ebe75110aaba659df4e2471940129c117","tarball":"https://registry.npmjs.org/glsl-constants/-/glsl-constants-2.0.0.tgz","fileCount":39,"integrity":"sha512-PGNZJox3SVSrKdxAEgPzIUNGQjmdjApzdectCHQoiJCxwFhh4IFmiSSm58JhqBxyQOR5XWnBZFTBukzN7v06eA==","signatures":[{"sig":"MEYCIQCMpFGKkFYYt6/qliRzXV7ZhfMJ5J4wYGV7mctdBi5BOgIhAL/Qu5OPalOZCRui4GaXe44WVbHgUMgcJYZrf2QHQSCK","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10743,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiov4kACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr4Xg//YrFWVe/Ahe1MQWN3avWgEev5e2lnGgJ/mOogzCSSKjeNmyNT\r\niLCN/Kd1t93Ro/s11JEaAoz0sm8axKPzhLKsUb7m6KzS16KUbm+W7YGQZD13\r\nZ9yR5ft7t3OWzRuxjxgfLFlCVXvm1MHUS69/4N7fAclpCv5hF+H3BwgAGu75\r\niDgSVTEvHV4yYgKUpBDawhfvZEjBHbUcjruFgO7vpMzpuVhfnP7NNQ2dp//C\r\nvQXy9nhQOXd7PgS4nvQsQfUU9pcOq2/N2YPv3sCqYr4lx39WXCsi8pj1rGWt\r\njrq5XxSXfICckQXRQ8h00p6oVtc7MLEBR4jnIrV8Wm0bRmMGwGWoO0Ce0kCh\r\n2dlO7wqacx/xtgkDzQ+PamKyje8GdWzLdoLQWH++qIxBtJ7Q8DpbLpC9348h\r\nUYQ0nYEGwCrfp8hEiaulutD1Nwf70jWMhZQAu/RICllooDDoulfgz5ff194J\r\nS8TL1K1DmBmD/IHbsw9ePfc/CHcDFeji0fvmucbWWn2FZ9/1pSWjr2v01uFk\r\nNdGsDiCP3XF3VHxAXR1dTmbXK2eMMckbfCU0RM03YiUJEqE2fs7ybqtQoBWn\r\njNYYyR9I6b9XfTIFgbVXHdxb3ZSuK4rktu8QpzaoJQ8yOr0TvhKPEFPzS7FK\r\nwW/kOUta793kYeJTz2o9BUTKU1dFqetW3/o=\r\n=YT/Q\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","type":"module","types":"types/index.d.ts","engines":{"npm":">=7.0.0","node":">=16.0.0"},"exports":"./index.js","funding":[{"url":"https://paypal.me/dmnsgn","type":"individual"},{"url":"https://commerce.coinbase.com/checkout/56cbdf28-e323-48d8-9c98-7019e72c97f3","type":"individual"}],"gitHead":"aebf09a11d2964dd93e9f2d0aa55e315b45a3cd6","scripts":{"test":"glslify test/index.glsl"},"snowdev":{"dependencies":[]},"_npmUser":{"name":"dmnsgn","email":"dmnsgn@gmail.com"},"repository":{"url":"git+https://github.com/dmnsgn/glsl-constants.git","type":"git"},"_npmVersion":"8.9.0","description":"Common GLSL math constants (with 11 decimals) available both as ES modules strings and as GLSL files for use with glslify.","directories":{},"sideEffects":false,"_nodeVersion":"18.2.0","_hasShrinkwrap":false,"devDependencies":{"glslify":"^7.1.1","glsl-rotate":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/glsl-constants_2.0.0_1654849060172_0.40410029008554216","host":"s3://npm-registry-packages"}},"2.0.1":{"name":"glsl-constants","version":"2.0.1","description":"Common GLSL math constants (with 11 decimals) available both as ES modules strings and as GLSL files for use with glslify.","keywords":["glsl","math","constants","glslify","webgl","shader"],"homepage":"https://github.com/dmnsgn/glsl-constants","bugs":{"url":"https://github.com/dmnsgn/glsl-constants/issues"},"repository":{"type":"git","url":"git+https://github.com/dmnsgn/glsl-constants.git"},"funding":[{"type":"individual","url":"https://paypal.me/dmnsgn"},{"type":"individual","url":"https://commerce.coinbase.com/checkout/56cbdf28-e323-48d8-9c98-7019e72c97f3"}],"license":"MIT","author":{"name":"Damien Seguin","url":"https://github.com/dmnsgn"},"sideEffects":false,"type":"module","exports":{".":{"types":"./types/index.d.ts","default":"./index.js"}},"main":"index.js","types":"types/index.d.ts","scripts":{"test":"glslify test/index.glsl"},"devDependencies":{"glsl-rotate":"^2.0.0","glslify":"^7.1.1"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"snowdev":{"dependencies":[]},"_id":"glsl-constants@2.0.1","gitHead":"84c91531406dc5c650b705e506a36b28fb884a38","_nodeVersion":"22.3.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-+92w2eioJ6df1R+nd4BAbaCOZxYCJ6n33JgglwId1TlQ/w4kjPdnnNLxrLY4UjTk0C2XX43x7cFL2h62HtefwA==","shasum":"bca8662515fd0265adc5da782cb2cab1d9900133","tarball":"https://registry.npmjs.org/glsl-constants/-/glsl-constants-2.0.1.tgz","fileCount":39,"unpackedSize":11004,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB4C8TaCHDjk2F//Mx3N2acKtws8YCLoy9wFXzEftUEdAiEAzwsEhazlqjGwW5oPyB6VvmxLRglVD6UjGK60RhYHDcg="}]},"_npmUser":{"name":"dmnsgn","email":"dmnsgn@gmail.com"},"directories":{},"maintainers":[{"name":"dmnsgn","email":"dmnsgn@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/glsl-constants_2.0.1_1720277126693_0.09972930940581537"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-27T01:04:55.203Z","modified":"2024-07-06T14:45:27.140Z","1.0.0":"2018-03-27T01:04:55.248Z","2.0.0":"2022-06-10T08:17:40.428Z","2.0.1":"2024-07-06T14:45:26.965Z"},"maintainers":[{"name":"dmnsgn","email":"dmnsgn@gmail.com"}],"author":{"name":"Damien Seguin","url":"https://github.com/dmnsgn"},"repository":{"type":"git","url":"git+https://github.com/dmnsgn/glsl-constants.git"},"keywords":["glsl","math","constants","glslify","webgl","shader"],"license":"MIT","homepage":"https://github.com/dmnsgn/glsl-constants","bugs":{"url":"https://github.com/dmnsgn/glsl-constants/issues"},"readme":"# glsl-constants\n\n[![npm version](https://img.shields.io/npm/v/glsl-constants)](https://www.npmjs.com/package/glsl-constants)\n[![stability-stable](https://img.shields.io/badge/stability-stable-green.svg)](https://www.npmjs.com/package/glsl-constants)\n[![npm minzipped size](https://img.shields.io/bundlephobia/minzip/glsl-constants)](https://bundlephobia.com/package/glsl-constants)\n[![dependencies](https://img.shields.io/librariesio/release/npm/glsl-constants)](https://github.com/dmnsgn/glsl-constants/blob/main/package.json)\n[![types](https://img.shields.io/npm/types/glsl-constants)](https://github.com/microsoft/TypeScript)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-fa6673.svg)](https://conventionalcommits.org)\n[![styled with prettier](https://img.shields.io/badge/styled_with-Prettier-f8bc45.svg?logo=prettier)](https://github.com/prettier/prettier)\n[![linted with eslint](https://img.shields.io/badge/linted_with-ES_Lint-4B32C3.svg?logo=eslint)](https://github.com/eslint/eslint)\n[![license](https://img.shields.io/github/license/dmnsgn/glsl-constants)](https://github.com/dmnsgn/glsl-constants/blob/main/LICENSE.md)\n\nCommon GLSL math constants (with 11 decimals) available both as ES modules strings and as GLSL files for use with glslify.\n\n[![paypal](https://img.shields.io/badge/donate-paypal-informational?logo=paypal)](https://paypal.me/dmnsgn)\n[![coinbase](https://img.shields.io/badge/donate-coinbase-informational?logo=coinbase)](https://commerce.coinbase.com/checkout/56cbdf28-e323-48d8-9c98-7019e72c97f3)\n[![twitter](https://img.shields.io/twitter/follow/dmnsgn?style=social)](https://twitter.com/dmnsgn)\n\n## Installation\n\n```bash\nnpm install glsl-constants\n```\n\n## Usage\n\n### ESM\n\n```js\nimport * as glslConstants from \"glsl-constants\";\nimport * as glslRotate from \"glsl-rotate\";\n\nconst shader = /* glsl */ `\n${glslConstants.GAMMA}\n${glslConstants.RECIPROCAL_GAMMA}\n${glslConstants.TAU}\n${glslConstants.PI}\n${glslConstants.HALF_PI}\n${glslConstants.QUARTER_PI}\n${glslConstants.RECIPROCAL_PI}\n${glslConstants.RECIPROCAL_TAU}\n${glslConstants.TO_RADIANS}\n${glslConstants.TO_DEGREES}\n\n// ...\n\nvec3 toGamma(vec3 v) {\n  return pow(v, vec3(RECIPROCAL_GAMMA));\n}\n\n${glslRotate.rotate}\n\nvoid main() {\n  vec2 p2d = vec2(1.0, 0.0);\n  p2d = rotate(p2d, TAU);\n  p2d = rotate(p2d, PI);\n  p2d = rotate(p2d, HALF_PI);\n  p2d = rotate(p2d, QUARTER_PI);\n  p2d = rotate(p2d, PHI);\n  p2d = rotate(p2d, RECIPROCAL_PI);\n  p2d = rotate(p2d, RECIPROCAL_TAU);\n  p2d = rotate(p2d, 90.0 * TO_RADIANS);\n\n  // ...\n  gl_FragColor.rgb = toGamma(color.rgb);\n}\n`;\n```\n\n### glslify\n\n```glsl\n#pragma glslify: GAMMA = require(glsl-constants/GAMMA)\n#pragma glslify: TAU = require(glsl-constants/TAU)\n#pragma glslify: PI = require(glsl-constants/PI)\n#pragma glslify: HALF_PI = require(glsl-constants/HALF_PI)\n#pragma glslify: QUARTER_PI = require(glsl-constants/QUARTER_PI)\n#pragma glslify: PHI = require(glsl-constants/PHI)\n#pragma glslify: RECIPROCAL_PI = require(glsl-constants/RECIPROCAL_PI)\n#pragma glslify: RECIPROCAL_TAU = require(glsl-constants/RECIPROCAL_TAU)\n#pragma glslify: TO_RADIANS = require(glsl-constants/TO_RADIANS)\n#pragma glslify: TO_DEGREES = require(glsl-constants/TO_DEGREES)\n\n// ...\n\nvec3 toGamma(vec3 v) {\n  return pow(v, vec3(RECIPROCAL_GAMMA));\n}\n\n#pragma glslify: rotate = require(glsl-rotate)\n\nvoid main() {\n  vec2 p2d = vec2(1.0, 0.0);\n  p2d = rotate(p2d, TAU);\n  p2d = rotate(p2d, PI);\n  p2d = rotate(p2d, HALF_PI);\n  p2d = rotate(p2d, QUARTER_PI);\n  p2d = rotate(p2d, PHI);\n  p2d = rotate(p2d, RECIPROCAL_PI);\n  p2d = rotate(p2d, RECIPROCAL_TAU);\n  p2d = rotate(p2d, 90.0 * TO_RADIANS);\n\n  // ...\n  gl_FragColor.rgb = toGamma(color.rgb);\n}\n```\n\n## License\n\nMIT. See [license file](https://github.com/dmnsgn/glsl-constants/blob/main/LICENSE.md).\n","readmeFilename":"README.md"}