00001 #pragma once 00002 00003 #include "Vis.hpp" 00004 #include "VisTexture1D.hpp" 00005 #include "VisTexture2D.hpp" 00006 #include "VisTexture3D.hpp" 00007 #include "VisMesh.hpp" 00008 #include "VisShader.hpp" 00009 #include "VisFBO.hpp" 00010 00014 class VolRenderer 00015 { 00016 00020 Texture3D* volume; 00021 00025 M44f texture_matrix; 00026 00030 vector<Plane3f> planes; 00031 00035 vector<visPolygon> plane_polygons; 00036 00040 Shader pass1; 00041 00045 Shader* pass2; 00046 00050 Shader lightS; 00051 00055 Shader nonLightS; 00056 00060 Shader npr; 00061 00065 Shader nprPost; 00066 00070 Color4f upperLight; 00071 00075 Color4f lowerLight; 00076 00080 V3f lightNormal; 00081 00085 bool lightOn; 00086 00090 bool nprOn; 00091 00092 00096 Texture2D* offscreen_buffer; 00097 00101 FBO* fbo; 00102 00103 public: 00104 00108 Texture1D* transferFunction; 00109 00110 bool texInit; 00111 00115 VolRenderer(Texture3D &volume); 00116 00117 virtual ~VolRenderer(); 00118 00122 void draw(); 00123 00127 void add_plane(Plane3f plane); 00128 00132 void delete_plane(int i); 00133 00137 void set_plane(int i, Plane3f plane); 00138 00142 int get_plane_count() 00143 { 00144 return planes.size(); 00145 } 00146 00150 Plane3f get_plane(int i) 00151 { 00152 return planes[i]; 00153 } 00154 00158 void setTransferFunc(Texture1D* tData); 00159 00163 void triggerLight(bool on); 00164 00168 void triggerNPR(bool on); 00169 00173 void setUpperLight (Color4f color) { upperLight = color; } 00174 00178 void setLowerLight (Color4f color) { lowerLight = color; } 00179 00183 void setLightDirection (V3f dir) { lightNormal = dir; } 00184 00185 void resizeBackBuffer(V2i new_size); 00186 };