我转换了一个模型。对象。JS
当我尝试加载。带有 THREE.JSONLoader 的 Js 如下:
var loader = new THREE.JSONLoader();
loader.load( {model: "/modelos/modelos3D/Dragon.js", callback: agregarDragon } );
function agregarDragon( geometria )
{
geometria.materials[0][0].shading = THREE.FlatShading;
geometria.materials[0][0].morphTargets = true;
var material = new THREE.MeshFaceMaterial();
modeloDragon = new THREE.Mesh( geometria, material );
modeloDragon.scale.set(50,50,50);
escena.add( modeloDragon );
}
一些 Dragon.js:
{
"metadata" :
{
"formatVersion" : 3,
"sourceFile" : "Dragon.obj",
"generatedBy" : "OBJConverter",
"vertices" : 3143,
"faces" : 11130,
"normals" : 10066,
"colors" : 0,
"uvs" : 1172,
"materials" : 3
},
"scale" : 1.000000,
"materials": [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "Material__35"
},
{
"DbgColor" : 15597568,
"DbgIndex" : 1,
"DbgName" : "Material__47"
},
{
"DbgColor" : 60928,
"DbgIndex" : 2,
"DbgName" : "Material__83"
}],
"vertices": [-0.696100,0.260000,0.408700,....]
.
.
}
当我尝试使用 chrome 加载时会产生以下错误
Uncaught SyntaxError: Unexpected token :
并强调线条
"metadata" :
和带有萤火虫的雷区:
invalid label: Dragon.js(line 3, col 4 )
"metadata" :
为什么会产生这个错误?
怎么修?