Add support for priority field

parent 57219920
......@@ -894,8 +894,19 @@ define(['three'], function(THREE, BSPTree){
});
return;
}
if(comparison){
if(comparison === 0){
var nodePriority = BSPTree.utils.getPriority(node);
var compareWithPriority = BSPTree.utils.getPriority(compareWith);
if(nodePriority > compareWithPriority){
comparison = -1;
} else {
comparison = 1;
}
}
if(comparison === 1){
if(!compareWith.back){
compareWith.back = node;
} else {
......@@ -930,6 +941,13 @@ define(['three'], function(THREE, BSPTree){
getPointSign: function(normal, point, pointOnPlane){
return this.sign(normal.dot(point.clone().sub(pointOnPlane)));
},
getPriority: function(node){
if(typeof node.element.priority === 'number'){
return node.element.priority;
} else {
return 0;
}
},
isPointInSegment: function(point, p1, p2){
// This function assumes that point lies on the line
// and determines whether it is in line _segment_
......@@ -1004,7 +1022,13 @@ define(['three'], function(THREE, BSPTree){
if(thisSign === undefined) return undefined;
return (viewerSign !== thisSign);
if(thisSign === 0) return 0;
if(viewerSign !== thisSign){
return 1;
} else {
return -1;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment