Skip to main content

Type Alias: ShaderModule<PropsT, UniformsT, BindingsT>

ShaderModule<PropsT, UniformsT, BindingsT> = object

Defined in: lib/shader-module/shader-module.ts:41

A shader module definition object

Note​

Needs to be initialized with initializeShaderModules

Note​

UniformsT & BindingsT are deduced from PropsT by default. If a custom type for UniformsT is used, BindingsT should be also be provided.

Type Parameters​

PropsT​

PropsT extends Record<string, any> = Record<string, any>

UniformsT​

UniformsT extends Record<string, ShaderModuleUniformValue> = PickUniforms<PropsT>

BindingsT​

BindingsT extends Record<string, Binding> = PickBindings<PropsT>

Properties​

bindingLayout?​

optional bindingLayout?: readonly ShaderModuleBindingLayout[]

Defined in: lib/shader-module/shader-module.ts:53

Logical bind-group assignment for bindings declared by this module


bindings?​

optional bindings?: BindingsT

Defined in: lib/shader-module/shader-module.ts:51

Used for type inference, not currently used for values


defaultUniforms?​

optional defaultUniforms?: Required<UniformsT>

Defined in: lib/shader-module/shader-module.ts:76

Default uniform values


defines?​

optional defines?: Record<string, boolean | number>

Defined in: lib/shader-module/shader-module.ts:85

Boolean or numeric preprocessor defines contributed by this shader module.


dependencies?​

optional dependencies?: ShaderModule<any, any>[]

Defined in: lib/shader-module/shader-module.ts:86


deprecations?​

optional deprecations?: ShaderModuleDeprecation[]

Defined in: lib/shader-module/shader-module.ts:88

Information on deprecated properties


firstBindingSlot?​

optional firstBindingSlot?: number

Defined in: lib/shader-module/shader-module.ts:55

Preferred starting binding slot for this module's WGSL @binding(auto) declarations.


fs?​

optional fs?: string

Defined in: lib/shader-module/shader-module.ts:67

GLSL fragment shader code


getUniforms?​

optional getUniforms?: (props, prevUniforms?) => Partial<UniformsT & BindingsT>

Defined in: lib/shader-module/shader-module.ts:79

Function that maps props to uniforms & bindings

Parameters​

props​

Partial<PropsT>

prevUniforms?​

UniformsT

Returns​

Partial<UniformsT & BindingsT>


implements?​

optional implements?: string

Defined in: lib/shader-module/shader-module.ts:60

Exclusive named shader interface provided by this module.


instance?​

optional instance?: object

Defined in: lib/shader-module/shader-module.ts:91

The instance field contains information that is generated at run-time

normalizedInjections​

normalizedInjections: object

Empty compatibility value for consumers using older shadertools assembly.

normalizedInjections.fragment​

fragment: Record<string, ResolvedShaderInjection>

normalizedInjections.vertex​

vertex: Record<string, ResolvedShaderInjection>

parsedDeprecations​

parsedDeprecations: ShaderModuleDeprecation[]

propValidators?​

optional propValidators?: Record<string, PropValidator>


name​

name: string

Defined in: lib/shader-module/shader-module.ts:57


props?​

optional props?: PropsT

Defined in: lib/shader-module/shader-module.ts:47

Used for type inference not for values


propTypes?​

optional propTypes?: Record<keyof UniformsT, UniformInfo>

Defined in: lib/shader-module/shader-module.ts:74

Uniform JS prop types


source?​

optional source?: string

Defined in: lib/shader-module/shader-module.ts:65

WGSL code, or reusable code in sourceLanguage combined with the application source.


sourceLanguage?​

optional sourceLanguage?: string

Defined in: lib/shader-module/shader-module.ts:63

Language of source when an application-owned transpiler is required.


uniforms?​

optional uniforms?: UniformsT

Defined in: lib/shader-module/shader-module.ts:49

Used for type inference, not currently used for values


uniformTypes?​

optional uniformTypes?: Required<UniformTypes<UniformsT>>

Defined in: lib/shader-module/shader-module.ts:72

Uniform shader types @note: Both order and types MUST match uniform block declarations in shader


vs?​

optional vs?: string

Defined in: lib/shader-module/shader-module.ts:69

GLSL vertex shader code