fernandojsg / aframe-teleport-controls

A-Frame teleport controls component
https://fernandojsg.github.io/aframe-teleport-controls
MIT License
175 stars 71 forks source link

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

Open dirkk0 opened 4 years ago

dirkk0 commented 4 years ago

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.

rotoglup commented 4 years ago

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 commented 4 years ago

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 ?

blasco commented 4 years ago

Facing same issue here. Any possible solution?

Galadirith commented 4 years ago

@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 😊

Ten-Zen commented 4 years ago

@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.

jure commented 3 years ago

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 :)