------------------------------------------------------------------------------
| 22 | |
| 23 | //------------------------------------------------------------------------------ |
| 24 | void vtkOpenGLVolumeTransferFunction2D::InternalUpdate(vtkObject* func, int vtkNotUsed(blendMode), |
| 25 | double vtkNotUsed(sampleDistance), double vtkNotUsed(unitDistance), int filterValue) |
| 26 | { |
| 27 | vtkImageData* transfer2D = vtkImageData::SafeDownCast(func); |
| 28 | if (!transfer2D) |
| 29 | { |
| 30 | return; |
| 31 | } |
| 32 | int* dims = transfer2D->GetDimensions(); |
| 33 | // Resample if there is a size restriction |
| 34 | void* data = transfer2D->GetPointData()->GetScalars()->GetVoidPointer(0); |
| 35 | if (dims[0] != this->TextureWidth || dims[1] != this->TextureHeight) |
| 36 | { |
| 37 | this->ResizeFilter->SetInputData(transfer2D); |
| 38 | this->ResizeFilter->SetResizeMethodToOutputDimensions(); |
| 39 | this->ResizeFilter->SetOutputDimensions(this->TextureWidth, this->TextureHeight, 1); |
| 40 | this->ResizeFilter->Update(); |
| 41 | data = this->ResizeFilter->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0); |
| 42 | } |
| 43 | |
| 44 | this->TextureObject->SetWrapS(vtkTextureObject::ClampToEdge); |
| 45 | this->TextureObject->SetWrapT(vtkTextureObject::ClampToEdge); |
| 46 | this->TextureObject->SetMagnificationFilter(filterValue); |
| 47 | this->TextureObject->SetMinificationFilter(filterValue); |
| 48 | this->TextureObject->Create2DFromRaw( |
| 49 | this->TextureWidth, this->TextureHeight, this->NumberOfColorComponents, VTK_FLOAT, data); |
| 50 | } |
| 51 | |
| 52 | //------------------------------------------------------------------------------ |
| 53 | bool vtkOpenGLVolumeTransferFunction2D::NeedsUpdate(vtkObject* func, |
nothing calls this directly
no test coverage detected