I am trying to make a Wireframe-object from a loaded object, using WireframeGeometry like this:
var objGeo=object._3DObject.children[0].geometry;
var edgeGeo=THREE.WireframeGeometry(objGeo);
var edgeLines = new THREE.LineSegments( edgeGeo, new THREE.LineBasicMaterial( { color: 0xd8aa77} ) );
The second line causes a “TypeError: this.addAttribute is not a function” in three.min.js
I made sure child #0 is a mesh, and it has a geometry attribute. I have tried it on different loaded objects and in every case I get this message. The objects are all FBX files.
That works a lot better, but it looks like WireFrameMaterial does not go together with the OutlineEffect I am using. When I leave the effect out, it all works fine but when OutlineEffect is used I get a lot of shader errors like these:
TypeError: material.uniforms.outlineAlpha is undefined
and
[...]
33: attribute vec3 morphTarget5;
34: attribute vec3 morphTarget6;
35: attrib…
[three.min.js:54:477](http://dev.ngongo-b.net/adv3d/three/three.min.js)
THREE.WebGLProgram: shader error: 0 35715 false gl.getProgramInfoLog Must have a compiled vertex shader attached. ERROR: 0:185: 'outlineThickness' : redefinition ERROR: 0:186: 'calculateOutline' : function already has a body ERROR: 0:302: 'objectNormal' : redefinition [three.min.js:72:388](http://dev.ngongo-b.net/adv3d/three/three.min.js)
THREE.WebGLShader: Shader couldn't compile. [three.min.js:54:388](http://dev.ngongo-b.net/adv3d/three/three.min.js)
THREE.WebGLShader: gl.getShaderInfoLog() vertex ERROR: 0:201: 'outlineThickness' : redefinition ERROR: 0:202: 'calculateOutline' : function already has a body
1: precision highp float;
2: precision highp int;
3: #define SHADER_NAME ShaderMaterial
4: #define VERTEX_TEXTURES
5: #define GAMMA_FA
[...]
Somehow I can not reproduce it, but I did do some debugging:
I noticed the first error is in OutlineEffect.js (line 305) and when I place a console.log dump of the material that is being mentioned in every case is a simple material used by a sprite.
A workaround for now is to insert a line that exits the function if the outline parameters are not in place.
But somehow I can not get my head arround where I messed up to get this problem. I am pretty sure sprites did not give me this problem before.