'use strict';
/*global THREE:true*/
/*global animalLoader:true*/
/*global window:true*/
/*global Loop:true*/
/*global Earth:true*/
var world = (function () {
// standard global variables
var SCREEN_WIDTH = $(window).width();
var SCREEN_HEIGHT = $(window).height();
var NEAR = 0.1;
var FAR = 20000;
var loop;
var mouseX, mouseY;
var container,
scene,
camera,
renderer;
var projector;
/* timeSinceLastFrame ha comunque un valore plausibile anche
* se non e' ancora stato calcolato */
var tslf = 0.01;
var animals = [];
/* velocita' di movimento ininiziale degli animali */
var initialSpeed = 10;
/* velocita' di movimento in IDLE degli animali */
var speed = initialSpeed;
/* quanto dura l'animazione di "ingrandimento" e "spostamento"
* degli animali quando selezionati */
var zoomDuration = 1.0;
var menu = {
first: "",
second: "",
state: "IDLE"
};
var screenMargin = {
top: SCREEN_HEIGHT / 2,
bottom: -SCREEN_HEIGHT / 6,
left: -SCREEN_WIDTH / 2,
right: SCREEN_WIDTH / 2
};
var animalToZoom = [];
var addAnimals = function () {
animals = animalLoader.getAnimals().slice(0);
$.each(animals, function (index) {
var animal = this;
var delay = index * 10;
setTimeout(function () {
scene.add(animal.object);
}, delay);
});
};
var init = function () {
AnimalLabel.init();
scene = new THREE.Scene();
camera = new THREE.OrthographicCamera(SCREEN_WIDTH / -2, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SCREEN_HEIGHT / -2, NEAR, FAR);
scene.add(camera);
camera.position.set(0, 0, 1200);
camera.lookAt(scene.position);
try {
renderer = new THREE.WebGLRenderer({
antialias: false
});
} catch (e) {
console.log(e);
alert("Questo computer non supporta la grafica 3d. Gli effetti grafici verranno disabilitati.");
forceDisableWegl();
}
projector = new THREE.Projector();
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.