Changeset 417 for trunk/gui/vizservers/nanovis
- Timestamp:
- Apr 27, 2006, 2:14:52 PM (18 years ago)
- Location:
- trunk/gui/vizservers/nanovis
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/vizservers/nanovis/ConvexPolygon.cpp
r415 r417 187 187 } 188 188 glVertex4fv((float *)&(vertices[i])); 189 } 190 } 189 /* 190 //debug 191 fprintf(stderr, "(%f %f %f %f)", 192 vertices[i].x, 193 vertices[i].y, 194 vertices[i].z, 195 vertices[i].w ); 196 */ 197 } 198 } 199 //fprintf(stderr, " "); 191 200 } 192 201 -
trunk/gui/vizservers/nanovis/VolumeRenderer.cpp
r416 r417 31 31 tf.clear(); 32 32 slice.clear(); 33 add_volume(_vol, _tf, 256);33 add_volume(_vol, _tf, 64); 34 34 35 35 //initialize the volume shaders … … 93 93 total_enabled_volumes ++; 94 94 } 95 fprintf(stderr, "total volumes rendered: %d\n", total_enabled_volumes);95 //fprintf(stderr, "total volumes rendered: %d\n", total_enabled_volumes); 96 96 97 97 ConvexPolygon*** polys = new ConvexPolygon**[total_enabled_volumes]; //two dimension pointer array … … 181 181 Vector4 vert4 = (Vector4(+10, -10, -0.5, 1)); 182 182 183 #if 1 183 184 //Render cutplanes first with depth test enabled. 184 185 //They will mark the image with their depth values. Then we render other volume slices. 185 186 //These volume slices will be occluded correctly by the cutplanes and vice versa. 186 glEnable(GL_DEPTH_TEST); 187 glDisable(GL_BLEND); 188 187 188 ConvexPolygon static_poly; 189 189 for(int i=0; i<volume[volume_index]->get_cutplane_count(); i++){ 190 190 if(!volume[volume_index]->cutplane_is_enabled(i)) … … 199 199 vert3 = Vector4(+10, +10, offset, 1); 200 200 vert4 = Vector4(+10, -10, offset, 1); 201 //continue; 201 202 } 202 203 else if(axis==2){ … … 205 206 vert3 = Vector4(offset, +10, +10, 1); 206 207 vert4 = Vector4(offset, -10, +10, 1); 208 //continue; 207 209 } 208 210 else if(axis==3){ … … 211 213 vert3 = Vector4(+10, offset, +10, 1); 212 214 vert4 = Vector4(-10, offset, +10, 1); 215 //continue; 213 216 } 214 217 … … 218 221 vert4 = model_view_no_trans.transform(vert4); 219 222 220 ConvexPolygon 221 p oly.vertices.clear();222 223 p oly.append_vertex(vert1);224 p oly.append_vertex(vert2);225 p oly.append_vertex(vert3);226 p oly.append_vertex(vert4);223 ConvexPolygon* p = &static_poly; 224 p->vertices.clear(); 225 226 p->append_vertex(vert1); 227 p->append_vertex(vert2); 228 p->append_vertex(vert3); 229 p->append_vertex(vert4); 227 230 228 231 for(int k=0; k<6; k++){ 229 p oly.clip(volume_planes[k], true);232 p->clip(volume_planes[k], true); 230 233 } 231 234 232 //poly->transform(model_view_inverse); 233 //poly->translate(shift_4d); 234 //poly->transform(model_view); 235 poly.transform(model_view_no_trans_inverse); 236 poly.transform(model_view_trans); 235 p->transform(model_view_no_trans_inverse); 236 p->transform(model_view_trans); 237 237 238 238 glPushMatrix(); 239 239 glScalef(volume[volume_index]->aspect_ratio_width, volume[volume_index]->aspect_ratio_height, volume[volume_index]->aspect_ratio_depth); 240 240 241 activate_one_volume_shader(volume_index, 0, 1);241 activate_one_volume_shader(volume_index, .0, 1.); 242 242 glPopMatrix(); 243 243 244 glEnable(GL_DEPTH_TEST); 245 glDisable(GL_BLEND); 246 244 247 glBegin(GL_POLYGON); 245 p oly.Emit(true);248 p->Emit(true); 246 249 glEnd(); 250 glDisable(GL_DEPTH_TEST); 247 251 248 252 deactivate_one_volume_shader(); 249 253 } //done cutplanes 250 254 #endif 251 255 252 256 //Now do volume rendering 257 258 vert1 = (Vector4(-10, -10, -0.5, 1)); 259 vert2 = (Vector4(-10, +10, -0.5, 1)); 260 vert3 = (Vector4(+10, +10, -0.5, 1)); 261 vert4 = (Vector4(+10, -10, -0.5, 1)); 253 262 254 263 int counter = 0; … … 286 295 } 287 296 } //iterate all volumes 288 297 fprintf(stderr, "total slices: %d\n", total_rendered_slices); 289 298 290 299 //We sort all the polygons according to their eye-space depth, from farthest to the closest. … … 335 344 deactivate_one_volume_shader(); 336 345 } 346 //fprintf(stderr, "\n\n"); 347 337 348 338 349 glDisable(GL_DEPTH_TEST); -
trunk/gui/vizservers/nanovis/VolumeRenderer.h
r415 r417 19 19 #include <GL/glew.h> 20 20 #include <Cg/cgGL.h> 21 #include <GL/glut.h> 21 22 #include <math.h> 22 23 #include <stdio.h> … … 43 44 vector <TransferFunction*> tf;//array of corresponding transfer functions 44 45 vector <int> slice; //array of corresponding number of slices 45 vector <bool> render_bit; //bits marking which volume(s) to render46 46 int n_volumes; 47 47 -
trunk/gui/vizservers/nanovis/nanovis.cpp
r416 r417 862 862 load_vector_file(0, "./data/J-wire-vec.dx"); 863 863 load_volume_file(1, "./data/mu-wire-3d.dx"); 864 load_volume_file(2, "./data/mu-wire-3d.dx");865 load_volume_file(3, "./data/mu-wire-3d.dx");864 //load_volume_file(2, "./data/mu-wire-3d.dx"); 865 //load_volume_file(3, "./data/mu-wire-3d.dx"); 866 866 867 867 init_tf(); //initialize transfer function … … 872 872 //create volume renderer and add volumes to it 873 873 vol_render = new VolumeRenderer(cam, volume[1], tf[0], g_context); 874 volume[2]->move(Vector3(0.42, 0.1, 0.1));875 vol_render->add_volume(volume[2], tf[0], 256);876 volume[3]->move(Vector3(0.2, -0.1, -0.1));877 vol_render->add_volume(volume[3], tf[0], 256);874 //volume[2]->move(Vector3(0.42, 0.1, 0.1)); 875 //vol_render->add_volume(volume[2], tf[0], 256); 876 //volume[3]->move(Vector3(0.2, -0.1, -0.1)); 877 //vol_render->add_volume(volume[3], tf[0], 256); 878 878 879 879 -
trunk/gui/vizservers/nanovis/shaders/one_volume.cg
r416 r417 64 64 OUT.Color = color; 65 65 //debug 66 //OUT.Color = float4(tex_coord , 1);66 //OUT.Color = float4(tex_coord.xyz, 1); 67 67 68 68 return OUT;
Note: See TracChangeset
for help on using the changeset viewer.