Packagelaya.d3.shader
Classpublic class Shader3D
InheritanceShader3D Inheritance BaseShader Inheritance laya.resource.Resource



Public Properties
 PropertyDefined By
 InheritedactiveShader : BaseShader
[static]
BaseShader
  _attributeParams : Array = null
Shader3D
  _attributeParamsMap : Array
Shader3D
 InheritedbindShader : BaseShader
[static]
BaseShader
  _cameraUniformParamsMap : Array
Shader3D
  _id : int
Shader3D
  _includeFiles : *
[static]
Shader3D
  _materialUniformParamsMap : Array
Shader3D
  nameKey : StringKey
[static]
Shader3D
  _program : * = null
Shader3D
  _pshader : *
Shader3D
  _renderElementUniformParamsMap : Array
Shader3D
  _sceneUniformParamsMap : Array
Shader3D
  _spriteUniformParamsMap : Array
Shader3D
  _uniformParams : Array = null
Shader3D
  _vshader : *
Shader3D
Protected Properties
 PropertyDefined By
  shaderParamsMap : Object
[static]
Shader3D
Public Methods
 MethodDefined By
  
Shader3D(vs:String, ps:String, attributeMap:Object, sceneUniformMap:Object, cameraUniformMap:Object, spriteUniformMap:Object, materialUniformMap:Object, renderElementUniformMap:Object)
根据vs和ps信息生成shader对象
Shader3D
  
addInclude(fileName:String, txt:String):void
[static]
Shader3D
  
bind():Boolean
Shader3D
  
create(vs:String, ps:String, attributeMap:Object, sceneUniformMap:Object, cameraUniformMap:Object, spriteUniformMap:Object, materialUniformMap:Object, renderElementUniformMap:Object):Shader3D
[static]
Shader3D
  
uploadAttributes(attributeShaderValue:Array, _bufferUsage:*):void
按数组的定义提交
Shader3D
  
uploadCameraUniforms(shaderValue:Array):void
按数组的定义提交
Shader3D
  
uploadMaterialUniforms(shaderValue:Array):void
按数组的定义提交
Shader3D
  
uploadRenderElementUniforms(shaderValue:Array):void
按数组的定义提交
Shader3D
  
uploadSceneUniforms(shaderValue:Array):void
按数组的定义提交
Shader3D
  
uploadSpriteUniforms(shaderValue:Array):void
按数组的定义提交
Shader3D
  
uploadTexture2D(value:*):void
Shader3D
Protected Methods
 MethodDefined By
  
_preGetParams(vs:String, ps:String):Object
Shader3D
  
[override]
Shader3D
  
[override]
Shader3D
Public Constants
 ConstantDefined By
  PERIOD_CAMERA : int = 3
[static] shader变量提交周期,逐相机。
Shader3D
  PERIOD_MATERIAL : int = 1
[static] shader变量提交周期,逐材质。
Shader3D
  PERIOD_RENDERELEMENT : int = 0
[static] shader变量提交周期,逐渲染单元。
Shader3D
  PERIOD_SCENE : int = 4
[static] shader变量提交周期,逐场景。
Shader3D
  PERIOD_SPRITE : int = 2
[static] shader变量提交周期,逐精灵和相机,注:因为精灵包含MVP矩阵,为复合属性,所以摄像机发生变化时也应提交。
Shader3D
Property Detail
_attributeParamsproperty
public var _attributeParams:Array = null

_attributeParamsMapproperty 
public var _attributeParamsMap:Array

_cameraUniformParamsMapproperty 
public var _cameraUniformParamsMap:Array

_idproperty 
public var _id:int

_includeFilesproperty 
public static var _includeFiles:*

_materialUniformParamsMapproperty 
public var _materialUniformParamsMap:Array

_programproperty 
public var _program:* = null

_pshaderproperty 
public var _pshader:*

_renderElementUniformParamsMapproperty 
public var _renderElementUniformParamsMap:Array

_sceneUniformParamsMapproperty 
public var _sceneUniformParamsMap:Array

