25 #include <Inventor/events/SoMouseButtonEvent.h>
30 this->setBackgroundColor(SbColor(100 / 255.0f, 100 / 255.0f, 100 / 255.0f));
31 this->setAccumulationBuffer(
false);
32 this->setHeadlight(
true);
33 this->setViewing(
false);
34 this->setDecoration(
false);
37 this->setAntialiasing(
true, 4);
40 this->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
41 this->setFeedbackVisibility(
false);
44 SoSeparator* root =
new SoSeparator;
45 rotation =
new SoRotationXYZ;
46 rotation->axis = SoRotationXYZ::Y;
47 previewRoot =
new SoSeparator;
48 root->addChild(rotation);
49 root->addChild(previewRoot);
50 this->setSceneGraph(root);
53 timer.reset(
new SoTimerSensor);
54 timer->setFunction(timeSensorCallback);
56 timer->setBaseTime(SbTime::getTimeOfDay());
57 timer->setInterval(0.02f);
63 previewRoot->removeAllChildren();
64 previewRoot->addChild(
object);
69 previewRoot->removeAllChildren();
73 SbBool scene3D::ObjectPreviewViewer::processSoEvent(
const SoEvent*
const event)
79 void scene3D::ObjectPreviewViewer::timeSensorCallback(
void*
data, SoSensor* sensor)
81 ObjectPreviewViewer* viewer = (ObjectPreviewViewer*)
data;
83 if (viewer->previewRoot->getNumChildren() > 0)
85 viewer->rotation->angle.setValue(viewer->rotation->angle.getValue() + 0.01f);
86 viewer->getCamera()->viewAll(viewer->getSceneGraph(), viewer->getViewportRegion());