@absulit/points
Version:
A Generative Art library made in WebGPU
61 lines (53 loc) • 1.62 kB
JavaScript
/**
* The defaultStructs are structs already incorporated onto the shaders you create,
* so you can call them without import.
* <br>
* Fragment, Sound, and Event structs.
* <br>
* <br>
* Fragment used in Vertex Shaders.<br>
* Sound used along with {@link Points#setAudio}<br>
* Event used along with {@link Points#addEventListener}<br>
* @module defaultStructs
*/
const defaultStructs = /*wgsl*/`
struct ComputeIn {
GID: vec3u,
WID: vec3u,
LID: vec3u
}
struct VertexIn {
position:vec4f,
color:vec4f,
uv:vec2f,
normal:vec3f,
id:u32, // mesh id
barycentrics: vec3f,
vertexIndex: u32,
instanceIndex: u32
}
struct FragmentIn {
position: vec4f,
color: vec4f,
uv: vec2f,
ratio: vec2f, // relation between params.screen.x and params.screen.y
uvr: vec2f, // uv with aspect ratio corrected
mouse: vec2f,
normal: vec3f,
id: u32, // mesh or instance id
barycentrics: vec3f,
world: vec3f,
}
struct Sound {
data: array<f32, 2048>,
//play
//dataLength
//duration
//currentPosition
}
struct Event {
updated: u32,
// data: array<f32>
}
`;
export default defaultStructs;