lavavu 1.8.74__tar.gz → 1.8.76__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. {lavavu-1.8.74/lavavu.egg-info → lavavu-1.8.76}/PKG-INFO +1 -1
  2. {lavavu-1.8.74 → lavavu-1.8.76}/README.md +1 -1
  3. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/drawbox.js +9 -0
  4. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/emscripten-template.js +1 -1
  5. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/menu.js +1 -0
  6. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/webview.html +1 -1
  7. {lavavu-1.8.74 → lavavu-1.8.76/lavavu.egg-info}/PKG-INFO +1 -1
  8. {lavavu-1.8.74 → lavavu-1.8.76}/setup.py +1 -1
  9. {lavavu-1.8.74 → lavavu-1.8.76}/src/DrawingObject.h +3 -0
  10. {lavavu-1.8.74 → lavavu-1.8.76}/src/Geometry.cpp +70 -24
  11. {lavavu-1.8.74 → lavavu-1.8.76}/src/Geometry.h +3 -4
  12. {lavavu-1.8.74 → lavavu-1.8.76}/src/InteractiveViewer.cpp +2 -1
  13. {lavavu-1.8.74 → lavavu-1.8.76}/src/LavaVu.cpp +6 -6
  14. {lavavu-1.8.74 → lavavu-1.8.76}/src/LavaVu.h +3 -3
  15. {lavavu-1.8.74 → lavavu-1.8.76}/src/LavaVuPython_wrap.cxx +2015 -1180
  16. {lavavu-1.8.74 → lavavu-1.8.76}/src/VideoEncoder.cpp +5 -4
  17. {lavavu-1.8.74 → lavavu-1.8.76}/src/Volumes.cpp +0 -3
  18. lavavu-1.8.76/src/version.cpp +2 -0
  19. lavavu-1.8.74/src/version.cpp +0 -2
  20. {lavavu-1.8.74 → lavavu-1.8.76}/LICENSE.md +0 -0
  21. {lavavu-1.8.74 → lavavu-1.8.76}/MANIFEST.in +0 -0
  22. {lavavu-1.8.74 → lavavu-1.8.76}/Makefile +0 -0
  23. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/dict.json +0 -0
  24. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/font.bin +0 -0
  25. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/LavaVu-amalgamated.css +0 -0
  26. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/OK-min.js +0 -0
  27. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/baseviewer.js +0 -0
  28. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/control.css +0 -0
  29. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/control.js +0 -0
  30. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/dat-gui-light-theme.css +0 -0
  31. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/dat.gui.min.js +0 -0
  32. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/draw.js +0 -0
  33. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/emscripten.css +0 -0
  34. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/favicon.ico +0 -0
  35. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/gl-matrix-min.js +0 -0
  36. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/gui.css +0 -0
  37. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/server.js +0 -0
  38. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/stats.min.js +0 -0
  39. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/styles.css +0 -0
  40. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/html/webview-template.html +0 -0
  41. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/default.frag +0 -0
  42. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/default.vert +0 -0
  43. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/fontShader.frag +0 -0
  44. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/fontShader.vert +0 -0
  45. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/lineShader.frag +0 -0
  46. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/lineShader.vert +0 -0
  47. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/pointShader.frag +0 -0
  48. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/pointShader.vert +0 -0
  49. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/triShader.frag +0 -0
  50. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/triShader.vert +0 -0
  51. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/volumeShader.frag +0 -0
  52. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu/shaders/volumeShader.vert +0 -0
  53. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu.egg-info/SOURCES.txt +0 -0
  54. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu.egg-info/dependency_links.txt +0 -0
  55. {lavavu-1.8.74 → lavavu-1.8.76}/lavavu.egg-info/top_level.txt +0 -0
  56. {lavavu-1.8.74 → lavavu-1.8.76}/pyproject.toml +0 -0
  57. {lavavu-1.8.74 → lavavu-1.8.76}/requirements.txt +0 -0
  58. {lavavu-1.8.74 → lavavu-1.8.76}/setup.cfg +0 -0
  59. {lavavu-1.8.74 → lavavu-1.8.76}/src/ApplicationInterface.h +0 -0
  60. {lavavu-1.8.74 → lavavu-1.8.76}/src/ColourMap.cpp +0 -0
  61. {lavavu-1.8.74 → lavavu-1.8.76}/src/ColourMap.h +0 -0
  62. {lavavu-1.8.74 → lavavu-1.8.76}/src/Colours.cpp +0 -0
  63. {lavavu-1.8.74 → lavavu-1.8.76}/src/Colours.h +0 -0
  64. {lavavu-1.8.74 → lavavu-1.8.76}/src/Contour.cpp +0 -0
  65. {lavavu-1.8.74 → lavavu-1.8.76}/src/Contour.h +0 -0
  66. {lavavu-1.8.74 → lavavu-1.8.76}/src/DrawingObject.cpp +0 -0
  67. {lavavu-1.8.74 → lavavu-1.8.76}/src/Extensions.cpp +0 -0
  68. {lavavu-1.8.74 → lavavu-1.8.76}/src/Extensions.h +0 -0
  69. {lavavu-1.8.74 → lavavu-1.8.76}/src/FontLine.h +0 -0
  70. {lavavu-1.8.74 → lavavu-1.8.76}/src/FontSans.h +0 -0
  71. {lavavu-1.8.74 → lavavu-1.8.76}/src/GLUtils.cpp +0 -0
  72. {lavavu-1.8.74 → lavavu-1.8.76}/src/GLUtils.h +0 -0
  73. {lavavu-1.8.74 → lavavu-1.8.76}/src/GraphicsUtil.cpp +0 -0
  74. {lavavu-1.8.74 → lavavu-1.8.76}/src/GraphicsUtil.h +0 -0
  75. {lavavu-1.8.74 → lavavu-1.8.76}/src/Include.h +0 -0
  76. {lavavu-1.8.74 → lavavu-1.8.76}/src/InputInterface.h +0 -0
  77. {lavavu-1.8.74 → lavavu-1.8.76}/src/IsoSurface.cpp +0 -0
  78. {lavavu-1.8.74 → lavavu-1.8.76}/src/IsoSurface.h +0 -0
  79. {lavavu-1.8.74 → lavavu-1.8.76}/src/Lines.cpp +0 -0
  80. {lavavu-1.8.74 → lavavu-1.8.76}/src/LinesSorted.cpp +0 -0
  81. {lavavu-1.8.74 → lavavu-1.8.76}/src/Links.cpp +0 -0
  82. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/CGLViewer.cpp +0 -0
  83. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/CGLViewer.h +0 -0
  84. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/CocoaViewer.h +0 -0
  85. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/CocoaViewer.mm +0 -0
  86. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/EGLViewer.cpp +0 -0
  87. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/EGLViewer.h +0 -0
  88. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/GLFWViewer.cpp +0 -0
  89. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/GLFWViewer.h +0 -0
  90. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/OSMesaViewer.cpp +0 -0
  91. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/OSMesaViewer.h +0 -0
  92. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/X11Viewer.cpp +0 -0
  93. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/X11Viewer.h +0 -0
  94. {lavavu-1.8.74 → lavavu-1.8.76}/src/Main/main.cpp +0 -0
  95. {lavavu-1.8.74 → lavavu-1.8.76}/src/Model.cpp +0 -0
  96. {lavavu-1.8.74 → lavavu-1.8.76}/src/Model.h +0 -0
  97. {lavavu-1.8.74 → lavavu-1.8.76}/src/OpenGLViewer.cpp +0 -0
  98. {lavavu-1.8.74 → lavavu-1.8.76}/src/OpenGLViewer.h +0 -0
  99. {lavavu-1.8.74 → lavavu-1.8.76}/src/OutputInterface.h +0 -0
  100. {lavavu-1.8.74 → lavavu-1.8.76}/src/Points.cpp +0 -0
  101. {lavavu-1.8.74 → lavavu-1.8.76}/src/QuadSurfaces.cpp +0 -0
  102. {lavavu-1.8.74 → lavavu-1.8.76}/src/RenderContext.cpp +0 -0
  103. {lavavu-1.8.74 → lavavu-1.8.76}/src/RenderContext.h +0 -0
  104. {lavavu-1.8.74 → lavavu-1.8.76}/src/Session.cpp +0 -0
  105. {lavavu-1.8.74 → lavavu-1.8.76}/src/Session.h +0 -0
  106. {lavavu-1.8.74 → lavavu-1.8.76}/src/Shaders.cpp +0 -0
  107. {lavavu-1.8.74 → lavavu-1.8.76}/src/Shaders.h +0 -0
  108. {lavavu-1.8.74 → lavavu-1.8.76}/src/Shapes.cpp +0 -0
  109. {lavavu-1.8.74 → lavavu-1.8.76}/src/TimeStep.h +0 -0
  110. {lavavu-1.8.74 → lavavu-1.8.76}/src/Tracers.cpp +0 -0
  111. {lavavu-1.8.74 → lavavu-1.8.76}/src/TriSurfaces.cpp +0 -0
  112. {lavavu-1.8.74 → lavavu-1.8.76}/src/Triangles.cpp +0 -0
  113. {lavavu-1.8.74 → lavavu-1.8.76}/src/Util.cpp +0 -0
  114. {lavavu-1.8.74 → lavavu-1.8.76}/src/Util.h +0 -0
  115. {lavavu-1.8.74 → lavavu-1.8.76}/src/Vectors.cpp +0 -0
  116. {lavavu-1.8.74 → lavavu-1.8.76}/src/VideoEncoder.h +0 -0
  117. {lavavu-1.8.74 → lavavu-1.8.76}/src/View.cpp +0 -0
  118. {lavavu-1.8.74 → lavavu-1.8.76}/src/View.h +0 -0
  119. {lavavu-1.8.74 → lavavu-1.8.76}/src/ViewerApp.h +0 -0
  120. {lavavu-1.8.74 → lavavu-1.8.76}/src/ViewerTypes.h +0 -0
  121. {lavavu-1.8.74 → lavavu-1.8.76}/src/base64.cpp +0 -0
  122. {lavavu-1.8.74 → lavavu-1.8.76}/src/base64.h +0 -0
  123. {lavavu-1.8.74 → lavavu-1.8.76}/src/fifo_map.hpp +0 -0
  124. {lavavu-1.8.74 → lavavu-1.8.76}/src/jpeg/jpgd.cpp +0 -0
  125. {lavavu-1.8.74 → lavavu-1.8.76}/src/jpeg/jpgd.h +0 -0
  126. {lavavu-1.8.74 → lavavu-1.8.76}/src/jpeg/jpge.cpp +0 -0
  127. {lavavu-1.8.74 → lavavu-1.8.76}/src/jpeg/jpge.h +0 -0
  128. {lavavu-1.8.74 → lavavu-1.8.76}/src/json.hpp +0 -0
  129. {lavavu-1.8.74 → lavavu-1.8.76}/src/linalg.h +0 -0
  130. {lavavu-1.8.74 → lavavu-1.8.76}/src/miniz/miniz.c +0 -0
  131. {lavavu-1.8.74 → lavavu-1.8.76}/src/miniz/miniz.h +0 -0
  132. {lavavu-1.8.74 → lavavu-1.8.76}/src/png/lodepng.cpp +0 -0
  133. {lavavu-1.8.74 → lavavu-1.8.76}/src/png/lodepng.h +0 -0
  134. {lavavu-1.8.74 → lavavu-1.8.76}/src/sqlite3/sqlite3.c +0 -0
  135. {lavavu-1.8.74 → lavavu-1.8.76}/src/sqlite3/sqlite3.h +0 -0
  136. {lavavu-1.8.74 → lavavu-1.8.76}/src/stb_image_resize.h +0 -0
  137. {lavavu-1.8.74 → lavavu-1.8.76}/src/tiny_obj_loader.h +0 -0
  138. {lavavu-1.8.74 → lavavu-1.8.76}/src/version.h +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: lavavu
