-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvolume.h
More file actions
64 lines (49 loc) · 1.8 KB
/
Copy pathvolume.h
File metadata and controls
64 lines (49 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef VOLUME_H
#define VOLUME_H
#include "global.h"
#include <vtkSmartPointer.h>
#include <list>
class vtkImageData;
class Volume
{
public:
Volume(vtkSmartPointer<vtkImageData> data);
~Volume();
// (GL context)
void bind();
// (GL context)
void render(const Matrix4& projectionMatrix, const Matrix4& modelViewMatrix);
void renderSelection(const Matrix4& projectionMatrix, const Matrix4& modelViewMatrix, Vector3& firstPos, Vector3& lastPos, const Matrix4& invSelectionMatrix, const Matrix4& oldData);
void setClipPlane(float a, float b, float c, float d); // plane equation: ax+by+cz+d=0
void clearClipPlane();
double getMinValue() const { return mRange[0]; }
double getMaxValue() const { return mRange[1]; }
void setOpacity(float opacity) { mOpacity = opacity; }
private:
bool hasClipPlane();
// (GL context)
void initXPlanes(unsigned int& baseIndex);
void initYPlanes(unsigned int& baseIndex);
void initZPlanes(unsigned int& baseIndex);
// (GL context)
void switchMaterial(MaterialSharedPtr newMaterial);
MaterialSharedPtr mMaterial;
MaterialSharedPtr mMaterialClip, mMaterialFast;
bool mBound;
GLint mVertexAttrib, mTexCoordAttrib, mSliceAttrib;
GLint mProjectionUniform, mModelViewUniform, mDimensionsUniform, mInvertUniform, mClipPlaneUniform, mSpacingUniform, mOpacityUniform;
GLuint mVertexBuffer, mTexCoordBuffer;
GLuint mIndexBufferX, mIndexBufferY, mIndexBufferZ;
std::vector<GLfloat> mVertices, mTexCoords;
std::vector<GLushort> mIndicesX, mIndicesY, mIndicesZ;
// std::list<std::vector<unsigned char>> mTexturesX, mTexturesY, mTexturesZ;
std::vector<unsigned char> mTexture;
int mDimensions[3];
double mRange[2];
Vector3 mSpacing;
// GLuint mTextureXHandle, mTextureYHandle, mTextureZHandle;
GLuint mTextureHandle;
float mClipEq[4];
float mOpacity;
};
#endif /* VOLUME_H */