Home Reference Source
public class | source

Shader

Extends:

GLBoostObject → Shader

Static Method Summary

Static Public Methods
public static
public static

isMixin(source: *): boolean

public static

isThisGLVersion_2(gl: *): *

public static

mixin(source: *)

public static

removeMixin(source: *)

public static

swapMixin(current: *, newone: *)

public static

trySettingMatrix33ToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, matrixArray: *)

public static

trySettingMatrix44ToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, matrixArray: *)

public static

trySettingVec2ArrayToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, vecArray: *)

public static

trySettingVec3ArrayToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, vecArray: *)

public static

trySettingVec4ArrayToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, vecArray: *)

Static Private Methods
private static

_exist(functions: *, glboostConstantForAttributeType: *): *

private static
private static

_generateShadowingStr(gl: *, i: *, isShadowEnabledAsTexture: *): *

private static

_getNormalStr(gl: *, material: *, f: *): *

private static
private static
private static
private static

_glslVer(gl: *): *

private static

_in_onFrag(gl: *): *

private static

_in_onVert(gl: *): *

private static

_out_onVert(gl: *): *

private static
private static

_set_glFragData_inGLVer1(gl: *, i: *): *

private static

_set_outColor_onFrag(gl: *, i: *): *

private static

_textureProj_func(gl: *): *

private static

_texture_func(gl: *): *

Constructor Summary

Public Constructor
public

constructor(glBoostContext: *)

Member Summary

Public Members
public get

dirty: *

public set

dirty: *

public get
Private Members
private
private

Method Summary

Public Methods
public
public

getShaderParameter(material: *, parameterName: *, defaultValue: *): *

public

getShaderProgram(expression: *, vertexAttribs: *, existCamera_f: *, lights_: *, material: *, extraData: *): *

public
public

setUniforms(gl: *, glslProgram: *, scene: *, material: *, camera: *, mesh: *, lights: *)

public

setUniformsAsTearDown(gl: *, glslProgram: *, scene: *, material: *, camera: *, mesh: *, lights: *)

Private Methods
private

_addLineNumber(shaderString: *): *

private

_getFragmentShaderString(gl: *, functions: *, lights: *, material: *, extraData: *): *

private
private

_getShader(gl: *, theSource: *, type: *): *

private

_getVertexShaderString(gl: *, functions: *, existCamera_f: *, lights: *, material: *, extraData: *): *

private

_initShaders(gl: *, vertexShaderStr: *, fragmentShaderStr: *): *

private
private

_prepareAssetsForShaders(gl: *, shaderProgram: *, expression: *, vertexAttribs: *, existCamera_f: *, lights: *, material: *, extraData: *, canvas: *): *

private

_removeDuplicatedLine(shaderString: *): *

private

Inherited Summary

From class GLBoostObject
public static
private static
private static
public get
public get
public get

Return the simple class-specific number.

public get
public get
public get
public get
public get
public get
public set
private
private
private
private
private
private
private
private
private
private
public
public
public
public

Return instance name.

public
private

_copy(instance: *)

private

Static Public Methods

public static initMixinMethodArray() source

public static isMixin(source: *): boolean source

Params:

NameTypeAttributeDescription
source *

Return:

boolean

public static isThisGLVersion_2(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

public static mixin(source: *) source

Params:

NameTypeAttributeDescription
source *

public static removeMixin(source: *) source

Params:

NameTypeAttributeDescription
source *

public static swapMixin(current: *, newone: *) source

Params:

NameTypeAttributeDescription
current *
newone *

public static trySettingMatrix33ToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, matrixArray: *) source

Params:

NameTypeAttributeDescription
gl *
hashIdOfGLSLProgram *
material *
semanticsDir *
semantics *
matrixArray *

public static trySettingMatrix44ToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, matrixArray: *) source

Params:

NameTypeAttributeDescription
gl *
hashIdOfGLSLProgram *
material *
semanticsDir *
semantics *
matrixArray *

public static trySettingVec2ArrayToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, vecArray: *) source

Params:

NameTypeAttributeDescription
gl *
hashIdOfGLSLProgram *
material *
semanticsDir *
semantics *
vecArray *

public static trySettingVec3ArrayToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, vecArray: *) source

Params:

NameTypeAttributeDescription
gl *
hashIdOfGLSLProgram *
material *
semanticsDir *
semantics *
vecArray *

public static trySettingVec4ArrayToUniform(gl: *, hashIdOfGLSLProgram: *, material: *, semanticsDir: *, semantics: *, vecArray: *) source

Params:

