本文整理汇总了TypeScript中neuroglancer/webgl/shader_lib.setVec4FromUint32函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setVec4FromUint32函数的具体用法?TypeScript setVec4FromUint32怎么用?TypeScript setVec4FromUint32使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setVec4FromUint32函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: testPair
function testPair(a: number, b: number) {
let result = (a + b) >>> 0;
gl.uniform4fv(shader.uniform('uValue1'), setVec4FromUint32(vec4.create(), a));
gl.uniform4fv(shader.uniform('uValue2'), setVec4FromUint32(vec4.create(), b));
tester.execute();
let value = tester.readUint32();
expect(value).toEqual(result, `${a} + ${b}`);
}
示例2: testOffset
function testOffset(x: number) {
let value = data[x];
gl.uniform1f(shader.uniform('uOffset'), x);
gl.uniform4fv(shader.uniform('uExpected'), setVec4FromUint32(new Float32Array(4), value));
gl.activeTexture(gl.TEXTURE0 + textureUnit);
gl.bindTexture(gl.TEXTURE_2D, texture);
tester.execute();
gl.bindTexture(gl.TEXTURE_2D, null);
let actual = new Float32Array(4);
let expected = new Float32Array(4);
for (let i = 0; i < 4; ++i) {
actual[i] = tester.readFloat(i);
expected[i] = (value >>> (8 * i)) & 0xFF;
}
for (let i = 0; i < 4; ++i) {
expect(actual[i]).toBe(
expected[i],
`offset = ${x}, value = ${x}, actual = ${Array.from(actual)}, expected = ${
Array.from(expected)}`);
}
expect(tester.readFloat(4))
.toBe(value, `uint24le value != expected, offset = ${x}, value = ${x}`);
expect(tester.readFloat(5))
.toBe(1.0, `uExpected != value in shader, offset = ${x}, value = ${x}`);
}