topical media & game development

talk show tell print

mobile-query-three-plugins-csg-tquery.object3d.csg.js / js



  tQuery.Object3D.registerInstance('csg', function(operation, tqObject){
          var objects3d        = [];
          this.each(function(object3d){
                  var tqGeometry        = tQuery(object3d).geometry().csg(operation, tqObject.geometry());
                  var geometry        = tqGeometry.get(0);
  
                  var material        = new THREE.MeshNormalMaterial();
                  var mesh        = new THREE.Mesh(geometry, material);
                  objects3d.push(mesh);
          });
          return new tQuery.Object3D(objects3d).back(this);
  });
  
  // some shortcut
  tQuery.Object3D.registerInstance('union'        , function(tqObject){ return this.csg('union'         , tqObject);        });
  tQuery.Object3D.registerInstance('subtract'        , function(tqObject){ return this.csg('subtract' , tqObject);        });
  tQuery.Object3D.registerInstance('intersect'        , function(tqObject){ return this.csg('intersect', tqObject);        });
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.