MCPcopy Create free account
hub / github.com/Kitware/VTK / Render

Method Render

Rendering/VolumeOpenGL2/vtkMultiBlockVolumeMapper.cxx:78–138  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

76
77//------------------------------------------------------------------------------
78void vtkMultiBlockVolumeMapper::Render(vtkRenderer* ren, vtkVolume* vol)
79{
80 vtkDataObject* dataObj = this->GetDataObjectInput();
81 if (dataObj->GetMTime() != this->BlockLoadingTime)
82 {
83 vtkDebugMacro("Reloading data blocks!");
84 this->LoadDataSet(ren, vol);
85 this->BlockLoadingTime = dataObj->GetMTime();
86 }
87
88 vol->GetModelToWorldMatrix(this->TempMatrix4x4);
89 this->SortMappers(ren, this->TempMatrix4x4);
90
91 MapperVec::iterator end = this->Mappers.end();
92 for (MapperVec::iterator it = this->Mappers.begin(); it != end; ++it)
93 {
94 if (this->FallBackMapper)
95 {
96 vtkImageData* image = vtkImageData::SafeDownCast((*it)->GetInput());
97 image->Modified();
98 this->FallBackMapper->SetInputData(image);
99 this->FallBackMapper->Render(ren, vol);
100 continue;
101 }
102
103 (*it)->Render(ren, vol);
104 }
105
106#ifdef MB_DEBUG
107 this->DebugRen->RemoveAllViewProps();
108 unsigned int count = 0;
109 for (MapperVec::const_iterator it = this->Mappers.begin(); it != end; ++it)
110 {
111 double* bnds = (*it)->GetInput()->GetBounds();
112 // vtkErrorMacro("Count: " << count << " bnds " << bnds[0] << " " << bnds[1] << " " << bnds[2]
113 // << " " << bnds[3]
114 // << " " << bnds[4] << " " << bnds[5]);
115 double rgb[3];
116 rgb[0] = (count % 4) * 85 / 255.0;
117 rgb[1] = ((count / 4) % 4) * 85 / 255.0;
118 rgb[2] = (count / 16) * 85 / 255.0;
119 vtkNew<vtkActor> act;
120 act->GetProperty()->SetColor(rgb);
121 act->GetProperty()->SetDiffuse(0);
122 act->GetProperty()->SetAmbient(1);
123 vtkNew<vtkCubeSource> cube;
124 cube->SetBounds(bnds);
125 vtkNew<vtkPolyDataMapper> mapper;
126 mapper->SetInputConnection(cube->GetOutputPort());
127 act->SetMapper(mapper);
128 this->DebugRen->AddActor(act);
129 count++;
130 }
131
132 this->DebugRen->GetActiveCamera()->ShallowCopy(ren->GetActiveCamera());
133 this->DebugWin->SetSize(ren->GetVTKWindow()->GetSize());
134 this->DebugWin->MakeCurrent();
135 this->DebugWin->Render();

Callers

nothing calls this directly

Calls 15

LoadDataSetMethod · 0.95
SortMappersMethod · 0.95
GetModelToWorldMatrixMethod · 0.80
GetActiveCameraMethod · 0.80
GetVTKWindowMethod · 0.80
RenderMethod · 0.65
GetDataObjectInputMethod · 0.45
GetMTimeMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
GetInputMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected