Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/threejs/7_bones/js/test1.js.orig

(Deskargatu)
Math.radians = function(degrees) {
      return degrees * Math.PI / 180;
};

var scene = new THREE.Scene();
var clock  = new THREE.Clock();
var SCREEN_WIDTH = window.innerWidth;
var SCREEN_HEIGHT = window.innerHeight;
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );

scene.fog = new THREE.Fog( 0xffffff, 2000, 10000 );
var renderer = new THREE.WebGLRenderer({ antialias:true});
				renderer = new THREE.WebGLRenderer( { antialias: true } );
				renderer.setClearColor( scene.fog.color );
				renderer.setPixelRatio( window.devicePixelRatio );
				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
				renderer.domElement.style.position = "relative";
document.body.appendChild( renderer.domElement );

// Add floor
var planeGeometry = new THREE.PlaneGeometry(350,350);
var planeMaterial =    new THREE.MeshLambertMaterial({color: 0xffffff});
var plane = new THREE.Mesh(planeGeometry,planeMaterial);
plane.receiveShadow  = true;
plane.rotation.x=-0.5*Math.PI;
plane.position.x=120
plane.position.y=0
plane.position.z=120
scene.add(plane);



<<<<<<< 7ce395b1ccdb57cbe2fc20e0a432cf0c8793ee6c
=======
// Build hexas!
var h = new Hexa(scene);
//h.build();

// Build perso
var p = new Perso(scene);
p.build();
>>>>>>> x

var p = new Perso(scene);
p.build();

// Update position
camera.position.x = 8;
camera.position.z = -5;
camera.position.y = 8;
camera.lookAt(new THREE.Vector3(0,0,0));


var target = new THREE.Object3D();
target.position = new THREE.Vector3(5, 0, 0);

var pointColor = "#ffffff";
				scene.add( new THREE.HemisphereLight( 0x111111, 0x444444 ) );

				var light = new THREE.DirectionalLight( 0xebf3ff, 1.5 );
				light.position.set( 0, 140, 500 ).multiplyScalar( 1.1 );
				scene.add( light );

var controls = new function () {

    this.camera_x = camera.position.x;
    this.camera_y = camera.position.y;
    this.camera_z = camera.position.z;

    this.play = p.play.bind(p);
    }

var gui = new dat.GUI();

    gui.add(controls, 'camera_x',-200,200).onChange(function (e) {
        camera.position.x = e;
        camera.lookAt(new THREE.Vector3(0,0,0));
    });
    gui.add(controls, 'camera_y',-200,200).onChange(function (e) {
        camera.position.y = e;
        camera.lookAt(new THREE.Vector3(0,0,0));
    });
    gui.add(controls, 'camera_z',-200,200).onChange(function (e) {
        camera.position.z = e;
        camera.lookAt(new THREE.Vector3(0,0,0));
    });

    gui.add(controls, 'play');



var mouse = new THREE.Vector2();


x=0;
function render()
{
	requestAnimationFrame( render );

    var delta = 0.75 * clock.getDelta();
    if(p.mixer)
    {
        p.mixer.update(delta);
    }
	renderer.render( scene, camera );
}



render();