This commit is contained in:
Alon Zakai 2014-08-15 16:07:58 -07:00
Родитель 6a14c99241
Коммит 4fe5e75d84
2 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -150,6 +150,10 @@ function WebGLClient() {
ctx.uniform1f(objects[buffer[i]], buffer[i+1]);
i += 2;
}
function uniform3f() {
ctx.uniform3f(objects[buffer[i]], buffer[i+1], buffer[i+2], buffer[i+3]);
i += 4;
}
function uniform3fv() {
ctx.uniform3fv(objects[buffer[i]], buffer[i+1]);
i += 2;
@ -233,6 +237,11 @@ function WebGLClient() {
66: { name: 'blendEquation', func: func1 },
67: { name: 'generateMipmap', func: func1 },
68: { name: 'uniformMatrix3fv', func: func3L0 },
69: { name: 'stencilMask', func: func1 },
70: { name: 'clearStencil', func: func1 },
71: { name: 'texSubImage2D', func: func9 },
72: { name: 'uniform3f', func: uniform3f },
73: { name: 'blendFuncSeparate', func: func4 },
};
function renderCommands(buf) {

Просмотреть файл

@ -936,6 +936,36 @@ function WebGLWorker() {
if (!location) return;
commandBuffer.push(68, location.id, transpose, new Float32Array(data));
};
this.stencilMask = function(mask) {
commandBuffer.push(69, mask);
};
this.clearStencil = function(s) {
commandBuffer.push(70, s);
};
this.texSubImage2D = function(target, level, xoffset, yoffset, width, height, format, type, pixels) {
if (pixels === undefined) {
// shorter overload: target, level, xoffset, yoffset, format, type, pixels
var formatTemp = format;
format = width;
type = height;
pixels = formatTemp;
assert(pixels instanceof Image);
assert(format === this.RGBA); // HTML Images are RGBA, 8-bit
assert(type === this.UNSIGNED_BYTE);
var data = pixels.data;
width = data.width;
height = data.height;
pixels = new Uint8Array(data.data); // XXX transform from clamped to normal, could have been done in duplicate
}
commandBuffer.push(71, target, level, xoffset, yoffset, width, height, format, type, duplicate(pixels));
};
this.uniform3f = function(location, x, y, z) {
if (!location) return;
commandBuffer.push(72, location.id, x, y, z);
};
this.blendFuncSeparate = function(srcRGB, dstRGB, srcAlpha, dstAlpha) {
commandBuffer.push(73, srcRGB, dstRGB, srcAlpha, dstAlpha);
}
// Setup