我需要使用 2.9 查看器文件来使用具有图像纹理的材质的帮助。我看到它使用了 three.js 的第 71 版
我创建了一个自定义形状。一个由顶点组成的正方形
我想使用图像纹理材质
var shininess = 50, specular = 0x333333, bumpScale = 1, shading = THREE.SmoothShading;
var imgTexture = THREE.ImageUtils.loadTexture( "textures/UV_Grid_Sm.jpg" );
imgTexture.wrapS = imgTexture.wrapT = THREE.RepeatWrapping;
imgTexture.anisotropy = 16;
var material = new THREE.MeshLambertMaterial( { map: imgTexture, color: 0xffffff, shading: shading } );
viewer.impl.matman().addMaterial("FloorMaterial", material, true);
...
// Convert Array to Vector Array and World Space
var vectorWorldArray = convertFloatArrayToVectorWorldArray(viewer,
matrixWorld, floatArray);
var shape = new THREE.Shape(vectorWorldArray);
var geometry = new THREE.ShapeGeometry(shape);
geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
geometry.faces.push( new THREE.Face3( 2, 3, 0 ) );
geometry.computeFaceNormals();
var mesh = new THREE.Mesh(geometry, material);
var scene = viewer.impl.scene;
// mesh.translateZ( 10 );
scene.add(mesh);
纹理只是显示为全黑
只有在 chrome 中出现的东西(版本 52.0.2743.116 m)[.Offscreen-For-WebGL-0B70AB98]RENDER WARNING:没有纹理绑定到单元 0
我知道纹理存在
是否有更简单/正确的添加图像纹理材料的方法?