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.
13 lines (11 loc) • 408 B
JavaScript
//#region src/core/shaders/chunks/vertex/head/get-normal-helpers.ts
/** Get `normal` (`vec3f`) in world or view space. */
const getNormalHelpers = `
fn getWorldNormal(normal: vec3f) -> vec3f {
return normalize(matrices.normal * normal);
}
fn getViewNormal(normal: vec3f) -> vec3f {
return normalize((camera.view * vec4(matrices.normal * normal, 0.0)).xyz);
}`;
//#endregion
export { getNormalHelpers };