diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 18:10:42 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-21 18:10:42 +0000 |
commit | 219891e8bc41b05c51a81dc40ff1ed340691f2d7 (patch) | |
tree | 8565d1be2e0ba1719b50ce5ad4f93d8eac76ae9d /o3d/samples/o3djs/loader.js | |
parent | babaa4e9c446721c92aff4f18e22c9314bc397f9 (diff) | |
download | chromium_src-219891e8bc41b05c51a81dc40ff1ed340691f2d7.zip chromium_src-219891e8bc41b05c51a81dc40ff1ed340691f2d7.tar.gz chromium_src-219891e8bc41b05c51a81dc40ff1ed340691f2d7.tar.bz2 |
Add IO functions for Bitmap and change other utilites
to use them.
Review URL: http://codereview.chromium.org/174236
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/samples/o3djs/loader.js')
-rw-r--r-- | o3d/samples/o3djs/loader.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/o3d/samples/o3djs/loader.js b/o3d/samples/o3djs/loader.js index 6a8760b2..fa38e2d 100644 --- a/o3d/samples/o3djs/loader.js +++ b/o3d/samples/o3djs/loader.js @@ -111,6 +111,49 @@ o3djs.loader.Loader.prototype.loadTexture = function(pack, }; /** + * Loads a RawData. + * @param {!o3d.Pack} pack Pack to load texture into. + * @param {string} url URL of image file to load. + * @param {!function(!o3d.FileRequest, o3d.RawData, *): void} onLoaded Callback + * when RawData is loaded. It will be passed the request, a RawData and an + * exception which is null on success. The RawData is associated with + * the request so it will stay in memory until you free with request with + * pack.removeObject(request). + */ +o3djs.loader.Loader.prototype.loadRawData = function(pack, + url, + onLoaded) { + var that = this; // so the function below can see "this". + ++this.count_; + var loadInfo = o3djs.io.loadRawData( + pack, url, function(request, rawData, exception) { + onLoaded(request, rawData, exception); + that.countDown_(); + }); + this.loadInfo.addChild(loadInfo); +}; + +/** + * Loads bitmaps. + * @param {!o3d.Pack} pack Pack to load texture into. + * @param {string} url URL of image file to load. + * @param {!function(!Array.<!o3d.Bitmap>, *): void} onBitmapsLoaded Callback + * when bitmaps are loaded. It will be passed an array of bitmaps and an + * exception which is null on success. + */ +o3djs.loader.Loader.prototype.loadBitmaps = function(pack, + url, + onBitmapsLoaded) { + var that = this; // so the function below can see "this". + ++this.count_; + var loadInfo = o3djs.io.loadBitmaps(pack, url, function(bitmaps, exception) { + onBitmapsLoaded(bitmaps, exception); + that.countDown_(); + }); + this.loadInfo.addChild(loadInfo); +}; + +/** * Loads a 3d scene. * @param {!o3d.Client} client An O3D client object. * @param {!o3d.Pack} pack Pack to load texture into. |