topical media & game development

talk show tell print

mobile-query-three-plugins-requirejs-examples-manual-modwithbaseurl.htm / htm



  <!doctype html>
  <script src="../vendor/require.js"></script>
  <script>
          // TODO put that in a require-config.js
          requirejs.config({
                  paths        : {
                          "build"                : "../../../build",
                          "plugins"        : "../..",
                          'threex'        : '../../../vendor/threex',
                  },
                  map        : {
                          "*"        : {
                                  'tquery'                : 'build/tquery-bundle',
                                  'tquery.createplanet'        : 'plugins/requirejs/confrequire/planets.initrequire',
                          }
                  },
                  shim        : {
                          'plugins/requirejs/confrequire/planets.initrequire'        : ['tquery']
                  }
          });
  
          require([
                  'tquery.createplanet',
          ], function(){
                  var world        = tQuery.createWorld().boilerplate().start();
                  var planet        = tQuery.createPlanet().id('obj').addTo(world);
  
                  // setup light
                  tQuery.createDirectionalLight().addTo(world).position(1,1,1);
                  tQuery.createDirectionalLight().addTo(world).position(-1,1,1);
                  tQuery.createAmbientLight().addTo(world).color(0xFFFFFF);
                  // make the object rotate
                  world.loop().hook(function(delta, now){
                          var angle        = 0.05 * now * Math.PI * 2;
                          planet.get(0).rotation.y        = angle;
                  });
          });
  </script>
  
  


(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.