Class: RenderShader
Hierarchy
↳
RenderShader
Constructors
Properties
- useRz
- vsName
- fsName
- shaderState
- textures
- pipeline
- bindGroupLayouts
- materialDataUniformBuffer
- envMap
- prefilterMap
- instanceID
- shaderVariant
- vsEntryPoint
- fsEntryPoint
- bindGroups
- shaderReflection
- defineValue
- constValues
- uniforms
Accessors
Methods
- setShaderEntry
- setUniform
- setTexture
- getTexture
- genRenderPipeline
- reBuild
- apply
- preCompile
- applyPostDefine
- setBindGroup
- destroy
- destroyShader
- getShader
- createShader
- noticeShaderChange
- noticeValueChange
- setStorageBuffer
- setStructStorageBuffer
- setUniformBuffer
- setDefine
- hasDefine
- deleteDefine
- setUniformFloat
- setUniformVector2
- setUniformVector3
- setUniformVector4
- setUniformColor
- setUniformArray
- getUniform
Constructors
constructor
• new RenderShader(vs
, fs
)
Parameters
Name | Type |
---|---|
vs | string |
fs | string |
Overrides
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:83
Properties
useRz
• useRz: boolean
= false
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:32
vsName
• vsName: string
Vertex shader name
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:37
fsName
• fsName: string
Fragment shader name
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:42
shaderState
• shaderState: ShaderState
State of the shader
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:47
textures
• textures: Object
The collection of textures used in shading
Index signature
▪ [name: string
]: Texture
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:52
pipeline
• pipeline: GPURenderPipeline
Render pipeline
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:57
bindGroupLayouts
• bindGroupLayouts: GPUBindGroupLayout
[]
BindGroup layout
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:62
materialDataUniformBuffer
• materialDataUniformBuffer: MaterialDataUniformGPUBuffer
Uniform data for materials
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:67
envMap
• envMap: Texture
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:69
prefilterMap
• prefilterMap: Texture
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:71
instanceID
• Readonly
instanceID: string
Shader Unique instance id
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:20
shaderVariant
• shaderVariant: string
Shader variant value
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:25
vsEntryPoint
• vsEntryPoint: string
Vertex stage entry point name
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:30
fsEntryPoint
• fsEntryPoint: string
Fragment stage entry point name
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:35
bindGroups
• bindGroups: GPUBindGroup
[]
BindGroup collection
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:40
shaderReflection
• shaderReflection: ShaderReflection
Shader reflection info
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:45
defineValue
• defineValue: Object
The defined syntax value of the Shader when it is precompiled
Index signature
▪ [name: string
]: any
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:50
constValues
• constValues: Object
The constant value of the Shader when it is precompiled
Index signature
▪ [name: string
]: any
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:55
uniforms
• uniforms: Object
Uniforms data collection
Index signature
▪ [name: string
]: UniformNode
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:60
Accessors
renderOrder
• get
renderOrder(): number
Blend mode
Returns
number
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:119
• set
renderOrder(value
): void
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:123
doubleSide
• get
doubleSide(): boolean
Cull mode
Returns
boolean
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:133
• set
doubleSide(value
): void
Parameters
Name | Type |
---|---|
value | boolean |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:137
cullMode
• get
cullMode(): GPUCullMode
get render face cull mode
Returns
GPUCullMode
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:148
• set
cullMode(value
): void
set render face cull mode
Parameters
Name | Type |
---|---|
value | GPUCullMode |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:155
frontFace
• get
frontFace(): GPUFrontFace
get front face mode
GPUFront Face
Returns
GPUFrontFace
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:166
• set
frontFace(value
): void
set front face mode
GPUFront Face
value
Parameters
Name | Type |
---|---|
value | GPUFrontFace |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:174
depthBias
• get
depthBias(): number
Depth bias
Returns
number
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:184
• set
depthBias(value
): void
Parameters
Name | Type |
---|---|
value | number |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:188
topology
• get
topology(): GPUPrimitiveTopology
Primitive topology
Returns
GPUPrimitiveTopology
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:198
• set
topology(value
): void
Parameters
Name | Type |
---|---|
value | GPUPrimitiveTopology |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:202
blendMode
• get
blendMode(): BlendMode
Blend mode
Returns
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:212
• set
blendMode(value
): void
Parameters
Name | Type |
---|---|
value | BlendMode |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:216
depthCompare
• get
depthCompare(): GPUCompareFunction
Depth compare function
Returns
GPUCompareFunction
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:229
• set
depthCompare(value
): void
Parameters
Name | Type |
---|---|
value | GPUCompareFunction |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:233
baseColor
• get
baseColor(): Color
Returns
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:283
• set
baseColor(value
): void
Parameters
Name | Type |
---|---|
value | Color |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:287
Methods
setShaderEntry
▸ setShaderEntry(vsEntryPoint?
, fsEntryPoint?
): void
Sets the entry point names for the RenderShader vertex phase and fragment phase
Parameters
Name | Type | Default value |
---|---|---|
vsEntryPoint | string | '' |
fsEntryPoint | string | '' |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:245
setUniform
▸ setUniform(name
, value
): void
Parameters
Name | Type |
---|---|
name | string |
value | any |
Returns
void
Overrides
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:255
setTexture
▸ setTexture(name
, texture
): void
Set the texture used in the Render Shader code
Parameters
Name | Type | Description |
---|---|---|
name | string | Name in the shader code |
texture | Texture | Texture object |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:265
getTexture
▸ getTexture(name
): Texture
Get the texture used in the Render Shader code
Parameters
Name | Type | Description |
---|---|---|
name | string | Name in the shader code |
Returns
Texture object
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:296
genRenderPipeline
▸ genRenderPipeline(geometry
, renderPassState
): void
Create a rendering pipeline
Parameters
Name | Type |
---|---|
geometry | GeometryBase |
renderPassState | RendererPassState |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:305
reBuild
▸ reBuild(geometry
, rendererPassState
): void
Recompile the shader and create the rendering pipeline
Parameters
Name | Type |
---|---|
geometry | GeometryBase |
rendererPassState | RendererPassState |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:315
apply
▸ apply(geometry
, rendererPassState
, noticeFun?
): void
Apply render shader state value
Parameters
Name | Type |
---|---|
geometry | GeometryBase |
rendererPassState | RendererPassState |
noticeFun? | Function |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:329
preCompile
▸ preCompile(geometry
): void
Precompile the shader code
Parameters
Name | Type |
---|---|
geometry | GeometryBase |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:356
applyPostDefine
▸ applyPostDefine(shader
, renderPassState
): string
Apply defines syntax values
Parameters
Name | Type |
---|---|
shader | string |
renderPassState | RendererPassState |
Returns
string
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:369
setBindGroup
▸ setBindGroup(groupIndex
, group
): void
Set GPUBindGroup to the specified index slot
Parameters
Name | Type |
---|---|
groupIndex | number |
group | GPUBindGroup |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:392
destroy
▸ destroy(force?
): void
Destroy and release render shader related resources
Parameters
Name | Type |
---|---|
force? | boolean |
Returns
void
Overrides
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:901
destroyShader
▸ Static
destroyShader(instanceID
): void
Destroy a RenderShader object
Parameters
Name | Type | Description |
---|---|---|
instanceID | string | instance ID of the RenderShader |
Returns
void
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:942
getShader
▸ Static
getShader(instanceID
): RenderShader
Get the RenderShader object by specifying the RenderShader instance ID
Parameters
Name | Type | Description |
---|---|---|
instanceID | string | instance ID of the RenderShader |
Returns
RenderShader object
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:955
createShader
▸ Static
createShader(vs
, fs
): string
Create a RenderShader with vertex shaders and fragment shaders
Parameters
Name | Type | Description |
---|---|---|
vs | string | Vertex shader name |
fs | string | Fragment shader name |
Returns
string
Returns the instance ID of the RenderShader
Defined in
src/gfx/graphics/webGpu/shader/RenderShader.ts:965
noticeShaderChange
▸ noticeShaderChange(): void
notice shader change
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:77
noticeValueChange
▸ noticeValueChange(): void
notice shader state change
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:84
setStorageBuffer
▸ setStorageBuffer(name
, buffer
): void
set storage gpu buffer
Parameters
Name | Type | Description |
---|---|---|
name | string | buffer name |
buffer | StorageGPUBuffer | storage useAge gpu buffer |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:93
setStructStorageBuffer
▸ setStructStorageBuffer<T
>(name
, buffer
): void
set struct storage gpu buffer
Type parameters
Name | Type |
---|---|
T | extends Struct <T > |
Parameters
Name | Type | Description |
---|---|---|
name | string | buffer name |
buffer | StructStorageGPUBuffer <T > | struct storage useAge gpu buffer |
Returns
void
Inherited from
ShaderBase.setStructStorageBuffer
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:107
setUniformBuffer
▸ setUniformBuffer(name
, buffer
): void
set uniform gpu buffer min size 256
Parameters
Name | Type |
---|---|
name | string |
buffer | UniformGPUBuffer |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:121
setDefine
▸ setDefine(defineName
, value
): void
set define value
Parameters
Name | Type |
---|---|
defineName | string |
value | any |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:135
hasDefine
▸ hasDefine(defineName
): boolean
Whether there is a define key
Parameters
Name | Type |
---|---|
defineName | string |
Returns
boolean
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:149
deleteDefine
▸ deleteDefine(defineName
): void
delete define value
Parameters
Name | Type |
---|---|
defineName | string |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:157
setUniformFloat
▸ setUniformFloat(name
, value
): void
set uniform float value
Parameters
Name | Type |
---|---|
name | string |
value | number |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:167
setUniformVector2
▸ setUniformVector2(name
, value
): void
set uniform vector2 value
Parameters
Name | Type |
---|---|
name | string |
value | Vector2 |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:181
setUniformVector3
▸ setUniformVector3(name
, value
): void
set uniform vector3 value
Parameters
Name | Type |
---|---|
name | string |
value | Vector3 |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:195
setUniformVector4
▸ setUniformVector4(name
, value
): void
set uniform vector4 value
Parameters
Name | Type |
---|---|
name | string |
value | Vector4 |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:208
setUniformColor
▸ setUniformColor(name
, value
): void
set uniform color value
Parameters
Name | Type |
---|---|
name | string |
value | Color |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:221
setUniformArray
▸ setUniformArray(name
, value
): void
set uniform array value
Parameters
Name | Type |
---|---|
name | string |
value | Float32Array |
Returns
void
Inherited from
Defined in
src/gfx/graphics/webGpu/shader/ShaderBase.ts:234
getUniform
▸ getUniform(name
): any
Parameters
Name | Type |
---|---|
name | string |
Returns
any