window.onload = init;
var camera,render,scene;
var sphere;
function init(){
render = new THREE.WebGLRenderer();
render.setSize(innerWidth,innerHeight);
document.body.appendChild(render.domElement);
camera = new THREE.PerspectiveCamera(70,innerWidth/innerHeight,1,10000);
camera.position.z = 1400;
scene = new THREE.Scene();
var sphere_geometry = new THREE.SphereGeometry(700,40,40);
var texture = new THREE.ImageUtils.loadTexture('earthtexture.jpg');
texture.anisotropy = render.getMaxAnisotropy();
var sphere_material = new THREE.MeshBasicMaterial({map:texture});
//var sphere_material = new THREE.MeshNormalMaterial();
sphere = new THREE.Mesh(sphere_geometry,sphere_material);
scene.add(sphere);
animate();
}
function animate() {
requestAnimationFrame( animate );
sphere.rotation.y += 0.01;
render.render( scene, camera );
}
- работает показывает шар с текстурами земли
window.onload = init;
var camera,render,scene;
var sphere;
function init(){
render = new THREE.WebGLRenderer();
render.setSize(innerWidth,innerHeight);
document.body.appendChild(render.domElement);
camera = new THREE.PerspectiveCamera(70,innerWidth/innerHeight,1,10000);
camera.position.z = 1400;
scene = new THREE.Scene();
var sphere_geometry = new THREE.SphereGeometry(700,40,40);
var texture = new THREE.ImageUtils.loadTexture('earthtexture.jpg');
texture.anisotropy = render.getMaxAnisotropy();
var sphere_material = new THREE.MeshBasicMaterial({map:texture});
//var sphere_material = new THREE.MeshNormalMaterial();
sphere = new THREE.Mesh(sphere_geometry,sphere_material);
scene.add(sphere);
render.render( scene, camera );
//animate();
}
function animate() {
requestAnimationFrame( animate );
sphere.rotation.y += 0.01;
render.render( scene, camera );
}
- не работает не показывает ничего(
если кто знает может и книгу посоветуете(англ не знаю)