Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(480)

Unified Diff: samples/o3d-webgl/pack.js

Issue 1745002: Incremental progress toward archive loading in o3d-webgl. Implemented... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/o3d-webgl/file_request.js ('k') | samples/o3d-webgl/param_object.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/o3d-webgl/pack.js
===================================================================
--- samples/o3d-webgl/pack.js (revision 45126)
+++ samples/o3d-webgl/pack.js (working copy)
@@ -171,7 +171,7 @@
*/
o3d.Pack.prototype.createObject =
function(type_name) {
- var foo = o3d.global.o3d[type_name];
+ var foo = o3d.global.o3d[o3d.filterTypeName_(type_name)];
if (typeof foo != 'function') {
throw 'cannot find type in o3d namespace: ' + type_name
}
@@ -232,18 +232,37 @@
* Note: If enable_render_surfaces is true, then the dimensions must be a
* power of two.
*
- * @param {number} edge_length The edge of the texture area in texels
+ * @param {number} edgeLength The edge of the texture area in texels
* (max = 2048)
* @param {o3d.Texture.Format} format The memory format of each texel.
* @param {number} levels The number of mipmap levels. Use zero to create
* the compelete mipmap chain.
- * @param {boolean} enable_render_surfaces If true, the texture object
+ * @param {boolean} enableRenderSurfaces If true, the texture object
* will expose RenderSurface objects through GetRenderSurface(...).
* @return {!o3d.TextureCUBE} The TextureCUBE object.
*/
o3d.Pack.prototype.createTextureCUBE =
- function(edge_length, format, levels, enable_render_surfaces) {
- o3d.notImplemented();
+ function(edgeLength, format, levels, enableRenderSurfaces) {
+ var texture = this.createObject('TextureCUBE');
+ texture.edgeLength = edgeLength;
+ texture.texture_ = this.gl.createTexture();
+
+ this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP, texture.texture_);
+ for (var ii = 0; ii < 6; ++ii) {
+ this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X + ii,
+ 0, this.gl.RGBA, edgeLength, edgeLength, 0,
+ this.gl.RGBA, this.gl.UNSIGNED_BYTE, null);
+ }
+ this.gl.texParameteri(this.gl.TEXTURE_CUBE_MAP,
+ this.gl.TEXTURE_MAG_FILTER, this.gl.LINEAR);
+ this.gl.texParameteri(this.gl.TEXTURE_CUBE_MAP,
+ this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
+ this.gl.texParameteri(this.gl.TEXTURE_CUBE_MAP,
+ this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
+ this.gl.texParameteri(this.gl.TEXTURE_CUBE_MAP,
+ this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
+
+ return texture;
};
@@ -280,9 +299,7 @@
*/
o3d.Pack.prototype.getObjects =
function(name, class_type_name) {
- if (class_type_name.substr(0, 4) == 'o3d.') {
- class_type_name = class_type_name.substr(4);
- }
+ class_type_name = o3d.filterTypeName_(class_type_name);
var found = [];
@@ -361,6 +378,14 @@
return this.createObject('FileRequest');
};
+/**
+ * Creates an ArchiveRequest so we can stream in assets from an archive.
+ * @return {!o3d.ArchiveRequest} an ArchiveRequest
+ */
+o3d.Pack.prototype.createArchiveRequest =
+ function() {
+ return this.createObject('ArchiveRequest');
+};
/**
* Create Bitmaps from RawData.
« no previous file with comments | « samples/o3d-webgl/file_request.js ('k') | samples/o3d-webgl/param_object.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698