Package | laya.webgl.shader |
Class | public class Shader |
Inheritance | Shader BaseShader laya.resource.Resource |
Subclasses | Shader2X |
Property | Defined By | ||
---|---|---|---|
activeShader : BaseShader [static] | BaseShader | ||
bindShader : BaseShader [static] | BaseShader | ||
_id : int | Shader | ||
nameKey : StringKey [static] | Shader | ||
_offset : int = 0 | Shader | ||
_params : Array = null | Shader | ||
_paramsMap : * | Shader | ||
_preCompileShader : * [static] | Shader | ||
_program : * = null | Shader | ||
_pshader : * | Shader | ||
sharders : Array [static] | Shader | ||
tag : * | Shader | ||
_vshader : * | Shader |
Property | Defined By | ||
---|---|---|---|
shaderParamsMap : Object [static] | Shader |
Method | Defined By | ||
---|---|---|---|
Shader(vs:String, ps:String, saveName:* = null, nameMap:* = null)
根据vs和ps信息生成shader对象
| Shader | ||
addInclude(fileName:String, txt:String):void [static] | Shader | ||
[static] | Shader | ||
getParams():Array
得到编译后的变量及相关预定义
| Shader | ||
[static] | Shader | ||
getUniform(name:String):*
根据变量名字获得
| Shader | ||
preCompile(nameID:int, vs:String, ps:String, nameMap:*):void [static]
预编译shader文件,主要是处理宏定义
| Shader | ||
preCompile2D(nameID:int, mainID:int, vs:String, ps:String, nameMap:*):void [static]
预编译shader文件,主要是处理宏定义
| Shader | ||
upload(shaderValue:ShaderValue, params:Array = null):void
提交shader到GPU
| Shader | ||
uploadArray(shaderValue:Array, length:int, _bufferUsage:*):void
按数组的定义提交
| Shader | ||
uploadOne(name:String, value:*):void | Shader | ||
uploadTexture2D(value:*):void | Shader | ||
withCompile(nameID:int, define:*, shaderName:*, createShader:Function):Shader [static]
根据宏动态生成shader文件,支持#include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";条件嵌入文件
| Shader | ||
withCompile2D(nameID:int, mainID:int, define:*, shaderName:*, createShader:Function):Shader [static]
根据宏动态生成shader文件,支持#include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";条件嵌入文件
| Shader |
Method | Defined By | ||
---|---|---|---|
_preGetParams(vs:String, ps:String):Object | Shader | ||
detoryResource():void [override] | Shader | ||
recreateResource():void [override] | Shader |
Constant | Defined By | ||
---|---|---|---|
SHADERNAME2ID : Number = 0.0002 [static] | Shader |
_id | property |
public var _id:int
_offset | property |
public var _offset:int = 0
_params | property |
public var _params:Array = null
_paramsMap | property |
public var _paramsMap:*
_preCompileShader | property |
public static var _preCompileShader:*
_program | property |
public var _program:* = null
_pshader | property |
public var _pshader:*
_vshader | property |
public var _vshader:*
nameKey | property |
public static var nameKey:StringKey
shaderParamsMap | property |
protected static var shaderParamsMap:Object
sharders | property |
public static var sharders:Array
tag | property |
public var tag:*
Shader | () | Constructor |
public function Shader(vs:String, ps:String, saveName:* = null, nameMap:* = null)
根据vs和ps信息生成shader对象
Parametersvs:String | |
ps:String | |
saveName:* (default = null )
| |
nameMap:* (default = null ) — 帮助里要详细解释为什么需要nameMap
|
_preGetParams | () | method |
protected function _preGetParams(vs:String, ps:String):Object
Parameters
vs:String | |
ps:String |
Object |
addInclude | () | method |
public static function addInclude(fileName:String, txt:String):void
Parameters
fileName:String | |
txt:String |
create | () | method |
public static function create(vs:String, ps:String, saveName:* = null, nameMap:* = null):Shader
Parameters
vs:String | |
ps:String | |
saveName:* (default = null )
| |
nameMap:* (default = null )
|
Shader |
detoryResource | () | method |
override protected function detoryResource():void
getParams | () | method |
public function getParams():Array
得到编译后的变量及相关预定义
ReturnsArray —
|
getShader | () | method |
getUniform | () | method |
public function getUniform(name:String):*
根据变量名字获得
Parameters
name:String |
* —
|
preCompile | () | method |
public static function preCompile(nameID:int, vs:String, ps:String, nameMap:*):void
预编译shader文件,主要是处理宏定义
Parameters
nameID:int | |
vs:String | |
ps:String | |
nameMap:* |
preCompile2D | () | method |
public static function preCompile2D(nameID:int, mainID:int, vs:String, ps:String, nameMap:*):void
预编译shader文件,主要是处理宏定义
Parameters
nameID:int | |
mainID:int | |
vs:String | |
ps:String | |
nameMap:* |
recreateResource | () | method |
override protected function recreateResource():void
upload | () | method |
public function upload(shaderValue:ShaderValue, params:Array = null):void
提交shader到GPU
Parameters
shaderValue:ShaderValue | |
params:Array (default = null )
|
uploadArray | () | method |
public function uploadArray(shaderValue:Array, length:int, _bufferUsage:*):void
按数组的定义提交
Parameters
shaderValue:Array — 数组格式[name,value,...]
| |
length:int | |
_bufferUsage:* |
uploadOne | () | method |
public function uploadOne(name:String, value:*):void
Parameters
name:String | |
value:* |
uploadTexture2D | () | method |
public function uploadTexture2D(value:*):void
Parameters
value:* |
withCompile | () | method |
public static function withCompile(nameID:int, define:*, shaderName:*, createShader:Function):Shader
根据宏动态生成shader文件,支持#include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";条件嵌入文件
Parameters
nameID:int | |
define:* | |
shaderName:* | |
createShader:Function — 宏定义,格式:{name:value...}
|
Shader —
|
withCompile2D | () | method |
public static function withCompile2D(nameID:int, mainID:int, define:*, shaderName:*, createShader:Function):Shader
根据宏动态生成shader文件,支持#include?COLOR_FILTER "parts/ColorFilter_ps_logic.glsl";条件嵌入文件
Parameters
nameID:int | |
mainID:int | |
define:* | |
shaderName:* — 宏定义,格式:{name:value...}
| |
createShader:Function |
Shader —
|
SHADERNAME2ID | Constant |
public static const SHADERNAME2ID:Number = 0.0002