Home Reference Source
import {CgShader} from './core/cg/cg_shader.js'
public class | source

CgShader

Extends:

EventTarget → CgShader

Direct Subclass:

Shader, Shader

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

id: *

Private Members
private

_defines: *[]

private

_isValid: boolean

private

_needsRecompile: boolean

Method Summary

Public Methods
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

Public Members

public id: * source

Private Members

private _defines: *[] source

private _isValid: boolean source

private _needsRecompile: boolean source

Public Methods

public define(name: String, value: Any) source

add a define to a shader, e.g. #define DO_THIS_THAT 1

Params:

NameTypeAttributeDescription
name String
value Any

(can be empty)

public getDefine(name: *): * source

Params:

NameTypeAttributeDescription
name *

Return:

*

public getDefines(): * source

Return:

*

public hasDefine(name: String): Boolean source

return true if shader has define

Params:

NameTypeAttributeDescription
name String

Return:

Boolean

public removeDefine(name: name) source

remove a define from a shader

Params:

NameTypeAttributeDescription
name name

public toggleDefine(name: name, enabled: any) source

easily enable/disable a define without a value

Params:

NameTypeAttributeDescription
name name
enabled any

value or port