26 #include <Inventor/events/SoMouseButtonEvent.h>
33 this->setBackgroundColor(SbColor(100 / 255.0f, 100 / 255.0f, 100 / 255.0f));
34 this->setAccumulationBuffer(
false);
35 this->setHeadlight(
true);
36 this->setViewing(
false);
37 this->setDecoration(
false);
40 this->setAntialiasing(
true, 4);
43 this->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
44 this->setFeedbackVisibility(
false);
47 SoSeparator* root =
new SoSeparator;
48 rotation =
new SoRotationXYZ;
49 rotation->axis = SoRotationXYZ::Y;
50 previewRoot =
new SoSeparator;
51 root->addChild(rotation);
52 root->addChild(previewRoot);
53 this->setSceneGraph(root);
56 timer.reset(
new SoTimerSensor);
57 timer->setFunction(timeSensorCallback);
59 timer->setBaseTime(SbTime::getTimeOfDay());
60 timer->setInterval(0.02f);
67 previewRoot->removeAllChildren();
68 previewRoot->addChild(
object);
74 previewRoot->removeAllChildren();
79 scene3D::ObjectPreviewViewer::processSoEvent(
const SoEvent*
const event)
86 scene3D::ObjectPreviewViewer::timeSensorCallback(
void*
data, SoSensor* sensor)
88 ObjectPreviewViewer* viewer = (ObjectPreviewViewer*)
data;
90 if (viewer->previewRoot->getNumChildren() > 0)
92 viewer->rotation->angle.setValue(viewer->rotation->angle.getValue() + 0.01f);
93 viewer->getCamera()->viewAll(viewer->getSceneGraph(), viewer->getViewportRegion());