#include <Inventor/SoDB.h> #include <Inventor/SoInteraction.h> #include <Inventor/SoInput.h> #include <Inventor/SoOutput.h> #include <Inventor/actions/SoWriteAction.h> #include <Inventor/actions/SoToVRML2Action.h> #include <Inventor/nodes/SoSeparator.h> #include <Inventor/VRMLnodes/SoVRMLGroup.h> int main(int argc, char *argv[]) { SoDB::init(); SoInteraction::init(); SoInput in; in.openFile(argv[1]); printf("Reading.../n"); SoSeparator *root = SoDB::readAll(&in); if (root) { root->ref(); SbString hdr = in.getHeader(); in.closeFile(); printf("Converting.../n"); SoToVRML2Action tovrml2; tovrml2.apply(root); SoVRMLGroup *newroot = tovrml2.getVRML2SceneGraph(); newroot->ref(); root->unref(); printf("Writing.../n"); SoOutput out; out.openFile("out.wrl"); out.setHeaderString("#VRML V2.0 utf8"); SoWriteAction wra(&out); wra.apply(newroot); out.closeFile(); newroot->unref(); } return 0; }