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];