diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 23:14:43 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 23:14:43 +0000 |
commit | 42ca9a490f404c33ab4462ed44afec22c3ecc82b (patch) | |
tree | ecaaeee0e76eba60846c3466eeadb4922e603cd5 /o3d/samples | |
parent | 261baf9696bd0c28c6466de3d4921bef4ba937c5 (diff) | |
download | chromium_src-42ca9a490f404c33ab4462ed44afec22c3ecc82b.zip chromium_src-42ca9a490f404c33ab4462ed44afec22c3ecc82b.tar.gz chromium_src-42ca9a490f404c33ab4462ed44afec22c3ecc82b.tar.bz2 |
Add support for Param Arrays for Effect parameters.
Arrays of floats, float2, float3, float4, Matrix4,
int, bool and sampler are all supported.
I'll enable the test for selenium and check in
a screenshot in another build.
Review URL: http://codereview.chromium.org/125188
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples')
-rw-r--r-- | o3d/samples/o3djs/effect.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/o3d/samples/o3djs/effect.js b/o3d/samples/o3djs/effect.js index d9d22c4..3031cee 100644 --- a/o3d/samples/o3djs/effect.js +++ b/o3d/samples/o3djs/effect.js @@ -737,3 +737,36 @@ o3djs.effect.attachStandardShader = function(pack, } }; +/** + * Creates the uniform parameters needed for an Effect on the given ParamObject. + * @param {!o3d.Pack} pack Pack to create extra objects in like Samplers and + * ParamArrays. + * @param {!o3d.Effect} effect Effect. + * @param {!o3d.ParamObject} paramObject ParamObject on which to create Params. + */ +o3djs.effect.createUniformParameters = function(pack, effect, paramObject) { + effect.createUniformParameters(paramObject); + var infos = effect.getParameterInfo(); + for (var ii = 0; ii < infos.length; ++ii) { + var info = infos[ii]; + if (info.sasClassName.length == 0) { + if (info.numElements > 0) { + var paramArray = pack.createObject('ParamArray'); + var param = paramObject.getParam(info.name); + param.value = paramArray; + paramArray.resize(info.numElements, info.className); + if (info.className == 'o3d.ParamSampler') { + for (var jj = 0; jj < info.numElements; ++jj) { + var sampler = pack.createObject('Sampler'); + paramArray.getParam(jj).value = sampler; + } + } + } else if (info.className == 'o3d.ParamSampler') { + var sampler = pack.createObject('Sampler'); + var param = paramObject.getParam(info.name); + param.value = sampler; + } + } + } +}; + |