Advertisement
Guest User

Oleg Orlov

a guest
Mar 7th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Test = { isThread: true };
  2.  
  3. Test.Checker = function() {
  4.     this.bufferMaterial = undefined;
  5. };
  6. Test.Checker.prototype.checkTextures = function( scene ) {
  7.     if ( scene !== undefined && scene !== null) {
  8.         scene.children.filter(function( item ) {
  9.             if ( item instanceof THREE.Mesh ) {
  10.                 this.bufferMaterial = item.material;
  11.             }
  12.         });
  13.     }
  14. };
  15. Test.Checker.prototype.changeTexture = function() {
  16.     if ( this.bufferMaterial !== undefined ) {
  17.         this.bufferMaterial = new THREE.MeshBasicMaterial({
  18.             map: THREE.ImageUtils.loadTexture( '/images/textures/box2.jpg' )
  19.         });
  20.     }
  21.     else return -1;
  22. };
  23.  
  24. onmessage = function( sender ) {
  25.     var objectTest = new Test.Checker();
  26.     objectTest.checkTextures( sender.data );
  27.     if ( this.bufferMaterial !== undefined ) this.changeTexture();
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement