From mixed convetion (_, and camel case) to all camel case

This commit is contained in:
Thomas FORGIONE
2015-08-28 21:34:29 +02:00
parent f136ce833f
commit 74cad3824b
40 changed files with 323 additions and 312 deletions

View File

@@ -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) {

View File

@@ -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 lon 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);

View File

@@ -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 lon 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);

View File

@@ -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;

View File

@@ -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++) {

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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]);
}

View File

@@ -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();

View File

@@ -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 lon 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);