View plaincopy to clipboardprint?
# 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 ...");
SoSeparator * root = SoDB: readAll (& in );
If (root ){
Root-> ref ();
SbString hdr = in. getHeader ();
In. closeFile ();
Printf ("Converting ...");
SoToVRML2Action tovrml2;
Tovrml2.apply (root );
SoVRMLGroup * newroot = tovrml2.getVRML2SceneGraph ();
Newroot-> ref ();
Root-> unref ();
Printf ("Writing ...");
SoOutput out;
Out. openFile ("out. wrl ");
Out. setHeaderString ("# fig ");
SoWriteAction wra (& out );
Wra. apply (newroot );
Out. closeFile ();
Newroot-> unref ();
}
Return 0;
}