Changeset 19867
- Timestamp:
- 12/08/15 20:31:56 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/plot_overlay.js
r19864 r19867 17 17 18 18 //Process data and model 19 var x = md.mesh.x; 20 var y = md.mesh.y; 21 var z = [0.0]; 22 var elements = md.mesh.elements; 19 var meshresults = processmesh(md,data,options); 20 var x = meshresults[0]; 21 var y = meshresults[1]; 22 var z = meshresults[2]; 23 var elements = meshresults[3]; 24 var is2d = meshresults[4]; 25 var isplanet = meshresults[5]; 23 26 //}}} 24 27 25 28 //Compute coordinates and data range: 26 xlim=options.getfieldvalue('xlim',[ArrayMin(x),ArrayMax(x)]); 27 ylim=options.getfieldvalue('ylim',[ArrayMin(y),ArrayMax(y)]); 29 var modelxlim = [ArrayMin(x),ArrayMax(x)]; 30 var modelylim = [ArrayMin(y),ArrayMax(y)]; 31 var modelzlim = [ArrayMin(z),ArrayMax(z)]; 32 var xlim = options.getfieldvalue('xlim',modelxlim); 33 var ylim = options.getfieldvalue('ylim',modelylim); 34 var zlim = options.getfieldvalue('zlim',modelzlim); 28 35 xmin = xlim[0]; 29 36 xmax = xlim[1]; 30 37 ymin = ylim[0]; 31 38 ymax = ylim[1]; 32 zmin = ArrayMin(z);33 zmax = ArrayMax(z);39 zmin = zlim[0]; 40 zmax = zlim[1]; 34 41 35 42 //Compute scaling: … … 37 44 node["scale"] = [scale, scale, scale]; 38 45 node["rotation"] = options.getfieldvalue('view',[0,0,0]); 39 node["translation"] = [( xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmin + zmax) / (-2 / scale)];46 node["translation"] = [(modelxlim[0] + modelxlim[1]) / (-2 / scale), (modelylim[0] + modelylim[1]) / (-2 / scale), (modelzlim[0] + modelzlim[1]) / (-2 / scale)]; 40 47 node["modelMatrix"] = recalculateModelMatrix(node); 41 node["texture"] = initTexture(gl,options.getfieldvalue('image','images/ checker.gif'));48 node["texture"] = initTexture(gl,options.getfieldvalue('image','images/penguin.png')); 42 49 node["alpha"] = options.getfieldvalue('alpha',1.0); 43 50 node["overlay"] = true; … … 49 56 var xrange = xmax - xmin; 50 57 var yrange = ymax - ymin; 58 59 //redefine overlay as square plane 60 x = [xmin, xmax, xmin, xmax]; 61 y = [ymin, ymin, ymax, ymax]; 62 z = [zmin, zmin, zmin, zmin]; 63 elements = [[1,2,3],[2,4,3]]; 51 64 52 65 //generate mesh: … … 54 67 vertices[vertices.length] = x[i]; 55 68 vertices[vertices.length] = y[i]; 56 vertices[vertices.length] = 0.0;69 vertices[vertices.length] = z[i]; 57 70 58 71 texcoords[texcoords.length] = (x[i] - xmin) / xrange;
Note:
See TracChangeset
for help on using the changeset viewer.