topical media & game development

talk show tell print

mobile-query-three-plugins-requirejs-build-main-prod.js / js



  tQuery.registerStatic("createPlanet",function(e){typeof e=="string"&&(e={type:e}),e=tQuery.extend(e,{type:"moon"});var t=tQuery.createPlanet.baseUrl;if(e.type==="moon"){var n=t+"images/moon_1024.jpg",r=tQuery.createSphere().addClass("planet");r.material(new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture(n)}))}else if(e.type==="earth"){var r=tQuery.createObject3D(),i=tQuery.createSphere(.5,100,50).addTo(r).addClass("planet"),n=t+"images/earth_atmos_2048.jpg";i.material(new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture(n)}));var s=tQuery.createSphere(.52,100,50).addTo(r).addClass("cloud"),n=t+"images/earth_clouds_1024.png";s.material(new THREE.MeshBasicMaterial({map:THREE.ImageUtils.loadTexture(n),transparent:!0}))}else if(e.type==="earthNormal"){var r=tQuery.createObject3D(),o=THREE.ImageUtils.loadTexture(t+"images/earth_atmos_2048.jpg"),u=THREE.ImageUtils.loadTexture(t+"images/earth_normal_2048.jpg"),a=THREE.ImageUtils.loadTexture(t+"images/earth_specular_2048.jpg"),f=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(f.uniforms);l.tNormal.value=u,l.uNormalScale.value.set(.85,.85),l.tDiffuse.value=o,l.tSpecular.value=a,l.enableAO.value=!1,l.enableDiffuse.value=!0,l.enableSpecular.value=!0,l.uDiffuseColor.value.setHex(16777215),l.uSpecularColor.value.setHex(6710886),l.uAmbientColor.value.setHex(0),l.uShininess.value=20,l.uDiffuseColor.value.convertGammaToLinear(),l.uSpecularColor.value.convertGammaToLinear(),l.uAmbientColor.value.convertGammaToLinear();var c=new THREE.ShaderMaterial({fragmentShader:f.fragmentShader,vertexShader:f.vertexShader,uniforms:l,lights:!0}),h=new THREE.SphereGeometry(.5,30,15);h.computeTangents(),tQuery(h,c).addTo(r).addClass("planet");var n=t+"images/earth_clouds_1024.png",p=THREE.ImageUtils.loadTexture(n),d=new THREE.MeshLambertMaterial({color:16777215,map:p,transparent:!0});tQuery(h,d).addTo(r).addClass("cloud").scaleBy(1.01)}else console.assert(!1,"unknown opts.type: "+e.type);return r}),tQuery.createPlanet.baseUrl="../../../plugins/planets/",define("plugins/planets/tquery.createplanet",function(){}),define("plugins/requirejs/confrequire/planets.initrequire",["module","plugins/planets/tquery.createplanet"],function(e){tQuery.createPlanet.baseUrl=e.uri+"/../../../planets/"}),require(["tquery.planets"],function(){var e=tQuery.createWorld().boilerplate().start(),t=tQuery.createPlanet().id("obj").addTo(e);tQuery.createDirectionalLight().addTo(e).position(1,1,1),tQuery.createDirectionalLight().addTo(e).position(-1,1,1),tQuery.createAmbientLight().addTo(e).color(16777215),e.loop().hook(function(e,n){var r=.05*n*Math.PI*2;t.get(0).rotation.y=r})}),define("main-dev.js",function(){})


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