Changeset 19929
- Timestamp:
- 01/06/16 12:37:02 (9 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/plot_manager.js
r19912 r19929 7 7 // See also: PLOTMODEL, PLOT_UNIT 8 8 9 10 9 //parse options and get a structure of options. 11 10 checkplotoptions(md,options); 12 13 11 //get data to be displayed 14 12 data=options.getfieldvalue('data'); 15 16 //standard plot: initialize open Gl for each canvas :13 14 //standard plot: initialize open Gl for each canvas, if needed: 17 15 var canvas = $('<div><canvas id="'+options.getfieldvalue('canvasid')+'" width="'+options.getfieldvalue('canvassize',480)+'" height="'+options.getfieldvalue('canvassize',480)+'"></canvas></div>)') 18 16 canvas.css({'height':String(options.getfieldvalue('canvassize',480)+'px')}); … … 21 19 } 22 20 canvas=document.getElementById(options.getfieldvalue('canvasid')); 23 24 // Initialize the GL context: 25 var gl=initWebGL(canvas,options); 26 if(!gl){ 27 throw Error("plotmodel error message: could not initialize open Gl!"); 28 } 29 30 //Initialize the buffer structure: 31 var nodes = {}; 32 nodes["main"] = Node(gl,options); 33 21 //Initialize the buffer structure when first data is drawn to mesh: 22 var requestDrawing = false; 23 var gl = canvas.gl; 24 if (!canvas.hasOwnProperty("nodes")) { 25 canvas.nodes = {}; 26 canvas.datalength = 0; 27 requestDrawing = true; 28 //Initialize the GL context: 29 gl = initWebGL(canvas,options); 30 if (!gl) { 31 throw Error("plotmodel error message: could not initialize open Gl!"); 32 } 33 canvas.gl = gl; 34 } 35 canvas.nodes["data"+String(++canvas.datalength)] = Node(gl,options); 36 34 37 //figure out if this is a special plot 35 38 if (typeof data === 'string'){ … … 189 192 //Figure out if this is a semi-transparent plot. 190 193 if (options.getfieldvalue('overlay','off')=='on'){ 191 nodes["overlay"] = Node(gl,options);192 plot_overlay(md,data,options,canvas,gl, nodes["overlay"]);194 canvas.nodes["overlay"] = Node(gl,options); 195 plot_overlay(md,data,options,canvas,gl,canvas.nodes["overlay"]); 193 196 } 194 197 … … 219 222 if (typeof data !== 'string'){ 220 223 //plot unit 221 plot_unit(md,data,options,canvas,gl,nodes["main"]); 222 } 223 224 //applyoptions(md,data2,options); 225 applyoptions(md,data,options,canvas,gl,nodes["main"]); 224 plot_unit(md,data,options,canvas,gl,canvas.nodes["data"+String(canvas.datalength)]); 225 } 226 227 applyoptions(md,data,options,canvas,gl,canvas.nodes["data"+String(canvas.datalength)]); 226 228 227 /*Draw into the canvas:*/ 228 draw(gl,options,canvas,nodes); 229 //Draw into the canvas if needed: 230 if (requestDrawing) draw(gl,options,canvas,canvas.nodes); 231 console.log(canvas.nodes); 229 232 } -
issm/trunk-jpl/src/m/plot/plot_overlay.js
r19927 r19929 52 52 node["modelMatrix"] = recalculateModelMatrix(node); 53 53 node["texture"] = initTexture(gl,options.getfieldvalue('image')); 54 node["alpha"] = options.getfieldvalue(' alpha',.5);54 node["alpha"] = options.getfieldvalue('outeralpha',.9); 55 55 node["overlay"] = false; 56 56 node["drawOrder"] = 1; -
issm/trunk-jpl/src/m/plot/plot_unit.js
r19927 r19929 58 58 node["translation"] = [(xmin + xmax) / (-2 / scale), (ymin + ymax) / (-2 / scale), (zmax) / (-1 / scale)]; 59 59 node["modelMatrix"] = recalculateModelMatrix(node); 60 node["alpha"] = options.getfieldvalue('alpha', 1.0);60 node["alpha"] = options.getfieldvalue('alpha',.6); 61 61 node["overlay"] = options.getfieldvalue('overlay','off') == 'on'; 62 62 node["drawOrder"] = 0; -
issm/trunk-jpl/src/m/plot/plotmodel.js
r19741 r19929 34 34 //go through subplots 35 35 if (numberofplots){ 36 36 //Clear all canvas nodes 37 for (var i=0;i<numberofplots;i++){ 38 var canvas=document.getElementById(options.list[i].getfieldvalue('canvasid')); 39 if (canvas && canvas.nodes) { 40 delete canvas.nodes; 41 } 42 } 37 43 //Go through all data plottable and close window if an error occurs 38 44 for (var i=0;i<numberofplots;i++){ 39 40 45 plot_manager(options.list[i].getfieldvalue('model',md),options.list[i],subplotwidth,nlines,ncols,i); 41 46 -
issm/trunk-jpl/src/m/plot/webgl.js
r19923 r19929 423 423 gl.uniform1i(node["shader"]["uColorSampler"], 0); 424 424 } 425 if (node["overlay"] == true) { 426 gl.blendFunc(gl.SRC_ALPHA, gl.ONE); 427 } 428 else { 429 gl.blendFunc (gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); 430 } 425 //if (node["overlay"] == true) { 426 // gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); 427 //} 428 //else { 429 // gl.blendFunc (gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); 430 //} 431 gl.blendFunc (gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); 431 432 if (node["useIndexBuffer"] == true) { 432 433 gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, node["buffers"][node["buffers"].length - 1]);
Note:
See TracChangeset
for help on using the changeset viewer.