Changeset 19874


Ignore:
Timestamp:
12/10/15 21:23:40 (9 years ago)
Author:
dlcheng
Message:

CHG (javascript): Correcting xlim/ylim overlay offsets.

Location:
issm/trunk-jpl/src/m/plot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/plot_overlay.js

    r19873 r19874  
    4848        node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)];
    4949        node["modelMatrix"] = recalculateModelMatrix(node);
    50         node["texture"] = initTexture(gl,options.getfieldvalue('image','images/penguin.png'));
     50        node["texture"] = initTexture(gl,options.getfieldvalue('image','images/checker.gif'));
    5151        //node["alpha"] = options.getfieldvalue('alpha',1.0);
    5252        node["overlay"] = false;
     
    5757        vertices.itemSize = 3;
    5858       
    59         var xrange = xmax - xmin;
    60         var yrange = ymax - ymin;
     59        var xrange = modelxlim[1] - modelxlim[0];
     60        var yrange = modelylim[1] - modelylim[0];
    6161
    6262        //redefine overlay as square plane
    63         //x = [xmin, xmax, xmin, xmax];
    64         //y = [ymin, ymin, ymax, ymax];
    65         //z = [zmin, zmin, zmin, zmin];
     63        //x = [modelxlim[0], modelxlim[1], modelxlim[0], modelxlim[1]];
     64        //y = [modelylim[0], modelylim[0], modelylim[1], modelylim[1]];
     65        //z = [modelzlim[0], modelzlim[0], modelzlim[0], modelzlim[0]];
    6666        //elements = [[1,2,3],[2,4,3]];
    6767       
     
    7272                vertices[vertices.length] = z[i];
    7373
    74                 texcoords[texcoords.length] = (x[i] - xmin) / xrange;
    75                 texcoords[texcoords.length] = (y[i] - ymin) / yrange;
     74                texcoords[texcoords.length] = (x[i] - modelxlim[0]) / xrange;
     75                texcoords[texcoords.length] = (y[i] - modelylim[0]) / yrange;
    7676        }
    7777       
     
    8282       
    8383        /*Initalize buffers: */
    84         node["buffers"] = initBuffers(gl,[vertices, texcoords, indices]);
     84        node["arrays"] = [vertices, texcoords, indices];
     85        node["buffers"] = initBuffers(gl,node["arrays"]);
    8586}
  • issm/trunk-jpl/src/m/plot/plot_unit.js

    r19873 r19874  
    3333
    3434        //Compute coordinates and data range:
    35         var xlim = options.getfieldvalue('xlim',[ArrayMin(x),ArrayMax(x)]);
    36         var ylim = options.getfieldvalue('ylim',[ArrayMin(y),ArrayMax(y)]);
    37         var zlim = options.getfieldvalue('zlim',[ArrayMin(z),ArrayMax(z)]);
     35        var modelxlim = [ArrayMin(x),ArrayMax(x)];
     36        var modelylim = [ArrayMin(y),ArrayMax(y)];
     37        var modelzlim = [ArrayMin(z),ArrayMax(z)];
     38        var xlim = options.getfieldvalue('xlim',modelxlim);
     39        var ylim = options.getfieldvalue('ylim',modelylim);
     40        var zlim = options.getfieldvalue('zlim',modelzlim);
    3841        xmin = xlim[0];
    3942        xmax = xlim[1];
     
    146149       
    147150        /*Initalize buffers: */
    148         node["buffers"] = initBuffers(gl,[vertices, texcoords, indices]);
    149         node["overlay"] = false;
     151        node["arrays"] = [vertices, texcoords, indices];
     152        node["buffers"] = initBuffers(gl,node["arrays"]);
    150153}
Note: See TracChangeset for help on using the changeset viewer.