From 8fee64afe7ba2867255af94eae719f6f6b5ddc33 Mon Sep 17 00:00:00 2001 From: "petersont@google.com" Date: Fri, 9 Jul 2010 23:48:08 +0000 Subject: Implemented picking, at last. The picking sample is already checked in, but to get the sample to draw the right thing required a bunch of ancillary bug fixes, also in this cl. Review URL: http://codereview.chromium.org/2874008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52021 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/samples/o3d-webgl/param.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'o3d/samples/o3d-webgl/param.js') diff --git a/o3d/samples/o3d-webgl/param.js b/o3d/samples/o3d-webgl/param.js index a7b3e6f..59c0219 100644 --- a/o3d/samples/o3d-webgl/param.js +++ b/o3d/samples/o3d-webgl/param.js @@ -767,8 +767,29 @@ o3d.WorldViewProjectionInverseTransposeParamMatrix4 = function() { o3d.inherit('WorldViewProjectionInverseTransposeParamMatrix4', 'CompositionParamMatrix4'); + +/** + * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. + */ +o3d.ParamInteger.prototype.applyToLocation = function(gl, location) { + gl.uniform1i(location, this.value); +}; + +/** + * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. + */ +o3d.ParamBoolean.prototype.applyToLocation = function(gl, location) { + gl.uniform1i(location, this.value); +}; + /** * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. */ o3d.ParamFloat.prototype.applyToLocation = function(gl, location) { gl.uniform1f(location, this.value); @@ -776,6 +797,8 @@ o3d.ParamFloat.prototype.applyToLocation = function(gl, location) { /** * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. */ o3d.ParamFloat2.prototype.applyToLocation = function(gl, location) { gl.uniform2fv(location, this.value); @@ -783,6 +806,8 @@ o3d.ParamFloat2.prototype.applyToLocation = function(gl, location) { /** * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. */ o3d.ParamFloat3.prototype.applyToLocation = function(gl, location) { gl.uniform3fv(location, this.value); @@ -790,6 +815,8 @@ o3d.ParamFloat3.prototype.applyToLocation = function(gl, location) { /** * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. */ o3d.ParamFloat4.prototype.applyToLocation = function(gl, location) { gl.uniform4fv(location, this.value); @@ -797,6 +824,8 @@ o3d.ParamFloat4.prototype.applyToLocation = function(gl, location) { /** * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. */ o3d.ParamMatrix4.prototype.applyToLocation = function(gl, location) { gl.uniformMatrix4fv(location, @@ -812,6 +841,8 @@ o3d.Param.texture_index_ = 0; /** * Called to specify the value of a uniform variable. + * @param {WebGLContext} gl The current context. + * @param {WebGLUniformLocation} location The location to which to apply. */ o3d.ParamSampler.prototype.applyToLocation = function(gl, location) { // When before the effect object assigns values to parameters, -- cgit v1.1