Ignore:
Timestamp:
Sep 24, 2013, 4:41:59 PM (11 years ago)
Author:
gah
Message:

sync with trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/blt4/packages/vizservers/nanovis/nanovis.cpp

    r3892 r3958  
    504504    }
    505505#endif
    506     // FIXME: should use ARB programs or (preferably) a GLSL profile for portability
     506    // FIXME: should use GLSL for portability
     507#ifdef USE_ARB_PROGRAMS
     508    if (!GLEW_ARB_vertex_program ||
     509        !GLEW_ARB_fragment_program) {
     510        ERROR("ARB_vertex_program and ARB_fragment_program extensions are required");
     511        return false;
     512    }
     513#else
    507514    if (!GLEW_NV_vertex_program3 ||
    508515        !GLEW_NV_fragment_program2) {
     
    510517        return false;
    511518    }
     519#endif
    512520
    513521    if (!FilePath::getInstance()->setPath(path)) {
     
    611619}
    612620
     621/**
     622 * \brief Called when new volumes are added to update ranges
     623 */
    613624void
    614625NanoVis::setVolumeRanges()
     
    636647}
    637648
     649/**
     650 * \brief Called when new heightmaps are added to update ranges
     651 */
    638652void
    639653NanoVis::setHeightmapRanges()
     
    668682NanoVis::collectBounds(bool onlyVisible)
    669683{
    670     if (Flow::updatePending) {
    671         mapFlows();
    672     }
    673 
    674684    sceneBounds.makeEmpty();
    675685
     
    698708    }
    699709
    700     {
     710    for (FlowHashmap::iterator itr = flowTable.begin();
     711         itr != flowTable.end(); ++itr) {
     712        Flow *flow = itr->second;
     713
    701714        BBox bbox;
    702         getFlowBounds(bbox.min, bbox.max, onlyVisible);
     715        flow->getBounds(bbox.min, bbox.max, onlyVisible);
    703716        sceneBounds.extend(bbox);
    704717    }
     
    714727    }
    715728
     729#if 0
    716730    if (!onlyVisible || grid->isVisible()) {
    717731        BBox bbox;
     
    719733        sceneBounds.extend(bbox);
    720734    }
     735#endif
    721736
    722737    if (sceneBounds.isEmpty()) {
     
    802817}
    803818
     819/**
     820 * \brief Called when new flows are added to update ranges
     821 */
    804822bool
    805 NanoVis::mapFlows()
     823NanoVis::setFlowRanges()
    806824{
    807825    TRACE("Enter");
     
    817835         itr != flowTable.end(); ++itr) {
    818836        Flow *flow = itr->second;
    819         double min, max;
    820837        if (!flow->isDataLoaded()) {
    821838            continue;
    822839        }
    823         Rappture::Unirect3d *data = flow->data();
    824         min = data->magMin();
    825         max = data->magMax();
    826         if (min < Flow::magMin) {
    827             Flow::magMin = min;
     840        double range[2];
     841        flow->getVectorRange(range);
     842        if (range[0] < Flow::magMin) {
     843            Flow::magMin = range[0];
    828844        }
    829         if (max > Flow::magMax) {
    830             Flow::magMax = max;
     845        if (range[1] > Flow::magMax) {
     846            Flow::magMax = range[1];
    831847        }
    832848    }
     
    846862            flow->initializeParticles();
    847863        }
    848         if (!flow->scaleVectorField()) {
    849             return false;
    850         }
    851864    }
    852865
    853866    Flow::updatePending = false;
    854867    return true;
    855 }
    856 
    857 void
    858 NanoVis::getFlowBounds(Vector3f& min,
    859                        Vector3f& max,
    860                        bool onlyVisible)
    861 {
    862     TRACE("Enter");
    863 
    864     BBox allBounds;
    865     for (FlowHashmap::iterator itr = flowTable.begin();
    866          itr != flowTable.end(); ++itr) {
    867         BBox bbox;
    868         itr->second->getBounds(bbox.min, bbox.max, onlyVisible);
    869         allBounds.extend(bbox);
    870     }
    871 
    872     min = allBounds.min;
    873     max = allBounds.max;
    874868}
    875869
     
    918912
    919913    if (Flow::updatePending) {
    920         mapFlows();
     914        setFlowRanges();
    921915    }
    922916    if (HeightMap::updatePending) {
Note: See TracChangeset for help on using the changeset viewer.