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 function PointCloudSceneNode(name, parent, pointCloud){
 14 	SceneNode.call(this, name, parent);
 15 	this.pointCloud = pointCloud;
 16 	
 17 	if(MaterialManager.getMaterial("pointCloudMat") == null){
 18 		this.material = new PointCloudMaterial("pointCloudMat");
 19 	}else{
 20 		this.material = MaterialManager.getMaterial("pointCloudMat");
 21 	}
 22 	
 23 	var attributes = pointCloud.pointAttributes;
 24 	if(attributes.hasColors() && attributes.hasNormals()){
 25 		this.material.illuminationMode = IlluminationMode.FLAT;
 26 	}else if(attributes.hasNormals()){
 27 		this.material.illuminationMode = IlluminationMode.PHONG;
 28 	}else{
 29 		this.material.illuminationMode = IlluminationMode.POSITION;
 30 	}
 31 //	this.material.setRenderMode(PointCloudRenderMode.WEIGHTED_CIRCLE);
 32 	this.material.renderMode = PointCloudRenderMode.WEIGHTED_CIRCLE;
 33 	
 34 }
 35 
 36 PointCloudSceneNode.prototype = new SceneNode(inheriting);
 37 PointCloudSceneNode.base = SceneNode.prototype;
 38 
 39 Object.defineProperty(PointCloudSceneNode.prototype, 'aabb', {
 40 	get: function(){
 41 		var aabb = new AABB();
 42 		aabb.setDimensionByMinMax(this.pointCloud.aabb.min, this.pointCloud.aabb.max);
 43 		aabb.setTransform(this.transform);
 44 		
 45 		return aabb;
 46 	}
 47 });
 48 
 49 PointCloudSceneNode.prototype.render = function(camera, lights) {
 50 
 51 	if(this.pointCloud == null){
 52 		return;
 53 	}
 54 	if(!this.visible){
 55 		return;
 56 	}
 57 
 58 	this.material.render(this, camera, lights);
 59 };
 60 
 61 PointCloudSceneNode.prototype.addTime = function addTime(time){
 62 
 63 };
 64 
 65