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.

19 lines (16 loc) 426 B
const getLambertDirect = ( /* wgsl */ ` fn getLambertDirect( normal: vec3f, diffuseColor: vec3f, directLight: DirectLight, ptr_reflectedLight: ptr<function, ReflectedLight> ) { let NdotL = saturate(dot(normal, directLight.direction)); let irradiance: vec3f = NdotL * directLight.color; (*ptr_reflectedLight).directDiffuse += irradiance * BRDF_Lambert( diffuseColor ); } ` ); export { getLambertDirect };