3
- Version: 1.8.74
3
+ Version: 1.8.76
4
4
  Summary: UNKNOWN
5
5
  Home-page: UNKNOWN
6
6
  Author: UNKNOWN
@@ -3,7 +3,7 @@
3
3
  [![Build Status](https://github.com/lavavu/LavaVu/workflows/Test/badge.svg)](https://github.com/lavavu/LavaVu/actions?query=workflow:Test)
4
4
  [![Deploy Status](https://github.com/lavavu/LavaVu/workflows/Deploy/badge.svg?branch=1.7.3)](https://github.com/lavavu/LavaVu/actions?query=workflow:Deploy)
5
5
  [![DOI](https://zenodo.org/badge/45163055.svg)](https://zenodo.org/badge/latestdoi/45163055)
6
- [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/lavavu/LavaVu/1.8.74)
6
+ [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/lavavu/LavaVu/1.8.76)
7
7
 
8
8
  A scientific visualisation tool with a python interface for fast and flexible visual analysis.
9
9
 
@@ -190,6 +190,14 @@ function canvasBoxMouseMove(event, mouse) {
190
190
 
191
191
  mouse.element.viewer.draw();
192
192
 
193
+ //Instant updates
194
+ if (mouse.element.viewer.alwaysdraw) {
195
+ if (mouse.element.viewer.rotating)
196
+ mouse.element.viewer.command('' + mouse.element.viewer.getRotationString());
197
+ else
198
+ mouse.element.viewer.command('' + mouse.element.viewer.getTranslationString());
199
+ }
200
+
193
201
  return false;
194
202
  }
195
203
 
@@ -422,6 +430,7 @@ function BoxViewer(canvas) {
422
430
 
423
431
  //Non-persistant settings
424
432
  this.mode = 'Rotate';
433
+ this.alwaysdraw = false;
425
434
  if (!this.gl) return;
426
435
 
427
436
  //Create the renderers
@@ -67,7 +67,7 @@ var Module = {
67
67
  },
68
68
  locateFile: function(path, prefix) {
69
69
  // Source from github by default
70
- if (path.endsWith("LavaVu.wasm") || path.endsWith("LavaVu.data")) return "https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@LAVAVU_VERSION/" + path;
70
+ //if (path.endsWith("LavaVu.wasm") || path.endsWith("LavaVu.data")) return "https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@LAVAVU_VERSION/" + path;
71
71
  // otherwise, use the default, the prefix (JS file's dir) + the path
72
72
  return prefix + path;
73
73
  },
@@ -320,6 +320,7 @@ function createMenu(viewer, onchange, webglmode, global) {
320
320
  gui.add({"Export GLDB" : function() {window.commands.push('export');}}, 'Export GLDB');
321
321
  } else if (viewer.canvas) {
322
322
  //Server render
323
+ gui.add(viewer, "alwaysdraw");
323
324
  var url = viewer.canvas.imgtarget.baseurl;
324
325
  if (url)
325
326
  gui.add({"Popup Viewer" : function() {window.open(url, "LavaVu", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1024,height=768");}}, 'Popup Viewer');
@@ -27,7 +27,7 @@
27
27
 
28
28
  <input id="fileinput" type="file" style="visibility:hidden" onchange="useFileInput(this)" />
29
29
 
30
- <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.8.74/LavaVu-amalgamated.min.js"></script>
30
+ <script async src="https://cdn.jsdelivr.net/gh/lavavu/lavavu.github.io@1.8.76/LavaVu-amalgamated.min.js"></script>
31
31
  <!--script src="dat.gui.min.js"></script>
32
32
  <script src="OK-min.js"></script>
33
33
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.0
2
2
  Name: lavavu
3
- Version: 1.8.74
3
+ Version: 1.8.76
4
4
  Summary: UNKNOWN
5
5
  Home-page: UNKNOWN
6
6
  Author: UNKNOWN
@@ -19,7 +19,7 @@ import shutil
19
19
 
20
20
  #Current version
21
21
  #(must be of the form X.Y.Z to trigger wheel builds)
22
- version = "1.8.74"
22
+ version = "1.8.76"
23
23
 
24
24
  """
25
25
  To release a new verison:
@@ -73,6 +73,9 @@ public:
73
73
  Properties properties;
74
74
  //Default texture
75
75
  Texture_Ptr texture;
76
+ //Additional textures (stored by label / uniform name)
77
+ std::map<std::string, Texture_Ptr> textures;
78
+ std::map<std::string, GLuint> texture_units;
76
79
 
77
80
  DrawingObject(Session& session, std::string name="", std::string props="", unsigned int id=0);
78
81
  ~DrawingObject();
@@ -1405,24 +1405,39 @@ void Geometry::setState(Geom_Ptr g)
1405
1405
  {
1406
1406
  std::string texfn = prop;
1407
1407
  //Support multiple textures, load subsequent from custom props
1408
- if (textures.find(texfn) == textures.end())
1408
+ if (draw->textures.find(label) == draw->textures.end() || draw->textures[label]->fn.full != texfn)
1409
1409
  {
1410
1410
  //Add a new empty texture container
1411
- textures[texfn] = std::make_shared<ImageLoader>();
1412
- textures[texfn]->fn = texfn;
1411
+ draw->textures[label] = std::make_shared<ImageLoader>();
1412
+ //Default to the object flip setting
1413
+ bool flip = draw->properties["fliptexture"];
1414
+ //Allow override by setting "flip" or "noflip" in uniform name
1415
+ if (label.find("flip") != std::string::npos)
1416
+ {
1417
+ flip = true;
1418
+ if (label.find("noflip") != std::string::npos)
1419
+ flip = false;
1420
+ }
1421
+ draw->textures[label]->flip = flip;
1422
+ draw->textures[label]->fn = texfn;
1413
1423
  //std::cout << "LOADED ADDITIONAL TEX " << label << " : " << texfn << std::endl;
1414
-
1415
- //NOTE: hasTexture() on geom objects will return False, unless the
1416
- //drawing object has a texture set too, so need to set ["texture"] = True at least
1417
1424
  }
1418
- //else
1419
- //std::cout << "FOUND ADDITIONAL TEX " << label << " : " << textures[texfn]->empty() << std::endl;
1420
- auto the_texture = textures[texfn];
1425
+
1426
+ auto the_texture = draw->textures[label];
1421
1427
  TextureData* texture_data = draw->useTexture(the_texture);
1422
1428
  if (texture_data)
1423
1429
  {
1424
1430
  if (!texture_data->unit)
1425
- texture_data->unit = textures.size()+2; //Set the texture unit, starting from 2 (1 reserved for 3d)
1431
+ {
1432
+ if (draw->texture_units.find(label) == draw->texture_units.end())
1433
+ {
1434
+ //Set the texture unit, starting from 2 (1 reserved for 3d)
1435
+ texture_data->unit = draw->texture_units.size()+2; //Set the texture unit, starting from 2 (1 reserved for 3d)
1436
+ draw->texture_units[label] = texture_data->unit; //Associate this texture unit with this uniform name
1437
+ }
1438
+ else
1439
+ texture_data->unit = draw->texture_units[label];
1440
+ }
1426
1441
  prog->setUniformi(label, texture_data->unit);
1427
1442
  //printf("Texture unit set %d \n", texture_data->unit);
1428
1443
  }
@@ -1462,6 +1477,11 @@ void Geometry::setState(Geom_Ptr g)
1462
1477
  prog->setUniformi("uFrame", session.frame);
1463
1478
  prog->setUniformf("uTime", session.time);
1464
1479
 
1480
+ //Viewport size uniform
1481
+ float viewport[4];
1482
+ glGetFloatv(GL_VIEWPORT, viewport);
1483
+ prog->setUniform4f("uViewport", viewport);
1484
+
1465
1485
  if (texture)
1466
1486
  prog->setUniform("uTexture", (int)texture->unit);
1467
1487
 
@@ -2427,13 +2447,22 @@ void Geometry::toImage(unsigned int idx)
2427
2447
  image.write(path);
2428
2448
  }
2429
2449
 
2430
- void Geometry::setTexture(DrawingObject* draw, Texture_Ptr tex)
2450
+ void Geometry::setTexture(DrawingObject* draw, Texture_Ptr tex, std::string label)
2431
2451
  {
2432
- Geom_Ptr geomdata = getObjectStore(draw);
2433
- if (geomdata)
2452
+ if (label.length() == 0)
2434
2453
  {
2435
- //printf("(%s) Set texture on %p to %p\n", GeomData::names[type].c_str(), geomdata.get(), tex.get());
2436
- geomdata->texture = tex;
2454
+ Geom_Ptr geomdata = getObjectStore(draw);
2455
+ if (geomdata)
2456
+ {
2457
+ //printf("(%s) Set texture on %p to %p\n", GeomData::names[type].c_str(), geomdata.get(), tex.get());
2458
+ geomdata->texture = tex;
2459
+ }
2460
+ }
2461
+ else
2462
+ {
2463
+ //Custom texture load by uniform name label
2464
+ //std::cout << "LOAD TEXTURE " << tex->fn.full << " BY LABEL " << label << " ON " << draw->name() << std::endl;
2465
+ draw->textures[label] = tex;
2437
2466
  }
2438
2467
  }
2439
2468
 
@@ -2449,17 +2478,34 @@ void Geometry::clearTexture(DrawingObject* draw)
2449
2478
  geomdata->texture = std::make_shared<ImageLoader>(); //Add a new empty texture container
2450
2479
  }
2451
2480
 
2452
- void Geometry::loadTexture(DrawingObject* draw, GLubyte* data, GLuint width, GLuint height, GLuint channels, bool flip, int filter, bool bgr)
2481
+ void Geometry::loadTexture(DrawingObject* draw, GLubyte* data, GLuint width, GLuint height, GLuint channels, bool flip, int filter, bool bgr, std::string label)
2453
2482
  {
2454
- Geom_Ptr geomdata = getObjectStore(draw);
2455
- if (geomdata)
2483
+ if (label.length() == 0)
2456
2484
  {
2457
- //printf("(%s) Load texture on %p to %p\n", GeomData::names[type].c_str(), geomdata.get(), geomdata->texture.get());
2458
- //std::cout << "LOAD TEXTURE " << width << " x " << height << " x " << channels << " BGR " << bgr << " ON " << draw->name() << std::endl;
2459
- //NOTE: must only load the data here, can't make OpenGL calls as can be called async
2460
- geomdata->texture->filter = filter;
2461
- geomdata->texture->bgr = bgr;
2462
- geomdata->texture->loadData(data, width, height, channels, flip);
2485
+ Geom_Ptr geomdata = getObjectStore(draw);
2486
+ if (geomdata)
2487
+ {
2488
+ //printf("(%s) Load texture on %p to %p\n", GeomData::names[type].c_str(), geomdata.get(), geomdata->texture.get());
2489
+ //std::cout << "LOAD TEXTURE " << width << " x " << height << " x " << channels << " BGR " << bgr << " ON " << draw->name() << std::endl;
2490
+ //NOTE: must only load the data here, can't make OpenGL calls as can be called async
2491
+ //
2492
+ geomdata->texture->filter = filter;
2493
+ geomdata->texture->bgr = bgr;
2494
+ geomdata->texture->loadData(data, width, height, channels, flip);
2495
+ }
2496
+ }
2497
+ else
2498
+ {
2499
+ //Custom texture load by uniform name label
2500
+ if (draw->textures.find(label) != draw->textures.end())
2501
+ {
2502
+ //std::cout << "LOAD TEXTURE BY LABEL" << label << " : " << width << " x " << height << " x " << channels << " BGR " << bgr << " ON " << draw->name() << std::endl;
2503
+ draw->textures[label]->filter = filter;
2504
+ draw->textures[label]->bgr = bgr;
2505
+ draw->textures[label]->loadData(data, width, height, channels, flip);
2506
+ }
2507
+ else
2508
+ std::cout << "LOAD TEXTURE, LABEL NOT FOUND: " << label << std::endl;
2463
2509
  }
2464
2510
  }
2465
2511
 
@@ -485,6 +485,7 @@ public:
485
485
  {
486
486
  if (texture->loaded || texture->source || !texture->fn.empty()) return true;
487
487
  if (draw->texture) return true;
488
+ if (draw->textures.size() > 0) return true;
488
489
  if (draw->properties.has("texture"))
489
490
  {
490
491
  std::string tex = draw->properties["texture"];
@@ -556,8 +557,6 @@ protected:
556
557
  std::vector<Geom_Ptr> records;
557
558
  std::vector<Geom_Ptr> geom;
558
559
  std::vector<bool> hidden;
559
- //Additional textures (stored by filename)
560
- std::map<std::string, Texture_Ptr> textures;
561
560
  unsigned int elements;
562
561
  unsigned int drawcount;
563
562
  DrawingObject* cached;
@@ -640,9 +639,9 @@ public:
640
639
  void objectBounds(DrawingObject* draw, float* min, float* max, bool allsteps=false);
641
640
  void move(Geometry* other);
642
641
  void toImage(unsigned int idx);
643
- void setTexture(DrawingObject* draw, Texture_Ptr tex);
642
+ void setTexture(DrawingObject* draw, Texture_Ptr tex, std::string label="");
644
643
  void clearTexture(DrawingObject* draw);
645
- void loadTexture(DrawingObject* draw, GLubyte* data, GLuint width, GLuint height, GLuint channels, bool flip=true, int filter=2, bool bgr=false);
644
+ void loadTexture(DrawingObject* draw, GLubyte* data, GLuint width, GLuint height, GLuint channels, bool flip=true, int filter=2, bool bgr=false, std::string label="");
646
645
  Quaternion vectorRotation(Vec3d rvector);
647
646
  void drawVector(DrawingObject *draw, const Vec3d& translate, const Vec3d& vector, bool scale3d, float scale, float radius0, float radius1, float head_scale, int segment_count=24, Colour* colour=NULL);
648
647
  void drawTrajectory(DrawingObject *draw, float coord0[3], float coord1[3], float radius0, float radius1, float arrowHeadSize, float scale[3], float maxLength=0.f, int segment_count=24, Colour* colour=NULL);
@@ -585,6 +585,8 @@ bool LavaVu::parseChar(unsigned char key)
585
585
  return parseCommands("help");
586
586
  case KEY_F2:
587
587
  return parseCommands("antialias");
588
+ case KEY_F3:
589
+ return parseCommands("shaders");
588
590
  case KEY_TAB:
589
591
  //Tab-completion from history
590
592
  for (int l=history.size()-1; l>=0; l--)
@@ -2890,7 +2892,6 @@ bool LavaVu::parseCommand(std::string cmd, bool gethelp)
2890
2892
 
2891
2893
  printMessage("Reloading shaders");
2892
2894
  reloadShaders();
2893
- return true;
2894
2895
  }
2895
2896
  else if (parsed.exists("blend"))
2896
2897
  {
@@ -3639,7 +3639,7 @@ void LavaVu::clearTexture(DrawingObject* target)
3639
3639
  std::cerr << "Container not found object:" << target->name() << std::endl;
3640
3640
  }
3641
3641
 
3642
- void LavaVu::setTexture(DrawingObject* target, std::string texpath, bool flip, int filter, bool bgr)
3642
+ void LavaVu::setTexture(DrawingObject* target, std::string texpath, bool flip, int filter, bool bgr, std::string label)
3643
3643
  {
3644
3644
  //GL_Check_Thread(viewer->render_thread);
3645
3645
  if (!amodel || !target) return;
@@ -3649,33 +3649,33 @@ void LavaVu::setTexture(DrawingObject* target, std::string texpath, bool flip, i
3649
3649
  Texture_Ptr texture = std::make_shared<ImageLoader>(texpath, flip);
3650
3650
  texture->filter = filter;
3651
3651
  texture->bgr = bgr;
3652
- container->setTexture(target, texture);
3652
+ container->setTexture(target, texture, label);
3653
3653
  reloadObject(target);
3654
3654
  }
3655
3655
  else
3656
3656
  std::cerr << "Container not found object:" << target->name() << std::endl;
3657
3657
  }
3658
3658
 
3659
- void LavaVu::textureUChar(DrawingObject* target, unsigned char* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip, int filter, bool bgr)
3659
+ void LavaVu::textureUChar(DrawingObject* target, unsigned char* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip, int filter, bool bgr, std::string label)
3660
3660
  {
3661
3661
  if (!amodel || !target) return;
3662
3662
  Geometry* container = amodel->lookupObjectRenderer(target);
3663
3663
  if (container)
3664
3664
  {
3665
- container->loadTexture(target, array, width, height, channels, flip, filter, bgr);
3665
+ container->loadTexture(target, array, width, height, channels, flip, filter, bgr, label);
3666
3666
  reloadObject(target);
3667
3667
  }
3668
3668
  else
3669
3669
  std::cerr << "Container not found object:" << target->name() << std::endl;
3670
3670
  }
3671
3671
 
3672
- void LavaVu::textureUInt(DrawingObject* target, unsigned int* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip, int filter, bool bgr)
3672
+ void LavaVu::textureUInt(DrawingObject* target, unsigned int* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip, int filter, bool bgr, std::string label)
3673
3673
  {
3674
3674
  if (!amodel || !target) return;
3675
3675
  Geometry* container = amodel->lookupObjectRenderer(target);
3676
3676
  if (container)
3677
3677
  {
3678
- container->loadTexture(target, (GLubyte*)array, width, height, channels, flip, filter, bgr);
3678
+ container->loadTexture(target, (GLubyte*)array, width, height, channels, flip, filter, bgr, label);
3679
3679
  reloadObject(target);
3680
3680
  }
3681
3681
  else
@@ -259,9 +259,9 @@ public:
259
259
  Geom_Ptr arrayFloat(DrawingObject* target, float* array, int len, lucGeometryDataType type=lucVertexData, int width=0, int height=0, int depth=0);
260
260
  Geom_Ptr arrayFloat(DrawingObject* target, float* array, int len, std::string label, int width=0, int height=0, int depth=0);
261
261
  void clearTexture(DrawingObject* target);
262
- void setTexture(DrawingObject* target, std::string texpath, bool flip=true, int filter=2, bool bgr=false);
263
- void textureUChar(DrawingObject* target, unsigned char* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip=true, int filter=2, bool bgr=false);
264
- void textureUInt(DrawingObject* target, unsigned int* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip=true, int filter=2, bool bgr=false);
262
+ void setTexture(DrawingObject* target, std::string texpath, bool flip=true, int filter=2, bool bgr=false, std::string label="");
263
+ void textureUChar(DrawingObject* target, unsigned char* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip=true, int filter=2, bool bgr=false, std::string label="");
264
+ void textureUInt(DrawingObject* target, unsigned int* array, int len, unsigned int width, unsigned int height, unsigned int channels, bool flip=true, int filter=2, bool bgr=false, std::string label="");
265
265
 
266
266
  std::vector<Geom_Ptr> getGeometry(DrawingObject* target);
267
267
  std::vector<Geom_Ptr> getGeometryAt(DrawingObject* target, int timestep=-2);