【问题标题】:svg data gives error for texture on canvg translatesvg 数据在 canvg translate 上给出纹理错误
【发布时间】:2014-08-03 15:53:20
【问题描述】:

animate() 循环开始时出现错误:

"NetworkError: 404 Not Found - http://127.0.0.1:8080/threejs_1/%5Bobject%20Object%5D

不确定threejs 在服务器上寻找什么。 svg 数据开始:

<svg style="width: 512px; height: 512px;" id="ext-gen2256" height="512" width="512"
version="1.1" xmlns="http://www.w3.org/2000/svg"><defs></defs><rect id="ext-gen2257"
opacity="0" stroke="none" fill="#000" height="100%" width="100%"></rect><path
transform="matrix(1,0,0, ... </svg>

var SvgData = Ext.DomQuery.selectNode('svg', 'div11').parentNode.innerHTML;
var imageCanvas22 = document.createElement("canvas");
canvg(imageCanvas22, SvgData);
var texture33 = new THREE.Texture(imageCanvas22);
texture33.needsUpdate = true;
map = THREE3.ImageUtils.loadTexture( texture33 ); // is this correct usage ???
// map = THREE3.ImageUtils.loadTexture( "textures/teechart-bar2.png" ); // works
map.wrapS = map.wrapT = THREE3.RepeatWrapping;
map.repeat.set( 16, 16 );
var planeGeo = new THREE3.PlaneGeometry( 200, 200 );
ground = new THREE3.Mesh( planeGeo, new THREE3.MeshPhongMaterial( { color: 0xffffff,   ambient: 0xffffff, specular: 0x111111, shininess: 50, map: map, perPixel: true, metal: true } ) );
ground.rotation.x = -Math.PI/2;
scene.add( ground );

经过检查,纹理看起来不错,地图看起来也不错。不知道从哪里开始。场景确实渲染并正常工作,但地面没有应用纹理。从文件加载纹理时,一切正常。发布完整的 svg 有帮助吗?

【问题讨论】:

    标签: three.js


    【解决方案1】:

    从这里修复这个问题

    https://github.com/mrdoob/three.js/issues/1305

    这不是正确的用法:

    // map = THREE3.ImageUtils.loadTexture( texture33 );
    map =  texture33 ;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-06-18
      • 1970-01-01
      • 1970-01-01
      • 2016-03-21
      • 2012-10-05
      • 2019-01-07
      相关资源
      最近更新 更多