Ignore:
Timestamp:
Dec 22, 2014, 7:18:59 AM (5 years ago)
Author:
ldelgass
Message:

Merge serveral changes from trunk. Does not include threading, world space
changes, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nanovis/branches/1.1/Volume.cpp

    r4889 r4904  
    3232
    3333Volume::Volume(float x, float y, float z,
    34                int w, int h, int d,
    35                int n, float *data,
    36                double v0, double v1, double nonZeroMin) :
     34               int width, int height, int depth,
     35               int numComponents, float *data,
     36               double vmin, double vmax, double nonZeroMin) :
    3737    _id(0),
    38     _width(w),
    39     _height(h),
    40     _depth(d),
     38    _width(width),
     39    _height(height),
     40    _depth(depth),
    4141    _transferFunc(NULL),
    4242    _ambient(0.6f),
     
    4747    _opacityScale(0.5f),
    4848    _data(NULL),
    49     _numComponents(n),
     49    _numComponents(numComponents),
    5050    _nonZeroMin(nonZeroMin),
    5151    _cutplanesVisible(true),
    5252    _tex(NULL),
    53     _location(x, y, z),
     53    _position(x, y, z),
     54    _scale(1, 1, 1),
    5455    _numSlices(512),
    5556    _enabled(true),
     
    6364    _outlineColor[0] = _outlineColor[1] = _outlineColor[2] = 1.0f;
    6465
    65     _tex = new Texture3D(_width, _height, _depth, GL_FLOAT, GL_LINEAR, n);
     66    _tex = new Texture3D(_width, _height, _depth, GL_FLOAT, GL_LINEAR, _numComponents);
    6667    int fcount = _width * _height * _depth * _numComponents;
    6768    _data = new float[fcount];
    6869    if (data != NULL) {
    69         TRACE("data is copied");
    7070        memcpy(_data, data, fcount * sizeof(float));
    71         _tex->initialize(_data);
    7271    } else {
    73         TRACE("data is null");
    74         memset(_data, 0, sizeof(_width * _height * _depth * _numComponents *
    75                                 sizeof(float)));
    76         _tex->initialize(_data);
     72        TRACE("data is NULL");
     73        memset(_data, 0, fcount * sizeof(float));
    7774    }
    78 
     75    _tex->initialize(_data);
    7976    _id = _tex->id();
    8077
    81     wAxis.setRange(v0, v1);
     78    wAxis.setRange(vmin, vmax);
    8279
    8380    //Add cut planes. We create 3 default cut planes facing x, y, z directions.
    8481    //The default location of cut plane is in the middle of the data.
    8582    _plane.clear();
    86     addCutplane(1, 0.5f);
    87     addCutplane(2, 0.5f);
    88     addCutplane(3, 0.5f);
     83    addCutplane(CutPlane::X_AXIS, 0.5f);
     84    addCutplane(CutPlane::Y_AXIS, 0.5f);
     85    addCutplane(CutPlane::Z_AXIS, 0.5f);
    8986
    9087    TRACE("Leave");
     
    104101
    105102    Matrix4x4d mat;
    106     mat.makeTranslation(_location);
     103    mat.makeTranslation(_position);
    107104    Matrix4x4d mat2;
    108105    mat2.makeScale(scale);
Note: See TracChangeset for help on using the changeset viewer.