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

Function Update

Rendering/VolumeOpenGL2/vtkVolumeMask.h:55–256  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

53
54 //--------------------------------------------------------------------------
55 void Update(vtkRenderer* ren, vtkImageData* input, int cellFlag, int textureExtent[6],
56 int scalarMode, int arrayAccessMode, int arrayId, const char* arrayName,
57 vtkIdType maxMemoryInBytes)
58 {
59 bool needUpdate = false;
60 bool modified = false;
61
62 if (!this->Texture)
63 {
64 this->Texture = vtkTextureObject::New();
65 needUpdate = true;
66 }
67
68 vtkOpenGLRenderWindow* renWin = vtkOpenGLRenderWindow::SafeDownCast(ren->GetRenderWindow());
69 auto ostate = renWin->GetState();
70 this->Texture->SetContext(renWin);
71
72 if (!this->Texture->GetHandle())
73 {
74 needUpdate = true;
75 }
76
77 int obsolete = needUpdate || !this->Loaded || input->GetMTime() > this->BuildTime;
78 if (!obsolete)
79 {
80 obsolete = cellFlag != this->LoadedCellFlag;
81 int i = 0;
82 while (!obsolete && i < 6)
83 {
84 obsolete = obsolete || this->LoadedExtent[i] > textureExtent[i];
85 ++i;
86 obsolete = obsolete || this->LoadedExtent[i] < textureExtent[i];
87 ++i;
88 }
89 }
90
91 if (obsolete)
92 {
93 this->Loaded = false;
94 int dim[3];
95 input->GetDimensions(dim);
96
97 vtkDataArray* scalars = vtkAbstractMapper::GetScalars(
98 input, scalarMode, arrayAccessMode, arrayId, arrayName, this->LoadedCellFlag);
99
100 // DON'T USE GetScalarType() or GetNumberOfScalarComponents() on
101 // ImageData as it deals only with point data...
102 int scalarType = scalars->GetDataType();
103 if (scalarType != VTK_UNSIGNED_CHAR)
104 {
105 std::cout << "Mask should be VTK_UNSIGNED_CHAR." << std::endl;
106 }
107 if (scalars->GetNumberOfComponents() != 1)
108 {
109 std::cout << "Mask should be a one-component scalar field." << std::endl;
110 }
111
112 GLint internalFormat = GL_R8;

Callers 1

RenderMethod · 0.50

Calls 15

vtkglPixelStoreiMethod · 0.80
SetInternalFormatMethod · 0.80
Create3DFromRawMethod · 0.80
NewFunction · 0.50
GetScalarsClass · 0.50
GetDataTypeSizeFunction · 0.50
GetRenderWindowMethod · 0.45
GetStateMethod · 0.45
SetContextMethod · 0.45
GetHandleMethod · 0.45
GetMTimeMethod · 0.45
GetDimensionsMethod · 0.45

Tested by

no test coverage detected