-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathShaderChunks.ts
40 lines (37 loc) · 1.49 KB
/
ShaderChunks.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { RenderMaterialShadersType } from '../../types/Materials'
import get_output_position from './chunks/get_output_position.wgsl'
import get_uv_cover from './chunks/get_uv_cover.wgsl'
import get_vertex_to_uv_coords from './chunks/get_vertex_to_uv_coords.wgsl'
/** Defines {@link ShaderChunks} object structure */
export type ShaderChunks = Record<RenderMaterialShadersType, Record<string, string>>
/** Defines {@link ProjectedShaderChunks} object structure */
export type ProjectedShaderChunks = Record<RenderMaterialShadersType, Record<string, string>>
/**
* Useful WGSL code chunks added to the vertex and/or fragment shaders
*/
export const ShaderChunks = {
/** WGSL code chunks added to the vertex shader */
vertex: {
/** Applies given texture matrix to given uv coordinates */
get_uv_cover,
},
/** WGSL code chunks added to the fragment shader */
fragment: {
/** Applies given texture matrix to given uv coordinates */
get_uv_cover,
/** Convert vertex position to uv coordinates */
get_vertex_to_uv_coords,
},
} as ShaderChunks
/**
* Useful WGSL code chunks added to the projected Meshes vertex and/or fragment shaders
*/
export const ProjectedShaderChunks = {
/** WGSL code chunks added to the vertex shader */
vertex: {
/** Get output vec4f position vector by applying model view projection matrix to vec3f attribute position vector */
get_output_position,
},
/** WGSL code chunks added to the fragment shader */
fragment: {},
} as ProjectedShaderChunks