mrdoob / three.js

JavaScript 3D Library.
https://threejs.org/
MIT License
102.58k stars 35.36k forks source link

VRMLLoader should support identifiers with "-" (0x2D) in them. #19991

Closed Sgeo closed 4 years ago

Sgeo commented 4 years ago
Description of the problem

VRMLLoader should support identifiers with "-" (0x2D) in them.

http://x-3-x.net/vrml/archive/annotatedVRML2/APPA.HTM#Nodes states that the second and further characters of an identifier, such as that used after DEF or USE, can contain 0x2D. This does contradict the document mentioned in the comment http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics .

At least one VRML world exists that expects this to be possible: https://sgeo.github.io/threejsvrmltest/

Three.js version
Browser
OS
Mugen87 commented 4 years ago

At least one VRML world exists that expects this to be possible

How was this VRML file generated? Maybe the exporter is buggy?

Mugen87 commented 4 years ago

BTW: It seems the "no dash" variant can't also be loaded because the asset uses . (0x2e) in identifiers which is also not valid according to http://gun.teipir.gr/VRML-amgem/spec/part1/concepts.html#SyntaxBasics.

cecilemuller commented 4 years ago

As data point: at least Vrmlpad, BSContact, and the 3dsmax exporters accept identifiers with dashes, and we've been using dashes in identifiers in our own projects for years as well.

mrdoob commented 4 years ago

I guess this format is like obj. In that the community ignored the spec. Oh well..

Mugen87 commented 4 years ago

To problem is that when allow - and ., it won't take long and other users will ask for + or \. Eventually, we come to a point where no one can say what definitions in context of VRML are supposed to be correct or not.

I think it's better to strictly implement a specific standard (the one linked in the loader's source) and stick to it. If users are not able to load their assets because of syntax issues, I suggest they pre-process their files by for example rename/sanitize identifiers.

Sgeo commented 4 years ago

http://gun.teipir.gr/VRML-amgem/spec/part1/grammar.html says the same thing as the other source I linked regarding -.

I don't know why the spec seems to be contradicting itself.

Mugen87 commented 4 years ago

Closing. Files using the mentioned characters in IDs needs to be pre-processed on app level.