Ignore:
Timestamp:
Apr 16, 2013 12:52:20 AM (11 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/Grid.cpp

    r3627 r3630  
    3838}
    3939
     40void Grid::getBounds(vrmath::Vector3f& bboxMin, vrmath::Vector3f& bboxMax) const
     41{
     42    bboxMin.set(xAxis.min(), yAxis.min(), zAxis.min());
     43    bboxMax.set(xAxis.min() + xAxis.range(),
     44                yAxis.min() + yAxis.range(),
     45                zAxis.min() + zAxis.range());
     46}
     47
    4048void Grid::render()
    4149{
     
    5563    glPushMatrix();
    5664
    57     double xDataRange = xAxis.dataMax() - xAxis.dataMin();
    58     double yDataRange = yAxis.dataMax() - yAxis.dataMin();
    59     double zDataRange = zAxis.dataMax() - zAxis.dataMin();
    60 
    61     double paspectX = 1.0f;
    62     double paspectY = yDataRange / xDataRange;
    63     double paspectZ = zDataRange / xDataRange;
    64  
    65     double xscale = xAxis.range() / xDataRange;
    66     double yscale = yAxis.range() / xDataRange;
    67     double zscale = zAxis.range() / xDataRange;
    68 
    69     double xoffset = (xAxis.min() - xAxis.dataMin()) * xAxis.scale();
    70     double yoffset = (yAxis.min() - yAxis.dataMin()) * yAxis.scale();
    71     double zoffset = (zAxis.min() - zAxis.dataMin()) * zAxis.scale();
    72 
    73     TRACE("Axis ranges: %g %g %g", xAxis.range(), yAxis.range(), zAxis.range());
    74     TRACE("Axis scales: %g %g %g", xAxis.scale(), yAxis.scale(), zAxis.scale());
    75     TRACE("Axis min/max: %g,%g %g,%g %g,%g",
    76           xAxis.min(), xAxis.max(),
    77           yAxis.min(), yAxis.max(),
    78           zAxis.min(), zAxis.max());
    79     TRACE("Axis vmin/vmax: %g,%g %g,%g %g,%g",
    80           xAxis.dataMin(), xAxis.dataMax(),
    81           yAxis.dataMin(), yAxis.dataMax(),
    82           zAxis.dataMin(), zAxis.dataMax());
    83     TRACE("paspect: %g %g %g", paspectX, paspectY, paspectZ);
    84     TRACE("scale: %g %g %g", xscale, yscale, zscale);
    85 
    86     glTranslatef(-0.5f * paspectX, -0.5f * paspectY, -0.5f * paspectZ);
    87     glScalef(xscale, yscale, zscale);
    88     glTranslatef(xoffset, yoffset, zoffset);
     65    glTranslatef(xAxis.min(), yAxis.min(), zAxis.min());
     66    glScalef(xAxis.range(), yAxis.range(), zAxis.range());
    8967
    9068    glLineWidth(2.0f);
Note: See TracChangeset for help on using the changeset viewer.