aframe-teleport-controls icon indicating copy to clipboard operation
aframe-teleport-controls copied to clipboard

error: THREE.Mesh: .drawMode has been removed.

Open dirkk0 opened this issue 4 years ago • 6 comments

The controls throw an error on the console: 'THREE.Mesh: .drawMode has been removed.' Commenting out the offending line: https://github.com/fernandojsg/aframe-teleport-controls/search?q=drawmode&type=Code makes the error go away.

dirkk0 avatar Feb 24 '20 21:02 dirkk0

The full message is

THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.

It seems that the current Meshes are constructed using drawMode == THREE.TriangleStripDrawMode, so commenting the lines is probably not enough, one should also call BufferGeometryUtils.toTrianglesDrawMode()

rotoglup avatar Feb 25 '20 09:02 rotoglup

I've been looking into this to improve my AFrame knowledge : this component uses an 'old' THREE API, that came with AFrame 0.9.2.

More recent versions of AFrame come with newer revisions of THREE (r111, soon r113) which may not be compatible, see THREE migration guide.

How is this usually handled in other external componants ?

rotoglup avatar Feb 25 '20 14:02 rotoglup

Facing same issue here. Any possible solution?

blasco avatar Apr 26 '20 18:04 blasco

@blasco The suggestion by @rotoglup was great and as the migration guide suggests, however I don't think simply using toTrianglesDrawMode() is sufficient because the rest of the code to update the line still assumes it's a triangle strip. I've made some of my own changes over on my fork (https://github.com/fernandojsg/aframe-teleport-controls/compare/master...Galadirith:migrate-tri-strip-to-tri) and you can include the distribution from jsdelivr in your HTML.

Let me know if that works for you. It seems to have solved my issues and now correctly renders the line as it should do. I'll open a PR with this if it looks good 😊

Galadirith avatar Apr 29 '20 01:04 Galadirith

@Galadirith this eliminates the warning but does not solve all the problems I currently am having. Could be entirely unrelated, but my teleport lines are still not showing up and i have no functionality.

Ten-Zen avatar Nov 06 '20 08:11 Ten-Zen

I've ported the ray to use the default Three.js draw mode, i.e. the triangles draw mode, here: https://github.com/jure/aframe-blink-controls/blob/main/src/index.js#L525-L603

You can pretty much copy the body of this function into your aframe-teleport-controls code (https://github.com/fernandojsg/aframe-teleport-controls/blob/master/lib/RayCurve.js#L3-L58) and it will work as intended.

Hope that helps someone! I did enjoy the very elegant and efficient approach of TriangleStripDrawMode, but since it's been removed it doesn't help to lament, it is what it is :)

jure avatar Dec 18 '20 17:12 jure