NameTypeAttributeDescription
gl *
hashIdOfGLSLProgram *
material *
semanticsDir *
semantics *
vecArray *

Static Private Methods

private static _exist(functions: *, glboostConstantForAttributeType: *): * source

Params:

NameTypeAttributeDescription
functions *
glboostConstantForAttributeType *

Return:

*

private static _generateLightStr(i: *): * source

Params:

NameTypeAttributeDescription
i *

Return:

*

private static _generateShadowingStr(gl: *, i: *, isShadowEnabledAsTexture: *): * source

Params:

NameTypeAttributeDescription
gl *
i *
isShadowEnabledAsTexture *

Return:

*

private static _getNormalStr(gl: *, material: *, f: *): * source

Params:

NameTypeAttributeDescription
gl *
material *
f *

Return:

*

private static _glsl1DrawBufferExt(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _glsl1ShaderTextureLodExt(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _glsl1StdDerivativeExt(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _glslVer(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _in_onFrag(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _in_onVert(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _out_onVert(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _set_glFragColor_inGLVer1(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _set_glFragData_inGLVer1(gl: *, i: *): * source

Params:

NameTypeAttributeDescription
gl *
i *

Return:

*

private static _set_outColor_onFrag(gl: *, i: *): * source

Params:

NameTypeAttributeDescription
gl *
i *

Return:

*

private static _textureProj_func(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private static _texture_func(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

Public Constructors

public constructor(glBoostContext: *) source

Override:

GLBoostObject#constructor

Params:

NameTypeAttributeDescription
glBoostContext *

Public Members

public get dirty: * source

public set dirty: * source

public get glslProgram: * source

Private Members

private _dirty: boolean source

private _glslProgram: * source

Public Methods

public getDefaultPointLightIfNotExist(lights: *): * source

Params:

NameTypeAttributeDescription
lights *

Return:

*

public getShaderParameter(material: *, parameterName: *, defaultValue: *): * source

Params:

NameTypeAttributeDescription
material *
parameterName *
defaultValue *

Return:

*

public getShaderProgram(expression: *, vertexAttribs: *, existCamera_f: *, lights_: *, material: *, extraData: *): * source

Params:

NameTypeAttributeDescription
expression *
vertexAttribs *
existCamera_f *
lights_ *
material *
extraData *
  • optional
  • default: {}

Return:

*

public readyForDiscard() source

Override:

GLBoostObject#readyForDiscard

public setUniforms(gl: *, glslProgram: *, scene: *, material: *, camera: *, mesh: *, lights: *) source

Params:

NameTypeAttributeDescription
gl *
glslProgram *
scene *
material *
camera *
mesh *
lights *

public setUniformsAsTearDown(gl: *, glslProgram: *, scene: *, material: *, camera: *, mesh: *, lights: *) source

Params:

NameTypeAttributeDescription
gl *
glslProgram *
scene *
material *
camera *
mesh *
lights *

Private Methods

private _addLineNumber(shaderString: *): * source

Params:

NameTypeAttributeDescription
shaderString *

Return:

*

private _getFragmentShaderString(gl: *, functions: *, lights: *, material: *, extraData: *): * source

Params:

NameTypeAttributeDescription
gl *
functions *
lights *
material *
extraData *

Return:

*

private _getMaxDrawBuffers(): number source

Return:

number

private _getShader(gl: *, theSource: *, type: *): * source

Params:

NameTypeAttributeDescription
gl *
theSource *
type *

Return:

*

private _getVertexShaderString(gl: *, functions: *, existCamera_f: *, lights: *, material: *, extraData: *): * source

Params:

NameTypeAttributeDescription
gl *
functions *
existCamera_f *
lights *
material *
extraData *

Return:

*

private _initShaders(gl: *, vertexShaderStr: *, fragmentShaderStr: *): * source

Params:

NameTypeAttributeDescription
gl *
vertexShaderStr *
fragmentShaderStr *

Return:

*

private _multiplyAlphaToColorOfTexel(gl: *): * source

Params:

NameTypeAttributeDescription
gl *

Return:

*

private _prepareAssetsForShaders(gl: *, shaderProgram: *, expression: *, vertexAttribs: *, existCamera_f: *, lights: *, material: *, extraData: *, canvas: *): * source

Params:

NameTypeAttributeDescription
gl *
shaderProgram *
expression *
vertexAttribs *
existCamera_f *
lights *
material *
extraData *
canvas *

Return:

*

private _removeDuplicatedLine(shaderString: *): * source

Params:

NameTypeAttributeDescription
shaderString *

Return:

*

private _sampler2DShadow_func(): * source

Return:

*