From mixed convetion (_, and camel case) to all camel case
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
var BouncingCube = function(size, style) {
|
||||
L3D.Cube.call(this, size, style);
|
||||
|
||||
this.fixed_center = new THREE.Vector3();
|
||||
this.fixedCenter = new THREE.Vector3();
|
||||
this.center = new THREE.Vector3();
|
||||
|
||||
this.speed = new THREE.Vector3(0,0,300);
|
||||
@@ -11,13 +11,13 @@ BouncingCube.prototype.constructor = BouncingCube;
|
||||
|
||||
BouncingCube.prototype.update = function() {
|
||||
// Compute new center
|
||||
var speed_clone = this.speed.clone();
|
||||
speed_clone.multiply(BouncingCube.DT);
|
||||
var speedClone = this.speed.clone();
|
||||
speedClone.multiply(BouncingCube.DT);
|
||||
|
||||
this.speed.add(BouncingCube.G);
|
||||
|
||||
if (this.speed.dot(this.speed) > 100) {
|
||||
this.center.add(speed_clone);
|
||||
this.center.add(speedClone);
|
||||
}
|
||||
|
||||
if (this.center.z < 0) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
var renderer, scene, camera, controls, cube, container, plane, mouse= {x:0, y:0};
|
||||
var raycaster;
|
||||
var objects = [];
|
||||
var container_size = {};
|
||||
var containerSize = {};
|
||||
var previousTime;
|
||||
container_size.width = 1067;
|
||||
container_size.height = 600;
|
||||
containerSize.width = 1067;
|
||||
containerSize.height = 600;
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -12,10 +12,10 @@ animate();
|
||||
function init() {
|
||||
// on initialise le moteur de rendu
|
||||
container = document.getElementById('container');
|
||||
container.style.height = container_size.height + 'px';
|
||||
container.style.width = container_size.width + 'px';
|
||||
container.style.height = containerSize.height + 'px';
|
||||
container.style.width = containerSize.width + 'px';
|
||||
renderer = new THREE.WebGLRenderer({alpha:"true"});
|
||||
renderer.setSize(container_size.width, container_size.height);
|
||||
renderer.setSize(containerSize.width, containerSize.height);
|
||||
renderer.shadowMapEnabled = true;
|
||||
document.getElementById('container').appendChild(renderer.domElement);
|
||||
|
||||
@@ -24,16 +24,16 @@ function init() {
|
||||
raycaster = new THREE.Raycaster();
|
||||
|
||||
// init light
|
||||
var directional_light = new THREE.DirectionalLight(0xffffff);
|
||||
directional_light.position.set(1, 0.5, 1).normalize();
|
||||
directional_light.castShadow = true;
|
||||
scene.add(directional_light);
|
||||
var directionalLight = new THREE.DirectionalLight(0xffffff);
|
||||
directionalLight.position.set(1, 0.5, 1).normalize();
|
||||
directionalLight.castShadow = true;
|
||||
scene.add(directionalLight);
|
||||
|
||||
var ambient_light = new THREE.AmbientLight(0x444444);
|
||||
scene.add(ambient_light);
|
||||
var ambientLight = new THREE.AmbientLight(0x444444);
|
||||
scene.add(ambientLight);
|
||||
|
||||
// on initialise la camera que l’on place ensuite sur la scène
|
||||
camera = new L3D.Camera(50, container_size.width / container_size.height, 1, 10000);
|
||||
camera = new L3D.Camera(50, containerSize.width / containerSize.height, 1, 10000);
|
||||
scene.add(camera);
|
||||
|
||||
window.addEventListener('resize', onWindowResize, false);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
var mesh_number = 25;
|
||||
var meshNumber = 25;
|
||||
var renderer, scene, camera, controls, cube, container, plane, mouse= {x:0, y:0};
|
||||
var raycaster;
|
||||
var objects = [];
|
||||
var spheres = new Array(mesh_number);
|
||||
var spheres = new Array(meshNumber);
|
||||
var visible = 0;
|
||||
|
||||
var loader, previousTime;
|
||||
|
||||
var container_size = {};
|
||||
container_size.width = 1067;
|
||||
container_size.height = 600;
|
||||
var containerSize = {};
|
||||
containerSize.width = 1067;
|
||||
containerSize.height = 600;
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -34,10 +34,10 @@ function loadSphere(i) {
|
||||
function init() {
|
||||
// on initialise le moteur de rendu
|
||||
container = document.getElementById('container');
|
||||
container.style.height = container_size.height + 'px';
|
||||
container.style.width = container_size.width + 'px';
|
||||
container.style.height = containerSize.height + 'px';
|
||||
container.style.width = containerSize.width + 'px';
|
||||
renderer = new THREE.WebGLRenderer({alpha:"true"});
|
||||
renderer.setSize(container_size.width, container_size.height);
|
||||
renderer.setSize(containerSize.width, containerSize.height);
|
||||
renderer.shadowMapEnabled = true;
|
||||
document.getElementById('container').appendChild(renderer.domElement);
|
||||
|
||||
@@ -46,16 +46,16 @@ function init() {
|
||||
raycaster = new THREE.Raycaster();
|
||||
|
||||
// init light
|
||||
var directional_light = new THREE.DirectionalLight(0xffffff);
|
||||
directional_light.position.set(1, 0.5, 1).normalize();
|
||||
directional_light.castShadow = true;
|
||||
scene.add(directional_light);
|
||||
var directionalLight = new THREE.DirectionalLight(0xffffff);
|
||||
directionalLight.position.set(1, 0.5, 1).normalize();
|
||||
directionalLight.castShadow = true;
|
||||
scene.add(directionalLight);
|
||||
|
||||
var ambient_light = new THREE.AmbientLight(0x444444);
|
||||
scene.add(ambient_light);
|
||||
var ambientLight = new THREE.AmbientLight(0x444444);
|
||||
scene.add(ambientLight);
|
||||
|
||||
// on initialise la camera que l’on place ensuite sur la scène
|
||||
camera = new L3D.Camera(50, container_size.width / container_size.height, 1, 10000);
|
||||
camera = new L3D.Camera(50, containerSize.width / containerSize.height, 1, 10000);
|
||||
scene.add(camera);
|
||||
|
||||
window.addEventListener('resize', onWindowResize, false);
|
||||
@@ -65,7 +65,7 @@ function init() {
|
||||
// Création d'un objloader
|
||||
loader = new THREE.OBJLoader();
|
||||
|
||||
for (var i = 0; i < mesh_number; i++) {
|
||||
for (var i = 0; i < meshNumber; i++) {
|
||||
|
||||
loadSphere(i);
|
||||
|
||||
|
||||
12
js/l3d/apps/prototype/Coin.js
vendored
12
js/l3d/apps/prototype/Coin.js
vendored
@@ -39,8 +39,8 @@ Coin.setSize = function(width,height) {
|
||||
|
||||
Coin.initSize = function() {
|
||||
try {
|
||||
Coin.domElement.width = container_size.width();
|
||||
Coin.domElement.height = container_size.height();
|
||||
Coin.domElement.width = containerSize.width();
|
||||
Coin.domElement.height = containerSize.height();
|
||||
} catch (e) {
|
||||
setTimeout(100, Coin.initSize);
|
||||
return;
|
||||
@@ -51,9 +51,9 @@ Coin.update = function() {
|
||||
|
||||
var x;
|
||||
try {
|
||||
x = container_size.width() * 4.75 / 5;
|
||||
Coin.domElement.width = container_size.width();
|
||||
Coin.domElement.height = container_size.height();
|
||||
x = containerSize.width() * 4.75 / 5;
|
||||
Coin.domElement.width = containerSize.width();
|
||||
Coin.domElement.height = containerSize.height();
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ Coin.set = function() {
|
||||
Coin.set(newLvl);
|
||||
},50);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Coin.image.onload = Coin.update;
|
||||
|
||||
|
||||
20
js/l3d/apps/prototype/GlobalFunctions.js
vendored
20
js/l3d/apps/prototype/GlobalFunctions.js
vendored
@@ -1,11 +1,11 @@
|
||||
// Auto-resize case
|
||||
// var main_section = document.getElementById('main-section');
|
||||
// var mainSection = document.getElementById('main-section');
|
||||
//
|
||||
// var container_size = {
|
||||
// width: function() { if (!isFullscreen) return main_section.clientWidth; else return screen.width;},
|
||||
// var containerSize = {
|
||||
// width: function() { if (!isFullscreen) return mainSection.clientWidth; else return screen.width;},
|
||||
// height: function() {
|
||||
// if (!isFullscreen)
|
||||
// return main_section.clientHeight
|
||||
// return mainSection.clientHeight
|
||||
// - document.getElementById('nav').offsetHeight
|
||||
// - document.getElementById('main-div').offsetHeight;
|
||||
// else
|
||||
@@ -13,7 +13,7 @@
|
||||
// }
|
||||
// };
|
||||
|
||||
var container_size = {
|
||||
var containerSize = {
|
||||
|
||||
width: function() { return 1134; },
|
||||
height: function() { return 768; }
|
||||
@@ -54,7 +54,7 @@ function objectClickerOnHover(camera1, previewer, recommendations, container) {
|
||||
if (obj instanceof L3D.BaseRecommendation) {
|
||||
// The newly hovered object is different and is a recommendation
|
||||
|
||||
event.arrow_id = recommendations.indexOf(obj);
|
||||
event.arrowId = recommendations.indexOf(obj);
|
||||
event.start = true;
|
||||
event.send();
|
||||
|
||||
@@ -66,7 +66,7 @@ function objectClickerOnHover(camera1, previewer, recommendations, container) {
|
||||
// but the previous one is : we must log
|
||||
|
||||
// Unhovered
|
||||
event.arrow_id = 0;
|
||||
event.arrowId = 0;
|
||||
event.start = false;
|
||||
event.send();
|
||||
|
||||
@@ -94,7 +94,7 @@ function objectClickerOnClick(camera1, buttonManager, recommendations, coins) {
|
||||
|
||||
// Send event to DB
|
||||
event = new L3D.DB.Event.CoinClicked();
|
||||
event.coin_id = obj.id;
|
||||
event.coinId = obj.id;
|
||||
event.send();
|
||||
|
||||
} else if (obj instanceof L3D.BaseRecommendation) {
|
||||
@@ -104,7 +104,7 @@ function objectClickerOnClick(camera1, buttonManager, recommendations, coins) {
|
||||
|
||||
// Send event to DB
|
||||
event = new L3D.DB.Event.ArrowClicked();
|
||||
event.arrow_id = recommendations.indexOf(obj);
|
||||
event.arrowId = recommendations.indexOf(obj);
|
||||
event.send();
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ var hide = createVisibilityFunction(false);
|
||||
|
||||
function resizeElements() {
|
||||
|
||||
var width = container_size.width(), height = container_size.height();
|
||||
var width = containerSize.width(), height = containerSize.height();
|
||||
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
|
||||
|
||||
8
js/l3d/apps/prototype/coin-checker/main.js
vendored
8
js/l3d/apps/prototype/coin-checker/main.js
vendored
@@ -97,7 +97,7 @@ function initThreeElements() {
|
||||
// Initialize pointer camera
|
||||
camera1 = new L3D.PointerCamera(
|
||||
50,
|
||||
container_size.width() / container_size.height(),
|
||||
containerSize.width() / containerSize.height(),
|
||||
0.01, 100000, renderer, container
|
||||
);
|
||||
|
||||
@@ -236,7 +236,7 @@ function render() {
|
||||
// Set current position of camera
|
||||
camera1.look();
|
||||
|
||||
var left = 0, bottom = 0, width = container_size.width(), height = container_size.height();
|
||||
var left = 0, bottom = 0, width = containerSize.width(), height = containerSize.height();
|
||||
renderer.setScissor(left, bottom, width, height);
|
||||
renderer.enableScissorTest(true);
|
||||
renderer.setViewport(left, bottom, width, height);
|
||||
@@ -252,7 +252,7 @@ function render() {
|
||||
THREEx.Transparency.update(camera1);
|
||||
|
||||
// Render preview
|
||||
previewer.render(container_size.width(), container_size.height());
|
||||
previewer.render(containerSize.width(), containerSize.height());
|
||||
|
||||
// Finish stats
|
||||
stats.end();
|
||||
@@ -264,7 +264,7 @@ function onWindowResize() {
|
||||
resizeElements(renderer, container, previewer, pointer, startCanvas);
|
||||
|
||||
recommendations.forEach(function(reco) {
|
||||
resetCameraAspect(reco.camera, container_size.width(), container_size.height());
|
||||
resetCameraAspect(reco.camera, containerSize.width(), containerSize.height());
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
8
js/l3d/apps/prototype/coin-creator/main.js
vendored
8
js/l3d/apps/prototype/coin-creator/main.js
vendored
@@ -103,7 +103,7 @@ function initThreeElements() {
|
||||
// Initialize pointer camera
|
||||
camera1 = new L3D.PointerCamera(
|
||||
50,
|
||||
container_size.width() / container_size.height(),
|
||||
containerSize.width() / containerSize.height(),
|
||||
0.01, 100000, renderer, container
|
||||
);
|
||||
|
||||
@@ -233,7 +233,7 @@ function render() {
|
||||
// Set current position of camera
|
||||
camera1.look();
|
||||
|
||||
var left = 0, bottom = 0, width = container_size.width(), height = container_size.height();
|
||||
var left = 0, bottom = 0, width = containerSize.width(), height = containerSize.height();
|
||||
renderer.setScissor(left, bottom, width, height);
|
||||
renderer.enableScissorTest(true);
|
||||
renderer.setViewport(left, bottom, width, height);
|
||||
@@ -249,7 +249,7 @@ function render() {
|
||||
THREEx.Transparency.update(camera1);
|
||||
|
||||
// Render preview
|
||||
previewer.render(container_size.width(), container_size.height());
|
||||
previewer.render(containerSize.width(), containerSize.height());
|
||||
|
||||
// Finish stats
|
||||
stats.end();
|
||||
@@ -261,7 +261,7 @@ function onWindowResize() {
|
||||
resizeElements(renderer, container, previewer, pointer, startCanvas);
|
||||
|
||||
recommendations.forEach(function(reco) {
|
||||
resetCameraAspect(reco.camera, container_size.width(), container_size.height());
|
||||
resetCameraAspect(reco.camera, containerSize.width(), containerSize.height());
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
8
js/l3d/apps/prototype/coin-viewer/main.js
vendored
8
js/l3d/apps/prototype/coin-viewer/main.js
vendored
@@ -103,7 +103,7 @@ function initThreeElements() {
|
||||
// Initialize pointer camera
|
||||
camera1 = new L3D.PointerCamera(
|
||||
50,
|
||||
container_size.width() / container_size.height(),
|
||||
containerSize.width() / containerSize.height(),
|
||||
0.01, 100000, renderer, container
|
||||
);
|
||||
|
||||
@@ -239,7 +239,7 @@ function render() {
|
||||
// Set current position of camera
|
||||
camera1.look();
|
||||
|
||||
var left = 0, bottom = 0, width = container_size.width(), height = container_size.height();
|
||||
var left = 0, bottom = 0, width = containerSize.width(), height = containerSize.height();
|
||||
renderer.setScissor(left, bottom, width, height);
|
||||
renderer.enableScissorTest(true);
|
||||
renderer.setViewport(left, bottom, width, height);
|
||||
@@ -255,7 +255,7 @@ function render() {
|
||||
THREEx.Transparency.update(camera1);
|
||||
|
||||
// Render preview
|
||||
previewer.render(container_size.width(), container_size.height());
|
||||
previewer.render(containerSize.width(), containerSize.height());
|
||||
|
||||
// Finish stats
|
||||
stats.end();
|
||||
@@ -267,7 +267,7 @@ function onWindowResize() {
|
||||
resizeElements(renderer, container, previewer, pointer, startCanvas);
|
||||
|
||||
recommendations.forEach(function(reco) {
|
||||
resetCameraAspect(reco.camera, container_size.width(), container_size.height());
|
||||
resetCameraAspect(reco.camera, containerSize.width(), containerSize.height());
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
8
js/l3d/apps/prototype/interactive/main.js
vendored
8
js/l3d/apps/prototype/interactive/main.js
vendored
@@ -92,7 +92,7 @@ function initThreeElements() {
|
||||
// Initialize pointer camera
|
||||
camera1 = new L3D.PointerCamera(
|
||||
50,
|
||||
container_size.width() / container_size.height(),
|
||||
containerSize.width() / containerSize.height(),
|
||||
0.01, 100000, renderer, container
|
||||
);
|
||||
|
||||
@@ -189,7 +189,7 @@ function render() {
|
||||
// Set current position of camera
|
||||
camera1.look();
|
||||
|
||||
var left = 0, bottom = 0, width = container_size.width(), height = container_size.height();
|
||||
var left = 0, bottom = 0, width = containerSize.width(), height = containerSize.height();
|
||||
renderer.setScissor(left, bottom, width, height);
|
||||
renderer.enableScissorTest(true);
|
||||
renderer.setViewport(left, bottom, width, height);
|
||||
@@ -205,7 +205,7 @@ function render() {
|
||||
THREEx.Transparency.update(camera1);
|
||||
|
||||
// Render preview
|
||||
previewer.render(container_size.width(), container_size.height());
|
||||
previewer.render(containerSize.width(), containerSize.height());
|
||||
|
||||
// Finish stats
|
||||
stats.end();
|
||||
@@ -217,7 +217,7 @@ function onWindowResize() {
|
||||
resizeElements(renderer, container, previewer, Coin, pointer, startCanvas);
|
||||
|
||||
recommendations.forEach(function(reco) {
|
||||
resetCameraAspect(reco.camera, container_size.width(), container_size.height());
|
||||
resetCameraAspect(reco.camera, containerSize.width(), containerSize.height());
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
4
js/l3d/apps/prototype/replay/main.js
vendored
4
js/l3d/apps/prototype/replay/main.js
vendored
@@ -20,7 +20,7 @@ function main() {
|
||||
initThreeElements();
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "/prototype/replay_info/" + params.get.id, true);
|
||||
xhr.open("GET", "/prototype/replay-info/" + params.get.id, true);
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == 4 && xhr.status == 200) {
|
||||
@@ -60,7 +60,7 @@ function init(data) {
|
||||
container.appendChild(renderer.domElement);
|
||||
|
||||
// Initialize replay camera
|
||||
camera1 = new L3D.ReplayCamera(50, container_size.width()/container_size.height(), 0.01, 100000, coins, data);
|
||||
camera1 = new L3D.ReplayCamera(50, containerSize.width()/containerSize.height(), 0.01, 100000, coins, data);
|
||||
recommendations = initMainScene(camera1, scene, coins, undefined, data.redCoins);
|
||||
camera1.cameras = recommendations;
|
||||
|
||||
|
||||
24
js/l3d/apps/prototype/tutorial/TutoCamera.js
vendored
24
js/l3d/apps/prototype/tutorial/TutoCamera.js
vendored
@@ -5,7 +5,7 @@ var TutoCamera = function() {
|
||||
this.renderer = arguments[4];
|
||||
this.onWindowResize = arguments[6];
|
||||
var scene = arguments[5];
|
||||
var container_size = arguments[7];
|
||||
var containerSize = arguments[7];
|
||||
var coins = arguments[8];
|
||||
|
||||
if (arguments[9] === undefined)
|
||||
@@ -76,7 +76,7 @@ var TutoCamera = function() {
|
||||
this.collisions = true;
|
||||
|
||||
// Create tutorial
|
||||
this.tutorial = new TutorialSteps(this, scene, coins, this.onWindowResize, container_size, arguments[10]);
|
||||
this.tutorial = new TutorialSteps(this, scene, coins, this.onWindowResize, containerSize, arguments[10]);
|
||||
|
||||
this.shouldLock = true;
|
||||
|
||||
@@ -191,14 +191,14 @@ TutoCamera.prototype.update = function(time) {
|
||||
};
|
||||
|
||||
TutoCamera.prototype.linearMotion = function(time) {
|
||||
var position_direction = L3D.Tools.diff(this.new_position, this.position);
|
||||
var target_direction = L3D.Tools.diff(this.new_target, this.target);
|
||||
var positionDirection = L3D.Tools.diff(this.newPosition, this.position);
|
||||
var targetDirection = L3D.Tools.diff(this.newTarget, this.target);
|
||||
|
||||
this.position.add(L3D.Tools.mul(position_direction, 0.05 * time / 20));
|
||||
this.target.add(L3D.Tools.mul(target_direction, 0.05 * time / 20));
|
||||
this.position.add(L3D.Tools.mul(positionDirection, 0.05 * time / 20));
|
||||
this.target.add(L3D.Tools.mul(targetDirection, 0.05 * time / 20));
|
||||
|
||||
if (L3D.Tools.norm2(L3D.Tools.diff(this.position, this.new_position)) < 0.01 &&
|
||||
L3D.Tools.norm2(L3D.Tools.diff(this.target, this.new_target)) < 0.01) {
|
||||
if (L3D.Tools.norm2(L3D.Tools.diff(this.position, this.newPosition)) < 0.01 &&
|
||||
L3D.Tools.norm2(L3D.Tools.diff(this.target, this.newTarget)) < 0.01) {
|
||||
this.moving = false;
|
||||
this.anglesFromVectors();
|
||||
}
|
||||
@@ -352,11 +352,11 @@ TutoCamera.prototype.move = function(recommendation, toSave) {
|
||||
this.moving = true;
|
||||
this.movingHermite = false;
|
||||
|
||||
this.new_target = otherCamera.target.clone();
|
||||
this.new_position = otherCamera.position.clone();
|
||||
this.newTarget = otherCamera.target.clone();
|
||||
this.newPosition = otherCamera.position.clone();
|
||||
var t = [0,1];
|
||||
var f = [this.position.clone(), this.new_position];
|
||||
var fp = [L3D.Tools.diff(this.target, this.position), L3D.Tools.diff(this.new_target, this.new_position)];
|
||||
var f = [this.position.clone(), this.newPosition];
|
||||
var fp = [L3D.Tools.diff(this.target, this.position), L3D.Tools.diff(this.newTarget, this.newPosition)];
|
||||
this.hermite = new L3D.Hermite.Polynom(t,f,fp);
|
||||
this.t = 0;
|
||||
|
||||
|
||||
10
js/l3d/apps/prototype/tutorial/TutorialSteps.js
vendored
10
js/l3d/apps/prototype/tutorial/TutorialSteps.js
vendored
@@ -1,11 +1,11 @@
|
||||
var nextStep;
|
||||
var TutorialSteps = function(tutoCamera, scene, coins, onWindowResize, container_size, clickableObjects) {
|
||||
var TutorialSteps = function(tutoCamera, scene, coins, onWindowResize, containerSize, clickableObjects) {
|
||||
this.camera = tutoCamera;
|
||||
this.step = 0;
|
||||
this.coinNumber = 0;
|
||||
this.camera.allowed = {};
|
||||
this.onWindowResize = onWindowResize;
|
||||
this.container_size = container_size;
|
||||
this.containerSize = containerSize;
|
||||
this.coins = coins;
|
||||
this.clickableObjects = clickableObjects;
|
||||
|
||||
@@ -193,7 +193,7 @@ TutorialSteps.prototype.nextStep = function() {
|
||||
});
|
||||
break;
|
||||
case 14:
|
||||
this.firstReco = L3D.createPeachRecommendations(this.container_size.width(), this.container_size.height())[0];
|
||||
this.firstReco = L3D.createPeachRecommendations(this.containerSize.width(), this.containerSize.height())[0];
|
||||
this.addRecommendation(this.firstReco);
|
||||
this.camera.move({
|
||||
position: new THREE.Vector3(-9.157274598933608,3.6852142459329533,2.1820896816244444),
|
||||
@@ -201,7 +201,7 @@ TutorialSteps.prototype.nextStep = function() {
|
||||
});
|
||||
break;
|
||||
case 16:
|
||||
this.secondReco = L3D.createPeachRecommendations(this.container_size.width(), this.container_size.height(), L3D.ViewportRecommendation)[1];
|
||||
this.secondReco = L3D.createPeachRecommendations(this.containerSize.width(), this.containerSize.height(), L3D.ViewportRecommendation)[1];
|
||||
this.addRecommendation(this.secondReco);
|
||||
this.secondReco.raycastable = true;
|
||||
this.camera.move({
|
||||
@@ -217,7 +217,7 @@ TutorialSteps.prototype.nextStep = function() {
|
||||
});
|
||||
}, 3*60*1000);
|
||||
|
||||
var cams = L3D.createPeachRecommendations(this.container_size.width(), this.container_size.height());
|
||||
var cams = L3D.createPeachRecommendations(this.containerSize.width(), this.containerSize.height());
|
||||
for (var i = 2; i < cams.length; i++) {
|
||||
this.addRecommendation(cams[i]);
|
||||
}
|
||||
|
||||
10
js/l3d/apps/prototype/tutorial/main.js
vendored
10
js/l3d/apps/prototype/tutorial/main.js
vendored
@@ -92,8 +92,8 @@ function initThreeElements() {
|
||||
// Initialize pointer camera
|
||||
camera1 = new TutoCamera(
|
||||
50,
|
||||
container_size.width() / container_size.height(),
|
||||
0.01, 100000, renderer, scene, onWindowResize, container_size, coins, container, clickableObjects
|
||||
containerSize.width() / containerSize.height(),
|
||||
0.01, 100000, renderer, scene, onWindowResize, containerSize, coins, container, clickableObjects
|
||||
);
|
||||
|
||||
tutorial = camera1.tutorial;
|
||||
@@ -186,7 +186,7 @@ function render() {
|
||||
// Set current position of camera
|
||||
camera1.look();
|
||||
|
||||
var left = 0, bottom = 0, width = container_size.width(), height = container_size.height();
|
||||
var left = 0, bottom = 0, width = containerSize.width(), height = containerSize.height();
|
||||
renderer.setScissor(left, bottom, width, height);
|
||||
renderer.enableScissorTest(true);
|
||||
renderer.setViewport(left, bottom, width, height);
|
||||
@@ -202,7 +202,7 @@ function render() {
|
||||
THREEx.Transparency.update(camera1);
|
||||
|
||||
// Render preview
|
||||
previewer.render(container_size.width(), container_size.height());
|
||||
previewer.render(containerSize.width(), containerSize.height());
|
||||
|
||||
// Finish stats
|
||||
stats.end();
|
||||
@@ -214,7 +214,7 @@ function onWindowResize() {
|
||||
resizeElements(renderer, container, previewer, Coin, pointer, startCanvas);
|
||||
|
||||
recommendations.forEach(function(reco) {
|
||||
resetCameraAspect(reco.camera, container_size.width(), container_size.height());
|
||||
resetCameraAspect(reco.camera, containerSize.width(), containerSize.height());
|
||||
});
|
||||
|
||||
render();
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
var mesh_number = 25;
|
||||
var meshNumber = 25;
|
||||
var renderer, scene, controls, cube, container, plane, mouse= {x:0, y:0}, sphere, sphereLoader;
|
||||
var bigmesh;
|
||||
var raycaster;
|
||||
var objects = [];
|
||||
var spheres = new Array(mesh_number);
|
||||
var spheres = new Array(meshNumber);
|
||||
var visible = 0;
|
||||
var previousTime;
|
||||
var loader;
|
||||
|
||||
var container_size = {width: 1067, height: 600};
|
||||
var containerSize = {width: 1067, height: 600};
|
||||
|
||||
init();
|
||||
animate();
|
||||
@@ -16,10 +16,10 @@ animate();
|
||||
function init() {
|
||||
// on initialise le moteur de rendu
|
||||
container = document.getElementById('container');
|
||||
container.style.height = container_size.height + 'px';
|
||||
container.style.width = container_size.width + 'px';
|
||||
container.style.height = containerSize.height + 'px';
|
||||
container.style.width = containerSize.width + 'px';
|
||||
renderer = new THREE.WebGLRenderer({alpha:"true"});
|
||||
renderer.setSize(container_size.width, container_size.height);
|
||||
renderer.setSize(containerSize.width, containerSize.height);
|
||||
renderer.shadowMapEnabled = true;
|
||||
// renderer.setClearColor(0x000000);
|
||||
document.getElementById('container').appendChild(renderer.domElement);
|
||||
@@ -29,16 +29,16 @@ function init() {
|
||||
raycaster = new THREE.Raycaster();
|
||||
|
||||
// init light
|
||||
var directional_light = new THREE.DirectionalLight(0x999999);
|
||||
directional_light.position.set(1, 0.5, 1).normalize();
|
||||
directional_light.castShadow = true;
|
||||
scene.add(directional_light);
|
||||
var directionalLight = new THREE.DirectionalLight(0x999999);
|
||||
directionalLight.position.set(1, 0.5, 1).normalize();
|
||||
directionalLight.castShadow = true;
|
||||
scene.add(directionalLight);
|
||||
|
||||
var ambient_light = new THREE.AmbientLight(0x333333);
|
||||
scene.add(ambient_light);
|
||||
var ambientLight = new THREE.AmbientLight(0x333333);
|
||||
scene.add(ambientLight);
|
||||
|
||||
// on initialise la camera que l’on place ensuite sur la scène
|
||||
camera = new L3D.Camera(50, container_size.width / container_size.height, 1, 100000);
|
||||
camera = new L3D.Camera(50, containerSize.width / containerSize.height, 1, 100000);
|
||||
scene.add(camera);
|
||||
|
||||
window.addEventListener('resize', onWindowResize, false);
|
||||
|
||||
@@ -294,14 +294,14 @@ L3D.PointerCamera.prototype.update = function(time) {
|
||||
* @param {Number} time number of milliseconds between the previous and the next frame
|
||||
*/
|
||||
L3D.PointerCamera.prototype.linearMotion = function(time) {
|
||||
var position_direction = L3D.Tools.diff(this.new_position, this.position);
|
||||
var target_direction = L3D.Tools.diff(this.new_target, this.target);
|
||||
var positionDirection = L3D.Tools.diff(this.newPosition, this.position);
|
||||
var targetDirection = L3D.Tools.diff(this.newTarget, this.target);
|
||||
|
||||
this.position.add(L3D.Tools.mul(position_direction, 0.05 * time / 20));
|
||||
this.target.add(L3D.Tools.mul(target_direction, 0.05 * time / 20));
|
||||
this.position.add(L3D.Tools.mul(positionDirection, 0.05 * time / 20));
|
||||
this.target.add(L3D.Tools.mul(targetDirection, 0.05 * time / 20));
|
||||
|
||||
if (L3D.Tools.norm2(L3D.Tools.diff(this.position, this.new_position)) < 0.01 &&
|
||||
L3D.Tools.norm2(L3D.Tools.diff(this.target, this.new_target)) < 0.01) {
|
||||
if (L3D.Tools.norm2(L3D.Tools.diff(this.position, this.newPosition)) < 0.01 &&
|
||||
L3D.Tools.norm2(L3D.Tools.diff(this.target, this.newTarget)) < 0.01) {
|
||||
this.moving = false;
|
||||
this.anglesFromVectors();
|
||||
}
|
||||
@@ -461,11 +461,11 @@ L3D.PointerCamera.prototype.move = function(recommendation, toSave) {
|
||||
this.movingHermite = false;
|
||||
this.moving = true;
|
||||
|
||||
this.new_target = otherCamera.target.clone();
|
||||
this.new_position = otherCamera.position.clone();
|
||||
this.newTarget = otherCamera.target.clone();
|
||||
this.newPosition = otherCamera.position.clone();
|
||||
var t = [0,1];
|
||||
var f = [this.position.clone(), this.new_position];
|
||||
var fp = [L3D.Tools.diff(this.target, this.position), L3D.Tools.diff(this.new_target, this.new_position)];
|
||||
var f = [this.position.clone(), this.newPosition];
|
||||
var fp = [L3D.Tools.diff(this.target, this.position), L3D.Tools.diff(this.newTarget, this.newPosition)];
|
||||
this.hermite = new L3D.Hermite.Polynom(t,f,fp);
|
||||
this.t = 0;
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ L3D.ReplayCamera = function() {
|
||||
|
||||
this.position = new THREE.Vector3();
|
||||
this.target = new THREE.Vector3();
|
||||
this.new_position = new THREE.Vector3();
|
||||
this.new_target = new THREE.Vector3();
|
||||
this.newPosition = new THREE.Vector3();
|
||||
this.newTarget = new THREE.Vector3();
|
||||
|
||||
this.data = arguments[5];
|
||||
|
||||
@@ -54,7 +54,7 @@ L3D.ReplayCamera.prototype.update = function(time) {
|
||||
};
|
||||
|
||||
L3D.ReplayCamera.prototype.linearMotion = function(time) {
|
||||
var tmp = L3D.Tools.sum(L3D.Tools.mul(this.old_position, 1-this.t), L3D.Tools.mul(this.new_position, this.t));
|
||||
var tmp = L3D.Tools.sum(L3D.Tools.mul(this.oldPosition, 1-this.t), L3D.Tools.mul(this.newPosition, this.t));
|
||||
this.position.copy(tmp);
|
||||
this.t += 0.1 * time / 20;
|
||||
|
||||
@@ -65,9 +65,9 @@ L3D.ReplayCamera.prototype.linearMotion = function(time) {
|
||||
|
||||
L3D.ReplayCamera.prototype.cameraMotion = function(time) {
|
||||
|
||||
var tmp = L3D.Tools.sum(L3D.Tools.mul(this.old_position, 1-this.t), L3D.Tools.mul(this.new_position, this.t));
|
||||
var tmp = L3D.Tools.sum(L3D.Tools.mul(this.oldPosition, 1-this.t), L3D.Tools.mul(this.newPosition, this.t));
|
||||
this.position.copy(tmp);
|
||||
this.target = L3D.Tools.sum(L3D.Tools.mul(this.old_target, 1-this.t), L3D.Tools.mul(this.new_target, this.t));
|
||||
this.target = L3D.Tools.sum(L3D.Tools.mul(this.oldTarget, 1-this.t), L3D.Tools.mul(this.newTarget, this.t));
|
||||
this.t += 1 / (((new Date(this.path[this.counter].time)).getTime() - (new Date(this.path[this.counter-1].time)).getTime()) / 20);
|
||||
|
||||
if (this.t > 1) {
|
||||
@@ -171,10 +171,10 @@ L3D.ReplayCamera.prototype.move = function(recommendation) {
|
||||
var otherCamera = recommendation.camera || recommendation;
|
||||
|
||||
this.moving = true;
|
||||
this.old_target = this.target.clone();
|
||||
this.old_position = this.position.clone();
|
||||
this.new_target = new THREE.Vector3(otherCamera.target.x, otherCamera.target.y, otherCamera.target.z);
|
||||
this.new_position = new THREE.Vector3(otherCamera.position.x, otherCamera.position.y, otherCamera.position.z);
|
||||
this.oldTarget = this.target.clone();
|
||||
this.oldPosition = this.position.clone();
|
||||
this.newTarget = new THREE.Vector3(otherCamera.target.x, otherCamera.target.y, otherCamera.target.z);
|
||||
this.newPosition = new THREE.Vector3(otherCamera.position.x, otherCamera.position.y, otherCamera.position.z);
|
||||
this.t = 0;
|
||||
|
||||
};
|
||||
|
||||
@@ -132,11 +132,11 @@ L3D.MousePointer.prototype.render = function(style, force) {
|
||||
|
||||
this.domElement.width = this.domElement.width;
|
||||
|
||||
var i = container_size.width() / 2;
|
||||
var i = containerSize.width() / 2;
|
||||
var imin = i - this.size;
|
||||
var imax = i + this.size;
|
||||
|
||||
var j = container_size.height() / 2;
|
||||
var j = containerSize.height() / 2;
|
||||
var jmin = j - this.size;
|
||||
var jmax = j + this.size;
|
||||
|
||||
|
||||
@@ -61,15 +61,15 @@ L3D.Previewer = function(renderer, scene) {
|
||||
|
||||
/**
|
||||
* Renders the preview
|
||||
* @param {Number} container_width width of the container
|
||||
* @param {Number} container_height height of the container
|
||||
* @param {Number} containerWidth width of the container
|
||||
* @param {Number} containerHeight height of the container
|
||||
*/
|
||||
L3D.Previewer.prototype.render = function(container_width, container_height) {
|
||||
L3D.Previewer.prototype.render = function(containerWidth, containerHeight) {
|
||||
var width, height, left, bottom;
|
||||
|
||||
if (this.camera) {
|
||||
width = Math.floor(container_width / 5);
|
||||
height = Math.floor(container_height / 5);
|
||||
width = Math.floor(containerWidth / 5);
|
||||
height = Math.floor(containerHeight / 5);
|
||||
if (!this.fixed) {
|
||||
left = Math.floor(this.mouse.x - width/2);
|
||||
bottom = Math.floor(this.renderer.domElement.height - this.mouse.y + height/5);
|
||||
@@ -88,22 +88,22 @@ L3D.Previewer.prototype.render = function(container_width, container_height) {
|
||||
}
|
||||
|
||||
// Draw border
|
||||
var can_bottom = container_height - bottom - height ;
|
||||
var canBottom = containerHeight - bottom - height ;
|
||||
this.ctx.strokeStyle = "#ffffff";
|
||||
this.ctx.beginPath();
|
||||
this.ctx.moveTo(left-1, can_bottom);
|
||||
this.ctx.lineTo(left-1, can_bottom + height);
|
||||
this.ctx.lineTo(left + width-1, can_bottom + height);
|
||||
this.ctx.lineTo(left + width-1, can_bottom);
|
||||
this.ctx.moveTo(left-1, canBottom);
|
||||
this.ctx.lineTo(left-1, canBottom + height);
|
||||
this.ctx.lineTo(left + width-1, canBottom + height);
|
||||
this.ctx.lineTo(left + width-1, canBottom);
|
||||
this.ctx.closePath();
|
||||
this.ctx.stroke();
|
||||
|
||||
this.ctx.strokeStyle = "#000000";
|
||||
this.ctx.beginPath();
|
||||
this.ctx.moveTo(left, can_bottom + 1);
|
||||
this.ctx.lineTo(left, can_bottom + height - 1);
|
||||
this.ctx.lineTo(left + width - 2 , can_bottom + height-1);
|
||||
this.ctx.lineTo(left + width - 2, can_bottom+1);
|
||||
this.ctx.moveTo(left, canBottom + 1);
|
||||
this.ctx.lineTo(left, canBottom + height - 1);
|
||||
this.ctx.lineTo(left + width - 2 , canBottom + height-1);
|
||||
this.ctx.lineTo(left + width - 2, canBottom+1);
|
||||
this.ctx.closePath();
|
||||
this.ctx.stroke();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ L3D.StartCanvas.prototype.render = function(force) {
|
||||
this.ctx.font = '30px Verdana';
|
||||
this.ctx.globalAlpha = 1;
|
||||
this.ctx.fillStyle = 'black';
|
||||
this.ctx.fillText('Click here to lock the pointer !', container_size.width()/3.25, container_size.height()/2-10);
|
||||
this.ctx.fillText('Click here to lock the pointer !', containerSize.width()/3.25, containerSize.height()/2-10);
|
||||
|
||||
|
||||
this.shown = true;
|
||||
|
||||
@@ -2,9 +2,9 @@ var container = document.getElementById('content');
|
||||
|
||||
function print(text) {
|
||||
var content = document.createTextNode(text);
|
||||
var new_line = document.createElement('br');
|
||||
var newLine = document.createElement('br');
|
||||
container.appendChild(content);
|
||||
container.appendChild(new_line);
|
||||
container.appendChild(newLine);
|
||||
}
|
||||
|
||||
function toString(variable) {
|
||||
|
||||
@@ -190,26 +190,26 @@ L3D.BaseRecommendation.prototype.update = function(mainCamera) {
|
||||
// Compute distance between center of camera and position
|
||||
dist = L3D.Tools.norm2(L3D.Tools.diff(mainCamera.position, this.center));
|
||||
|
||||
var low_bound = 1;
|
||||
var high_bound = 5;
|
||||
var new_value;
|
||||
var lowBound = 1;
|
||||
var highBound = 5;
|
||||
var newValue;
|
||||
|
||||
if (dist < low_bound) {
|
||||
new_value = 0;
|
||||
} else if (dist > high_bound) {
|
||||
new_value = 1;
|
||||
if (dist < lowBound) {
|
||||
newValue = 0;
|
||||
} else if (dist > highBound) {
|
||||
newValue = 1;
|
||||
} else {
|
||||
new_value = (dist - low_bound)/(high_bound - low_bound);
|
||||
newValue = (dist - lowBound)/(highBound - lowBound);
|
||||
}
|
||||
|
||||
// Update opacity
|
||||
var self = this;
|
||||
this.object3D.traverse(function(elt) {
|
||||
if (elt instanceof THREE.Mesh) {
|
||||
elt.material.transparent = new_value < 0.9;
|
||||
elt.material.opacity = new_value;
|
||||
elt.material.transparent = newValue < 0.9;
|
||||
elt.material.opacity = newValue;
|
||||
|
||||
if (new_value < 0.1)
|
||||
if (newValue < 0.1)
|
||||
self.raycastable = elt.raycastable = elt.material.transparent = elt.visible = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -42,8 +42,8 @@ L3D.ViewportRecommendation = function(arg1, arg2, arg3, arg4, position, target)
|
||||
(function(self, direction, left, other) {
|
||||
var material = new THREE.LineBasicMaterial({ color: '0x000000'});
|
||||
var geometry = new THREE.Geometry();
|
||||
var tmp_direction = L3D.Tools.mul(direction, -2);
|
||||
var target = L3D.Tools.sum(self.camera.position, tmp_direction);
|
||||
var tmpDirection = L3D.Tools.mul(direction, -2);
|
||||
var target = L3D.Tools.sum(self.camera.position, tmpDirection);
|
||||
// geometry.vertices.push(self.camera.position, target);
|
||||
geometry.vertices.push(
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
@@ -53,16 +53,16 @@ L3D.ViewportRecommendation = function(arg1, arg2, arg3, arg4, position, target)
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
L3D.Tools.sum(L3D.Tools.diff(self.camera.position, other), left),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.diff(L3D.Tools.sum(self.camera.position, other),left),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.diff(L3D.Tools.diff(self.camera.position, left),other),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.sum(L3D.Tools.diff(self.camera.position, other), left)
|
||||
);
|
||||
|
||||
@@ -73,14 +73,14 @@ L3D.ViewportRecommendation = function(arg1, arg2, arg3, arg4, position, target)
|
||||
|
||||
var material = new THREE.MeshBasicMaterial();
|
||||
var geometry = new THREE.Geometry();
|
||||
var tmp_direction = L3D.Tools.mul(direction, -2);
|
||||
var tmpDirection = L3D.Tools.mul(direction, -2);
|
||||
|
||||
geometry.vertices = [
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
L3D.Tools.diff(L3D.Tools.sum(self.camera.position, other),left),
|
||||
L3D.Tools.diff(L3D.Tools.diff(self.camera.position, left),other),
|
||||
L3D.Tools.sum(L3D.Tools.diff(self.camera.position, other), left),
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction)
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection)
|
||||
];
|
||||
|
||||
geometry.faces = [
|
||||
@@ -145,22 +145,22 @@ L3D.ViewportRecommendation.prototype.update = function(position) {
|
||||
// Compute distance between center of camera and position
|
||||
dist = L3D.Tools.norm2(L3D.Tools.diff(position.position, this.camera.position));
|
||||
|
||||
var low_bound = 0.5;
|
||||
var high_bound = 5;
|
||||
var new_value;
|
||||
var max_value = 0.5;
|
||||
var lowBound = 0.5;
|
||||
var highBound = 5;
|
||||
var newValue;
|
||||
var maxValue = 0.5;
|
||||
|
||||
if (dist < low_bound)
|
||||
new_value = 0;
|
||||
else if (dist > high_bound)
|
||||
new_value = max_value;
|
||||
if (dist < lowBound)
|
||||
newValue = 0;
|
||||
else if (dist > highBound)
|
||||
newValue = maxValue;
|
||||
else
|
||||
new_value = max_value * (dist - low_bound)/(high_bound - low_bound);
|
||||
newValue = maxValue * (dist - lowBound)/(highBound - lowBound);
|
||||
|
||||
this.mesh.material.transparent = new_value < 0.9;
|
||||
this.mesh.material.opacity = new_value;
|
||||
this.mesh.material.transparent = newValue < 0.9;
|
||||
this.mesh.material.opacity = newValue;
|
||||
|
||||
this.raycastable = this.line.visible = this.mesh.material.transparent = this.mesh.visible = new_value > 0.1;
|
||||
this.raycastable = this.line.visible = this.mesh.material.transparent = this.mesh.visible = newValue > 0.1;
|
||||
};
|
||||
|
||||
L3D.ViewportRecommendation.prototype.setSize = function(size) {
|
||||
@@ -187,8 +187,8 @@ L3D.ViewportRecommendation.prototype.setSize = function(size) {
|
||||
|
||||
(function(self, direction, left, other, size) {
|
||||
|
||||
var tmp_direction = L3D.Tools.mul(direction, -2 * size);
|
||||
var target = L3D.Tools.sum(self.camera.position, tmp_direction);
|
||||
var tmpDirection = L3D.Tools.mul(direction, -2 * size);
|
||||
var target = L3D.Tools.sum(self.camera.position, tmpDirection);
|
||||
|
||||
var vertices = [
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
@@ -198,16 +198,16 @@ L3D.ViewportRecommendation.prototype.setSize = function(size) {
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
L3D.Tools.sum(L3D.Tools.diff(self.camera.position, other), left),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.diff(L3D.Tools.sum(self.camera.position, other),left),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.diff(L3D.Tools.diff(self.camera.position, left),other),
|
||||
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction),
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection),
|
||||
L3D.Tools.sum(L3D.Tools.diff(self.camera.position, other), left)
|
||||
];
|
||||
|
||||
@@ -218,14 +218,14 @@ L3D.ViewportRecommendation.prototype.setSize = function(size) {
|
||||
|
||||
(function(self, direction, left, other) {
|
||||
|
||||
var tmp_direction = L3D.Tools.mul(direction, -2 * size);
|
||||
var tmpDirection = L3D.Tools.mul(direction, -2 * size);
|
||||
|
||||
self.collidingObject.geometry.vertices = [
|
||||
L3D.Tools.sum(L3D.Tools.sum(self.camera.position, left), other),
|
||||
L3D.Tools.diff(L3D.Tools.sum(self.camera.position, other),left),
|
||||
L3D.Tools.diff(L3D.Tools.diff(self.camera.position, left),other),
|
||||
L3D.Tools.sum(L3D.Tools.diff(self.camera.position, other), left),
|
||||
L3D.Tools.sum(self.camera.position, tmp_direction)
|
||||
L3D.Tools.sum(self.camera.position, tmpDirection)
|
||||
];
|
||||
|
||||
})(this, direction, left, other, size);
|
||||
|
||||
@@ -8,13 +8,13 @@ L3D.LogFunction = function(a,b) {
|
||||
};
|
||||
|
||||
L3D.addLight = function(scene) {
|
||||
var directional_light = new THREE.DirectionalLight(0xdddddd);
|
||||
directional_light.position.set(1, 2.5, 1).normalize();
|
||||
directional_light.castShadow = false;
|
||||
scene.add(directional_light);
|
||||
var directionalLight = new THREE.DirectionalLight(0xdddddd);
|
||||
directionalLight.position.set(1, 2.5, 1).normalize();
|
||||
directionalLight.castShadow = false;
|
||||
scene.add(directionalLight);
|
||||
|
||||
var ambient_light = new THREE.AmbientLight(0x555555);
|
||||
scene.add(ambient_light);
|
||||
var ambientLight = new THREE.AmbientLight(0x555555);
|
||||
scene.add(ambientLight);
|
||||
};
|
||||
|
||||
L3D.initPeachCastle = function(scene, collidableObjects, recommendation, clickable) {
|
||||
@@ -52,7 +52,7 @@ L3D.resetPeachElements = function() {
|
||||
};
|
||||
};
|
||||
|
||||
L3D.initPeach = function(camera, scene, coins, clickable, coin_ids) {
|
||||
L3D.initPeach = function(camera, scene, coins, clickable, coinIds) {
|
||||
L3D.addLight(scene);
|
||||
|
||||
var collidableObjects = [];
|
||||
@@ -67,7 +67,7 @@ L3D.initPeach = function(camera, scene, coins, clickable, coin_ids) {
|
||||
|
||||
scene.add(camera);
|
||||
|
||||
var tmp = L3D.generateCoins(L3D.createPeachCoins(), coin_ids);
|
||||
var tmp = L3D.generateCoins(L3D.createPeachCoins(), coinIds);
|
||||
|
||||
for (var i in tmp) {
|
||||
coins.push(tmp[i]);
|
||||
@@ -195,12 +195,12 @@ L3D.resetBobombElements = function() {
|
||||
};
|
||||
};
|
||||
|
||||
L3D.generateCoins = function(totalCoins, coin_ids) {
|
||||
L3D.generateCoins = function(totalCoins, coinIds) {
|
||||
|
||||
var i = 0;
|
||||
var tmp = [];
|
||||
|
||||
if (coin_ids === undefined) {
|
||||
if (coinIds === undefined) {
|
||||
|
||||
tmp = [];
|
||||
|
||||
@@ -215,17 +215,17 @@ L3D.generateCoins = function(totalCoins, coin_ids) {
|
||||
totalCoins.push(tmp[coinsId[i]]);
|
||||
}
|
||||
|
||||
} else if (coin_ids === null) {
|
||||
} else if (coinIds === null) {
|
||||
|
||||
return [];
|
||||
|
||||
} else {
|
||||
|
||||
for (i = 0; i < coin_ids.length; i++) {
|
||||
for (i = 0; i < coinIds.length; i++) {
|
||||
|
||||
for (var j = 0; j < totalCoins.length; j++) {
|
||||
|
||||
if (coin_ids[i] === totalCoins[j].id) {
|
||||
if (coinIds[i] === totalCoins[j].id) {
|
||||
|
||||
// Swap i and j
|
||||
tmp = totalCoins[i];
|
||||
@@ -241,7 +241,7 @@ L3D.generateCoins = function(totalCoins, coin_ids) {
|
||||
var indices = [];
|
||||
var coins = [];
|
||||
|
||||
var bound = (coin_ids instanceof Array && coin_ids.length === 0) ? totalCoins.length : 8;
|
||||
var bound = (coinIds instanceof Array && coinIds.length === 0) ? totalCoins.length : 8;
|
||||
|
||||
for (i = 0; i < bound; i++) {
|
||||
coins.push(totalCoins[i].coin);
|
||||
@@ -317,7 +317,7 @@ L3D.createBobombRecommendations = function(width, height) {
|
||||
|
||||
};
|
||||
|
||||
L3D.initBobomb = function(camera, scene, coins, clickable, coin_ids) {
|
||||
L3D.initBobomb = function(camera, scene, coins, clickable, coinIds) {
|
||||
L3D.addLight(scene);
|
||||
|
||||
var collidableObjects = [];
|
||||
@@ -333,13 +333,13 @@ L3D.initBobomb = function(camera, scene, coins, clickable, coin_ids) {
|
||||
scene.add(camera);
|
||||
|
||||
Coin.init();
|
||||
var tmp = L3D.generateCoins(L3D.createBobombCoins(), coin_ids);
|
||||
var tmp = L3D.generateCoins(L3D.createBobombCoins(), coinIds);
|
||||
|
||||
for (var i in tmp) {
|
||||
coins.push(tmp[i]);
|
||||
}
|
||||
|
||||
var recommendations = L3D.createBobombRecommendations(container_size.width(), container_size.height());
|
||||
var recommendations = L3D.createBobombRecommendations(containerSize.width(), containerSize.height());
|
||||
|
||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||
|
||||
@@ -473,7 +473,7 @@ L3D.resetWhompElements = function() {
|
||||
};
|
||||
};
|
||||
|
||||
L3D.initWhomp = function(recommendation, scene, coins, clickable, coin_ids) {
|
||||
L3D.initWhomp = function(recommendation, scene, coins, clickable, coinIds) {
|
||||
L3D.addLight(scene);
|
||||
|
||||
var collidableObjects = [];
|
||||
@@ -489,13 +489,13 @@ L3D.initWhomp = function(recommendation, scene, coins, clickable, coin_ids) {
|
||||
scene.add(recommendation);
|
||||
|
||||
Coin.init(0.002);
|
||||
var tmp = L3D.generateCoins(L3D.createWhompCoins(), coin_ids);
|
||||
var tmp = L3D.generateCoins(L3D.createWhompCoins(), coinIds);
|
||||
|
||||
for (var i in tmp) {
|
||||
coins.push(tmp[i]);
|
||||
}
|
||||
|
||||
var recommendations = L3D.createWhompRecommendations(container_size.width(), container_size.height());
|
||||
var recommendations = L3D.createWhompRecommendations(containerSize.width(), containerSize.height());
|
||||
|
||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||
|
||||
@@ -610,7 +610,7 @@ L3D.resetMountainElements = function() {
|
||||
};
|
||||
};
|
||||
|
||||
L3D.initMountain = function(recommendation, scene, coins, clickable, coin_ids) {
|
||||
L3D.initMountain = function(recommendation, scene, coins, clickable, coinIds) {
|
||||
L3D.addLight(scene);
|
||||
|
||||
var collidableObjects = [];
|
||||
@@ -626,13 +626,13 @@ L3D.initMountain = function(recommendation, scene, coins, clickable, coin_ids) {
|
||||
scene.add(recommendation);
|
||||
|
||||
Coin.init();
|
||||
var tmp = L3D.generateCoins(L3D.createMountainCoins(), coin_ids);
|
||||
var tmp = L3D.generateCoins(L3D.createMountainCoins(), coinIds);
|
||||
|
||||
for (var i in tmp) {
|
||||
coins.push(tmp[i]);
|
||||
}
|
||||
|
||||
var recommendations = L3D.createMountainRecommendations(container_size.width(), container_size.height());
|
||||
var recommendations = L3D.createMountainRecommendations(containerSize.width(), containerSize.height());
|
||||
|
||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||
|
||||
@@ -691,8 +691,6 @@ L3D.initSponzaScene = function(scene, collidableObjects, recommendation, clickab
|
||||
collidableObjects.push(loader.obj);
|
||||
loader.obj.raycastable = true;
|
||||
|
||||
|
||||
|
||||
// ProgressiveLoader('/static/data/sponza/sponza.obj', scene,
|
||||
// function(obj) {
|
||||
// obj.scale.set(0.1,0.1,0.1);
|
||||
@@ -749,7 +747,7 @@ L3D.initSponza = function(recommendation, scene, coins, clickable) {
|
||||
coins.push(tmp[i]);
|
||||
}
|
||||
|
||||
var recommendations = L3D.createSponzaRecommendations(container_size.width(), container_size.height());
|
||||
var recommendations = L3D.createSponzaRecommendations(containerSize.width(), containerSize.height());
|
||||
|
||||
recommendations.forEach(function(reco) {reco.addToScene(scene);});
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ L3D.DB.Event.ArrowClicked = function() {
|
||||
* Id of the arrow
|
||||
* @type {Number}
|
||||
*/
|
||||
this.arrow_id = null;
|
||||
this.arrowId = null;
|
||||
|
||||
};
|
||||
|
||||
@@ -109,7 +109,7 @@ L3D.DB.Event.ArrowClicked = function() {
|
||||
*/
|
||||
L3D.DB.Event.ArrowClicked.prototype.send = function() {
|
||||
var url = "/posts/arrow-clicked";
|
||||
var data = {arrow_id: this.arrow_id};
|
||||
var data = {arrowId: this.arrowId};
|
||||
L3D.DB.Private.sendData(url, data);
|
||||
};
|
||||
|
||||
@@ -124,7 +124,7 @@ L3D.DB.Event.CoinClicked = function() {
|
||||
* Id of the coin taken
|
||||
* @type {Number}
|
||||
*/
|
||||
this.coin_id = null;
|
||||
this.coinId = null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ L3D.DB.Event.CoinClicked = function() {
|
||||
*/
|
||||
L3D.DB.Event.CoinClicked.prototype.send = function() {
|
||||
var url = "/posts/coin-clicked";
|
||||
var data = {coin_id: this.coin_id};
|
||||
var data = {coinId: this.coinId};
|
||||
L3D.DB.Private.sendData(url, data);
|
||||
};
|
||||
|
||||
@@ -222,7 +222,7 @@ L3D.DB.Event.Hovered = function() {
|
||||
* The id of the arrow hovered
|
||||
* @type {Number}
|
||||
*/
|
||||
this.arrow_id = null;
|
||||
this.arrowId = null;
|
||||
|
||||
/**
|
||||
* true if the hover starts, false if finishes
|
||||
@@ -239,7 +239,7 @@ L3D.DB.Event.Hovered.prototype.send = function() {
|
||||
var url = "/posts/hovered";
|
||||
var data = {
|
||||
start: this.start,
|
||||
arrow_id: this.arrow_id
|
||||
arrowId: this.arrowId
|
||||
};
|
||||
|
||||
L3D.DB.Private.sendData(url, data);
|
||||
|
||||
Reference in New Issue
Block a user