小编koo*_*ber的帖子

三.js:使用纹理加载器加载 svg 自 r78 起不起作用

以下对 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)

javascript svg three.js

5
推荐指数
1
解决办法
986
查看次数

标签 统计

javascript ×1

svg ×1

three.js ×1