Skip to content

Commit

Permalink
Revert "Solving multiple shapes display order with new function addOr…
Browse files Browse the repository at this point in the history
…dered"

This reverts commit d4fe4c1.
  • Loading branch information
Mysterix committed May 2, 2014
1 parent d4fe4c1 commit 6c71697
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions js/isomer.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,35 +82,6 @@ Isomer.prototype.add = function (item, baseColor) {
}
};

/**
* Adds an array of shapes to the scene, sorting their faces globally
* so that they are displayed in the right order
*
* Input is given as an array of {shape: yourShape, color: yourColor}
*/

Isomer.prototype.addOrdered = function (item) {
var Point = Isomer.Point;
var observer = new Point(-10, -10, 10);
var pathList = [];
var index = 0;

for (var i = 0; i < item.length; i++) {
for(var j = 0 ; j < item[i].shape.paths.length ; j++){
pathList[index] = {
path: item[i].shape.paths[j],
color: item[i].color,
distance: item[i].shape._pathDistances(item[i].shape.paths[j], observer)
};
index++;
}
}
pathList.sort(function(pathA, pathB){return (pathB.distance.averageDistance - pathA.distance.averageDistance)});

for (var i = 0 ; i < pathList.length ; i++) {
this._addPath(pathList[i].path, pathList[i].color);
}
};

/**
* Adds a path to the scene
Expand Down

0 comments on commit 6c71697

Please sign in to comment.