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 (17 loc) 482 B
const declareAttributesVars = ({ geometry }) => { let attributeVars = geometry.vertexBuffers.map( (vertexBuffer) => vertexBuffer.attributes.map((attribute) => { return ( /* wgsl */ ` var ${attribute.name}: ${attribute.type} = attributes.${attribute.name};` ); }).join("") ).join("\n"); attributeVars += /* wgsl */ ` var instanceIndex: u32 = attributes.instanceIndex; `; return attributeVars; }; export { declareAttributesVars };