Changeset 407
- Timestamp:
- Apr 24, 2006 12:46:14 PM (18 years ago)
- Location:
- trunk/gui/vizservers/nanovis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/vizservers/nanovis/Makefile
r406 r407 101 101 gcc $(CFLAG) Lic.cpp 102 102 103 Volume.o: Texture3D.o Volume.cpp $(AUXSRC)103 Volume.o: Texture3D.o Volume.cpp Volume.h $(AUXSRC) 104 104 gcc $(CFLAG) Volume.cpp 105 105 -
trunk/gui/vizservers/nanovis/Volume.cpp
r374 r407 37 37 38 38 location = Vector3(x,y,z); 39 40 //add cut planes 41 plane.clear(); 42 plane.push_back(CutPlane(1, 0.5)); 43 plane.push_back(CutPlane(2, 0.5)); 44 plane.push_back(CutPlane(3, 0.5)); 45 39 46 } 40 47 -
trunk/gui/vizservers/nanovis/Volume.h
r371 r407 17 17 #define _VOLUME_H_ 18 18 19 #include <vector> 20 19 21 #include "define.h" 20 22 #include "Texture3D.h" 21 23 #include "Vector3.h" 24 25 using namespace std; 26 27 struct CutPlane{ 28 int orient; //orientation - 1: xy slice, 2: yz slice, 3: xz slice 29 float offset; //normalized offset [0,1] in the volume 30 31 CutPlane(int _orient, float _offset): 32 orient(_orient), 33 offset(_offset){} 34 }; 35 22 36 23 37 class Volume{ … … 25 39 public: 26 40 Vector3 location; 41 vector <CutPlane> plane; //cut planes 27 42 28 43 int width; -
trunk/gui/vizservers/nanovis/VolumeRenderer.cpp
r406 r407 131 131 glEnable(GL_DEPTH_TEST); 132 132 glEnable(GL_BLEND); 133 133 134 //render the cut planes 135 for(int i=0; i<volume[volume_index]->plane.size(); i++){ 136 float offset = volume[volume_index]->plane[i].offset; 137 int axis = volume[volume_index]->plane[i].orient; 138 139 if(axis==1){ 140 vert1 = Vector4(-10, -10, offset, 1); 141 vert2 = Vector4(-10, +10, offset, 1); 142 vert3 = Vector4(+10, +10, offset, 1); 143 vert4 = Vector4(+10, -10, offset, 1); 144 } 145 else if(axis==2){ 146 vert1 = Vector4(offset, -10, -10, 1); 147 vert2 = Vector4(offset, +10, -10, 1); 148 vert3 = Vector4(offset, +10, +10, 1); 149 vert4 = Vector4(offset, -10, +10, 1); 150 } 151 else if(axis==3){ 152 vert1 = Vector4(-10, offset, -10, 1); 153 vert2 = Vector4(+10, offset, -10, 1); 154 vert3 = Vector4(+10, offset, +10, 1); 155 vert4 = Vector4(-10, offset, +10, 1); 156 } 157 158 vert1 = model_view.transform(vert1); 159 vert2 = model_view.transform(vert2); 160 vert3 = model_view.transform(vert3); 161 vert4 = model_view.transform(vert4); 162 163 ConvexPolygon *poly; 164 poly = &staticPoly; 165 poly->vertices.clear(); 166 167 poly->append_vertex(vert1); 168 poly->append_vertex(vert2); 169 poly->append_vertex(vert3); 170 poly->append_vertex(vert4); 171 172 for(int k=0; k<6; k++){ 173 poly->clip(volume_planes[k]); 174 } 175 176 poly->copy_vertices_to_texcoords(); 177 poly->transform(model_view_inverse); 178 poly->translate(shift_4d); 179 poly->transform(model_view); 180 181 glPushMatrix(); 182 glScalef(volume[volume_index]->aspect_ratio_width, volume[volume_index]->aspect_ratio_height, volume[volume_index]->aspect_ratio_depth); 183 184 activate_one_volume_shader(volume_index, 1, 1); 185 glPopMatrix(); 186 187 glBegin(GL_POLYGON); 188 poly->Emit(true); 189 glEnd(); 190 191 deactivate_one_volume_shader(); 192 } 193 194 #if 1 134 195 for (int i=0; i<n_actual_slices; i++){ 135 196 slice_z = zFar + i * z_step; //back to front … … 181 242 */ 182 243 183 activate_one_volume_shader(volume_index, n_actual_slices );244 activate_one_volume_shader(volume_index, n_actual_slices, 30); 184 245 glPopMatrix(); 185 246 … … 191 252 192 253 } 254 #endif 193 255 194 256 glDisable(GL_BLEND); … … 248 310 249 311 250 void VolumeRenderer::activate_one_volume_shader(int volume_index, int n_actual_slices ){312 void VolumeRenderer::activate_one_volume_shader(int volume_index, int n_actual_slices, float scale){ 251 313 252 314 cgGLSetStateMatrixParameter(m_mvp_vert_std_param, CG_GL_MODELVIEW_PROJECTION_MATRIX, CG_GL_MATRIX_IDENTITY); … … 261 323 cgGLEnableTextureParameter(m_tf_one_volume_param); 262 324 263 cgGLSetParameter4f(m_render_param_one_volume_param, n_actual_slices, 0., live_diffuse, live_specular);325 cgGLSetParameter4f(m_render_param_one_volume_param, n_actual_slices, scale, live_diffuse, live_specular); 264 326 cgGLBindProgram(m_one_volume_fprog); 265 327 cgGLEnableProfile(CG_PROFILE_FP30); -
trunk/gui/vizservers/nanovis/VolumeRenderer.h
r406 r407 63 63 CGparameter m_mvi_vert_std_param; 64 64 65 void activate_one_volume_shader(int volume_index, int n_actual_slices );65 void activate_one_volume_shader(int volume_index, int n_actual_slices, float opacity_scale); 66 66 void deactivate_one_volume_shader(); 67 67 -
trunk/gui/vizservers/nanovis/shaders/one_volume.cg
r401 r407 49 49 //sample the transfer function texture 50 50 float4 color = tex1D(tf, sample.x); 51 color.w = 30*color.w/renderParameters.x;51 color.w = renderParameters.y*color.w/renderParameters.x; 52 52 53 53 //float4 color = float4(sample.x, 0, 0, 1);
Note: See TracChangeset
for help on using the changeset viewer.