17 #ifndef mitkVtkModel_h
18 #define mitkVtkModel_h
24 #include <sofa/component/visualmodel/VisualModelImpl.h>
25 #include <sofa/helper/system/gl.h>
26 #include <vtkCellArray.h>
27 #include <vtkFloatArray.h>
28 #include <vtkPoints.h>
29 #include <vtkPolyData.h>
30 #include <vtkSmartPointer.h>
31 #include <MitkSimulationExports.h>
33 class vtkOpenGLTexture;
38 class MITKSIMULATION_EXPORT
VtkModel :
public sofa::component::visualmodel::VisualModelImpl
47 SOFA_CLASS(
VtkModel, sofa::component::visualmodel::VisualModelImpl);
49 void internalDraw(
const sofa::core::visual::VisualParams* vparams,
bool transparent)
override;
50 bool loadTextures()
override;
51 void SetVtkRenderer(vtkRenderer* renderer);
52 void updateBuffers()
override;
57 void SetMode(Mode mode);
64 MyType& operator=(
const MyType&);
66 void CreateIndexBuffer();
67 void CreateVertexBuffer();
68 void DrawGroup(
int group,
bool transparent);
69 void DrawOpenGLGroup(
int group,
bool transparent);
70 void DrawSurfaceGroup(
int group,
bool transparent);
71 void DrawGroups(
bool transparent);
73 void InitIndexBuffer();
74 void InitVertexBuffer();
75 void UpdateIndexBuffer();
76 void UpdateVertexBuffer();
77 void ValidateBoundBuffers();
79 bool m_GlewIsInitialized;
80 bool m_BuffersWereCreated;
81 size_t m_LastNumberOfVertices;
82 size_t m_LastNumberOfTriangles;
83 size_t m_LastNumberOfQuads;
84 GLuint m_VertexBuffer;
86 std::map<unsigned int, vtkSmartPointer<vtkOpenGLTexture> > m_Textures;
87 vtkRenderer* m_VtkRenderer;
89 vtkSmartPointer<vtkPoints> m_Points;
90 vtkSmartPointer<vtkCellArray> m_Polys;
91 vtkSmartPointer<vtkFloatArray> m_Normals;
92 vtkSmartPointer<vtkFloatArray> m_TexCoords;
93 vtkSmartPointer<vtkPolyData> m_PolyData;
Class for storing surfaces (vtkPolyData).
DataCollection - Class to facilitate loading/accessing structured data.