Home Reference Source
import {WebGpuContext} from './core/cgp/cgp_state.js'
public class | source

WebGpuContext

Extends:

cables-shared-client~EventsCGState → WebGpuContext

cables webgpu context/state manager

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

CULL_MODES: string[]

public

DEPTH_FUNCS: string[]

public

catchErrors: boolean

public

device: *

public

frame: number

public

gApi: *

public

lastErrorMsg: string

public

patch: *

Private Members
private

_defaultBlend: {"color": *, "alpha": *}

private
private
private
private

_log: *

private
private
private
private
private
private
private
private
private
private
private

_viewport: number[]

Method Summary

Public Methods
public

createMesh(geom: *, glPrimitive: *): *

public
public
public
public

getShader(): *

public

getViewPort(): Array

public
public

pop face culling enabled state

public

pop face culling face side

public

pop depth compare func

public

pop depth testing state

public

pop depth writing state

public

popErrorScope(cb: *)

public

pop current used shader from shader stack

public

pushBlend(b: *)

public

pushCullFace(b: Boolean)

push face culling face enabled state

public

push face culling face side

public

pushDepthFunc(f: string)

public

pushDepthTest(b: Boolean)

push depth testing enabled state

public

pushDepthWrite(b: Boolean)

push depth write enabled state

public

pushErrorScope(name: *, options: {})

public

pushShader(shader: Object)

push a shader to the shader stack

public
public

renderStart(cgp: *, identTranslate: *, identTranslateView: *)

public

setDevice(device: *)

public

setViewPort(x: *, y: *, w: *, h: *)

public

stateBlend(): *

public

stateCullFace(): Boolean

current state of face culling

public

stateCullFaceFacing(): Boolean

current state of face culling side

public

stateDepthFunc(): string

public

stateDepthTest(): Boolean

current state of depth testing

public

stateDepthWrite(): Boolean

current state of depth writing

Inherited Summary

From class CGState
public get

canvas: *

public get
public get
public get
public set
public
public
public
public
public
public
public
public
public

aborted: boolean

public

autoReSize: boolean

public

canvasScale: number

public
public
public
public

mMatrix: mat4

Current model matrix

public

pMatrix: mat4

Current projection matrix

public

patch: *

public

vMatrix: mat4

Current view matrix

private

_ident: *

private
private
private
private
private
public
public
public
public
public

modelMatrix(): mat4

get model matrix

public

popModelMatrix(): mat4

pop model matrix stack

public

popPMatrix(): mat4

pop projection matrix stack

public

popViewMatrix(): mat4

pop view matrix stack

public

push a matrix to the model matrix stack

public

push a matrix to the projection matrix stack

public

push a matrix to the view matrix stack

public

setAutoResize(parent: *)

public

setCanvas(canvEle: *)

public

setSize(w: *, h: *, ignorestyle: *)

public

shouldDrawHelpers(): boolean

public
private
private
private
private

_startMatrixStacks(identTranslate: *, identTranslateView: *)

Public Constructors

public constructor() source

Override:

CGState#constructor

Public Members

public CULL_MODES: string[] source

public DEPTH_FUNCS: string[] source

public catchErrors: boolean source

public device: * source

public frame: number source

public gApi: * source

public lastErrorMsg: string source

public patch: * source

Override:

CGState#patch

Private Members

private _defaultBlend: {"color": *, "alpha": *} source

private _defaultTexture: * source

private _emptyTexture: * source

private _errorTexture: * source

private _log: * source

private _shaderStack: *[] source

private _simpleShader: * source

private _stackBlend: *[] source

private _stackCullFace: *[] source

private _stackCullFaceFacing: *[] source

private _stackDepthFunc: *[] source

private _stackDepthTest: *[] source

private _stackDepthWrite: *[] source

private _stackErrorScope: *[] source

private _stackErrorScopeLogs: *[] source

private _viewport: number[] source

Public Methods

public createMesh(geom: *, glPrimitive: *): * source

Params:

NameTypeAttributeDescription
geom *
glPrimitive *

Return:

*

public getDefaultTexture(): * source

Return:

*

public getEmptyTexture(): * source

Return:

*

public getErrorTexture(): * source

Return:

*

public getShader(): * source

Return:

*

public getViewPort(): Array source

Return:

Array

array [x,y,w,h]

public popBlend() source

public popCullFace() source

pop face culling enabled state

public popCullFaceFacing() source

pop face culling face side

public popDepthFunc() source

pop depth compare func

public popDepthTest() source

pop depth testing state

public popDepthWrite() source

pop depth writing state

public popErrorScope(cb: *) source

Params:

NameTypeAttributeDescription
cb *

public popShader() source

pop current used shader from shader stack

public pushBlend(b: *) source

Params:

NameTypeAttributeDescription
b *

public pushCullFace(b: Boolean) source

push face culling face enabled state

Params:

NameTypeAttributeDescription
b Boolean

enabled

public pushCullFaceFacing(b: *) source

push face culling face side

Params:

NameTypeAttributeDescription
b *

public pushDepthFunc(f: string) source

Params:

NameTypeAttributeDescription
f string

depth compare func

public pushDepthTest(b: Boolean) source

push depth testing enabled state

Params:

NameTypeAttributeDescription
b Boolean

enabled

public pushDepthWrite(b: Boolean) source

push depth write enabled state

Params:

NameTypeAttributeDescription
b Boolean

enabled

public pushErrorScope(name: *, options: {}) source

Params:

NameTypeAttributeDescription
name *
options {}
  • optional
  • default: {}

public pushShader(shader: Object) source

push a shader to the shader stack

Params:

NameTypeAttributeDescription
shader Object

public renderEnd() source

public renderStart(cgp: *, identTranslate: *, identTranslateView: *) source

Params:

NameTypeAttributeDescription
cgp *
identTranslate *
identTranslateView *

public setDevice(device: *) source

Params:

NameTypeAttributeDescription
device *

public setViewPort(x: *, y: *, w: *, h: *) source

Params:

NameTypeAttributeDescription
x *
y *
w *
h *

public stateBlend(): * source

Return:

*

public stateCullFace(): Boolean source

current state of face culling

Return:

Boolean

enabled

public stateCullFaceFacing(): Boolean source

current state of face culling side

Return:

Boolean

enabled

public stateDepthFunc(): string source

Return:

string

public stateDepthTest(): Boolean source

current state of depth testing

Return:

Boolean

enabled

public stateDepthWrite(): Boolean source

current state of depth writing

Return:

Boolean

enabled