loadArbitraryModel("path/to/file.json");
loadArbitraryModel = function(path) {
var strings = path.split('.'); //now the path is ["path/to/file", "json"]
var types = ['json', 'obj', 'stl', 'babylon', 'collada'];
var result = -1;
types.forEach(function (item,index) {
if (strings.length > 1) {
if (strings[1] == item){ //strings[1] would be anything after the '.'
result = index;
}
}
});
switch (result){
case -1:
alert("формат файла не поддерживается/ неправильно назван");
case 0:
loadJSON(path);
break;
case 1:
loadOBJ(path);
break;
case 3:
loadSTL(path);
break;
//ETC etc etc
}
}
var material = new THREE.MeshPhysicalMaterial({
color: 0x00afaf,
side: THREE.DoubleSide
});
$params = array(
'client_id' => $config->client_id,
'client_secret' => $config->client_secret,
'code' => $_GET['code'],
'redirect_uri' => $config->redirect_uri
);