Changeset 36


Ignore:
Timestamp:
Dec 2, 2004, 9:57:54 AM (20 years ago)
Author:
darran
Message:
  • uniform scaling
  • spotlight removed
  • start-up on frame 1 bug fixed
Location:
Swollen
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • Swollen/doc/contract2_priorities.txt

    r35 r36  
    2525COMPLETED:
    2626
    27 
    28 
     27- Ability to remove light source (it's in the way sometimes) [2]
    2928
    3029
     
    3433- Optional colour coding of water surface based on arbitrary fields
    3534  (e.g. stage, speed, ..) [4]
    36 - Ability to remove light source (it's in the way sometimes) [2] 
    3735- Output coordinates defining camera position [?]
    38 - Interactive positioning of light(s) [1]
     36- Interactive positioning of light(s) [?]
    3937
    4038
     
    4442- cairns dataset reveals popping triangles (zbuffer?)
    4543- steepcull dataset reveals steep angle cull problem
    46 - nonuniform scaling into unit cube should be uniform
    47 - dragging sww onto swollen (all in one directory) does not produce the same results as calling from command line (All jpg's gone and no reflection)
     44- dragging sww onto swollen (all in one directory) does not produce the same results as calling from command line
    4845- Problems with Duncan's, Chris' and Stephen Roberts' machines at GA: Swollen won't render semi transparency. Swwiewer works fine.
    49 - Swollen starts up showing first time step, not zeroth (even though clock shows zero). Stepping one forward and one back, bring things into sync.
     46
    5047
    5148
     
    5350BUGS FIXED:
    5451
     52- Swollen starts up showing first time step, not zeroth (even though clock shows zero). Stepping one
     53  forward and one back, bring things into sync. [2004-12-01]
     54- nonuniform scaling into unit cube should be uniform [2004-12-01]
    5555- onscreen text no longer obscured by zoomed model
    5656- removed lighting from onscreen text, now constant colour
     
    6969- z-scaling to emphasize vertical details [1]
    7070- Optional height-dependent semi-transparent water surface [0]
    71 - Possibility of replacing graphics for bed-texture [2]
    7271       
    7372
     
    107106- Revisit use of culling steep epsilon [3]     
    108107- SWW netcdf meta information [0]
     108
     109
  • Swollen/include/swwreader.h

    r13 r36  
    133133    float _xscale, _yscale, _zscale;
    134134    float _xoffset, _yoffset, _zoffset;
     135    float _xcenter, _ycenter, _zcenter;
    135136
    136137    // stack of return values from netcdf function calls
  • Swollen/swollen/main.cpp

    r15 r36  
    114114
    115115
    116     // center model in x and y (now done in swwreader)
    117     /*
    118     osg::BoundingBox bbox = bedslope->getBound();
    119     float scale = 1.0/bbox.radius();
    120     model->setPosition( -bbox.center()*scale );
    121     */
    122 
    123116    // FIXME: should be reasonable default and adjustable
    124     model->setScale( osg::Vec3(1.0, 1.0, 0.2) );
     117    model->setScale( osg::Vec3(1.0, 1.0, 1.0) );
    125118
    126119    // sky
  • Swollen/swollen/spotlight.cpp

    r33 r36  
    4141    _shape->setCenter( osg::Vec3(0,0,0) );
    4242    _marker->addDrawable( new osg::ShapeDrawable(_shape) );
    43     _group->addChild(_marker);
     43
     44    // omit marker cone for now (FIX ME)
     45    // _group->addChild(_marker);
    4446
    4547    setPosition( osg::Vec3(0,0,1) );  // default overhead
  • Swollen/swollen/watersurface.cpp

    r13 r36  
    4444
    4545    // initial geometry
    46     setTimeStep(1);
     46    setTimeStep(0);
    4747
    4848    _material->setDiffuse(osg::Material::FRONT, osg::Vec4(DEF_WATER_COLOUR));
  • Swollen/swwreader/swwreader.cpp

    r33 r36  
    102102    float ymin, ymax, yrange;
    103103    float zmin, zmax, zrange;
    104     xmin = _px[0];
    105     xmax = _px[0];
    106     ymin = _py[0];
    107     ymax = _py[0];
    108     zmin = _pz[0];
    109     zmax = _pz[0];
     104    float aspect_ratio;
     105    xmin = _px[0]; xmax = _px[0];
     106    ymin = _py[0]; ymax = _py[0];
     107    zmin = _pz[0]; zmax = _pz[0];
    110108    for( iv=1; iv < _npoints; iv++ )
    111109    {
     
    117115      if( _pz[iv] > zmax ) zmax = _pz[iv];
    118116    }
    119     _xscale = 1.0/(xmax - xmin);  _xoffset = xmin;
    120     _yscale = 1.0/(ymax - ymin);  _yoffset = ymin;
    121     _zscale = (zmax==zmin) ? 1.0 : 1.0/(zmax - zmin);  _zoffset = zmin;
    122 
    123 #ifdef DEBUG
    124     std::cout << "xmin: " << xmin << std::endl;
    125     std::cout << "xmax: " << xmax << std::endl;
    126     std::cout << "ymin: " << ymin << std::endl;
    127     std::cout << "ymax: " << ymax << std::endl;
    128     std::cout << "zmin: " << zmin << std::endl;
    129     std::cout << "zmax: " << zmax << std::endl;
    130     std::cout << "xscale: " << _xscale << std::endl;
    131     std::cout << "yscale: " << _yscale << std::endl;
    132     std::cout << "zscale: " << _zscale << std::endl;
    133 #endif
     117
     118    xrange = xmax - xmin;
     119    yrange = ymax - ymin;
     120    aspect_ratio = xrange/yrange;
     121    if( aspect_ratio > 1.0 )
     122      {
     123        _xscale = 1.0 / xrange;
     124        _xoffset = xmin;
     125        _xcenter = 0.5;
     126
     127        _yscale = _xscale;
     128        _yoffset = ymin;
     129        _ycenter = 0.5 / aspect_ratio;
     130
     131        _zscale = _xscale;
     132        _zoffset = zmin;
     133        _zcenter = 0.0;
     134      }
     135    else
     136      {
     137        _yscale = 1.0 / yrange;
     138        _yoffset = ymin;
     139        _ycenter = 0.5;
     140
     141        _xscale = _yscale;
     142        _xoffset = xmin;
     143        _xcenter = 0.5 / aspect_ratio;
     144
     145        _zscale = _yscale;
     146        _zoffset = zmin;
     147        _zcenter = 0.0;
     148      }
     149
     150    osg::notify(osg::INFO) << "[SWWReader] xmin: " << xmin <<  std::endl;
     151    osg::notify(osg::INFO) << "[SWWReader] xmax: " << xmax <<  std::endl;
     152    osg::notify(osg::INFO) << "[SWWReader] xscale: " << _xscale <<  std::endl;
     153    osg::notify(osg::INFO) << "[SWWReader] ymin: " << ymin <<  std::endl;
     154    osg::notify(osg::INFO) << "[SWWReader] ymax: " << ymax <<  std::endl;
     155    osg::notify(osg::INFO) << "[SWWReader] yscale: " << _yscale <<  std::endl;
     156    osg::notify(osg::INFO) << "[SWWReader] zmin: " << zmin <<  std::endl;
     157    osg::notify(osg::INFO) << "[SWWReader] zmax: " << zmax <<  std::endl;
     158    osg::notify(osg::INFO) << "[SWWReader] zscale: " << _zscale <<  std::endl;
     159
    134160
    135161    // culling defaults
     
    155181    _bedslopevertices = new osg::Vec3Array;
    156182    for (iv=0; iv < _npoints; iv++)
    157       _bedslopevertices->push_back( osg::Vec3( (_px[iv]-_xoffset)*_xscale - 0.5,
    158                                                (_py[iv]-_yoffset)*_yscale - 0.5,
    159                                                (_pz[iv]-_zoffset)*_zscale - 0.5) );
     183      _bedslopevertices->push_back( osg::Vec3( (_px[iv]-_xoffset)*_xscale - _xcenter,
     184                                               (_py[iv]-_yoffset)*_yscale - _ycenter,
     185                                               (_pz[iv]-_zoffset)*_zscale - _zcenter) );
    160186
    161187    // load bedslope index array, pvolumes array indexes into x, y and z
     
    218244    for (iv=0; iv < _npoints; iv++)
    219245        _stagevertices->push_back( osg::Vec3(
    220                                              (_px[iv]-_xoffset)*_xscale - 0.5,
    221                                              (_py[iv]-_yoffset)*_yscale - 0.5,
    222                                              (_pstage[iv]-_zoffset)*_zscale - 0.5) );
     246                                             (_px[iv]-_xoffset)*_xscale - _xcenter,
     247                                             (_py[iv]-_yoffset)*_yscale - _ycenter,
     248                                             (_pstage[iv]-_zoffset)*_zscale - _zcenter) );
    223249
    224250    // stage index and per primitive normal and centroid arrays
Note: See TracChangeset for help on using the changeset viewer.