drawCircle = (context) ->
pos = 0.5
radius = 0.5
context.scale(0.05, -0.05)
context.beginPath()
context.arc(pos, pos, radius, 0, 2*Math.PI, false)
context.fillStyle = 'white'
context.fill()
m = new THREE.SpriteCanvasMaterial( {program: drawCircle } )
s = new THREE.Sprite( m )
返回错误
Uncaught TypeError: Cannot read property 'x' of undefined.
在Three.js中:36534行:
_gl.uniform2f( uniforms.uvScale, material.uvScale.x, material.uvScale.y );
似乎材料uvScale和uvOffset属性未正确初始化...为什么?如果我自己设置这些属性:
m.uvScale = new THREE.Vector2()
m.uvOffset = new THREE.Vector2()
错误消失了,但是我看不到粒子(我不知道在画布上绘制的位置,以及为什么要缩放它)。
您正在使用webglrenderer中用于canvas2D的材料。您应该使用canvasrenderenderer或使用其他材质(SpriteMaterial)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句