a:20:{s:9:"#provides";s:21:"dojox.gfx3d.scheduler";s:9:"#resource";s:18:"gfx3d/scheduler.js";s:9:"#requires";a:1:{i:0;a:2:{i:0;s:6:"common";i:1;s:18:"dojox.gfx3d.vector";}}s:38:"dojox.gfx3d.scheduler.BinarySearchTree";a:5:{s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:3:"obj";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:18:"dojox.gfx3d.Object";}s:7:"outline";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:158:" this.plus = null; this.minus = null; this.object = obj; var o = outline(obj); this.orient = o[0]; this.normal = dojox.gfx3d.vector.normalize(o);";s:7:"summary";s:507:"build the binary search tree, using binary space partition algorithm. The idea is for any polygon, for example, (a, b, c), the space is divided by the plane into two space: plus and minus. for any arbitary vertex p, if(p - a) dotProduct n = 0, p is inside the plane, > 0, p is in the plus space, vice versa for minus space. n is the normal vector that is perpendicular the plate, defined as: n = ( b - a) crossProduct ( c - a ) in this implementation, n is declared as normal, ,a is declared as orient.";s:9:"classlike";b:1;}s:42:"dojox.gfx3d.scheduler.BinarySearchTree.add";a:5:{s:9:"prototype";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:3:"obj";a:1:{s:4:"type";s:0:"";}s:7:"outline";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:836:" var epsilon = 0.5, o = outline(obj), v = dojox.gfx3d.vector, n = this.normal, a = this.orient, BST = dojox.gfx3d.scheduler.BinarySearchTree; if( dojo.every(o, function(item){ return Math.floor(epsilon + v.dotProduct(n, v.substract(item, a))) <= 0; }) ){ if(this.minus){ this.minus.add(obj, outline); }else{ this.minus = new BST(obj, outline); } }else if( dojo.every(o, function(item){ return Math.floor(epsilon + v.dotProduct(n, v.substract(item, a))) >= 0; }) ){ if(this.plus){ this.plus.add(obj, outline); } else { this.plus = new BST(obj, outline); } }else{ /* dojo.forEach(o, function(item){ console.debug(v.dotProduct(n, v.substract(item, a))); }); */ throw "The case: polygon cross siblings' plate is not implemneted yet"; }";s:7:"summary";s:0:"";}s:46:"dojox.gfx3d.scheduler.BinarySearchTree.iterate";a:5:{s:9:"prototype";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"outline";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:518:" var epsilon = 0.5; var v = dojox.gfx3d.vector; var sorted = []; var subs = null; // FIXME: using Infinity here? var view = {x: 0, y: 0, z: -10000}; if(Math.floor( epsilon + v.dotProduct(this.normal, v.substract(view, this.orient))) <= 0){ subs = [this.plus, this.minus]; }else{ subs = [this.minus, this.plus]; } if(subs[0]){ sorted = sorted.concat(subs[0].iterate()); } sorted.push(this.object); if(subs[1]){ sorted = sorted.concat(subs[1].iterate()); } return sorted;";s:7:"summary";s:0:"";}s:44:"dojox.gfx3d.scheduler.BinarySearchTree.minus";a:2:{s:8:"instance";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:7:"summary";s:0:"";}s:43:"dojox.gfx3d.scheduler.BinarySearchTree.plus";a:2:{s:8:"instance";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:7:"summary";s:0:"";}s:45:"dojox.gfx3d.scheduler.BinarySearchTree.object";a:2:{s:8:"instance";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:7:"summary";s:0:"";}s:45:"dojox.gfx3d.scheduler.BinarySearchTree.orient";a:2:{s:8:"instance";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:7:"summary";s:0:"";}s:45:"dojox.gfx3d.scheduler.BinarySearchTree.normal";a:2:{s:8:"instance";s:38:"dojox.gfx3d.scheduler.BinarySearchTree";s:7:"summary";s:0:"";}s:28:"dojox.gfx3d.scheduler.zOrder";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:6:"buffer";a:1:{s:4:"type";s:0:"";}s:5:"order";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:138:" order = order ? order : dojox.gfx3d.scheduler.order; buffer.sort(function(a, b){ return order(b) - order(a); }); return buffer;";s:7:"summary";s:0:"";}s:25:"dojox.gfx3d.scheduler.bsp";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:6:"buffer";a:1:{s:4:"type";s:0:"";}s:7:"outline";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:637:"dojo.provide("dojox.gfx3d.scheduler"); dojo.provide("dojox.gfx3d.drawer"); dojo.require("dojox.gfx3d.vector"); dojo.mixin(dojox.gfx3d.scheduler, { zOrder: function(buffer, order){ order = order ? order : dojox.gfx3d.scheduler.order; buffer.sort(function(a, b){ return order(b) - order(a); }); return buffer; }, bsp: function(buffer, outline){ // console.debug("BSP scheduler"); outline = outline ? outline : dojox.gfx3d.scheduler.outline; var p = new dojox.gfx3d.scheduler.BinarySearchTree(buffer[0], outline); dojo.forEach(buffer.slice(1), function(item){ p.add(item, outline); }); return p.iterate(outline);";s:7:"summary";s:0:"";}s:27:"dojox.gfx3d.scheduler.order";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:2:"it";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:24:" return it.getZOrder();";s:7:"summary";s:0:"";}s:29:"dojox.gfx3d.scheduler.outline";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:2:"it";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:25:" return it.getOutline();";s:7:"summary";s:0:"";}s:31:"dojox.gfx3d.drawer.conservative";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:5:"todos";a:1:{s:4:"type";s:0:"";}s:7:"objects";a:1:{s:4:"type";s:0:"";}s:8:"viewport";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:3376:"dojo.provide("dojox.gfx3d.scheduler"); dojo.provide("dojox.gfx3d.drawer"); dojo.require("dojox.gfx3d.vector"); dojo.mixin(dojox.gfx3d.scheduler, { zOrder: function(buffer, order){ order = order ? order : dojox.gfx3d.scheduler.order; buffer.sort(function(a, b){ return order(b) - order(a); }); return buffer; }, bsp: function(buffer, outline){ // console.debug("BSP scheduler"); outline = outline ? outline : dojox.gfx3d.scheduler.outline; var p = new dojox.gfx3d.scheduler.BinarySearchTree(buffer[0], outline); dojo.forEach(buffer.slice(1), function(item){ p.add(item, outline); }); return p.iterate(outline); }, // default implementation order: function(it){ return it.getZOrder(); }, outline: function(it){ return it.getOutline(); } }); dojo.declare("dojox.gfx3d.scheduler.BinarySearchTree", null, { constructor: function(obj, outline){ // summary: build the binary search tree, using binary space partition algorithm. // The idea is for any polygon, for example, (a, b, c), the space is divided by // the plane into two space: plus and minus. // // for any arbitary vertex p, if(p - a) dotProduct n = 0, p is inside the plane, // > 0, p is in the plus space, vice versa for minus space. // n is the normal vector that is perpendicular the plate, defined as: // n = ( b - a) crossProduct ( c - a ) // // in this implementation, n is declared as normal, ,a is declared as orient. // // obj: object: dojox.gfx3d.Object this.plus = null; this.minus = null; this.object = obj; var o = outline(obj); this.orient = o[0]; this.normal = dojox.gfx3d.vector.normalize(o); }, add: function(obj, outline){ var epsilon = 0.5, o = outline(obj), v = dojox.gfx3d.vector, n = this.normal, a = this.orient, BST = dojox.gfx3d.scheduler.BinarySearchTree; if( dojo.every(o, function(item){ return Math.floor(epsilon + v.dotProduct(n, v.substract(item, a))) <= 0; }) ){ if(this.minus){ this.minus.add(obj, outline); }else{ this.minus = new BST(obj, outline); } }else if( dojo.every(o, function(item){ return Math.floor(epsilon + v.dotProduct(n, v.substract(item, a))) >= 0; }) ){ if(this.plus){ this.plus.add(obj, outline); } else { this.plus = new BST(obj, outline); } }else{ /* dojo.forEach(o, function(item){ console.debug(v.dotProduct(n, v.substract(item, a))); }); */ throw "The case: polygon cross siblings' plate is not implemneted yet"; } }, iterate: function(outline){ var epsilon = 0.5; var v = dojox.gfx3d.vector; var sorted = []; var subs = null; // FIXME: using Infinity here? var view = {x: 0, y: 0, z: -10000}; if(Math.floor( epsilon + v.dotProduct(this.normal, v.substract(view, this.orient))) <= 0){ subs = [this.plus, this.minus]; }else{ subs = [this.minus, this.plus]; } if(subs[0]){ sorted = sorted.concat(subs[0].iterate()); } sorted.push(this.object); if(subs[1]){ sorted = sorted.concat(subs[1].iterate()); } return sorted; } }); dojo.mixin(dojox.gfx3d.drawer, { conservative: function(todos, objects, viewport){ // console.debug('conservative draw'); dojo.forEach(this.objects, function(item){ item.destroy(); }); dojo.forEach(objects, function(item){ item.draw(viewport.lighting); });";s:7:"summary";s:0:"";}s:24:"dojox.gfx3d.drawer.chart";a:4:{s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:5:"todos";a:1:{s:4:"type";s:0:"";}s:7:"objects";a:1:{s:4:"type";s:0:"";}s:8:"viewport";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:3660:"dojo.provide("dojox.gfx3d.scheduler"); dojo.provide("dojox.gfx3d.drawer"); dojo.require("dojox.gfx3d.vector"); dojo.mixin(dojox.gfx3d.scheduler, { zOrder: function(buffer, order){ order = order ? order : dojox.gfx3d.scheduler.order; buffer.sort(function(a, b){ return order(b) - order(a); }); return buffer; }, bsp: function(buffer, outline){ // console.debug("BSP scheduler"); outline = outline ? outline : dojox.gfx3d.scheduler.outline; var p = new dojox.gfx3d.scheduler.BinarySearchTree(buffer[0], outline); dojo.forEach(buffer.slice(1), function(item){ p.add(item, outline); }); return p.iterate(outline); }, // default implementation order: function(it){ return it.getZOrder(); }, outline: function(it){ return it.getOutline(); } }); dojo.declare("dojox.gfx3d.scheduler.BinarySearchTree", null, { constructor: function(obj, outline){ // summary: build the binary search tree, using binary space partition algorithm. // The idea is for any polygon, for example, (a, b, c), the space is divided by // the plane into two space: plus and minus. // // for any arbitary vertex p, if(p - a) dotProduct n = 0, p is inside the plane, // > 0, p is in the plus space, vice versa for minus space. // n is the normal vector that is perpendicular the plate, defined as: // n = ( b - a) crossProduct ( c - a ) // // in this implementation, n is declared as normal, ,a is declared as orient. // // obj: object: dojox.gfx3d.Object this.plus = null; this.minus = null; this.object = obj; var o = outline(obj); this.orient = o[0]; this.normal = dojox.gfx3d.vector.normalize(o); }, add: function(obj, outline){ var epsilon = 0.5, o = outline(obj), v = dojox.gfx3d.vector, n = this.normal, a = this.orient, BST = dojox.gfx3d.scheduler.BinarySearchTree; if( dojo.every(o, function(item){ return Math.floor(epsilon + v.dotProduct(n, v.substract(item, a))) <= 0; }) ){ if(this.minus){ this.minus.add(obj, outline); }else{ this.minus = new BST(obj, outline); } }else if( dojo.every(o, function(item){ return Math.floor(epsilon + v.dotProduct(n, v.substract(item, a))) >= 0; }) ){ if(this.plus){ this.plus.add(obj, outline); } else { this.plus = new BST(obj, outline); } }else{ /* dojo.forEach(o, function(item){ console.debug(v.dotProduct(n, v.substract(item, a))); }); */ throw "The case: polygon cross siblings' plate is not implemneted yet"; } }, iterate: function(outline){ var epsilon = 0.5; var v = dojox.gfx3d.vector; var sorted = []; var subs = null; // FIXME: using Infinity here? var view = {x: 0, y: 0, z: -10000}; if(Math.floor( epsilon + v.dotProduct(this.normal, v.substract(view, this.orient))) <= 0){ subs = [this.plus, this.minus]; }else{ subs = [this.minus, this.plus]; } if(subs[0]){ sorted = sorted.concat(subs[0].iterate()); } sorted.push(this.object); if(subs[1]){ sorted = sorted.concat(subs[1].iterate()); } return sorted; } }); dojo.mixin(dojox.gfx3d.drawer, { conservative: function(todos, objects, viewport){ // console.debug('conservative draw'); dojo.forEach(this.objects, function(item){ item.destroy(); }); dojo.forEach(objects, function(item){ item.draw(viewport.lighting); }); }, chart: function(todos, objects, viewport){ // NOTE: ondemand may require the todos' objects to use setShape // to redraw themselves to maintain the z-order. // console.debug('chart draw'); dojo.forEach(this.todos, function(item){ item.draw(viewport.lighting); });";s:7:"summary";s:0:"";}s:21:"dojox.gfx3d.scheduler";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:11:"dojox.gfx3d";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}