| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010, Google Inc. | 2 * Copyright 2010, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 * @type {!Array.<!o3d.Pack>} | 292 * @type {!Array.<!o3d.Pack>} |
| 293 */ | 293 */ |
| 294 o3d.Client.prototype.packs_ = []; | 294 o3d.Client.prototype.packs_ = []; |
| 295 | 295 |
| 296 /** | 296 /** |
| 297 * Keeps track of all counters associated with this client. | 297 * Keeps track of all counters associated with this client. |
| 298 * @type {o3d.CounterManager} | 298 * @type {o3d.CounterManager} |
| 299 */ | 299 */ |
| 300 o3d.Client.prototype.counter_manager_ = null; | 300 o3d.Client.prototype.counter_manager_ = null; |
| 301 | 301 |
| 302 /** |
| 303 * Whether or not the client sets the alpha channel of all pixels to 1 in the |
| 304 * final stage of rendering. |
| 305 * |
| 306 * By default, this is set to true to mimic the plugin's behavior. If |
| 307 * a transparent canvas background is desirable, this should be set to false. |
| 308 * |
| 309 * @type {boolean} |
| 310 */ |
| 311 o3d.Client.prototype.normalizeClearColorAlpha = true; |
| 302 | 312 |
| 303 /** | 313 /** |
| 304 * Function that gets called when the client encounters an error. | 314 * Function that gets called when the client encounters an error. |
| 305 */ | 315 */ |
| 306 o3d.Client.prototype.error_callback = function(error_message) { | 316 o3d.Client.prototype.error_callback = function(error_message) { |
| 307 alert(error_message); | 317 alert(error_message); |
| 308 }; | 318 }; |
| 309 | 319 |
| 310 | 320 |
| 311 /** | 321 /** |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 475 } |
| 466 this.then_ = now; | 476 this.then_ = now; |
| 467 | 477 |
| 468 this.gl.colorMask(true, true, true, true); | 478 this.gl.colorMask(true, true, true, true); |
| 469 | 479 |
| 470 this.renderTree(this.renderGraphRoot); | 480 this.renderTree(this.renderGraphRoot); |
| 471 | 481 |
| 472 // When o3d finally draws to the webpage, the alpha channel should be all 1's | 482 // When o3d finally draws to the webpage, the alpha channel should be all 1's |
| 473 // So we clear with a color mask to set all alpha bytes to 1 before drawing. | 483 // So we clear with a color mask to set all alpha bytes to 1 before drawing. |
| 474 // Before we draw again, the color mask gets set back to all true (above). | 484 // Before we draw again, the color mask gets set back to all true (above). |
| 475 this.gl.colorMask(false, false, false, true); | 485 if (this.normalizeClearColorAlpha) { |
| 476 this.gl.clearColor(0.0, 0.0, 0.0, 1.0); | 486 this.gl.colorMask(false, false, false, true); |
| 477 this.gl.clear(this.gl.COLOR_BUFFER_BIT); | 487 this.gl.clearColor(0.0, 0.0, 0.0, 1.0); |
| 488 this.gl.clear(this.gl.COLOR_BUFFER_BIT); |
| 489 } |
| 478 }; | 490 }; |
| 479 | 491 |
| 480 | 492 |
| 481 /** | 493 /** |
| 482 * An object for various statistics that are gather during the render tree | 494 * An object for various statistics that are gather during the render tree |
| 483 * tranversal. | 495 * tranversal. |
| 484 * | 496 * |
| 485 * @type {Object} | 497 * @type {Object} |
| 486 */ | 498 */ |
| 487 o3d.Client.prototype.render_stats = {} | 499 o3d.Client.prototype.render_stats = {} |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1271 * Gets info about the client. | 1283 * Gets info about the client. |
| 1272 */ | 1284 */ |
| 1273 o3d.Client.prototype.clientInfo = null; | 1285 o3d.Client.prototype.clientInfo = null; |
| 1274 | 1286 |
| 1275 | 1287 |
| 1276 /** | 1288 /** |
| 1277 * The canvas associated with this client. | 1289 * The canvas associated with this client. |
| 1278 * @type {Element} | 1290 * @type {Element} |
| 1279 */ | 1291 */ |
| 1280 o3d.Client.prototype.canvas = null; | 1292 o3d.Client.prototype.canvas = null; |
| OLD | NEW |