Const
Advanced
Declares the constants PI and INV_PI for a bit that lists it in requires
PI
INV_PI
requires
The lighting of Material3D and PhongMaterial requires it already, so a bit for either must not declare its own PI or INV_PI: the second declaration fails the compile.
const ringsBit: ShaderBit = { name: 'rings', requires: [mathConstantsBit], gpu: { fragment: { material: 'albedo *= 0.75 + 0.25 * cos(input.vUV.x * 8.0 * PI);' } }, gl: { fragment: { material: 'albedo *= 0.75 + 0.25 * cos(vUV.x * 8.0 * PI);' } },}; Copy
const ringsBit: ShaderBit = { name: 'rings', requires: [mathConstantsBit], gpu: { fragment: { material: 'albedo *= 0.75 + 0.25 * cos(input.vUV.x * 8.0 * PI);' } }, gl: { fragment: { material: 'albedo *= 0.75 + 0.25 * cos(vUV.x * 8.0 * PI);' } },};
Declares the constants
PIandINV_PIfor a bit that lists it inrequiresThe lighting of Material3D and PhongMaterial requires it already, so a bit for either must not declare its own
PIorINV_PI: the second declaration fails the compile.