Ignore:
Timestamp:
May 31, 2006 8:12:41 PM (18 years ago)
Author:
mmc
Message:

Fixed a problem with two volumes of same size and shape, as we have
in the Quantum Dot Lab (wavefunction and geometry). One volume was
obscuring the other, since their slices sat at exactly the same point.

Dialed up the ambient lighting, so features would be visible even when
in shadow.

Fixed the gradient calculation to be symmetric, so features don't
get distorted in a particular direction.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/vizservers/nanovis/VolumeRenderer.cpp

    r449 r451  
    6464
    6565  return ret;
     66}
     67
     68void
     69VolumeRenderer::shade_volume(Volume* _vol, TransferFunction* _tf)
     70{
     71  for (int i=0; i < volume.size(); i++) {
     72    if (volume[i] == _vol) {
     73      tf[i] = _tf;
     74    }
     75  }
    6676}
    6777
     
    851861
    852862  //x
    853   glPushMatrix();
    854     glTranslatef(0., -0.2, 1.);
    855     glColor3f(1.f, 1.0f, 1.0f);
    856 
     863  char* xlabel = (char*)vol->label[0].c_str();
     864  if (*xlabel != '\0') {
    857865    glPushMatrix();
    858       glScalef(1./volume[volume_index]->aspect_ratio_width,
    859           1./volume[volume_index]->aspect_ratio_height,
    860           1./volume[volume_index]->aspect_ratio_depth);
    861       glPrint((char*)vol->label[0].c_str(), 0);
     866      glTranslatef(0., -0.2, 1.);
     867      glColor3f(1.f, 1.0f, 1.0f);
     868
     869      glPushMatrix();
     870        glScalef(1./volume[volume_index]->aspect_ratio_width,
     871            1./volume[volume_index]->aspect_ratio_height,
     872            1./volume[volume_index]->aspect_ratio_depth);
     873        glPrint(xlabel, 0);
     874      glPopMatrix();
    862875    glPopMatrix();
    863   glPopMatrix();
     876  }
    864877
    865878  //y
    866   glPushMatrix();
    867     glTranslatef(1., 0.5, 0.);
    868 
     879  char* ylabel = (char*)vol->label[1].c_str();
     880  if (*ylabel != '\0') {
    869881    glPushMatrix();
    870       glScalef(1./volume[volume_index]->aspect_ratio_width,
    871           1./volume[volume_index]->aspect_ratio_height,
    872           1./volume[volume_index]->aspect_ratio_depth);
    873       glRotatef(45., 0., 1., 0.);
    874       glColor3f(1.f, 1.0f, 1.0f);
    875       glPrint((char*)vol->label[1].c_str(), 0);
     882      glTranslatef(1., 0.5, 0.);
     883
     884      glPushMatrix();
     885        glScalef(1./volume[volume_index]->aspect_ratio_width,
     886            1./volume[volume_index]->aspect_ratio_height,
     887            1./volume[volume_index]->aspect_ratio_depth);
     888        glRotatef(45., 0., 1., 0.);
     889        glColor3f(1.f, 1.0f, 1.0f);
     890        glPrint((char*)vol->label[1].c_str(), 0);
     891      glPopMatrix();
    876892    glPopMatrix();
    877   glPopMatrix();
     893  }
    878894
    879895  //z
    880   glPushMatrix();
    881     glTranslatef(1., -0.2, 1.);
    882 
     896  char* zlabel = (char*)vol->label[2].c_str();
     897  if (*zlabel != '\0') {
    883898    glPushMatrix();
    884       glScalef(1./volume[volume_index]->aspect_ratio_width,
    885           1./volume[volume_index]->aspect_ratio_height,
    886           1./volume[volume_index]->aspect_ratio_depth);
    887       glRotatef(90., 0., 1., 0.);
    888       glColor3f(1.f, 1.0f, 1.0f);
    889       glPrint((char*)vol->label[2].c_str(), 0);
     899      glTranslatef(1., -0.2, 1.);
     900
     901      glPushMatrix();
     902        glScalef(1./volume[volume_index]->aspect_ratio_width,
     903            1./volume[volume_index]->aspect_ratio_height,
     904            1./volume[volume_index]->aspect_ratio_depth);
     905        glRotatef(90., 0., 1., 0.);
     906        glColor3f(1.f, 1.0f, 1.0f);
     907        glPrint((char*)vol->label[2].c_str(), 0);
     908      glPopMatrix();
    890909    glPopMatrix();
    891   glPopMatrix();
     910  }
    892911
    893912  glDisable(GL_TEXTURE_2D);
Note: See TracChangeset for help on using the changeset viewer.