| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of solar3d; | 5 part of solar3d; |
| 6 | 6 |
| 7 class Texture { | 7 class Texture { |
| 8 final int bindingPoint; | 8 final int bindingPoint; |
| 9 WebGLTexture texture; | 9 WebGLTexture texture; |
| 10 Texture(this.bindingPoint); | 10 Texture(this.bindingPoint); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 gl.texImage2D(sideTargets[i], | 106 gl.texImage2D(sideTargets[i], |
| 107 0, | 107 0, |
| 108 WebGLRenderingContext.RGBA, | 108 WebGLRenderingContext.RGBA, |
| 109 WebGLRenderingContext.RGBA, | 109 WebGLRenderingContext.RGBA, |
| 110 WebGLRenderingContext.UNSIGNED_BYTE, | 110 WebGLRenderingContext.UNSIGNED_BYTE, |
| 111 img); | 111 img); |
| 112 c.complete(img.src); | 112 c.complete(img.src); |
| 113 }); | 113 }); |
| 114 img.src = '$baseURL${sides[i]}'; | 114 img.src = '$baseURL${sides[i]}'; |
| 115 } | 115 } |
| 116 return Futures.wait(futures); | 116 return Future.wait(futures); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void bind(String name) { | 119 void bind(String name) { |
| 120 Texture t = textures[name]; | 120 Texture t = textures[name]; |
| 121 if (t == null) { | 121 if (t == null) { |
| 122 print('Cannot find texture $name'); | 122 print('Cannot find texture $name'); |
| 123 return; | 123 return; |
| 124 } | 124 } |
| 125 gl.bindTexture(WebGLRenderingContext.TEXTURE_2D, null); | 125 gl.bindTexture(WebGLRenderingContext.TEXTURE_2D, null); |
| 126 gl.bindTexture(WebGLRenderingContext.TEXTURE_CUBE_MAP, null); | 126 gl.bindTexture(WebGLRenderingContext.TEXTURE_CUBE_MAP, null); |
| 127 gl.bindTexture(t.bindingPoint, t.texture); | 127 gl.bindTexture(t.bindingPoint, t.texture); |
| 128 } | 128 } |
| 129 } | 129 } |
| OLD | NEW |