int main(int argc, char *argv[]) { SoDB::init(); QApplication app(argc, argv); qAddPostRoutine(cleanup); // Moved here because of https://developer.oculusvr.com/forums/viewtopic.php?f=17&t=7915&p=108503#p108503 // Init libovr. if (!ovr_Initialize()) { qDebug() << "Could not initialize Oculus SDK."; exit(1); } CoinRiftWidget window; window.show(); // An example scene. static const char * inlineSceneGraph[] = { "#Inventor V2.1 ascii\n", "\n", "Separator {\n", " Rotation { rotation 1 0 0 0.3 }\n", " Cone { }\n", " BaseColor { rgb 1 0 0 }\n", " Scale { scaleFactor .7 .7 .7 }\n", " Cube { }\n", "\n", " DrawStyle { style LINES }\n", " ShapeHints { vertexOrdering COUNTERCLOCKWISE }\n", " Coordinate3 {\n", " point [\n", " -2 -2 1.1, -2 -1 1.1, -2 1 1.1, -2 2 1.1,\n", " -1 -2 1.1, -1 -1 1.1, -1 1 1.1, -1 2 1.1\n", " 1 -2 1.1, 1 -1 1.1, 1 1 1.1, 1 2 1.1\n", " 2 -2 1.1, 2 -1 1.1, 2 1 1.1, 2 2 1.1\n", " ]\n", " }\n", "\n", " Complexity { value 0.7 }\n", " NurbsSurface {\n", " numUControlPoints 4\n", " numVControlPoints 4\n", " uKnotVector [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ]\n", " vKnotVector [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ]\n", " }\n", "}\n", NULL }; SoInput in; in.setStringArray(inlineSceneGraph); window.setSceneGraph(SoDB::readAll(&in)); return app.exec(); }
void oculusSetTestScene(View3DInventorRiftViewer *window) { assert(window); // An example scene. static const char * inlineSceneGraph[] = { "#Inventor V2.1 ascii\n", "\n", "Separator {\n", " Rotation { rotation 1 0 0 0.3 }\n", " Cone { }\n", " BaseColor { rgb 1 0 0 }\n", " Scale { scaleFactor .7 .7 .7 }\n", " Cube { }\n", "\n", " DrawStyle { style LINES }\n", " ShapeHints { vertexOrdering COUNTERCLOCKWISE }\n", " Coordinate3 {\n", " point [\n", " -2 -2 1.1, -2 -1 1.1, -2 1 1.1, -2 2 1.1,\n", " -1 -2 1.1, -1 -1 1.1, -1 1 1.1, -1 2 1.1\n", " 1 -2 1.1, 1 -1 1.1, 1 1 1.1, 1 2 1.1\n", " 2 -2 1.1, 2 -1 1.1, 2 1 1.1, 2 2 1.1\n", " ]\n", " }\n", "\n", " Complexity { value 0.7 }\n", " NurbsSurface {\n", " numUControlPoints 4\n", " numVControlPoints 4\n", " uKnotVector [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ]\n", " vKnotVector [ 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0 ]\n", " }\n", "}\n", NULL }; SoInput in; in.setStringArray(inlineSceneGraph); window->setSceneGraph(SoDB::readAll(&in)); }
IVElement::IVElement(string ivfile, KthReal sc) { for(int i=0;i<3;i++){ position[i]= 0.0f; orientation[i]=0.0f; } orientation[2]=1.0f; orientation[3]=0.0f; scale=sc; trans= new SoTranslation; rot = new SoRotation; sca = new SoScale(); color = new SoMaterial; posVec = new SoSFVec3f; trans->translation.connectFrom(posVec); posVec->setValue((float)position[0],(float)position[1],(float)position[2]); rotVec = new SoSFRotation; rotVec->setValue(SbVec3f((float)orientation[0],(float)orientation[1], (float)orientation[2]),(float)orientation[3]); rot->rotation.connectFrom(rotVec); scaVec= new SoSFVec3f; scaVec->setValue((float)scale,(float)scale,(float)scale); sca->scaleFactor.connectFrom(scaVec); SoInput input; ivmodel = new SoSeparator; ivmodel->ref(); ivmodel->addChild(sca); if(input.openFile(ivfile.c_str())) ivmodel->addChild(SoDB::readAll(&input)); else { //ivmodel->addChild(new SoSphere()); static const char *str[] = { "#VRML V1.0 ascii\n", "DEF pointgoal Separator {\n", " Separator {\n", " MaterialBinding { value PER_PART }\n", " Coordinate3 {\n", " point [\n", " 0.0 0.0 0.0\n", " ]\n", " }\n", " DrawStyle { pointSize 5 }\n", " PointSet { }\n", " }\n", "}\n", NULL }; input.setStringArray(str); SoSeparator *sep = SoDB::readAll(&input); sep->ref(); while (sep->getNumChildren() > 0) { ivmodel->addChild(sep->getChild(0)); sep->removeChild(0); } sep->unref(); } ivmodel->ref(); }