UNPKG

gpu-curtains

Version:

gpu-curtains is a 3D WebGPU rendering engine. It can be used as a standalone 3D engine, but also includes extra classes focused on mapping 3d objects to DOM elements; It allows users to synchronize values such as position, sizing, or scale between them.

22 lines (17 loc) 686 B
const REIndirectDiffuse = ( /* wgsl */ ` fn getIndirectDiffuse(irradiance: vec3f, diffuseColor: vec3f, ptr_reflectedLight: ptr<function, ReflectedLight>) { (*ptr_reflectedLight).indirectDiffuse += irradiance * BRDF_Lambert( diffuseColor ); } // Indirect Diffuse RenderEquations fn RE_IndirectDiffuse(irradiance: vec3f, diffuseColor: vec3f, ptr_reflectedLight: ptr<function, ReflectedLight>) { var totalAmbientIrradiance: vec3f = irradiance; for(var i: i32 = 0; i < ambientLights.count; i++) { totalAmbientIrradiance += ambientLights.color[i]; } getIndirectDiffuse(totalAmbientIrradiance, diffuseColor, ptr_reflectedLight); } ` ); export { REIndirectDiffuse };