Appearance
@tmrw-realityos/charm • Docs
@tmrw-realityos/charm / WebGPUImmediateDraw
Class: WebGPUImmediateDraw
An interface to render simple shapes in inmediate mode. Useful for gizmos and debug info. Do not use to render scene geometry as it wont be taken into account in many steps.
Usage
typescript
renderer.renderAlpha.on( () => {
renderer.draw.drawPoints(flat_array_of_points, color, pointSize);
})
You can change pipeline parameter using renderer.draw.pipeline:
typescript
renderer.draw.pipeline.push();
renderer.draw.pipeline.setBlend( BlendOperation.add, BlendFactor.one, BlendFactor.one );
renderer.draw.pipeline.setDepthTest( false );
renderer.draw.drawPoints(flat_array_of_points,color, pointSize);
renderer.draw.pipeline.pop();
Extends
DrawInterface
Constructors
new WebGPUImmediateDraw()
new WebGPUImmediateDraw(
context
):WebGPUImmediateDraw
Parameters
• context: WebGPURenderContext
Returns
Overrides
DrawInterface.constructor
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:68
Properties
ambientLight
ambientLight:
vec3
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:66
context
context:
WebGPURenderContext
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:40
drawBufferModified
drawBufferModified:
boolean
=false
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:59
flatShader
flatShader:
FlatShader
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:50
geometryBuffer
geometryBuffer:
WebGPUBuffer
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:41
geometryBufferModified
geometryBufferModified:
boolean
=false
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:58
geometryData
geometryData:
Float32Array
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:42
globalUniformsBindGroup?
optional
globalUniformsBindGroup:GPUBindGroup
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:48
lastGeometryOffset
lastGeometryOffset:
number
=0
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:46
lightVector
lightVector:
vec3
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:65
phongShader
phongShader:
PhongShader
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:53
pipeline
pipeline:
PipelineInfo
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:47
pipelineStack
pipelineStack:
number
[] =[]
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:56
pointsShader
pointsShader:
PointsShader
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:51
secondaryGeometryBuffer?
optional
secondaryGeometryBuffer:WebGPUBuffer
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:44
structData
structData:
Float32Array
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:55
textureShader
textureShader:
TextureShader
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:52
transform
transform:
mat4
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:61
transformStack
transformStack:
mat4
[]
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:62
Methods
bindGlobalsUniform()
bindGlobalsUniform(
renderPass
,index
):void
Parameters
• renderPass: GPURenderPassEncoder
• index: number
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:546
destroy()
destroy():
void
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:115
drawBox()
drawBox(
bmin
,bmax
,color
):void
Parameters
• bmin: vec3
• bmax: vec3
• color: vec4
Returns
void
Overrides
DrawInterface.drawBox
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:220
drawGeometry()
drawGeometry(
vertices
,color
,topology
):void
Parameters
• vertices: Float32Array
• color: vec4
• topology: Topology
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:384
drawLine()
drawLine(
vertices
,color
,strip
):void
draws simple lines
Parameters
• vertices: Float32Array
• color: vec4
• strip: boolean
= false
Returns
void
Overrides
DrawInterface.drawLine
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:212
drawMesh()
drawMesh(
mesh
,color
,usePhong
,strip
,start
,range
):void
draws a mesh as long as the attributes are not interleaved
Parameters
• mesh: WebGPUMesh
• color: vec4
• usePhong: boolean
= false
• strip: boolean
= false
• start: number
= 0
• range: number
= 0
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:300
drawPoints()
drawPoints(
vertices
,color
,pointSize
,fixedSize
):void
Parameters
• vertices: Float32Array
• color: vec4
• pointSize: number
• fixedSize: boolean
= true
Returns
void
Overrides
DrawInterface.drawPoints
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:149
drawTexture()
drawTexture(
texture
,area
,color
,gamma
,depth
):void
Parameters
• texture: GPUTexture
• area: vec4
• color: vec4
• gamma: boolean
= true
• depth: number
= 0
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:440
drawTexture3D()
drawTexture3D(
texture
,position
,size
,color
,gamma
):void
Parameters
• texture: GPUTexture
• position: vec3
• size: vec2
• color: vec4
• gamma: boolean
= true
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:489
pop()
pop():
void
Returns
void
Overrides
DrawInterface.pop
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:127
push()
push():
void
Returns
void
Overrides
DrawInterface.push
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:122
reset()
reset():
void
prepares the class for a new frame, resets some offsets to 0
Returns
void
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:102
rotate()
rotate(
axis
,angle_in_rad
):void
Parameters
• axis: vec3
• angle_in_rad: number
Returns
void
Overrides
DrawInterface.rotate
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:141
scale()
scale(
v
):void
Parameters
• v: vec3
Returns
void
Overrides
DrawInterface.scale
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:145
setTransform()
setTransform(
m
):void
Parameters
• m: ReadonlyMat4
Returns
void
Overrides
DrawInterface.setTransform
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:133
translate()
translate(
v
):void
Parameters
• v: vec3
Returns
void
Overrides
DrawInterface.translate
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:137
uploadGeometry()
uploadGeometry(
data
):number
Parameters
• data: Float32Array
Returns
number
Defined in
packages/charm/src/graphics/WebGPU/WebGPUImmediateDraw.ts:514