function app2material(app) {
const mat = app.querySelector("Material");
const name = "appMaterial";
const myMaterial = new BABYLON.StandardMaterial(name, nullScene);
myMaterial.id = myMaterial.name + myMaterial.uniqueId;
myMaterial.diffuseColor.fromArray(
parseMFFloat(mat.getAttribute("diffuseColor"))
);
myMaterial.emissiveColor.fromArray(
parseMFFloat(mat.getAttribute("emissiveColor"))
);
myMaterial.specularColor.fromArray(
parseMFFloat(mat.getAttribute("specularColor"))
);
myMaterial.specularPower = +mat.getAttribute("shininess");
myMaterial.alpha = 1.0 - mat.getAttribute("transparency");
const ambient = +mat.getAttribute("ambientIntensity");
myMaterial.ambientColor.fromArray([ambient, ambient, ambient]);
return myMaterial;
}