本文整理汇总了TypeScript中neuroglancer/webgl/shader.ShaderBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ShaderBuilder.build方法的具体用法?TypeScript ShaderBuilder.build怎么用?TypeScript ShaderBuilder.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neuroglancer/webgl/shader.ShaderBuilder
的用法示例。
在下文中一共展示了ShaderBuilder.build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ShaderBuilder
`elementWiseTextureShader:${numTextures}:${getObjectId(shaderModule)}`, () => {
let builder = new ShaderBuilder(gl);
builder.addVarying('vec2', 'vTexCoord');
builder.addUniform('sampler2D', 'uSampler', numTextures);
builder.addInitializer(shader => {
let textureIndices: number[] = [];
for (let i = 0; i < numTextures; ++i) {
textureIndices[i] = i;
}
gl.uniform1iv(shader.uniform('uSampler'), textureIndices);
});
for (let i = 0; i < numTextures; ++i) {
builder.addFragmentCode(`
vec4 getValue${i}() {
return texture2D(uSampler[${i}], vTexCoord);
}
`);
}
builder.addUniform('mat4', 'uProjectionMatrix');
builder.require(shaderModule);
builder.addAttribute('vec4', 'aVertexPosition');
builder.addAttribute('vec2', 'aTexCoord');
builder.setVertexMain(
'vTexCoord = aTexCoord; gl_Position = uProjectionMatrix * aVertexPosition;');
return builder.build();
});
示例2: ShaderBuilder
return gl.memoize.get('trivialUniformColorShader', () => {
let builder = new ShaderBuilder(gl);
builder.addUniform('mat4', 'uProjectionMatrix');
builder.addAttribute('vec4', 'aVertexPosition');
builder.addUniform('vec4', 'uColor');
builder.setFragmentMain('gl_FragColor = uColor;');
builder.setVertexMain('gl_Position = uProjectionMatrix * aVertexPosition;');
return builder.build();
});
示例3: ShaderBuilder
return gl.memoize.get('trivialColorShader', () => {
let builder = new ShaderBuilder(gl);
builder.addVarying('vec4', 'vColor');
builder.addOutputBuffer('vec4', 'v4f_fragColor', null);
builder.setFragmentMain('v4f_fragColor = vColor;');
builder.addAttribute('vec4', 'aVertexPosition');
builder.addAttribute('vec4', 'aColor');
builder.addUniform('mat4', 'uProjectionMatrix');
builder.setVertexMain('vColor = aColor; gl_Position = uProjectionMatrix * aVertexPosition;');
return builder.build();
});