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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 o3d.TextureCUBE.FACE_POSITIVE_Y = 2; | 369 o3d.TextureCUBE.FACE_POSITIVE_Y = 2; |
370 o3d.TextureCUBE.FACE_NEGATIVE_Y = 3; | 370 o3d.TextureCUBE.FACE_NEGATIVE_Y = 3; |
371 o3d.TextureCUBE.FACE_POSITIVE_Z = 4; | 371 o3d.TextureCUBE.FACE_POSITIVE_Z = 4; |
372 o3d.TextureCUBE.FACE_NEGATIVE_Z = 5; | 372 o3d.TextureCUBE.FACE_NEGATIVE_Z = 5; |
373 | 373 |
374 | 374 |
375 /** | 375 /** |
376 * The length of each edge of the cube, in texels. | 376 * The length of each edge of the cube, in texels. |
377 * @type {number} | 377 * @type {number} |
378 */ | 378 */ |
379 o3d.TextureCUBE.prototype.edge_length = 0; | 379 o3d.TextureCUBE.prototype.edgeLength = 0; |
380 | 380 |
381 | 381 |
382 /** | 382 /** |
383 * Returns a RenderSurface object associated with a given cube face and | 383 * Returns a RenderSurface object associated with a given cube face and |
384 * mip_level of a texture. | 384 * mip_level of a texture. |
385 * | 385 * |
386 * @param {o3d.TextureCUBE.CubeFace} face The cube face from which to extract | 386 * @param {o3d.TextureCUBE.CubeFace} face The cube face from which to extract |
387 * the surface. | 387 * the surface. |
388 * @param {o3d.Pack} pack This parameter is no longer used. The surface exists | 388 * @param {o3d.Pack} pack This parameter is no longer used. The surface exists |
389 * as long as the texture it came from exists. | 389 * as long as the texture it came from exists. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 462 |
463 /** | 463 /** |
464 * Sets the content of a face of the texture to the content of the bitmap. The | 464 * Sets the content of a face of the texture to the content of the bitmap. The |
465 * texture and the bitmap must be the same dimensions and the same format. | 465 * texture and the bitmap must be the same dimensions and the same format. |
466 * | 466 * |
467 * @param {o3d.TextureCUBE.CubeFace} face The face to set. | 467 * @param {o3d.TextureCUBE.CubeFace} face The face to set. |
468 * @param {o3d.Bitmap} bitmap The bitmap to copy data from. | 468 * @param {o3d.Bitmap} bitmap The bitmap to copy data from. |
469 */ | 469 */ |
470 o3d.TextureCUBE.prototype.setFromBitmap = | 470 o3d.TextureCUBE.prototype.setFromBitmap = |
471 function(face, bitmap) { | 471 function(face, bitmap) { |
472 o3d.notImplemented(); | 472 this.gl.bindTexture(this.gl.TEXTURE_CUBE_MAP, this.texture_); |
| 473 this.gl.texImage2D(this.gl.TEXTURE_CUBE_MAP_POSITIVE_X + face, |
| 474 0, // Level. |
| 475 bitmap.canvas_, |
| 476 false); // Do not flip cube maps' faces. |
| 477 // TODO(petersont): figure out when we should call generateMipmaps. |
| 478 // TODO(petersont): move generateMips to Texture2D / TextureCUBE |
| 479 // classes because the target needs to differ. |
| 480 // if (bitmap.defer_mipmaps_to_texture_) { |
| 481 // this.generateMips(); |
| 482 // } |
473 }; | 483 }; |
474 | 484 |
475 | 485 |
476 /** | 486 /** |
477 * Copy pixels from source bitmap to certain face and mip level. | 487 * Copy pixels from source bitmap to certain face and mip level. |
478 * Scales if the width and height of source and dest do not match. | 488 * Scales if the width and height of source and dest do not match. |
479 * TODO(petersont): Should take optional arguments. | 489 * TODO(petersont): Should take optional arguments. |
480 * | 490 * |
481 * @param {o3d.Bitmap} source_img The source bitmap. | 491 * @param {o3d.Bitmap} source_img The source bitmap. |
482 * @param {number} source_mip which mip of the source to copy from. | 492 * @param {number} source_mip which mip of the source to copy from. |
(...skipping 13 matching lines...) Expand all Loading... |
496 * @param {number} dest_height height of the destination image. | 506 * @param {number} dest_height height of the destination image. |
497 */ | 507 */ |
498 o3d.TextureCUBE.prototype.drawImage = | 508 o3d.TextureCUBE.prototype.drawImage = |
499 function(source_img, source_mip, source_x, source_y, source_width, | 509 function(source_img, source_mip, source_x, source_y, source_width, |
500 source_height, face, dest_mip, dest_x, dest_y, dest_width, | 510 source_height, face, dest_mip, dest_x, dest_y, dest_width, |
501 dest_height) { | 511 dest_height) { |
502 o3d.notImplemented(); | 512 o3d.notImplemented(); |
503 }; | 513 }; |
504 | 514 |
505 | 515 |
OLD | NEW |