Class: DirectionalLightModel
Defined in: modules/engine/src/models/directional-light-model.ts:22
Extends
BaseLightModel<DirectionalLightModelProps>
Constructors
Constructor
new DirectionalLightModel(
device,props):DirectionalLightModel
Defined in: modules/engine/src/models/directional-light-model.ts:23
Parameters
device
Device
props
Returns
DirectionalLightModel
Overrides
BaseLightModel<DirectionalLightModelProps>.constructor
Properties
_attributeInfos
_attributeInfos:
Record<string,AttributeInfo> ={}
Defined in: modules/engine/src/model/gpu-vector-model.ts:362
Inherited from
BaseLightModel._attributeInfos
_gpuGeometry
_gpuGeometry:
GPUGeometry|null
Defined in: modules/engine/src/model/model.ts:35
Inherited from
BaseLightModel._gpuGeometry
_lastDrawTimestamp
_lastDrawTimestamp:
number=-1
Defined in: modules/engine/src/model/gpu-vector-model.ts:389
"Time" of last draw. Monotonically increasing timestamp
Inherited from
BaseLightModel._lastDrawTimestamp
_lastLogTime
_lastLogTime:
number=0
Defined in: modules/engine/src/model/gpu-vector-model.ts:1702
Throttle draw call logging
Inherited from
BaseLightModel._lastLogTime
_logOpen
_logOpen:
boolean=false
Defined in: modules/engine/src/model/gpu-vector-model.ts:1703
Inherited from
BaseLightModel._logOpen
_pipelineNeedsUpdate
_pipelineNeedsUpdate:
string|false='newly created'
Defined in: modules/engine/src/model/gpu-vector-model.ts:382
Inherited from
BaseLightModel._pipelineNeedsUpdate
_uniformStore
_uniformStore:
UniformStore
Defined in: modules/engine/src/model/gpu-vector-model.ts:360
Inherited from
BaseLightModel._uniformStore
bindings
bindings:
Record<string,ModelBinding> ={}
Defined in: modules/engine/src/model/gpu-vector-model.ts:341
Bindings (textures, samplers, uniform buffers)
Inherited from
BaseLightModel.bindings
bufferAttributes
bufferAttributes:
Record<string,Buffer> ={}
Defined in: modules/engine/src/model/gpu-vector-model.ts:337
Buffer-valued attributes
Inherited from
BaseLightModel.bufferAttributes
bufferLayout
bufferLayout:
BufferLayout[]
Defined in: modules/engine/src/model/gpu-vector-model.ts:317
Buffer layout
Inherited from
BaseLightModel.bufferLayout
constantAttributes
constantAttributes:
Record<string,TypedArray> ={}
Defined in: modules/engine/src/model/gpu-vector-model.ts:339
Constant-valued attributes
Inherited from
BaseLightModel.constantAttributes
device
readonlydevice:Device
Defined in: modules/engine/src/model/gpu-vector-model.ts:290
Device that created this model
Inherited from
BaseLightModel.device
firstIndex
firstIndex:
number
Defined in: modules/engine/src/model/gpu-vector-model.ts:332
First index element for WebGPU indexed draws.
Inherited from
BaseLightModel.firstIndex
firstVertex
firstVertex:
number
Defined in: modules/engine/src/model/gpu-vector-model.ts:330
First vertex byte offset for WebGL indexed draws or first vertex for non-indexed draws.
Inherited from
BaseLightModel.firstVertex
fs
readonlyfs:string
Defined in: modules/engine/src/model/gpu-vector-model.ts:301
GLSL fragment shader source
Inherited from
BaseLightModel.fs
id
readonlyid:string
Defined in: modules/engine/src/model/gpu-vector-model.ts:292
Application provided identifier
Inherited from
BaseLightModel.id
indexBuffer
indexBuffer:
Buffer|null=null
Defined in: modules/engine/src/model/gpu-vector-model.ts:335
Index buffer
Inherited from
BaseLightModel.indexBuffer
indexCount
indexCount:
number|undefined
Defined in: modules/engine/src/model/gpu-vector-model.ts:328
Indexed draw count override. Undefined uses vertexCount, then the full bound index buffer.
Inherited from
BaseLightModel.indexCount
instanceCount
instanceCount:
number=0
Defined in: modules/engine/src/model/gpu-vector-model.ts:324
instance count. undefined means not instanced
Inherited from
BaseLightModel.instanceCount
isInstanced
isInstanced:
boolean|undefined=undefined
Defined in: modules/engine/src/model/gpu-vector-model.ts:322
Use instanced rendering
Inherited from
BaseLightModel.isInstanced
material
material:
Material<Partial<Record<string,Record<string,unknown>>>,MaterialBindings> |null
Defined in: modules/engine/src/model/model.ts:34
Inherited from
BaseLightModel.material
parameters
parameters:
RenderPipelineParameters
Defined in: modules/engine/src/model/gpu-vector-model.ts:312
The render pipeline GPU parameters, depth testing etc
Inherited from
BaseLightModel.parameters
pipeline
pipeline:
RenderPipeline
Defined in: modules/engine/src/model/gpu-vector-model.ts:354
The underlying GPU "program".
Note
May be recreated if parameters change
Inherited from
BaseLightModel.pipeline
pipelineFactory
readonlypipelineFactory:PipelineFactory
Defined in: modules/engine/src/model/gpu-vector-model.ts:303
Factory used to create render pipelines
Inherited from
BaseLightModel.pipelineFactory
shaderFactory
readonlyshaderFactory:ShaderFactory
Defined in: modules/engine/src/model/gpu-vector-model.ts:305
Factory used to create shaders
Inherited from
BaseLightModel.shaderFactory
shaderInputs
shaderInputs:
ShaderInputs
Defined in: modules/engine/src/model/gpu-vector-model.ts:358
ShaderInputs instance
Inherited from
BaseLightModel.shaderInputs
source
readonlysource:string
Defined in: modules/engine/src/model/gpu-vector-model.ts:295
WGSL shader source when using unified shader
Inherited from
BaseLightModel.source
topology
topology:
PrimitiveTopology
Defined in: modules/engine/src/model/gpu-vector-model.ts:315
The primitive topology
Inherited from
BaseLightModel.topology
transformFeedback
transformFeedback:
TransformFeedback|null=null
Defined in: modules/engine/src/model/gpu-vector-model.ts:351
TransformFeedback, WebGL 2 only.
Inherited from
BaseLightModel.transformFeedback
userData
userData:
object={}
Defined in: modules/engine/src/model/gpu-vector-model.ts:307
User-supplied per-model data
Index Signature
[key: string]: unknown
Inherited from
BaseLightModel.userData
vertexArray
vertexArray:
VertexArray
Defined in: modules/engine/src/model/gpu-vector-model.ts:348
VertexArray
Note
not implemented: if bufferLayout is updated, vertex array has to be rebuilt!
Todo
- allow application to define multiple vertex arrays?
Inherited from
BaseLightModel.vertexArray
vertexCount
vertexCount:
number
Defined in: modules/engine/src/model/gpu-vector-model.ts:326
Vertex count
Inherited from
BaseLightModel.vertexCount
vs
readonlyvs:string
Defined in: modules/engine/src/model/gpu-vector-model.ts:298
GLSL vertex shader source
Inherited from
BaseLightModel.vs
defaultProps
staticdefaultProps:Required<GPUVectorModelProps> &object
Defined in: modules/engine/src/model/model.ts:29
Type Declaration
material
material:
Material
Inherited from
BaseLightModel.defaultProps
Accessors
[toStringTag]
Get Signature
get [toStringTag]():
string
Defined in: modules/engine/src/model/gpu-vector-model.ts:393
Returns
string
Inherited from
BaseLightModel.[toStringTag]
sourceGeometry
Get Signature
get sourceGeometry():
Geometry|GPUVectorGeometry|GPUGeometry|null|undefined
Defined in: modules/engine/src/model/model.ts:40
Borrowed source geometry, retained for scene adapters such as physics cooking.
Returns
Geometry | GPUVectorGeometry | GPUGeometry | null | undefined
Inherited from
BaseLightModel.sourceGeometry
Methods
_areBindingsLoading()
_areBindingsLoading():
string|false
Defined in: modules/engine/src/model/model.ts:132
Check that bindings are loaded. Returns id of first binding that is still loading.
Returns
string | false
Inherited from
BaseLightModel._areBindingsLoading
_getAttributeDebugTable()
_getAttributeDebugTable():
Record<string,Record<string,unknown>>
Defined in: modules/engine/src/model/gpu-vector-model.ts:1754
Returns
Record<string, Record<string, unknown>>
Inherited from
BaseLightModel._getAttributeDebugTable
_getBindGroupCacheKeys()
_getBindGroupCacheKeys():
Partial<Record<number,object>>
Defined in: modules/engine/src/model/model.ts:155
Returns
Partial<Record<number, object>>
Inherited from
BaseLightModel._getBindGroupCacheKeys
_getBindGroups()
_getBindGroups(
shaderLayout?,bindings?):BindingsByGroup
Defined in: modules/engine/src/model/model.ts:141
Groups resolved resource bindings for the current shader layout.
Parameters
shaderLayout?
AnyShaderLayout = ...
Reflected bindings used to group logical binding names.
bindings?
Record<string, Binding> = ...
GPUVectorModel bindings already resolved for this draw preparation.
Returns
BindingsByGroup
Inherited from
BaseLightModel._getBindGroups
_getBindings()
_getBindings(
shaderLayout?):Record<string,Binding>
Defined in: modules/engine/src/model/gpu-vector-model.ts:1509
Resolves ready model bindings for the current shader layout.
Parameters
shaderLayout?
AnyShaderLayout = ...
Reflected bindings used to select copied or external texture resolution.
Returns
Record<string, Binding>
Inherited from
BaseLightModel._getBindings
_getBindingsUpdateTimestamp()
_getBindingsUpdateTimestamp():
number
Defined in: modules/engine/src/model/model.ts:160
Get the timestamp of the latest updated bound GPU memory resource (buffer/texture).
Returns
number
Inherited from
BaseLightModel._getBindingsUpdateTimestamp
_getBufferOrConstantValues()
_getBufferOrConstantValues(
attribute,dataType):string
Defined in: modules/engine/src/model/gpu-vector-model.ts:1782
Parameters
attribute
TypedArray | Buffer
dataType
any
Returns
string
Inherited from
BaseLightModel._getBufferOrConstantValues
_logDrawCallEnd()
_logDrawCallEnd():
void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1718
Returns
void
Inherited from
BaseLightModel._logDrawCallEnd
_logDrawCallStart()
_logDrawCallStart():
void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1705
Returns
void
Inherited from
BaseLightModel._logDrawCallStart
_logFramebuffer()
_logFramebuffer(
renderPass):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1739
Parameters
renderPass
RenderPass
Returns
void
Inherited from
BaseLightModel._logFramebuffer
_setPipelineNeedsUpdate()
_setPipelineNeedsUpdate(
reason):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1580
Mark pipeline as needing update
Parameters
reason
string
Returns
void
Inherited from
BaseLightModel._setPipelineNeedsUpdate
_updatePipeline()
_updatePipeline():
RenderPipeline
Defined in: modules/engine/src/model/gpu-vector-model.ts:1587
Update pipeline if needed
Returns
RenderPipeline
Inherited from
BaseLightModel._updatePipeline
_updatePipelineAsync()
_updatePipelineAsync():
Promise<RenderPipeline>
Defined in: modules/engine/src/model/gpu-vector-model.ts:1603
Creates or replaces the render pipeline through the backend's asynchronous compilation path.
Returns
Promise<RenderPipeline>
Inherited from
BaseLightModel._updatePipelineAsync
destroy()
destroy():
void
Defined in: modules/engine/src/models/light-model-utils.ts:152
Returns
void
Inherited from
BaseLightModel.destroy
draw()
draw(
renderPass,options?):boolean
Defined in: modules/engine/src/models/light-model-utils.ts:158
Issue one draw call.
Parameters
renderPass
RenderPass
render pass to draw into
options?
Optional dynamic parameters restored after drawing, including on errors.
Returns
boolean
true if the draw call was executed, false if resources were not ready.
Inherited from
BaseLightModel.draw
drawBatches()
drawBatches<
Inputs>(renderPass,__namedParameters):boolean
Defined in: modules/engine/src/model/gpu-vector-model.ts:1067
Draws each aligned physical chunk without taking ownership of input vectors.
Each batch uses a separate aligned slot for managed shader-input uniforms set by
onBatch. Slots are reused on each call: submit previous draws before changing their
values or growing the allocation. Explicit buffers remain caller-managed. Vector
lengths and physical chunk boundaries must match.
Type Parameters
Inputs
Inputs extends GPUVectorModelInputs = GPUVectorModelInputs
Parameters
renderPass
RenderPass
__namedParameters
GPUVectorModelDrawBatchesOptions<Inputs>
Returns
boolean
Inherited from
BaseLightModel.drawBatches
getBindingDebugTable()
getBindingDebugTable(): readonly
ShaderBindingDebugRow[]
Defined in: modules/engine/src/model/gpu-vector-model.ts:662
Returns WGSL binding debug rows for the assembled shader. Returns an empty array for GLSL models.
Returns
readonly ShaderBindingDebugRow[]
Inherited from
BaseLightModel.getBindingDebugTable
needsRedraw()
needsRedraw():
string|false
Defined in: modules/engine/src/model/gpu-vector-model.ts:646
Query redraw status. Clears the status.
Returns
string | false
Inherited from
BaseLightModel.needsRedraw
predraw()
predraw(
commandEncoder):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:672
Updates uniforms and pipeline state before opening a render pass.
Parameters
commandEncoder
CommandEncoder
Encoder that should own any GPU uploads emitted during draw preparation.
Returns
void
Inherited from
BaseLightModel.predraw
setAttributes()
setAttributes(
buffers,options?):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1390
Sets attributes (buffers)
Parameters
buffers
Record<string, ModelBuffer>
options?
byteOffsets?
Record<string, number>
Optional byte offsets, keyed by buffer name, where each buffer's vertex data starts. Buffers without an entry are bound at offset 0.
disableWarnings?
boolean
Returns
void
Note
Overrides any attributes previously set with the same name
Inherited from
BaseLightModel.setAttributes
setAttributeVectors()
setAttributeVectors(
vectors,bufferLayouts?):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:861
Replaces supplemental vectors; instanced models default these inputs to instance step mode.
Parameters
vectors
bufferLayouts?
BufferLayout[]
Returns
void
Inherited from
BaseLightModel.setAttributeVectors
setBindings()
setBindings(
bindings):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1349
Sets bindings (textures, samplers, uniform buffers)
Parameters
bindings
Record<string, ModelBinding>
Returns
void
Inherited from
BaseLightModel.setBindings
setBufferLayout()
setBufferLayout(
bufferLayout):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1195
Updates the buffer layout.
Parameters
bufferLayout
BufferLayout[]
Returns
void
Note
Triggers a pipeline rebuild / pipeline cache fetch
Inherited from
BaseLightModel.setBufferLayout
setConstantAttributes()
setConstantAttributes(
attributes,options?):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1476
Sets constant attributes
Parameters
attributes
Record<string, TypedArray>
options?
disableWarnings?
boolean
Returns
void
Note
Overrides any attributes previously set with the same name Constant attributes are only supported in WebGL, not in WebGPU Any attribute that is disabled in the current vertex array object is read from the context's global constant value for that attribute location.
Inherited from
BaseLightModel.setConstantAttributes
setDrawOffsets()
setDrawOffsets(
__namedParameters):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1306
Updates the first indexed/non-indexed draw offsets.
Parameters
__namedParameters
firstIndex
number
firstVertex
number
Returns
void
Inherited from
BaseLightModel.setDrawOffsets
setGeometry()
setGeometry(
geometry):void
Defined in: modules/engine/src/model/model.ts:90
Adapts CPU and legacy buffer geometry into the GPU vector geometry API.
Parameters
geometry
Geometry | GPUVectorGeometry | GPUGeometry | null
Returns
void
Inherited from
BaseLightModel.setGeometry
setGeometryVectors()
setGeometryVectors(
vectors,bufferLayouts?):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:828
Replaces per-vertex mesh vectors while preserving supplemental attributes.
Parameters
vectors
bufferLayouts?
BufferLayout[]
Returns
void
Inherited from
BaseLightModel.setGeometryVectors
setGPUAttributes()
setGPUAttributes(
vectors,bufferLayouts):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:914
Binds typed columns using caller-resolved layouts, including packed groups.
Parameters
vectors
bufferLayouts
BufferLayout[]
Returns
void
Inherited from
BaseLightModel.setGPUAttributes
setGPUVectors()
setGPUVectors(
vectors,options?):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1027
Binds contiguous borrowed vectors; use drawBatches() for multi-chunk inputs.
Parameters
vectors
options?
count?
Returns
void
Inherited from
BaseLightModel.setGPUVectors
setIndexBuffer()
setIndexBuffer(
indexBuffer):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1366
Sets the index buffer
Parameters
indexBuffer
ModelBuffer | null
Returns
void
Todo
- how to unset it if we change geometry?
Inherited from
BaseLightModel.setIndexBuffer
setIndexCount()
setIndexCount(
indexCount):void
Defined in: modules/engine/src/model/model.ts:104
Updates the indexed draw count override.
Parameters
indexCount
number | undefined
Returns
void
Inherited from
BaseLightModel.setIndexCount
setIndexVector()
setIndexVector(
vector):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:919
Replaces the borrowed contiguous uint16/uint32 index vector.
Parameters
vector
GPUVectorModelInput | null
Returns
void
Inherited from
BaseLightModel.setIndexVector
setInstanceCount()
setInstanceCount(
instanceCount):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1279
Updates the instance count (used in draw calls)
Parameters
instanceCount
number
Returns
void
Note
Any attributes with stepMode=instance need to be at least this big
Inherited from
BaseLightModel.setInstanceCount
setMaterial()
setMaterial(
material):void
Defined in: modules/engine/src/model/model.ts:109
Parameters
material
Material<Partial<Record<string, Record<string, unknown>>>, MaterialBindings> | null
Returns
void
Inherited from
BaseLightModel.setMaterial
setNeedsRedraw()
setNeedsRedraw(
reason):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:657
Mark the model as needing a redraw
Parameters
reason
string
Returns
void
Inherited from
BaseLightModel.setNeedsRedraw
setParameters()
setParameters(
parameters):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1262
Set GPU parameters.
Parameters
parameters
RenderPipelineParameters
Returns
void
Note
Can trigger a pipeline rebuild / pipeline cache fetch on WebGPU. On WebGL, parameters are applied at each draw call, so the pipeline is kept.
Inherited from
BaseLightModel.setParameters
setProps()
setProps(
props):void
Defined in: modules/engine/src/models/light-model-utils.ts:165
Parameters
props
Partial<PropsT>
Returns
void
Inherited from
BaseLightModel.setProps
setShaderInputs()
setShaderInputs(
shaderInputs):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1313
Set the shader inputs
Parameters
shaderInputs
Returns
void
Inherited from
BaseLightModel.setShaderInputs
setTopology()
setTopology(
topology):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1184
Updates the primitive topology ('triangle-list', 'triangle-strip' etc).
Parameters
topology
PrimitiveTopology
Returns
void
Note
Triggers a pipeline rebuild / pipeline cache fetch on WebGPU
Inherited from
BaseLightModel.setTopology
setTransformFeedback()
setTransformFeedback(
transformFeedback):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1357
Updates optional transform feedback. WebGL only.
Parameters
transformFeedback
TransformFeedback | null
Returns
void
Inherited from
BaseLightModel.setTransformFeedback
setVertexCount()
setVertexCount(
vertexCount):void
Defined in: modules/engine/src/model/gpu-vector-model.ts:1293
Updates the vertex count (used in draw calls)
Parameters
vertexCount
number
Returns
void
Note
Any attributes with stepMode=vertex need to be at least this big
Inherited from
BaseLightModel.setVertexCount
toString()
toString():
string
Defined in: modules/engine/src/model/gpu-vector-model.ts:397
Returns
string
Inherited from
BaseLightModel.toString
updateShaderInputs()
updateShaderInputs(
commandEncoder?):void
Defined in: modules/engine/src/model/model.ts:118
Flushes current shader-input values into managed uniform buffers and resource bindings.
Parameters
commandEncoder?
CommandEncoder
Optional encoder used to order uniform uploads with subsequent draw commands.
Returns
void
Inherited from
BaseLightModel.updateShaderInputs
createAsync()
staticcreateAsync<ModelType,Props>(this,device,props):Promise<ModelType>
Defined in: modules/engine/src/model/gpu-vector-model.ts:218
Creates a model while allowing the backend to compile its render pipeline asynchronously.
Type Parameters
ModelType
ModelType extends GPUVectorModel
Props
Props = GPUVectorModelProps
Parameters
this
(device, props) => ModelType
device
Device
props
Props
Returns
Promise<ModelType>
Inherited from
BaseLightModel.createAsync