_spriteUniformParamsMapproperty 
public var _spriteUniformParamsMap:Array

_uniformParamsproperty 
public var _uniformParams:Array = null

_vshaderproperty 
public var _vshader:*

nameKeyproperty 
public static var nameKey:StringKey

shaderParamsMapproperty 
protected static var shaderParamsMap:Object

Constructor Detail
Shader3D()Constructor
public function Shader3D(vs:String, ps:String, attributeMap:Object, sceneUniformMap:Object, cameraUniformMap:Object, spriteUniformMap:Object, materialUniformMap:Object, renderElementUniformMap:Object)

根据vs和ps信息生成shader对象

Parameters
vs:String
 
ps:String
 
attributeMap:Object
 
sceneUniformMap:Object — 帮助里要详细解释为什么需要nameMap
 
cameraUniformMap:Object
 
spriteUniformMap:Object
 
materialUniformMap:Object
 
renderElementUniformMap:Object
Method Detail
_preGetParams()method
protected function _preGetParams(vs:String, ps:String):Object

Parameters

vs:String
 
ps:String

Returns
Object
addInclude()method 
public static function addInclude(fileName:String, txt:String):void

Parameters

fileName:String
 
txt:String

bind()method 
public function bind():Boolean

Returns
Boolean
create()method 
public static function create(vs:String, ps:String, attributeMap:Object, sceneUniformMap:Object, cameraUniformMap:Object, spriteUniformMap:Object, materialUniformMap:Object, renderElementUniformMap:Object):Shader3D

Parameters

vs:String
 
ps:String
 
attributeMap:Object
 
sceneUniformMap:Object
 
cameraUniformMap:Object
 
spriteUniformMap:Object
 
materialUniformMap:Object
 
renderElementUniformMap:Object

Returns
Shader3D
detoryResource()method 
override protected function detoryResource():void

recreateResource()method 
override protected function recreateResource():void

uploadAttributes()method 
public function uploadAttributes(attributeShaderValue:Array, _bufferUsage:*):void

按数组的定义提交

Parameters

attributeShaderValue:Array — 数组格式[name,value,...]
 
_bufferUsage:*

uploadCameraUniforms()method 
public function uploadCameraUniforms(shaderValue:Array):void

按数组的定义提交

Parameters

shaderValue:Array — 数组格式[name,value,...]

uploadMaterialUniforms()method 
public function uploadMaterialUniforms(shaderValue:Array):void

按数组的定义提交

Parameters

shaderValue:Array — 数组格式[name,value,...]

uploadRenderElementUniforms()method 
public function uploadRenderElementUniforms(shaderValue:Array):void

按数组的定义提交

Parameters

shaderValue:Array — 数组格式[name,value,...]

uploadSceneUniforms()method 
public function uploadSceneUniforms(shaderValue:Array):void

按数组的定义提交

Parameters

shaderValue:Array — 数组格式[name,value,...]

uploadSpriteUniforms()method 
public function uploadSpriteUniforms(shaderValue:Array):void

按数组的定义提交

Parameters

shaderValue:Array — 数组格式[name,value,...]

uploadTexture2D()method 
public function uploadTexture2D(value:*):void

Parameters

value:*

Constant Detail
PERIOD_CAMERAConstant
public static const PERIOD_CAMERA:int = 3

shader变量提交周期,逐相机。

PERIOD_MATERIALConstant 
public static const PERIOD_MATERIAL:int = 1

shader变量提交周期,逐材质。

PERIOD_RENDERELEMENTConstant 
public static const PERIOD_RENDERELEMENT:int = 0

shader变量提交周期,逐渲染单元。

PERIOD_SCENEConstant 
public static const PERIOD_SCENE:int = 4

shader变量提交周期,逐场景。

PERIOD_SPRITEConstant 
public static const PERIOD_SPRITE:int = 2

shader变量提交周期,逐精灵和相机,注:因为精灵包含MVP矩阵,为复合属性,所以摄像机发生变化时也应提交。