Kinetic Visualization
 All Classes Functions Variables Pages
RayCasting.h
1 #pragma once
2 #include "RendererOpenGL.h"
3 #include "VertexGeometry.h"
4 #include "Primitives.h"
5 #include "Shader.h"
6 #include "ParticleSystemCuda.h"
7 #include "CudaTexture.h"
8 
9 #include "GLM/gtx.hpp"
10 #include "GLM/gtc.hpp"
11 #include "GLM/gtx/type_ptr.hpp"
12 
14 {
15 
16 public:
18  RayCasting();
20  ~RayCasting();
21 
25  void init();
32  void resize(int width, int height);
36  void render(float elapsedTime);
37 
42  void setVolumeTextureHandle(GLuint tex);
47  void setTransferTextureHandle(GLuint tex);
57  void setTransferTextureParticleHandle(GLuint tex);
62  void setTransferFunction(bool active);
69  void setVolumeSize(float width, float height, float depth);
74  void setTextureLoaded(bool loaded);
79  void setLight(bool active);
84  void setPhong(bool active);
89  void setMip(bool active);
94  void setAverage(bool active);
99  void setCompositing(bool active);
104  void setAdaptive(bool active);
108  void setStepSize(double step);
113  void setXClipping(float x);
118  void setYClipping(float y);
123  void setZClipping(float z);
124 
129  void setPCDTextureHandle(GLuint tex);
130 
135  void SetIsoValue(float val);
136 
137 protected:
138 
139 private:
141  int screenWidth;
143  int screenHeight;
144 
146  bool textureLoaded;
147 
149  float volumeWidth;
151  float volumeHeight;
153  float volumeDepth;
155  GLuint volumeTextureHandle;
157  GLuint pcdTextureHandle;
158 
160  GLuint transferTextureHandle;
162  GLuint transferTextureHandle2D;
164  GLuint tfParticleHandle;
165 
167  bool transferFunction;
169  bool light;
171  bool phong;
173  bool mip;
175  bool average;
177  bool adaptive;
179  double step;
180 
182  glm::vec4* quadVertices;
183 
185  float xClipping;
187  float yClipping;
189  float zClipping;
190 
192  void bindRayCastingTextures();
194  void unbindRayCastingTextures();
195 
196  //for test only!!
197  Shader* texturShader;
198 
199 public:
200  View* m_volumeBricks_front;
201  View* m_volumeBricks_back;
202 //_________________
203 private:
204  VertexGeometry* m_particle_geo;
205  RendererOpenGL* m_renderer;
206 
207  ParticleSystemCuda* m_particle_cuda;
208 
209  FBO::FBOPtr fbo_back;
210  FBO::FBOPtr fbo_front;
211  FBO::FBOPtr fbo_hdr;
212  View* m_bb_front;
213  View* m_bb_back;
214  View* m_raycasting;
215  View* m_raycasting2D;
216  View* m_mip;
217  View* m_averaging;
218  View* m_particle;
219  View* m_hdr;
220  View* m_cp_back;
221  View* m_cp_front;
222  View* m_cp2_back;
223  View* m_cp2_front;
224 
225  View* m_contour;
226  View* m_exposure;
227 
228  Camera* cam;
229 
230  unsigned int bspile_weights;
231  unsigned int bspile_dev_weights;
232 public:
233  VertexGeometry* m_plane_tmp;
234 
235 public:
236  int m_type;
237 
238  //COPY VOM CUDA SDK UM ZU TESTEN, OB DIE VOLUMENDATEN BENÜZT WERDEN KÖNNEN!!!
239  void initPixelBuffer();
240  void renderCuda();
241  void display();
242  float invViewMatrix[12];
243  int width;
244  int height;
245  GLuint pbo; // OpenGL pixel buffer object
246  GLuint tex; // OpenGL texture object
247  struct cudaGraphicsResource *cuda_pbo_resource; // CUDA Graphics Resource (to transfer PBO)
248 
249  void AfterLoadingOfVolume(int width, int height, int depth);
250 
251  CudaTexture<float4,3>* m_volumen;
252  CudaTexture<float4,2>* m_texture;
253 
254  CudaTexture<float4,2>* m_hg;
255  CudaTexture<float4,2>* m_hg_dev;
256 
257  CudaTexture<float4,3>* m_pcd;
258 };