@@ -9,14 +9,6 @@ self.onmessage = function ( message ) {
99
1010var camera , scene , renderer , mesh , clock ;
1111
12- function createBoxMesh ( size , material ) {
13-
14- var material = new THREE . MeshBasicMaterial ( material ) ;
15- var geometry = new THREE . BoxBufferGeometry ( size , size , size ) ;
16- return new THREE . Mesh ( geometry , material ) ;
17-
18- }
19-
2012function init ( offscreen , width , height , pixelRatio ) {
2113
2214 camera = new THREE . PerspectiveCamera ( 70 , width / height , 1 , 1000 ) ;
@@ -33,16 +25,21 @@ function init( offscreen, width, height, pixelRatio ) {
3325 loader . load ( '../../textures/crate.gif' , function ( imageBitmap ) {
3426
3527 var texture = new THREE . CanvasTexture ( imageBitmap ) ;
36- mesh = createBoxMesh ( 200 , { map : texture } ) ;
28+ var material = new THREE . MeshBasicMaterial ( { map : texture } ) ;
29+ var geometry = new THREE . BoxBufferGeometry ( 200 , 200 , 200 ) ;
30+ mesh = new THREE . Mesh ( geometry , material ) ;
3731 scene . add ( mesh ) ;
3832
3933 animate ( ) ;
4034
4135 } , null , function ( ) {
4236
43- // On error use color instead of texture.
37+ // Workaround for Firefox
38+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1335594
4439
45- mesh = createBoxMesh ( 200 , { color : 0x00ff00 } ) ;
40+ var material = new THREE . MeshBasicMaterial ( { color : 0x00ff00 } ) ;
41+ var geometry = new THREE . BoxBufferGeometry ( 200 , 200 , 200 ) ;
42+ mesh = new THREE . Mesh ( geometry , material ) ;
4643 scene . add ( mesh ) ;
4744
4845 animate ( ) ;
@@ -70,6 +67,8 @@ function animate() {
7067
7168 } else if ( renderer . context . commit ) {
7269
70+ // Deprecated
71+
7372 renderer . context . commit ( ) . then ( animate ) ;
7473
7574 }
0 commit comments