18VTK_ABI_NAMESPACE_BEGIN
56 int scalarMode,
int arrayAccessMode,
int arrayId,
const char* arrayName,
59 bool needUpdate =
false;
60 bool modified =
false;
70 this->
Texture->SetContext(renWin);
72 if (!this->
Texture->GetHandle())
82 while (!obsolete && i < 6)
84 obsolete = obsolete || this->
LoadedExtent[i] > textureExtent[i];
86 obsolete = obsolete || this->
LoadedExtent[i] < textureExtent[i];
98 input, scalarMode, arrayAccessMode, arrayId, arrayName, this->
LoadedCellFlag);
105 std::cout <<
"Mask should be VTK_UNSIGNED_CHAR." << std::endl;
109 std::cout <<
"Mask should be a one-component scalar field." << std::endl;
112 GLint internalFormat = GL_R8;
113 GLenum format = GL_RED;
121 textureSize[i] = textureExtent[2 * i + 1] - textureExtent[2 * i] + 1;
126 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
127 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width && textureSize[2] <= width;
131 this->
Loaded = textureSize[0] * textureSize[1] * textureSize[2] *
136 ostate->vtkglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
138 if (!(textureExtent[1] - textureExtent[0] + cellFlag == dim[0]))
140 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, dim[0] - cellFlag);
142 if (!(textureExtent[3] - textureExtent[2] + cellFlag == dim[1]))
144 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, dim[1] - cellFlag);
147 ((textureExtent[4] * (dim[1] - cellFlag) + textureExtent[2]) * (dim[0] - cellFlag) +
151 this->
Texture->SetDataType(type);
152 this->
Texture->SetFormat(format);
153 this->
Texture->SetInternalFormat(internalFormat);
154 this->
Texture->Create3DFromRaw(
155 textureSize[0], textureSize[1], textureSize[2], 1, scalarType, dataPtr);
161 this->
Texture->SetBorderColor(0.0f, 0.0f, 0.0f, 0.0f);
164 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
165 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
180 swapBounds[0] = (spacing[0] < 0);
181 swapBounds[1] = (spacing[1] < 0);
182 swapBounds[2] = (spacing[2] < 0);
198 origin[0] +
static_cast<double>(this->
LoadedExtent[0 + swapBounds[0]]) * spacing[0];
200 origin[1] +
static_cast<double>(this->
LoadedExtent[2 + swapBounds[1]]) * spacing[1];
201 this->LoadedBounds[4] =
202 origin[2] +
static_cast<double>(this->
LoadedExtent[4 + swapBounds[2]]) * spacing[2];
203 this->LoadedBounds[1] =
204 origin[0] +
static_cast<double>(this->
LoadedExtent[1 - swapBounds[0]]) * spacing[0];
205 this->LoadedBounds[3] =
206 origin[1] +
static_cast<double>(this->
LoadedExtent[3 - swapBounds[1]]) * spacing[1];
207 this->LoadedBounds[5] =
208 origin[2] +
static_cast<double>(this->
LoadedExtent[5 - swapBounds[2]]) * spacing[2];
212 int wholeTextureExtent[6];
217 wholeTextureExtent[i]--;
224 if (this->
LoadedExtent[2 * i] == wholeTextureExtent[2 * i])
231 origin[i] + (
static_cast<double>(this->
LoadedExtent[2 * i]) + 0.5) * spacing[i];
234 if (this->
LoadedExtent[2 * i + 1] == wholeTextureExtent[2 * i + 1])
236 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
237 (
static_cast<double>(this->
LoadedExtent[2 * i + 1]) + 1.0) * spacing[i];
241 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
242 (
static_cast<double>(this->
LoadedExtent[2 * i + 1]) + 0.5) * spacing[i];
278 return this->
Texture->GetTextureUnit();
286 this->
Texture->ReleaseGraphicsResources(window);
307 std::map<vtkImageData*, vtkVolumeMask*>
Map;
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
virtual int GetDataType() const
Return the underlying data type.
virtual int GetDataTypeSize() const =0
Return the size of the underlying data type.
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
static vtkDataArray * GetScalars(vtkDataSet *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int &cellFlag)
Internal helper function for getting the active scalars.
int * GetDimensions()
Get dimensions of this structured points dataset.
virtual int * GetExtent()
Set/Get the extent.
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE.
topologically and geometrically regular array of data
virtual double * GetOrigin()
Set/Get the origin of the dataset.
virtual double * GetSpacing()
Set the spacing (width,height,length) of the cubical cells that compose the data set.
std::map< vtkImageData *, vtkVolumeMask * > Map
vtkMapMaskTextureId()=default
static vtkOpenGLRenderWindow * SafeDownCast(vtkObjectBase *o)
virtual vtkOpenGLState * GetState()
abstract specification for renderers
vtkRenderWindow * GetRenderWindow()
Specify the rendering window in which to draw.
In case DepthTextureCompare is true, specify the comparison function in use.
static vtkTextureObject * New()
record modification and/or execution time
void Update(vtkRenderer *ren, vtkImageData *input, int cellFlag, int textureExtent[6], int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, vtkIdType maxMemoryInBytes)
vtkTextureObject * Texture
vtkIdType LoadedExtent[6]
vtkTimeStamp GetBuildTime()
vtkIdType * GetLoadedExtent()
void ReleaseGraphicsResources(vtkWindow *window)
double * GetLoadedBounds()
window superclass for vtkRenderWindow
#define VTK_UNSIGNED_CHAR