Ignore:
Timestamp:
Apr 16, 2013, 3:52:20 AM (7 years ago)
Author:
ldelgass
Message:

Nanovis refactoring to fix problems with scaling and multiple results.
Do rendering in world space to properly place and scale multiple data sets.
Also fix flows to reduce resets of animations. More work toward removing
Cg dependency. Fix panning to convert viewport coords to world coords.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/FlowParticles.cpp

    r3627 r3630  
    2828    _sv.position.value = 0.0f;
    2929    _sv.position.flags = RELPOS;
    30     _sv.position.axis = 0; // X_AXIS
     30    _sv.position.axis = AXIS_Z;
    3131    _sv.color.r = _sv.color.g = _sv.color.b = _sv.color.a = 1.0f;
    3232    _sv.isHidden = false;
     
    4444}
    4545
     46float
     47FlowParticles::getRelativePosition(FlowPosition *position)
     48{
     49    if (position->flags == RELPOS) {
     50        return position->value;
     51    }
     52    switch (position->axis) {
     53    case AXIS_X: 
     54        return (position->value - _volume->xAxis.min()) /
     55            (_volume->xAxis.max() - _volume->xAxis.min());
     56    case AXIS_Y: 
     57        return (position->value - _volume->yAxis.min()) /
     58            (_volume->yAxis.max() - _volume->yAxis.min());
     59    case AXIS_Z: 
     60        return (position->value - _volume->zAxis.min()) /
     61            (_volume->zAxis.max() - _volume->zAxis.min());
     62    }
     63    return 0.0;
     64}
     65
    4666void
    4767FlowParticles::render()
     
    4969    TRACE("Particles '%s' axis: %d pos: %g rel pos: %g",
    5070          _name.c_str(), _sv.position.axis, _sv.position.value,
    51           Flow::getRelativePosition(&_sv.position));
     71          getRelativePosition(&_sv.position));
    5272
    53     _renderer->setPos(Flow::getRelativePosition(&_sv.position));
     73    _renderer->setPos(getRelativePosition(&_sv.position));
    5474    _renderer->setAxis(_sv.position.axis);
    5575    assert(_renderer->active());
     
    5777}
    5878
    59 void
     79bool
    6080FlowParticles::configure()
    6181{
    62     _renderer->setPos(Flow::getRelativePosition(&_sv.position));
     82    bool needReset = false;
     83
    6384    _renderer->setColor(Color4f(_sv.color.r,
    6485                                _sv.color.g,
     
    6687                                _sv.color.a));
    6788    _renderer->particleSize(_sv.particleSize);
    68     _renderer->setAxis(_sv.position.axis);
     89    if (_renderer->getAxis() != _sv.position.axis) {
     90        needReset = true;
     91        _renderer->setAxis(_sv.position.axis);
     92    }
     93    float pos = getRelativePosition(&_sv.position);
     94    if (_renderer->getPos() != pos) {
     95        needReset = true;
     96        _renderer->setPos(pos);
     97    }
    6998    _renderer->active(!_sv.isHidden);
     99
     100    return needReset;
    70101}
Note: See TracChangeset for help on using the changeset viewer.