Reputation: 63
is there a way to import X3d files into three.js?
Maybe convert the X3d file into something that three.js can read? Like OBJ or STL?
Thanks for the help!
Upvotes: 0
Views: 3162
Reputation: 7392
There is no X3D loader for three.js at the moment, but you could use X3DOM instead if you have to use that file format.
Otherwise, you'd have to write your own loader or convert to another format as you suspected.
However you could use the command-line tool AOPT mentioned in the X3DOM issue to make a webservice, then you could make ajax queries to the webservice to use it in client-side javascript.
aopt -i filename.x3db -e filename.obj
Otherwise X3DOM being open source, so you could dig into its code and try to extract only the parts that deal with parsing the file, and write an OBJ file accordingly, but that would require good knowledge of the X3D and OBJ formats, and solid javascript knowledge. You could skip the first part by having a 1-pixel canvas with X3DOM to feed it the files to parse though.
Upvotes: 2