IShaders

着色器

new YS.IShaders(ys, i3d)

自定义shader类
Name Type Description
ys YouScene YouScene实例
i3d I3d 3d对象
Example:
var shader = new YS.DrawRectangleShader(scene);
shader.init();

//更新框选范围
var p1 = YS.MathEngine.sphericalToModelR(SCENE._modelMatrix, extent.west, extent.south, centerZ);
var p2 = YS.MathEngine.sphericalToModelR(SCENE._modelMatrix, extent.east, extent.north, centerZ);

shader.update(p1, p2);
See:

Members

model

数据实体
Properties:
Type Description
I3d

Methods

init(options)

初始化shader
Name Type Description
options Object optional options
Name Type Description
programs Array.<Number> optional 要更改shader的program序号数组

abstractsetUniforms(uniforms)

设置shader的uniform变量
Name Type Description
uniforms Array uniforms变量定义
Name Type Description
name string uniforms变量名
typeId Cesium.WebGLConstants uniforms变量类型
count int optional 如果uniforms是数组的话,这里定义数组长度,否则0或者undefined
defaultValue Object 变量默认值
Example:
[{
       name: 'u_from',
       typeId: Cesium.WebGLConstants.FLOAT_VEC2,
       defaultValue: [0, 0]
  }
]

update()

更新shader数据