예제 #1
0
int main(int argc, char** argv)
{
    QWidget* mainwin = SoQt::init(argc, argv, argv[0]);

    SoSeparator* root = new SoSeparator;
    root->ref();
    InventorRobot robot(root);

    if (argc == 1){
        //robot.parse("../RobotEditorArmar4.dae");
        //robot.parse("/media/sf_host/manikin_creo_4.dae");
        std::cout << "Usage collada <collada file> [<inventor export>]" <<std::endl;
        return 1;
    }
    else {
        robot.parse(argv[1]);
        if (argc==3){
            SoWriteAction writeAction;
            writeAction.getOutput()->openFile(argv[2]);
            writeAction.apply(root);
        }
    }

    SoQtExaminerViewer* viewer = new SoQtExaminerViewer(mainwin);
    viewer->setSceneGraph(root);
    viewer->show();

    // Pop up the main window.
    SoQt::show(mainwin);
    // Loop until exit.
    SoQt::mainLoop();

    root->unref();
    return 1;
}
예제 #2
0
HorizontalWidget::HorizontalWidget( QWidget* parent )
:QWidget( parent ), sphereRadio( 120.0 ), m_azimuth( 0 ), m_zenith( 0 )
{
	QVBoxLayout* mainLayout = new QVBoxLayout;
	setLayout( mainLayout );

	QWidget* examinerWidget = new QWidget;
	examinerWidget->setFixedSize( 490, 300 );
	mainLayout->addWidget(examinerWidget);

	m_rootNode = new SoSeparator;

	m_rootNode->addChild( Ejes( ) );
	m_rootNode->addChild( Text() );
    m_rootNode->addChild( Sphere() );
   	m_rootNode->addChild( Horizon() );
   	m_rootNode->addChild( AzimuthLine() );
   	m_rootNode->addChild( ZenithLine() );
    m_rootNode->addChild( Star() );

	SoQtExaminerViewer* myRenderArea = new SoQtExaminerViewer( examinerWidget );
    myRenderArea->setSceneGraph( m_rootNode );
    SbColor col( 0.86f, 0.86f, 0.86f );
    myRenderArea->setBackgroundColor(col);
    myRenderArea->show(  );

     QWidget* labelsWidget = new QWidget;
    mainLayout->addWidget( labelsWidget );

 	QGridLayout* labelsLayout = new QGridLayout;
 	labelsWidget->setLayout( labelsLayout );

 	QLabel* m_AzimuthLabel = new QLabel;
 	m_AzimuthLabel->setText( "Azimuth:" );
 	labelsLayout->addWidget( m_AzimuthLabel, 0, 0, 1, 1 );

	m_azimuthValue = new QLabel;
 	m_azimuthValue->setText( QString::number( m_azimuth ) );
 	labelsLayout->addWidget( m_azimuthValue, 0, 1, 1, 3  );

	QLabel* m_zenithLabel = new QLabel;
 	m_zenithLabel->setText( "Zenith:" );
 	labelsLayout->addWidget( m_zenithLabel, 1, 0, 1, 1 );

	m_zenithValue = new QLabel;
 	m_zenithValue->setText( QString::number( m_zenith ) );
 	labelsLayout->addWidget( m_zenithValue, 1, 1, 1, 3 );

}
예제 #3
0
CelestialWidget::CelestialWidget( QWidget* parent )
:QWidget( parent ), sphereRadio( 120.0 ), m_declination( 0 ), m_rightAscension( 0 )
{
	QVBoxLayout* mainLayout = new QVBoxLayout;
	setLayout( mainLayout );

	QWidget* examinerWidget = new QWidget;
	examinerWidget->setFixedSize( 490, 300 );
	mainLayout->addWidget(examinerWidget);

	m_rootNode = new SoSeparator;

	m_rootNode->addChild( Ejes() );
	m_rootNode->addChild( Sphere() );
	m_rootNode->addChild( CelestialEquator() );
	m_rootNode->addChild( Ecliptic() );
	m_rootNode->addChild( Points() );
	m_rootNode->addChild( RightAscension() );
	m_rootNode->addChild( Declination() );
	m_rootNode->addChild( Star() );

	SoQtExaminerViewer* myRenderArea = new SoQtExaminerViewer( examinerWidget );
	myRenderArea->setSceneGraph( m_rootNode );
	SbColor col( 0.86f, 0.86f, 0.86f );
	myRenderArea->setBackgroundColor(col);
	myRenderArea->show( );

	QWidget* labelsWidget = new QWidget;
	mainLayout->addWidget( labelsWidget );
	QGridLayout* labelsLayout = new QGridLayout;
	labelsWidget->setLayout( labelsLayout );

	QLabel* m_rightLabel = new QLabel;
	m_rightLabel->setText( "Right Ascension:" );
	labelsLayout->addWidget( m_rightLabel, 0, 0, 1, 1 );

	m_rightValue = new QLabel;
	m_rightValue->setText( QString::number( m_rightAscension ) );
	labelsLayout->addWidget( m_rightValue, 0, 1, 1, 3 );

	QLabel* m_declinationLabel = new QLabel;
	m_declinationLabel->setText( "Declination:" );
	labelsLayout->addWidget( m_declinationLabel, 1, 0, 1, 1 );

	m_declinationValue = new QLabel;
	m_declinationValue->setText( QString::number( m_declination ) );
	labelsLayout->addWidget( m_declinationValue, 1, 1, 1, 3 );
}
예제 #4
0
파일: crash.cpp 프로젝트: ruisebastiao/SoQt
int
main(int argc, char ** argv)
{
  QWidget * win = SoQt::init("Debug Test");
  SoQtExaminerViewer * viewer = new SoQtExaminerViewer(win);
  viewer->show();
  SoQt::show(win);
  SoSeparator * sep = new SoSeparator;
  SoCallback * cb = new SoCallback;
  cb->setCallback(callback, sep);
  sep->addChild(cb);
  sep->addChild(new SoCube);
  viewer->setSceneGraph(sep);
  viewer->setViewing(FALSE);
  SoQt::mainLoop();
  viewer->hide();
  // delete viewer;
  return 0;
}
예제 #5
0
int
main(int argc, char ** argv)
{
  QWidget * w = SoQt::init(argc, argv, "SoQtColorEditor");
  SoQtExaminerViewer * viewer = new SoQtExaminerViewer(w);
  SoSeparator * root;
  viewer->setSceneGraph(root = makescene());
  viewer->show();

  // we want ColorEditor in scene
  SoSeparator * editorscene = new SoSeparator;
  SoTranslation * trans = new SoTranslation;
  trans->translation.setValue(SbVec3f(2.0f, 0.0f, 0.0f));
  SoRotationXYZ * rot = new SoRotationXYZ;
  SoMaterial * mat = new SoMaterial;
  mat->diffuseColor.setValue(0.8, 0.8, 0.8);
  rot->axis = SoRotationXYZ::Y;
  rot->angle = 0.5;
  editorscene->addChild(trans);
  editorscene->addChild(rot);
  editorscene->addChild(mat);
  SoGuiColorEditor * inscene = new SoGuiColorEditor;
  inscene->wysiwyg.setValue(TRUE);
  inscene->color.connectFrom(&(material->diffuseColor));
  inscene->color.getValue(); // update field
  material->diffuseColor.connectFrom(&(inscene->color));
  editorscene->addChild(inscene);
  root->insertChild(editorscene, 0);

#if 0
  SoQtColorEditor * editor = new SoQtColorEditor;
  editor->attach(&(material->diffuseColor));
  editor->show();
#endif

  SoQt::show(w);
  SoQt::mainLoop();
  return 0;
}
예제 #6
0
void show(SoNode* n)
{
    if (win == NULL)
    {
        printf("Could not create window.\n");
        exit(-3);
    }

    SoQtExaminerViewer* viewer = new SoQtExaminerViewer(win);

    // set the robot
    if (n)
    {
        viewer->setSceneGraph(n);
    }

    // register timer callback for animation and draw state updates
    /*
    SoSensorManager *sensor_mgr = SoDB::getSensorManager();
    SoTimerSensor *timer = new SoTimerSensor(TimerCallback, NULL);
    timer->setInterval(SbTime(0.02));
    sensor_mgr->insertTimerSensor(timer);
    */
    viewer->setBackgroundColor(SbColor(1.0f, 1.0f, 1.0f));
    viewer->setAccumulationBuffer(true);
    viewer->setAntialiasing(true, 4);
    viewer->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
    viewer->setFeedbackVisibility(true);

    // show everything
    viewer->show();

    // start the mainloop
    SoQt::show(win);
    SoQt::mainLoop();

    // clean up
    delete viewer;
}
예제 #7
0
int main(int argc, char** argv)
{
	// verify that argument is given
	if (argc < 2)
	{
		std::cerr << "syntax: chain <XML file>" << std::endl;
		return -1;
	}
				
	// setup the simulation
	XMLReader::read(std::string(argv[1]));

	// get the (only) simulation object
	boost::shared_ptr<Simulator> s = XMLReader::_sim_objs.front();

	// setup the visualization
	QWidget* mainwin = SoQt::init(argc, argv, argv[0]);
	SoQtExaminerViewer* viewer = new SoQtExaminerViewer(mainwin);
	SoSeparator* main_sep = new SoSeparator;
	main_sep->ref();

	// add a camera
	SoPerspectiveCamera* camera = new SoPerspectiveCamera;
	camera->position = SbVec3f(0, 0, 150);
	camera->pointAt(SbVec3f(0,0,1));
	main_sep->addChild(camera);

	// add lights
	SoDirectionalLight* light = new SoDirectionalLight;
	light->direction = SbVec3f(0,0,1);
	SoDirectionalLight* light2 = new SoDirectionalLight;
	light2->direction = SbVec3f(0,0,-1);
	SoDirectionalLight* light3 = new SoDirectionalLight;
	light3->direction = SbVec3f(-10,-5,-1);
	SoDirectionalLight* light4 = new SoDirectionalLight;
	light4->direction = SbVec3f(-10,-5,1);
	SoDirectionalLight* light5 = new SoDirectionalLight;
	light5->direction = SbVec3f(0,-10,1);
	main_sep->addChild(light);
	main_sep->addChild(light2);
	main_sep->addChild(light3);
	main_sep->addChild(light4);
	main_sep->addChild(light5);
	
	// setup the simulator visualization
	viz = boost::shared_ptr<InventorOutput>(new InventorOutput(s));
	SoSeparator* sep = viz->get_root();
	main_sep->addChild(sep);

	// start rendering
	viewer->setSceneGraph(sep);
	viewer->show();

	// add a timer sensor that runs the simulation
	SoTimerSensor* timer = new SoTimerSensor(&render, &s);
	SbTime interval(STEP_SIZE);
	timer->setInterval(interval);
	timer->schedule();

	// popup the main window
	SoQt::show(mainwin);
	SoQt::mainLoop();
	delete viewer;
}
예제 #8
0
void CmdSandboxExaminerViewer::activated(int iMsg)
{
    SoQtExaminerViewer* viewer = new SoQtExaminerViewer();
    viewer->show();
    viewer->setSceneGraph(new SoCone);
}