16 #ifndef vtkVolumeMask_h 17 #define vtkVolumeMask_h 66 int scalarMode,
int arrayAccessMode,
int arrayId,
const char* arrayName,
69 bool needUpdate =
false;
70 bool modified =
false;
92 while (!obsolete && i < 6)
94 obsolete = obsolete || this->
LoadedExtent[i] > textureExtent[i];
96 obsolete = obsolete || this->
LoadedExtent[i] < textureExtent[i];
108 input, scalarMode, arrayAccessMode, arrayId, arrayName, this->
LoadedCellFlag);
115 cout <<
"Mask should be VTK_UNSIGNED_CHAR." << endl;
119 cout <<
"Mask should be a one-component scalar field." << endl;
122 GLint internalFormat = GL_R8;
123 GLenum format = GL_RED;
124 GLenum
type = GL_UNSIGNED_BYTE;
131 textureSize[i] = textureExtent[2 * i + 1] - textureExtent[2 * i] + 1;
136 glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE, &width);
137 this->
Loaded = textureSize[0] <= width && textureSize[1] <= width && textureSize[2] <= width;
141 this->
Loaded = textureSize[0] * textureSize[1] * textureSize[2] *
146 ostate->vtkglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
148 if (!(textureExtent[1] - textureExtent[0] + cellFlag == dim[0]))
150 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, dim[0] - cellFlag);
152 if (!(textureExtent[3] - textureExtent[2] + cellFlag == dim[1]))
154 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, dim[1] - cellFlag);
157 ((textureExtent[4] * (dim[1] - cellFlag) + textureExtent[2]) * (dim[0] - cellFlag) +
165 textureSize[0], textureSize[1], textureSize[2], 1, scalarType, dataPtr);
174 ostate->vtkglPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
175 ostate->vtkglPixelStorei(GL_UNPACK_IMAGE_HEIGHT, 0);
190 swapBounds[0] = (
spacing[0] < 0);
191 swapBounds[1] = (
spacing[1] < 0);
192 swapBounds[2] = (
spacing[2] < 0);
222 int wholeTextureExtent[6];
227 wholeTextureExtent[i]--;
234 if (this->
LoadedExtent[2 * i] == wholeTextureExtent[2 * i])
244 if (this->
LoadedExtent[2 * i + 1] == wholeTextureExtent[2 * i + 1])
246 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
251 this->
LoadedBounds[2 * i + 1 - swapBounds[i]] = origin[i] +
317 std::map<vtkImageData*, vtkVolumeMask*>
Map;
325 #endif // vtkVolumeMask_h
vtkIdType * GetLoadedExtent()
virtual void ReleaseGraphicsResources(vtkWindow *win)
Deactivate and UnBind the texture.
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
vtkTimeStamp GetBuildTime()
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
static vtkOpenGLRenderWindow * SafeDownCast(vtkObjectBase *o)
vtkIdType LoadedExtent[6]
record modification and/or execution time
static vtkDataArray * GetScalars(vtkDataSet *input, int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, int &cellFlag)
Internal helper function for getting the active scalars.
void Modified()
Set this objects time to the current time.
abstract specification for renderers
virtual void SetWrapR(int)
Wrap mode for the first texture coordinate "r" Valid values are:
void SetDataType(unsigned int glType)
Get the data type for the texture as GLenum type.
virtual void SetBorderColor(float, float, float, float)
Border Color (RGBA).
double * GetLoadedBounds()
vtkTextureObject * Texture
void ReleaseGraphicsResources(vtkWindow *window)
window superclass for vtkRenderWindow
virtual int * GetDimensions()
Get dimensions of this structured points dataset.
virtual double * GetOrigin()
Set/Get the origin of the dataset.
bool Create3DFromRaw(unsigned int width, unsigned int height, unsigned int depth, int numComps, int dataType, void *data)
Create a 3D texture from client memory numComps must be in [1-4].
topologically and geometrically regular array of data
virtual void SetMinificationFilter(int)
Minification filter mode.
abstract superclass for arrays of numeric data
virtual double * GetSpacing()
Set the spacing (width,height,length) of the cubical cells that compose the data set.
vtkMTimeType GetMTime() override
Datasets are composite objects and need to check each part for MTime THIS METHOD IS THREAD SAFE.
virtual unsigned int GetHandle()
Returns the OpenGL handle.
virtual int GetDataType() const =0
Return the underlying data type.
void SetInternalFormat(unsigned int glInternalFormat)
Get/Set internal format (OpenGL internal format) that should be used.
virtual int * GetExtent()
Set/Get the extent.
void Update(vtkRenderer *ren, vtkImageData *input, int cellFlag, int textureExtent[6], int scalarMode, int arrayAccessMode, int arrayId, const char *arrayName, vtkIdType maxMemoryInBytes)
abstracts an OpenGL texture object.
#define VTK_UNSIGNED_CHAR
void Deactivate()
Deactivate and UnBind the texture.
static vtkTextureObject * New()
virtual void SetWrapS(int)
Wrap mode for the first texture coordinate "s" Valid values are:
vtkRenderWindow * GetRenderWindow()
Specify the rendering window in which to draw.
virtual vtkOpenGLState * GetState()
int GetTextureUnit()
Return the texture unit used for this texture.
virtual void Activate()
Activate and Bind the texture.
virtual void SetWrapT(int)
Wrap mode for the first texture coordinate "t" Valid values are:
std::map< vtkImageData *, vtkVolumeMask * > Map
void SetFormat(unsigned int glFormat)
Get/Set format (OpenGL internal format) that should be used.
virtual void Delete()
Delete a VTK object.
virtual int GetDataTypeSize() const =0
Return the size of the underlying data type.
void SetContext(vtkOpenGLRenderWindow *)
Get/Set the context.
virtual void SetMagnificationFilter(int)
Magnification filter mode.