Changeset 4612 for nanovis/branches/1.1/VolumeRenderer.cpp
- Timestamp:
- Aug 2, 2014 11:06:20 AM (10 years ago)
- Location:
- nanovis/branches/1.1
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
nanovis/branches/1.1
- Property svn:mergeinfo changed
/trunk/packages/vizservers/nanovis merged: 3597
- Property svn:mergeinfo changed
-
nanovis/branches/1.1/VolumeRenderer.cpp
r3567 r4612 132 132 TRACE("start loop %d", volumes.size()); 133 133 for (size_t i = 0; i < volumes.size(); i++) { 134 Volume *vol Ptr= volumes[i];134 Volume *volume = volumes[i]; 135 135 polys[i] = NULL; 136 136 actual_slices[i] = 0; 137 137 138 int n_slices = vol Ptr->numSlices();139 if (vol Ptr->isosurface()) {138 int n_slices = volume->numSlices(); 139 if (volume->isosurface()) { 140 140 // double the number of slices 141 141 n_slices <<= 1; … … 143 143 144 144 //volume start location 145 Vector3f volPos = vol Ptr->location();146 Vector3f volScaling = vol Ptr->getPhysicalScaling();145 Vector3f volPos = volume->location(); 146 Vector3f volScaling = volume->getPhysicalScaling(); 147 147 148 148 TRACE("VOL POS: %g %g %g", … … 196 196 //draw volume bounding box with translation (the correct location in 197 197 //space) 198 if (vol Ptr->outline()) {198 if (volume->outline()) { 199 199 float olcolor[3]; 200 vol Ptr->getOutlineColor(olcolor);200 volume->getOutlineColor(olcolor); 201 201 drawBoundingBox(x0, y0, z0, x0+1, y0+1, z0+1, 202 202 (double)olcolor[0], (double)olcolor[1], (double)olcolor[2], … … 222 222 size_t n_actual_slices; 223 223 224 if (vol Ptr->dataEnabled()) {224 if (volume->dataEnabled()) { 225 225 if (z_step == 0.0f) 226 226 n_actual_slices = 1; … … 244 244 // vice versa. 245 245 246 for (int j = 0; j < vol Ptr->getCutplaneCount(); j++) {247 if (!vol Ptr->isCutplaneEnabled(j)) {246 for (int j = 0; j < volume->getCutplaneCount(); j++) { 247 if (!volume->isCutplaneEnabled(j)) { 248 248 continue; 249 249 } 250 float offset = vol Ptr->getCutplane(j)->offset;251 int axis = vol Ptr->getCutplane(j)->orient;250 float offset = volume->getCutplane(j)->offset; 251 int axis = volume->getCutplane(j)->orient; 252 252 253 253 switch (axis) { … … 279 279 280 280 _cutplaneShader->bind(); 281 _cutplaneShader->setFPTextureParameter("volume", vol Ptr->textureID());282 _cutplaneShader->setFPTextureParameter("tf", vol Ptr->transferFunction()->id());281 _cutplaneShader->setFPTextureParameter("volume", volume->textureID()); 282 _cutplaneShader->setFPTextureParameter("tf", volume->transferFunction()->id()); 283 283 284 284 glPushMatrix(); … … 383 383 384 384 for (size_t i = 0; i < total_rendered_slices; i++) { 385 Volume *vol Ptr= NULL;385 Volume *volume = NULL; 386 386 387 387 int volume_index = slices[i].volumeId; … … 390 390 float z_step = z_steps[volume_index]; 391 391 392 vol Ptr= volumes[volume_index];393 394 Vector3f volScaling = vol Ptr->getPhysicalScaling();392 volume = volumes[volume_index]; 393 394 Vector3f volScaling = volume->getPhysicalScaling(); 395 395 396 396 glPushMatrix(); … … 398 398 399 399 // FIXME: compute view-dependent volume sample distance 400 double avgSampleDistance = 1.0 / pow(vol Ptr->width() * volScaling.x *401 vol Ptr->height() * volScaling.y *402 vol Ptr->depth() * volScaling.z, 1.0/3.0);400 double avgSampleDistance = 1.0 / pow(volume->width() * volScaling.x * 401 volume->height() * volScaling.y * 402 volume->depth() * volScaling.z, 1.0/3.0); 403 403 float sampleRatio = z_step / avgSampleDistance; 404 404 405 405 #ifdef notdef 406 406 TRACE("shading slice: volume %s addr=%x slice=%d, volume=%d z_step=%g avgSD=%g", 407 vol Ptr->name(), volPtr, slice_index, volume_index, z_step, avgSampleDistance);407 volume->name(), volume, slice_index, volume_index, z_step, avgSampleDistance); 408 408 #endif 409 activateVolumeShader(vol Ptr, false, sampleRatio);409 activateVolumeShader(volume, false, sampleRatio); 410 410 glPopMatrix(); 411 411 … … 493 493 494 494 void 495 VolumeRenderer::activateVolumeShader(Volume *vol Ptr, bool sliceMode,495 VolumeRenderer::activateVolumeShader(Volume *volume, bool sliceMode, 496 496 float sampleRatio) 497 497 { 498 498 //vertex shader 499 499 _stdVertexShader->bind(); 500 TransferFunction *t fPtr = volPtr->transferFunction();501 if (vol Ptr->volumeType() == Volume::CUBIC) {502 _regularVolumeShader->bind(t fPtr->id(), volPtr, sliceMode, sampleRatio);503 } else if (vol Ptr->volumeType() == Volume::ZINCBLENDE) {504 _zincBlendeShader->bind(t fPtr->id(), volPtr, sliceMode, sampleRatio);500 TransferFunction *transferFunc = volume->transferFunction(); 501 if (volume->volumeType() == Volume::CUBIC) { 502 _regularVolumeShader->bind(transferFunc->id(), volume, sliceMode, sampleRatio); 503 } else if (volume->volumeType() == Volume::ZINCBLENDE) { 504 _zincBlendeShader->bind(transferFunc->id(), volume, sliceMode, sampleRatio); 505 505 } 506 506 }
Note: See TracChangeset
for help on using the changeset viewer.