0
我想添加纹理到jsonloaded对象,由于某种原因不加载。添加纹理json不加载
的JavaScript
// Load in the mesh and add it to the scene.
var loader = new THREE.JSONLoader(true);
loader.load(jsonPath, function (geometry, materials) {
skateboardBase = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial(materials));
scene.add(skateboardBase);
});
如果我删除了部分材料,事情没有纹理
JSON
"materials" : [ {
"DbgColor" : 15658734,
"DbgIndex" : 0,
"DbgName" : "SVGMat.001",
"colorAmbient" : [0.3294117738218869, 0.6243137452649137, 0.3607843214390325],
"colorDiffuse" : [0.3294117738218869, 0.6243137452649137, 0.3607843214390325],
"colorSpecular" : [0.5, 0.5, 0.5],
"illumination" : 2,
"depthTest" : true,
"depthWrite" : true,
"specularCoef" : 50,
"transparency" : 1.0,
"transparent" : false,
"vertexColors" : false,
"mapDiffuse" : "../textures/dash.jpg",
"shading" : "Lambert"
}],
"vertices" : [1.32997,1.125,-0.870963,1.34966,1.125, ... ],
"uvs" : [],
"faces" : [34,124,126,125,0,...],
错误
做工精细[.WebGLRenderingContext]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 2
这是什么UVS有..? – 2014-11-04 09:18:53
@YellowandRed UV是[纹理坐标](https://www.google.com.au/search?q=texture+coordinates),2D u/v坐标将每个顶点映射到纹理中的某个位置。 – jozxyqk 2014-11-04 09:24:31