Ignore:
Timestamp:
Aug 2, 2014 11:06:20 AM (10 years ago)
Author:
ldelgass
Message:

merge r3597 from trunk

Location:
nanovis/branches/1.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nanovis/branches/1.1

  • nanovis/branches/1.1/VolumeRenderer.cpp

    r3567 r4612  
    132132    TRACE("start loop %d", volumes.size());
    133133    for (size_t i = 0; i < volumes.size(); i++) {
    134         Volume *volPtr = volumes[i];
     134        Volume *volume = volumes[i];
    135135        polys[i] = NULL;
    136136        actual_slices[i] = 0;
    137137
    138         int n_slices = volPtr->numSlices();
    139         if (volPtr->isosurface()) {
     138        int n_slices = volume->numSlices();
     139        if (volume->isosurface()) {
    140140            // double the number of slices
    141141            n_slices <<= 1;
     
    143143
    144144        //volume start location
    145         Vector3f volPos = volPtr->location();
    146         Vector3f volScaling = volPtr->getPhysicalScaling();
     145        Vector3f volPos = volume->location();
     146        Vector3f volScaling = volume->getPhysicalScaling();
    147147
    148148        TRACE("VOL POS: %g %g %g",
     
    196196        //draw volume bounding box with translation (the correct location in
    197197        //space)
    198         if (volPtr->outline()) {
     198        if (volume->outline()) {
    199199            float olcolor[3];
    200             volPtr->getOutlineColor(olcolor);
     200            volume->getOutlineColor(olcolor);
    201201            drawBoundingBox(x0, y0, z0, x0+1, y0+1, z0+1,
    202202                (double)olcolor[0], (double)olcolor[1], (double)olcolor[2],
     
    222222        size_t n_actual_slices;
    223223
    224         if (volPtr->dataEnabled()) {
     224        if (volume->dataEnabled()) {
    225225            if (z_step == 0.0f)
    226226                n_actual_slices = 1;
     
    244244        // vice versa.
    245245
    246         for (int j = 0; j < volPtr->getCutplaneCount(); j++) {
    247             if (!volPtr->isCutplaneEnabled(j)) {
     246        for (int j = 0; j < volume->getCutplaneCount(); j++) {
     247            if (!volume->isCutplaneEnabled(j)) {
    248248                continue;
    249249            }
    250             float offset = volPtr->getCutplane(j)->offset;
    251             int axis = volPtr->getCutplane(j)->orient;
     250            float offset = volume->getCutplane(j)->offset;
     251            int axis = volume->getCutplane(j)->orient;
    252252
    253253            switch (axis) {
     
    279279
    280280            _cutplaneShader->bind();
    281             _cutplaneShader->setFPTextureParameter("volume", volPtr->textureID());
    282             _cutplaneShader->setFPTextureParameter("tf", volPtr->transferFunction()->id());
     281            _cutplaneShader->setFPTextureParameter("volume", volume->textureID());
     282            _cutplaneShader->setFPTextureParameter("tf", volume->transferFunction()->id());
    283283
    284284            glPushMatrix();
     
    383383
    384384    for (size_t i = 0; i < total_rendered_slices; i++) {
    385         Volume *volPtr = NULL;
     385        Volume *volume = NULL;
    386386
    387387        int volume_index = slices[i].volumeId;
     
    390390        float z_step = z_steps[volume_index];
    391391
    392         volPtr = volumes[volume_index];
    393 
    394         Vector3f volScaling = volPtr->getPhysicalScaling();
     392        volume = volumes[volume_index];
     393
     394        Vector3f volScaling = volume->getPhysicalScaling();
    395395
    396396        glPushMatrix();
     
    398398
    399399        // FIXME: compute view-dependent volume sample distance
    400         double avgSampleDistance = 1.0 / pow(volPtr->width() * volScaling.x *
    401                                              volPtr->height() * volScaling.y *
    402                                              volPtr->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);
    403403        float sampleRatio = z_step / avgSampleDistance;
    404404
    405405#ifdef notdef
    406406        TRACE("shading slice: volume %s addr=%x slice=%d, volume=%d z_step=%g avgSD=%g",
    407               volPtr->name(), volPtr, slice_index, volume_index, z_step, avgSampleDistance);
     407              volume->name(), volume, slice_index, volume_index, z_step, avgSampleDistance);
    408408#endif
    409         activateVolumeShader(volPtr, false, sampleRatio);
     409        activateVolumeShader(volume, false, sampleRatio);
    410410        glPopMatrix();
    411411
     
    493493
    494494void
    495 VolumeRenderer::activateVolumeShader(Volume *volPtr, bool sliceMode,
     495VolumeRenderer::activateVolumeShader(Volume *volume, bool sliceMode,
    496496                                     float sampleRatio)
    497497{
    498498    //vertex shader
    499499    _stdVertexShader->bind();
    500     TransferFunction *tfPtr  = volPtr->transferFunction();
    501     if (volPtr->volumeType() == Volume::CUBIC) {
    502         _regularVolumeShader->bind(tfPtr->id(), volPtr, sliceMode, sampleRatio);
    503     } else if (volPtr->volumeType() == Volume::ZINCBLENDE) {
    504         _zincBlendeShader->bind(tfPtr->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);
    505505    }
    506506}
Note: See TracChangeset for help on using the changeset viewer.