00001
00002
00003 #include "Iguana/Controls/interface/IgMatEdViewer.h"
00004 #include <qwidget.h>
00005 #include <Inventor/nodes/SoSeparator.h>
00006 #include <Inventor/nodes/SoSphere.h>
00007 #include <Inventor/nodes/SoDirectionalLight.h>
00008 #include <Inventor/nodes/SoOrthographicCamera.h>
00009 #include <Inventor/Qt/SoQtRenderArea.h>
00010 #include <Inventor/actions/SoGLRenderAction.h>
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 IgMatEdViewer::IgMatEdViewer (QWidget *parent, SoNode *model)
00023 :m_parent(parent),
00024 m_renderArea (0),
00025 m_light (0),
00026 m_camera (0),
00027 m_root (0),
00028 m_userSeparator (0),
00029 m_model (model)
00030 {
00031 ASSERT (m_parent);
00032
00033 m_root = new SoSeparator ();
00034 m_root->ref ();
00035
00036 m_light = new SoDirectionalLight ();
00037 m_light->ref ();
00038
00039 m_camera = new SoOrthographicCamera ();
00040 m_camera->ref ();
00041
00042 m_userSeparator = new SoSeparator ();
00043 m_userSeparator->ref ();
00044
00045 m_userSeparator->addChild (m_model);
00046
00047 m_root->addChild (m_camera);
00048 m_root->addChild (m_light);
00049 m_root->addChild (m_userSeparator);
00050
00051 m_renderArea = new SoQtRenderArea (m_parent, "IgMatEdViewer", true, false, false);
00052
00053 m_camera->viewAll (m_userSeparator, m_renderArea->getViewportRegion());
00054 m_renderArea->setSceneGraph (m_root);
00055 m_renderArea->setBackgroundColor (SbColor(0.0f, 0.2f, 0.3f));
00056 m_renderArea->setTransparencyType (SoGLRenderAction::BLEND);
00057
00058 m_renderArea->show ();
00059 }