From e512583b79e366db399a6566964412bb6e5af823 Mon Sep 17 00:00:00 2001 From: "petersont@google.com" Date: Fri, 12 Mar 2010 21:00:00 +0000 Subject: Added textures, texture samplers and render targets to o3d-webgl. Also fixed bugs, added calls to parent class constructor to classes that didn't have them before, added a few demos to exhibit/test textures and render surfaces. Review URL: http://codereview.chromium.org/856004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41482 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/samples/o3d-webgl/effect.js | 54 ++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) (limited to 'o3d/samples/o3d-webgl/effect.js') diff --git a/o3d/samples/o3d-webgl/effect.js b/o3d/samples/o3d-webgl/effect.js index 53d8882..f8d7dc5 100644 --- a/o3d/samples/o3d-webgl/effect.js +++ b/o3d/samples/o3d-webgl/effect.js @@ -89,6 +89,7 @@ o3d.EffectParameterInfo.prototype.sas_class_name = ''; * @constructor */ o3d.EffectStreamInfo = function(opt_semantic, opt_semantic_index) { + o3d.NamedObject.call(this); if (!opt_semantic) { opt_semantic = o3d.Stream.UNKNOWN_SEMANTIC; } @@ -176,6 +177,13 @@ o3d.Effect.prototype.loadShaderFromString = function(shaderString, type) { var shader = this.gl.createShader(type); this.gl.shaderSource(shader, shaderString); this.gl.compileShader(shader); + + var log = this.gl.getShaderInfoLog(shader); + if (log != '') { + this.gl.client.error_callback( + 'Shader compile failed with error log:\n' + log); + } + this.gl.attachShader(this.program_, shader); }; @@ -245,24 +253,24 @@ o3d.Effect.prototype.createUniformParameters = 'worldView': true, 'worldProjection': true, 'worldViewProjection': true, - 'worldI': true, - 'viewI': true, - 'projectionI': true, - 'worldViewI': true, - 'worldProjectionI': true, - 'worldViewProjectionI': true, - 'worldT': true, - 'viewT': true, - 'projectionT': true, - 'worldViewT': true, - 'worldProjectionT': true, - 'worldViewProjectionT': true, - 'worldIT': true, - 'viewIT': true, - 'projectionIT': true, - 'worldViewIT': true, - 'worldProjectionIT': true, - 'worldViewProjectionIT': true}; + 'worldInverse': true, + 'viewInverse': true, + 'projectionInverse': true, + 'worldViewInverse': true, + 'worldProjectionInverse': true, + 'worldViewProjectionInverse': true, + 'worldTranspose': true, + 'viewTranspose': true, + 'projectionTranspose': true, + 'worldViewTranspose': true, + 'worldProjectionTranspose': true, + 'worldViewProjectionTranspose': true, + 'worldInverseTranspose': true, + 'viewInverseTranspose': true, + 'projectionInverseTranspose': true, + 'worldViewInverseTranspose': true, + 'worldProjectionInverseTranspose': true, + 'worldViewProjectionInverseTranspose': true}; for (name in this.uniforms) { var info = this.uniforms[name].info; @@ -330,7 +338,7 @@ o3d.Effect.prototype.createSASParameters = /** * Gets info about the parameters this effect needs. - * @returns {!Array.} an array of + * @return {!Array.} an array of * EffectParameterInfo objects. */ o3d.Effect.prototype.getParameterInfo = function() { @@ -341,7 +349,7 @@ o3d.Effect.prototype.getParameterInfo = function() { /** * Gets info about the streams this effect needs. - * @returns {!Array.} an array of + * @return {!Array.} an array of * EffectStreamInfo objects. */ o3d.Effect.prototype.getStreamInfo = function() { @@ -390,6 +398,12 @@ o3d.Effect.prototype.searchForParams = function(object_list) { } } } + + for (name in this.uniforms) { + if (!filled_map[name]) { + throw ('Uniform param not filled: '+name); + } + } }; -- cgit v1.1