1 /** 2 * potree.js 3 * http://potree.org 4 * 5 * Copyright 2012, Markus Sch�tz 6 * Licensed under the GPL Version 2 or later. 7 * - http://potree.org/wp/?page_id=7 8 * - http://www.gnu.org/licenses/gpl-3.0.html 9 * 10 */ 11 12 /** 13 * @class 14 * 15 * keeps track of all material instances. 16 * materials register themselves upon creation. 17 */ 18 function MaterialManager(){ 19 20 } 21 22 MaterialManager.materials = new Array(); 23 24 MaterialManager.addMaterial = function(material){ 25 if(MaterialManager.getMaterial(material.name) != null){ 26 var message= "material has already been created: " + material.name; 27 Logger.error(message); 28 throw message; 29 } 30 31 this.materials.push(material); 32 }; 33 34 MaterialManager.getMaterial = function(name){ 35 for(var i = 0; i < this.materials.length; i++){ 36 var material = this.materials[i]; 37 if(material.name == name){ 38 return material; 39 } 40 } 41 42 return null; 43 }; 44