Changeset 20205


Ignore:
Timestamp:
02/17/16 15:11:07 (9 years ago)
Author:
dlcheng
Message:

CHG (javascript): Bug fixes for plot_mesh, fixing default plot centering, globe support for mesh3d plot surfaces.

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

Legend:

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

    r19935 r20205  
    9898                                break;
    9999                        case 'mesh':
    100                                 plot_mesh(md,options,canvas,gl,nodes["main"]);
     100                                plot_mesh(md,options,canvas,gl,canvas.nodes["data"+String(canvas.datalength)]);
    101101                                break;
    102102                        case 'none':
     
    227227       
    228228        //Draw into the canvas if needed:
    229         if (requestDrawing)     draw(gl,options,canvas,canvas.nodes);
     229        if (requestDrawing)     draw(gl,options,canvas);
    230230}
  • issm/trunk-jpl/src/m/plot/plot_mesh.js

    r19919 r20205  
    1616       
    1717        //Process data and model
    18         var x = md.mesh.x;
    19         var y = md.mesh.y;
    20         var z = [].fill(md.mesh.x.length);
    21         var elements = md.mesh.elements;
     18        var meshresults = processmesh(md,[],options);
     19        var x = meshresults[0];
     20        var y = meshresults[1];
     21        var z = meshresults[2];
     22        var elements = meshresults[3];
     23        var is2d = meshresults[4];
     24        var isplanet = meshresults[5];
     25        var is3d = md.mesh.classname() == 'mesh3dsurface'; //use meshresults once behvaior can be verified
    2226       
    23         if (md.geometry.surface) {
     27        if (!is3d && md.geometry.surface) {
    2428                z = md.geometry.surface;
    2529        }
  • issm/trunk-jpl/src/m/plot/plot_overlay.js

    r20197 r20205  
    2424        var is2d = meshresults[4];
    2525        var isplanet = meshresults[5];
    26         var is3d = (md.mesh.classname() == 'mesh3dsurface');    //use is2d/isplanet once verified to work with mesh3dsurface
     26        var is3d = (md.mesh.classname() == 'mesh3dsurface'); //use meshresults once behvaior can be verified
    2727       
    2828        if (!is3d && md.geometry.surface) {
     
    5050        node["shader"] = gl["shaders"][node["shaderName"]]["program"];
    5151        node["scale"] = [scale, scale, scale*options.getfieldvalue('heightscale',1)];
    52         node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (2 / scale)];
     52        node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)];
    5353        node["modelMatrix"] = recalculateModelMatrix(node);
    5454        node["texture"] = initTexture(gl,options.getfieldvalue('image'));
    55         node["alpha"] = options.getfieldvalue('outeralpha',.9);
     55        node["alpha"] = options.getfieldvalue('outeralpha',0.9);
    5656        node["overlay"] = false;
    5757        node["drawOrder"] = 1;
  • issm/trunk-jpl/src/m/plot/plot_unit.js

    r20197 r20205  
    2626        var is2d = meshresults[4];
    2727        var isplanet = meshresults[5];
    28         var is3d = (md.mesh.classname() == 'mesh3dsurface');    //use is2d/isplanet once verified to work with mesh3dsurface
     28        var is3d = md.mesh.classname() == 'mesh3dsurface'; //use meshresults once behvaior can be verified
    2929       
    3030        var     dataresults = processdata(md,data,options);
     
    6767        node["enabled"] = options.getfieldvalue('nodata','off') == 'off';
    6868       
    69         console.log(node["translation"]);
    70        
    7169        switch(datatype){
    7270                //element plot {{{
     
    9593                                vertices.itemSize = 3;
    9694                                texcoords.itemSize = 2;
    97                                 var height = vec3.create();
    98                                 var heightscale = options.getfieldvalue('heightscale',1);
     95                                //var height = vec3.create();
     96                                //var heightscale = options.getfieldvalue('heightscale',1);
    9997                                for(var i = 0; i < x.length; i++){
    100                                         vec3.normalize(height, vec3.fromValues(x[i], y[i], z[i])); //fix to use normalized earth radius instead of radius+ height
    101                                         vec3.scale(height, height, heightscale);
    102                                         vertices[vertices.length] = x[i] + height[0];
    103                                         vertices[vertices.length] = y[i] + height[1];
    104                                         vertices[vertices.length] = z[i] + height[2];
     98                                        //vec3.normalize(height, vec3.fromValues(x[i], y[i], z[i])); //fix to use normalized earth radius instead of radius+ height
     99                                        //vec3.scale(height, height, heightscale);
     100                                        vertices[vertices.length] = x[i];
     101                                        vertices[vertices.length] = y[i];
     102                                        vertices[vertices.length] = z[i];
    105103
    106104                                        texcoords[texcoords.length] = 0.5;
  • issm/trunk-jpl/src/m/plot/webgl.js

    r20025 r20205  
    3838        canvas.zoomLast = canvas.zoomFactor;
    3939        canvas.cameraMatrix = mat4.create();
    40         canvas.translation = options.getfieldvalue('centeroffset',[0,0,0.25]);
     40        canvas.translation = options.getfieldvalue('centeroffset',[0,0,0.0]);
    4141        canvas.rotationAzimuthBounds = options.getfieldvalue('azimuthbounds',[0,360]);
    4242        canvas.rotationElevationBounds = options.getfieldvalue('elevationbounds',[-180,180]);
     
    477477               
    478478        // Skip drawing of new frame if any texture is not yet loaded
     479        var nodes = canvas.nodes;
    479480        for (var node in nodes) {
    480481                if (nodes[node]["texture"] && !nodes[node]["texture"]["isLoaded"]) {
Note: See TracChangeset for help on using the changeset viewer.