Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peteflorence/29e465e7972bfa230d31d2ea713a525f to your computer and use it in GitHub Desktop.
Save peteflorence/29e465e7972bfa230d31d2ea713a525f to your computer and use it in GitHub Desktop.
ddQVTKWidgetView::ddQVTKWidgetView(QWidget* parent) : ddViewBase(parent)
{
this->Internal = new ddInternal;
QVBoxLayout* layout = new QVBoxLayout(this);
layout->setMargin(0);
this->Internal->VTKWidget = new QVTKWidget;
layout->addWidget(this->Internal->VTKWidget);
this->Internal->VTKWidget->SetUseTDx(true);
this->Internal->RenderWindow = vtkSmartPointer<vtkRenderWindow>::New();
this->Internal->RenderWindow->SetMultiSamples(0);
this->Internal->RenderWindow->StereoCapableWindowOn();
this->Internal->RenderWindow->SetStereoTypeToRedBlue();
this->Internal->RenderWindow->StereoRenderOff();
this->Internal->RenderWindow->StereoUpdate();
this->Internal->VTKWidget->SetRenderWindow(this->Internal->RenderWindow);
this->Internal->LightKit = vtkSmartPointer<vtkLightKit>::New();
this->Internal->LightKit->SetKeyLightWarmth(0.5);
this->Internal->LightKit->SetFillLightWarmth(0.5);
this->Internal->TDxInteractor = vtkSmartPointer<vtkTDxInteractorStyleCallback>::New();
vtkInteractorStyle::SafeDownCast(this->Internal->RenderWindow->GetInteractor()->GetInteractorStyle())->SetTDxStyle(this->Internal->TDxInteractor);
//this->Internal->RenderWindow->SetNumberOfLayers(2);
//this->Internal->RendererBase = vtkSmartPointer<vtkRenderer>::New();
//this->Internal->RenderWindow->AddRenderer(this->Internal->RendererBase);
this->Internal->Renderer = vtkSmartPointer<vtkRenderer>::New();
//this->Internal->Renderer->SetLayer(1);
this->Internal->RenderWindow->AddRenderer(this->Internal->Renderer);
vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
this->Internal->Renderer->GradientBackgroundOn();
this->Internal->Renderer->SetBackground(0.0, 0.0, 0.0);
this->Internal->Renderer->SetBackground2(0.3, 0.3, 0.3);
this->Internal->Connector->Connect(this->Internal->Renderer, vtkCommand::StartEvent, this, SLOT(onStartRender()));
this->Internal->Connector->Connect(this->Internal->Renderer, vtkCommand::EndEvent, this, SLOT(onEndRender()));
this->setupOrientationMarker();
this->Internal->Renderer->ResetCamera();
this->connect(&this->Internal->RenderTimer, SIGNAL(timeout()), SLOT(onRenderTimer()));
this->Internal->RenderTimer.start();
this->setLightKitEnabled(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment