1 
  2 /**
  3  * potree.js 
  4  * http://potree.org
  5  *
  6  * Copyright 2012, Markus Sch�tz
  7  * Licensed under the GPL Version 2 or later.
  8  * - http://potree.org/wp/?page_id=7
  9  * - http://www.gnu.org/licenses/gpl-3.0.html
 10  *
 11  */
 12 
 13 /**
 14  * 
 15  * @class
 16  */
 17 function Renderer(){
 18 	
 19 };
 20 
 21 Renderer.render = function(scene){
 22 	var lights = new Array();
 23 	var pointClouds = new Array();
 24 	var pointCloudOctrees = new Array();
 25 	var camera = scene.activeCamera;
 26 	
 27 	var stack = new Array();
 28 	stack.push(scene.rootNode);
 29 	while(stack.length > 0){
 30 		var node = stack.pop();
 31 		for(var i in node.children){
 32 			stack.push(node.children[i]);
 33 		}
 34 		
 35 		if(node instanceof Light){
 36 			lights.push(node);
 37 		}else if(node instanceof PointCloudSceneNode){
 38 			pointClouds.push(node);
 39 		}else if(node instanceof PointcloudOctreeSceneNode){
 40 			pointCloudOctrees.push(node);
 41 		}
 42 	}
 43 	
 44 	for(var i = 0; i < pointClouds.length; i++){
 45 		var node = pointClouds[i];
 46 		node.render(camera, lights);
 47 	}
 48 	
 49 	for(var i = 0; i < pointCloudOctrees.length; i++){
 50 		var node = pointCloudOctrees[i];
 51 		node.render(camera, lights);
 52 	}
 53 	
 54 	// for...of not yet supported
 55 //	for(var node of pointClouds){
 56 //		node.render(123, camera);
 57 //	}
 58 };
 59 
 60 
 61 
 62 
 63 
 64 
 65 
 66 
 67 
 68 
 69 
 70 
 71 
 72 
 73 
 74 
 75