svg数据在canvg translate上给出纹理错误

时间:2014-08-02 22:12:08

标签: three.js

当animate()循环开始时我收到错误:

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

并且不确定服务器上正在寻找的是什么。 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帮助吗?

1 个答案:

答案 0 :(得分:0)

从这里解决了这个问题

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

这不是正确的用法:

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