本文整理匯總了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}`);
}