mrdoob / three.js

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

Negative coordinate can not be used in vrml model #19361

Closed gaorongfu closed 4 years ago

gaorongfu commented 4 years ago
Description of the problem

I write a test file with Rhino 7 and export as vrml file . when I use VRMLLoader to load it, many errors raised as below: column: 26 length: 1 line: 29 message: "unexpected character: ->-<- at offset: 376, skipped 1 characters." offset: 376

and the lines in vrml file around line 29 is : coord DEF Line02-COORD Coordinate { point [ -1.284 0 0.3363, -0.938 0 0.6823, -0.1168 0 0.6822, 0.1549 0 0.9538, 0.4757 0 0.9538, 0.7828 0 0.6465, 0.7828 0 -0.2076, 0.5859 0 -0.4011, 0.5859 0 -0.9949, 0.255 0 -1.326, -1.284 0 -1.326, -1.284 0.8661 0.3363, -0.938 0.8661 0.6823, -0.1168 0.8661 0.6822, 0.1549 0.8661 0.9538, 0.4757 0.8661 0.9538, 0.7828 0.8661 0.6465, 0.7828 0.8661 -0.2076, 0.5859 0.8661 -0.4011, 0.5859 0.8661 -0.9949, 0.255 0.8661 -1.326, -1.284 0.8661 -1.326, 1.165 0 -0.9862, 1.165 0 -0.5913, 1.665 0 -0.09973, 1.665 0 0.5683, 2.109 0 1.013, 2.715 0 1.013, 3.163 0 0.5642, 3.163 0 -1.326, 1.504 0 -1.326, 1.165 0.8661 -0.9862, 1.165 0.8661 -0.5913, 1.665 0.8661 -0.09973, 1.665 0.8661 0.5683, 2.109 0.8661 1.013, 2.715 0.8661 1.013, 3.163 0.8661 0.5642, 3.163 0.8661 -1.326, 1.504 0.8661 -1.326, -1.284 0 3.45, 3.163 0 3.45, 3.163 0 2.47, 2.815 0 2.123, 2.028 0 2.123, 1.698 0 2.454, -0.5289 0 2.454, -0.7179 0 2.265, -1.284 0 2.265, -1.284 0.8661 3.45, 3.163 0.8661 3.45, 3.163 0.8661 2.47, 2.815 0.8661 2.123, 2.028 0.8661 2.123, 1.698 0.8661 2.454, -0.5289 0.8661 2.454, -0.7179 0.8661 2.265, -1.284 0.8661 2.265] }

Since the negative coordinate is unavoidable in some case, could the VRMLLoader support it ?

gaorongfu commented 4 years ago

zx.zip

WestLangley commented 4 years ago

Your .wrl file loads for me without errors using the three.js example.

Screen Shot 2020-05-14 at 9 20 37 PM

gaorongfu commented 4 years ago

Oo, sorry , I use the origin example file add test ok just now. It maybe something wrong in my code. Thanks very much.

Mugen87 commented 4 years ago

Phew! 😅

gaorongfu commented 4 years ago

floor3.zip Attach file is which I exported with 3dMax,same exception reoccured.

Mugen87 commented 4 years ago

The problem in your VRML file is produced by the following node name: Line010-FACES and Line010-COORD. Both contain the - sign. According to the specs, this character is not allowed in this context.

When I remove the minus sign the file loads without issues. Seems to be an exporter issue to me.

gaorongfu commented 4 years ago

Thx a lot! the vrml file is exported by 3dmax 2021, and I have not modified anything. It seemed I should change the node name when export everytimes.