Changeset 20920
- Timestamp:
- 07/15/16 00:31:55 (9 years ago)
- Location:
- issm/trunk-jpl/src/m/plot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/plot_unit.js
r20823 r20920 236 236 } 237 237 indices.itemSize = 1; 238 238 239 239 //Initialize movie loop 240 240 node["movieInterval"] = 1000 / canvas.moviefps; … … 242 242 node["movieLength"] = timestamps.length; 243 243 node["movieFrame"] = 0; 244 244 245 245 if (canvas["movieHandler"]) clearInterval(canvas["movieHandler"]); 246 246 canvas["movieHandler"] = setInterval(function () { … … 261 261 canvas["progressBar"].slider('refresh'); 262 262 } 263 node["buffers"] = initBuffers(gl,[node["arrays"][0],node["arrays"][1][node["movieFrame"]],node["arrays"][2]]);263 node["buffers"] = node["buffersArray"][node["movieFrame"]]; 264 264 canvas["movieFrame"] = node["movieFrame"]; 265 265 }, node["movieInterval"]); … … 272 272 } 273 273 274 //Init alize buffers274 //Initialize buffers 275 275 node["arrays"] = [vertices, texcoords, indices]; 276 node["buffers"] = initBuffers(gl,[node["arrays"][0],node["arrays"][1][0],node["arrays"][2]]); 276 node["buffersArray"] = []; 277 for(var i = 0; i < timestamps.length; i++){ 278 node["buffersArray"][i] = initBuffers(gl,[node["arrays"][0],node["arrays"][1][i],node["arrays"][2]]); 279 } 280 node["buffers"] = node["buffersArray"][0]; 277 281 break; 278 282 //}}} -
issm/trunk-jpl/src/m/plot/plotdoc.js
r20829 r20920 30 30 console.log(' "colormap": same as standard matlab option (default "jet", ex: "hsv","cool","spring","gray","Ala","Rignot",...)'); 31 31 console.log(' "edgecolor": same as standard matlab option EdgeColor (default "black", ex: color name: "blue" or RGB array: [0.5, 0.2, 0.8])'); 32 console.log(' "viewPanning": enable view origin panning with two-finger touch or shift+mouse drag. (default "off", ex: "on", "off")'); 32 33 console.log(' "view": initial azimuth and elevation angles for camera (default [0,90], ex: [90, 180]'); 33 34 console.log(' "zoom": initial camera zoom as a percentage of default (default 1, ex: 1.5, 0.01)'); -
issm/trunk-jpl/src/m/plot/webgl.js
r20837 r20920 49 49 canvas.cameraMatrix = mat4.create(); 50 50 canvas.translation = options.getfieldvalue('origin',[0,0,0.0]); 51 canvas.viewPanning = options.getfieldvalue('viewpanning','off') == 'on'; 52 canvas.view = options.getfieldvalue('view',[0,90]); //0 azimuth - up is north, 90 elevation - looking straight down 53 canvas.rotation = canvas.view; 51 54 canvas.rotationAzimuthBounds = options.getfieldvalue('azlim',[0,360]); 52 55 canvas.rotationElevationBounds = options.getfieldvalue('ellim',[-180,180]); 53 canvas.view = options.getfieldvalue('view',[0,90]); //0 azimuth - up is north, 90 elevation - looking straight down 54 canvas.rotation = canvas.view; 55 canvas.controlsensitivity = options.getfieldvalue('controlsensitivity',1); 56 canvas.controlSensitivity = options.getfieldvalue('controlsensitivity',1); 56 57 canvas.twod = options.getfieldvalue('2d','off') == 'on'; 57 58 canvas.moviePlay = true; … … 59 60 canvas.movieIncrement = true; 60 61 canvas.moviefps = options.getfieldvalue('moviefps',5); 62 var backgroundcolor = new RGBColor(options.getfieldvalue('backgroundcolor','lightcyan')); 63 if (backgroundcolor.ok) canvas.backgroundcolor = [backgroundcolor.r/255.0, backgroundcolor.g/255.0, backgroundcolor.b/255.0, 1.0]; 64 else throw Error(sprintf("s%s%s\n","initWebGL error message: cound not find out background color for curent canvas ",canvas)); 61 65 62 66 // Add event listeners for canvas … … 330 334 } 331 335 if (ev.srcEvent.shiftKey || ev.pointers.length == 2) { 332 var deltaX = (canvas.lastDeltaX - ev.deltaX) / canvas.clientWidth / canvas.zoom * -2 * canvas.controlsensitivity; 333 var deltaY = (canvas.lastDeltaY - ev.deltaY) / canvas.clientHeight / canvas.zoom * -2 * canvas.controlsensitivity; 336 if (!canvas.viewPanning) return; 337 var deltaX = (canvas.lastDeltaX - ev.deltaX) / canvas.clientWidth / canvas.zoom * -2 * canvas.controlSensitivity; 338 var deltaY = (canvas.lastDeltaY - ev.deltaY) / canvas.clientHeight / canvas.zoom * -2 * canvas.controlSensitivity; 334 339 335 340 if (canvas.twod) { … … 343 348 } 344 349 else { 345 canvas.rotation[0] += degrees((canvas.lastDeltaX - ev.deltaX) / canvas.clientWidth / canvas.zoom * -2 * canvas.controlsensitivity);346 canvas.rotation[1] += degrees((canvas.lastDeltaY - ev.deltaY) / canvas.clientHeight / canvas.zoom * -2 * canvas.controlsensitivity);350 canvas.rotation[0] += degrees((canvas.lastDeltaX - ev.deltaX) / canvas.clientWidth * -2 * canvas.controlSensitivity); 351 canvas.rotation[1] += degrees((canvas.lastDeltaY - ev.deltaY) / canvas.clientHeight * -2 * canvas.controlSensitivity); 347 352 348 353 if (canvas.rotation[0] > 360) {canvas.rotation[0] -= 360}; … … 356 361 canvas.lastDeltaX = ev.deltaX; 357 362 canvas.lastDeltaY = ev.deltaY; 358 363 359 364 if (displaylog) console.log(canvas.rotation); 360 365 } //}}} … … 371 376 function onZoom(ev,canvas,displaylog) { //{{{ 372 377 ev.preventDefault(); 373 var delta = clamp(clamp(ev.scale || ev.wheelDelta || -ev.detail, -1, 1) * canvas.control sensitivity * canvas.zoom / 20, -1.0, 1.0);378 var delta = clamp(clamp(ev.scale || ev.wheelDelta || -ev.detail, -1, 1) * canvas.controlSensitivity * canvas.zoom / 20, -1.0, 1.0); 374 379 canvas.zoom = clamp(canvas.zoom + delta, canvas.zoomBounds[0], canvas.zoomBounds[1]); 375 380 … … 486 491 } 487 492 488 if (canvas.textcanvas) { 489 canvas.textcanvas.draw(canvas); 490 } 491 492 // Set clear color to black, fully opaque 493 if (canvas.textcanvas) canvas.textcanvas.draw(canvas); 494 493 495 var gl = canvas.gl; 494 var backgroundcolor = new RGBColor(options.getfieldvalue('backgroundcolor','lightcyan')); 495 if (backgroundcolor.ok) gl.clearColor(backgroundcolor.r/255.0, backgroundcolor.g/255.0, backgroundcolor.b/255.0, 1.0); 496 else throw Error(sprintf("s%s%s\n","initWebGL error message: cound not find out background color for curent canvas ",canvas)); 496 gl.clearColor(canvas.backgroundcolor[0], canvas.backgroundcolor[1], canvas.backgroundcolor[2], canvas.backgroundcolor[3]); 497 497 498 498 // Skip drawing of new frame if any texture is not yet loaded … … 512 512 for (var i = drawPassNumber - 1; i >= 0; i--) { 513 513 for (var node in nodes) { 514 if (nodes[node]["drawOrder"] == i) { 515 drawSceneGraphNode(canvas,nodes[node]); 516 } 514 if (nodes[node]["drawOrder"] == i) drawSceneGraphNode(canvas,nodes[node]); 517 515 } 518 516 }
Note:
See TracChangeset
for help on using the changeset viewer.