Home Reference Source
import Shader from './core/cgp/cgp_shader.js'
public class | source

Shader

Extends:

EventTargetCgShader → Shader

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public

bindingCounter: number

public

bindingsComp: undefined[]

public

bindingsFrag: undefined[]

public

bindingsVert: undefined[]

public

compute: *

public
public
public
public
public get

isValid: *

public
public
public
public
public
public
public get
Private Members
private

_cgp: *

private

_compileReason: string

private

_isValid: boolean

private

_log: *

private

_name: *

private

_needsRecompile: boolean

private

_src: string

private
private
private

_uniforms: *[]

Method Summary

Public Methods
public

addUniform(type: String, name: String, valueOrPort: any, p2: *, p3: *, p4: *): Uniform

add a uniform to all shader programs

public

addUniformFrag(type: String, name: String, valueOrPort: any, p2: *, p3: *, p4: *): Uniform

add a uniform to the fragment shader

public

addUniformVert(type: String, name: String, valueOrPort: any, p2: *, p3: *, p4: *): Uniform

add a uniform to the vertex shader

public

bind()

public
public

error(e: *)

public

getName(): *

public

getUniform(name: *): *

public
public

reInit()

public

setSource(src: *)

public

setWhyCompile(why: *)

Private Methods
private

_addUniform(uni: *)

Inherited Summary

From class CgShader
public

id: *

private

_defines: *[]

private

_isValid: boolean

private

_needsRecompile: boolean

public

define(name: String, value: Any)

add a define to a shader, e.g.

public

getDefine(name: *): *

public

getDefines(): *

public

hasDefine(name: String): Boolean

return true if shader has define

public

remove a define from a shader

public

toggleDefine(name: name, enabled: any)

easily enable/disable a define without a value

Public Constructors

public constructor() source

Override:

CgShader#constructor

Public Members

public bindCountlastFrame: * source

public bindingCounter: number source

public bindingsComp: undefined[] source

public bindingsFrag: undefined[] source

public bindingsVert: undefined[] source

public compute: * source

public defaultBindingComp: * source

public defaultBindingFrag: * source

public defaultBindingVert: * source

public gpuShaderModule: * source

public get isValid: * source

public needsPipelineUpdate: string source

public uniModelMatrix: * source

public uniModelViewMatrix: * source

public uniNormalMatrix: * source

public uniProjMatrix: * source

public uniViewMatrix: * source

public get uniforms: * source

Private Members

private _cgp: * source

private _compileReason: string source

private _isValid: boolean source

Override:

CgShader#_isValid

private _log: * source

private _name: * source

private _needsRecompile: boolean source

Override:

CgShader#_needsRecompile

private _src: string source

private _tempModelViewMatrix: * source

private _tempNormalMatrix: * source

private _uniforms: *[] source

Public Methods

public addUniform(type: String, name: String, valueOrPort: any, p2: *, p3: *, p4: *): Uniform source

add a uniform to all shader programs

Params:

NameTypeAttributeDescription
type String

['f','t', etc]

name String
valueOrPort any

value or port

p2 *
p3 *
p4 *

Return:

Uniform

public addUniformFrag(type: String, name: String, valueOrPort: any, p2: *, p3: *, p4: *): Uniform source

add a uniform to the fragment shader

Params:

NameTypeAttributeDescription
type String

['f','t', etc]

name String
valueOrPort any

value or port

p2 *
p3 *
p4 *

Return:

Uniform

public addUniformVert(type: String, name: String, valueOrPort: any, p2: *, p3: *, p4: *): Uniform source

add a uniform to the vertex shader

Params:

NameTypeAttributeDescription
type String

['f','t', etc]

name String
valueOrPort any

value or port

p2 *
p3 *
p4 *

Return:

Uniform

public bind() source

public compile() source

public error(e: *) source

Params:

NameTypeAttributeDescription
e *

public getName(): * source

Return:

*

public getUniform(name: *): * source

Params:

NameTypeAttributeDescription
name *

Return:

*

public incBindingCounter() source

public reInit() source

public setSource(src: *) source

Params:

NameTypeAttributeDescription
src *

public setWhyCompile(why: *) source

Params:

NameTypeAttributeDescription
why *

Private Methods

private _addUniform(uni: *) source

Params:

NameTypeAttributeDescription
uni *