This commit is contained in:
Thomas FORGIONE
2015-08-25 14:03:01 +02:00
parent 5f3b2e1862
commit f0e4455bc2
9 changed files with 59 additions and 198 deletions

View File

@@ -210,13 +210,11 @@ L3D.PointerCamera.prototype.lockPointer = function() {
* @returns true if the pointer is locked, false otherwise
*/
L3D.PointerCamera.prototype.isLocked = function() {
var toto =
return
document.pointerLockElement === this.renderer.domElement ||
document.mozPointerLockElement === this.renderer.domElement ||
document.webkitPointerLockElement === this.renderer.domElement;
return toto;
};
/**
@@ -741,6 +739,14 @@ L3D.PointerCamera.prototype.redoable = function() {
return this.history.redoable();
};
/**
* Creates a list containing all the elements to send to the server to stream visible part
* @return {Array} A list containing <ol start="0">
* <li>the position of the camera</li>
* <li>the target of the camera</li>
* <li>and planes defining the frustum of the camera (a,b,c, and d from ax+by+cz+d=0)</li>
* </ol>
*/
L3D.PointerCamera.prototype.toList = function() {
this.updateMatrix();
this.updateMatrixWorld();

View File

@@ -10,6 +10,7 @@ Math.clamp = Math.clamp || function(number, min, max) {
* @description Displays a small preview of a camera
*/
L3D.Previewer = function(renderer, scene) {
/**
* @type {element}
* @description The document element to add on top of the renderer
@@ -60,13 +61,6 @@ L3D.Previewer = function(renderer, scene) {
/**
* Renders the preview
* @param {Object} pref an object containing :
* <ul>
* <li><code>go</code> : a boolean if the rendering should be done</li>
* <li><code>x</code> : the x coordinate of the mouse</li>
* <li><code>y</code> : the y coordinate of the mouse</li>
* <li><code>camera</code> : the camera to use for the preview</li>
* </ul>
* @param {Number} container_width width of the container
* @param {Number} container_height height of the container
*/

View File

@@ -2,6 +2,7 @@ L3D.ProgressiveLoader = (function() {
/**
* Parse a list as it is sent by the server and gives a slightly more comprehensible result
* @param Array array corresponding to the line of the mesh file
* @private
*/
var _parseList = function(arr) {
@@ -117,12 +118,6 @@ var ProgressiveLoader = function(path, scene, camera, callback, log) {
*/
this.callback = callback;
/**
* Counter (not used)
* @private
*/
this.counter = 0;
/**
* Group where the sub-objects will be added
* @type {THREE.Object3D}

View File

@@ -48,7 +48,7 @@ L3D.Hermite.Polynom = function(t, f, fp) {
* @type {Object}
* @description an object containing
* <ul>
* <li><code>whatType</code> : a string being <code>THREE.Vector3</code> or <code>number</code></li>
* <li><code>whatType</code> : a string being <code>THREE.Vector3</code> or <code>Number</code></li>
* <li><code>tools</code> : an object containg sum and mul, functions of the correct type</li>
* </ul>
*/
@@ -58,7 +58,7 @@ L3D.Hermite.Polynom = function(t, f, fp) {
this.tools.sum = L3D.Tools.sum;
this.tools.prod = L3D.Tools.mul;
} else {
this.tools.whatType = 'number';
this.tools.whatType = 'Number';
this.tools.sum = function(a, b) { return a + b; };
this.tools.prod = function(a, b) { return a * b; };
}
@@ -266,7 +266,7 @@ L3D.Hermite.special.Polynom = function(P0, P1, PP1) {
* @type {Object}
* @description an object containing
* <ul>
* <li><code>whatType</code> : a string being <code>THREE.Vector3</code> or <code>number</code></li>
* <li><code>whatType</code> : a string being <code>THREE.Vector3</code> or <code>Number</code></li>
* <li><code>tools</code> : an object containg sum and mul, functions of the correct type</li>
* </ul>
*/

View File

@@ -1,3 +1,9 @@
/**
* @memberof L3D
* @extends BaseRecommendation
* @description Represents a recommendation not shown and not clickable (for hiding recommendations)
* @constructor
*/
L3D.EmptyRecommendation = function() {
L3D.BaseRecommendation.apply(this, arguments);
this.target = new THREE.Vector3();

View File

@@ -1,23 +1,3 @@
// http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array#answer-2450976
L3D.shuffle = function(array) {
var currentIndex = array.length, temporaryValue, randomIndex ;
// While there remain elements to shuffle...
while (0 !== currentIndex) {
// Pick a remaining element...
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
// And swap it with the current element.
temporaryValue = array[currentIndex];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
};
L3D.LogFunction = function(a,b) {
var val = 100*a/b;
$('.progress-bar').css('width', val+'%').attr('aria-valuenow', val);
@@ -218,19 +198,27 @@ L3D.resetBobombElements = function() {
L3D.generateCoins = function(totalCoins, coin_ids) {
var i = 0;
var tmp = [];
if (coin_ids === undefined) {
var tmp = [];
// Use global variable coinsId
tmp = [];
// Use global variable coinsId set by server
for (i = 0; i < totalCoins.length; i++) {
tmp.push(totalCoins[i]);
}
totalCoins.length = 0;
for (var i = 0; i < 8; i++) {
for (i = 0; i < 8; i++) {
totalCoins.push(tmp[coinsId[i]]);
}
} else if (coin_ids === null) {
return [];
} else {
for (i = 0; i < coin_ids.length; i++) {
@@ -240,7 +228,7 @@ L3D.generateCoins = function(totalCoins, coin_ids) {
if (coin_ids[i] === totalCoins[j].id) {
// Swap i and j
var tmp = totalCoins[i];
tmp = totalCoins[i];
totalCoins[i] = totalCoins[j];
totalCoins[j] = tmp;