/*
This file contains proprietary software owned by Motorola Mobility, Inc.
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/
///////////////////////////////////////////////////////////////////////
// Class MaterialsLibrary
// Contains an array of GLMaterials.
///////////////////////////////////////////////////////////////////////
var MaterialsLibrary = Object.create(Object.prototype, {
_materials : { value: [], writable: true, enumerable: true, configurable: true },
materials : {
get: function() {
return this._materials;
}
},
addMaterial: {
value: function (material)
{
this._materials.push(material);
}
},
addMaterialAt: {
value: function (material, index)
{
this._materials.splice(index, 0, material);
}
},
removeMaterialAt: {
value: function (index)
{
return this._materials.splice(index, 1);
}
},
removeMaterial: {
value: function (materialName)
{
var index = this.getIndexOfMaterial(materialName);
if(index !== -1)
{
return this.removeMaterialAt(index);
}
}
},
getMaterialAt: {
value: function (index)
{
return this._materials[index];
}
},
getMaterial: {
value: function (materialName)
{
var index = this.getIndexOfMaterial(materialName);
if(index !== -1)
{
return this._materials[index];
}
}
},
getIndexOfMaterial: {
value: function (materialName)
{
var len = this._materials.length;
for(var i=0; i