以下对 Three.js 的 R76 和 R77 中的 svg 文件效果很好,但在 R78 中我只能让它与 pngs 和 jpgs 一起使用
var floor = new THREE.TextureLoader();
floor.load('layout.svg', function ( texture ) {
var geometry = new THREE.PlaneBufferGeometry(4096, 4096);
var material = new THREE.MeshBasicMaterial( { map: texture } );
var mesh = new THREE.Mesh(geometry, material);
mesh.rotation.x = -Math.PI / 2;
scene.add(mesh);
} );
Run Code Online (Sandbox Code Playgroud)
由于问题出现,我在加载参数中添加了进度和错误函数...
function ( xhr ) {
console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
},
function ( xhr ) {
console.log( 'An …
Run Code Online (Sandbox Code Playgroud)