mrdoob / three.js

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

VRMLLoader fails when Points are in the same line. #5391

Closed mrdoob closed 9 years ago

mrdoob commented 9 years ago

@bartmcleod seems like the loader is currently not handling points defined like this:

point [ -100 -100 -100,-100 100 -100,-100 -100 100,-100 100 100,100 -100 100,
            100 100 100,100 -100 -100,100 100 -100
          ]

Here's the full file:

#VRML V2.0 utf8

#Created by CINEMA 4D

DEF B1 Transform {
 translation 600 0 0.333333
 children [ 
 DEF _60_ Transform {
  translation -600 0 0
  children [ 
  ]
}
DEF Button Transform {
  translation 679.734143 0 0
  children [ 
    Shape {
      appearance DEF MAT_Metal_010 Appearance {
        material Material {
          ambientIntensity 0.2
          diffuseColor 0.815686 0 0.223529
          specularColor 0 0 0
          emissiveColor 0 0 0
          shininess 0.1
          transparency 0
        }
      }
      geometry DEF FACESET_Button IndexedFaceSet {
        ccw FALSE
        creaseAngle 1.396263
        coord Coordinate {
          point [ -100 -100 -100,-100 100 -100,-100 -100 100,-100 100 100,100 -100 100,
            100 100 100,100 -100 -100,100 100 -100
          ]
        }
        texCoord TextureCoordinate {
          point [ 0 1,1 0,
            0 0,0 0,1 1,0 1,1 1,
            0 0,1 0,1 0,0 1,1 1,
            1 0,0 0,1 1,0 1,0 0,
            1 0,0 1,1 1
          ]
        }
        coordIndex [ 0,1,3,2,-1,2,3,5,4,-1,4,5,7,6,-1,
          6,7,1,0,-1,1,7,5,3,-1,6,0,2,4,-1
        ]
        texCoordIndex [ 2,5,11,8,-1,7,10,14,12,-1,13,15,19,17,-1,
          16,18,4,1,-1,3,18,14,9,-1,16,0,6,12,-1
        ]
      }
    }
  ]
 }
]
}
DEF Timer TimeSensor {
startTime 0
stopTime 0
cycleInterval 14.4
loop TRUE
}

More info: http://stackoverflow.com/questions/26137393/how-to-import-vrml-files-in-three-js

bartmcleod commented 9 years ago

It is likely (quick guess) that the points need to be each on their own line, I'm willing to look into that, but currently facing a tight deadline.

Vriendelijke groet, Bart McLeod

Op 1 okt. 2014, om 13:51 heeft Mr.doob notifications@github.com het volgende geschreven:

@bartmcleod seems like the loader is currently not handling points defined like this:

point [ -100 -100 -100,-100 100 -100,-100 -100 100,-100 100 100,100 -100 100, 100 100 100,100 -100 -100,100 100 -100 ] Here's the full file:

VRML V2.0 utf8

Created by CINEMA 4D

DEF B1 Transform { translation 600 0 0.333333 children [ DEF 60 Transform { translation -600 0 0 children [ ] } DEF Button Transform { translation 679.734143 0 0 children [ Shape { appearance DEF MAT_Metal_010 Appearance { material Material { ambientIntensity 0.2 diffuseColor 0.815686 0 0.223529 specularColor 0 0 0 emissiveColor 0 0 0 shininess 0.1 transparency 0 } } geometry DEF FACESET_Button IndexedFaceSet { ccw FALSE creaseAngle 1.396263 coord Coordinate { point [ -100 -100 -100,-100 100 -100,-100 -100 100,-100 100 100,100 -100 100, 100 100 100,100 -100 -100,100 100 -100 ] } texCoord TextureCoordinate { point [ 0 1,1 0, 0 0,0 0,1 1,0 1,1 1, 0 0,1 0,1 0,0 1,1 1, 1 0,0 0,1 1,0 1,0 0, 1 0,0 1,1 1 ] } coordIndex [ 0,1,3,2,-1,2,3,5,4,-1,4,5,7,6,-1, 6,7,1,0,-1,1,7,5,3,-1,6,0,2,4,-1 ] texCoordIndex [ 2,5,11,8,-1,7,10,14,12,-1,13,15,19,17,-1, 16,18,4,1,-1,3,18,14,9,-1,16,0,6,12,-1 ] } } ] } ] } DEF Timer TimeSensor { startTime 0 stopTime 0 cycleInterval 14.4 loop TRUE } More info: http://stackoverflow.com/questions/26137393/how-to-import-vrml-files-in-three-js

— Reply to this email directly or view it on GitHub.

mrdoob commented 9 years ago

@bartmcleod take your time :)

bartmcleod commented 9 years ago

I answered the question on stack with the workaround… :) Vriendelijke groet, Bart McLeod

Op 1 okt. 2014, om 14:00 heeft Mr.doob notifications@github.com het volgende geschreven:

@bartmcleod take your time :)

— Reply to this email directly or view it on GitHub.

pl1307 commented 9 years ago

Thank you for your fast answer. Your workaround works and I accepted your answer in SO. A modification of the VRMLLoader would be very good, because files exported from Cinema 4D have this issue with the points. But there's no hurry :-).

mrdoob commented 9 years ago

Fixed :)