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.

44 lines (33 loc) 1.21 kB
import { getVertexOutputStruct } from '../../chunks/vertex/head/get-vertex-output-struct.mjs'; import { getVertexOutput } from '../../chunks/vertex/body/get-vertex-output.mjs'; import { getVertexTransformedPositionNormal } from '../../chunks/vertex/body/get-vertex-transformed-position-normal.mjs'; import { declareAttributesVars } from '../../chunks/vertex/body/declare-attributes-vars.mjs'; import { patchAdditionalChunks } from '../../default-material-helpers.mjs'; const getVertexShaderCode = ({ bindings = [], geometry, chunks = null, additionalVaryings = [] }) => { chunks = patchAdditionalChunks(chunks); return ( /* wgsl */ ` ${chunks.additionalHead} ${getVertexOutputStruct({ geometry, additionalVaryings })} @vertex fn main( attributes: Attributes, ) -> VSOutput { var vsOutput: VSOutput; ${declareAttributesVars({ geometry })} // user defined preliminary contribution ${chunks.preliminaryContribution} ${getVertexTransformedPositionNormal({ bindings, geometry })} ${getVertexOutput({ geometry })} // user defined additional contribution ${chunks.additionalContribution} return vsOutput; }` ); }; export { getVertexShaderCode };