x_ite 4.0.5 → 4.7.5

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 (1007) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  2. package/.vscode/settings.json +15 -0
  3. package/.vscode/tasks.json +25 -0
  4. package/Makefile +55 -15
  5. package/README.md +13 -130
  6. package/build/bin/dist.pl +156 -0
  7. package/build/bin/version-number.pl +25 -0
  8. package/build/{version.pl → bin/version.pl} +64 -21
  9. package/build/components/annotation.build.js +15 -0
  10. package/build/components/cad-geometry.build.js +15 -0
  11. package/build/components/cube-map-texturing.build.js +15 -0
  12. package/build/components/dis.build.js +15 -0
  13. package/build/components/event-utilities.build.js +15 -0
  14. package/build/components/geometry2d.build.js +15 -0
  15. package/build/components/geospatial.build.js +15 -0
  16. package/build/components/h-anim.build.js +15 -0
  17. package/build/components/key-device-sensor.build.js +15 -0
  18. package/build/components/layout.build.js +15 -0
  19. package/build/components/nurbs.build.js +15 -0
  20. package/build/components/particle-systems.build.js +15 -0
  21. package/build/components/picking.build.js +15 -0
  22. package/build/components/projective-texture-mapping.build.js +15 -0
  23. package/build/components/rigid-body-physics.build.js +15 -0
  24. package/build/components/scripting.build.js +15 -0
  25. package/build/components/texturing-3d.build.js +15 -0
  26. package/build/components/volume-rendering.build.js +15 -0
  27. package/build/components/x_ite.build.js +15 -0
  28. package/build/parts/default.end.frag +2 -0
  29. package/build/parts/default.start.frag +6 -0
  30. package/build/parts/x_ite.end.frag +23 -0
  31. package/build/parts/x_ite.start.frag +8 -0
  32. package/build/x_ite.build.js +18 -0
  33. package/dist/LICENSE.txt +49 -0
  34. package/dist/assets/components/annotation.js +813 -0
  35. package/dist/assets/components/annotation.min.js +1 -0
  36. package/dist/assets/components/cad-geometry.js +1037 -0
  37. package/dist/assets/components/cad-geometry.min.js +1 -0
  38. package/dist/assets/components/cube-map-texturing.js +1212 -0
  39. package/dist/assets/components/cube-map-texturing.min.js +1 -0
  40. package/dist/assets/components/dis.js +908 -0
  41. package/dist/assets/components/dis.min.js +1 -0
  42. package/dist/assets/components/event-utilities.js +1114 -0
  43. package/dist/assets/components/event-utilities.min.js +1 -0
  44. package/dist/assets/components/geometry2d.js +2190 -0
  45. package/dist/assets/components/geometry2d.min.js +1 -0
  46. package/dist/assets/components/geospatial.js +3850 -0
  47. package/dist/assets/components/geospatial.min.js +2 -0
  48. package/dist/assets/components/h-anim.js +1084 -0
  49. package/dist/assets/components/h-anim.min.js +1 -0
  50. package/dist/assets/components/key-device-sensor.js +850 -0
  51. package/dist/assets/components/key-device-sensor.min.js +1 -0
  52. package/dist/assets/components/layout.js +2008 -0
  53. package/dist/assets/components/layout.min.js +1 -0
  54. package/dist/assets/components/nurbs.js +5388 -0
  55. package/dist/assets/components/nurbs.min.js +2 -0
  56. package/dist/assets/components/particle-systems.js +4216 -0
  57. package/dist/assets/components/particle-systems.min.js +2 -0
  58. package/dist/assets/components/picking.js +2481 -0
  59. package/dist/assets/components/picking.min.js +1 -0
  60. package/dist/assets/components/projective-texture-mapping.js +813 -0
  61. package/dist/assets/components/projective-texture-mapping.min.js +1 -0
  62. package/dist/assets/components/rigid-body-physics.js +4569 -0
  63. package/dist/assets/components/rigid-body-physics.min.js +59 -0
  64. package/dist/assets/components/scripting.js +801 -0
  65. package/dist/assets/components/scripting.min.js +1 -0
  66. package/dist/assets/components/texturing-3d.js +10054 -0
  67. package/dist/assets/components/texturing-3d.min.js +48 -0
  68. package/dist/assets/components/volume-rendering.js +3966 -0
  69. package/dist/assets/components/volume-rendering.min.js +3 -0
  70. package/dist/assets/components/x_ite.js +285 -0
  71. package/dist/assets/components/x_ite.min.js +1 -0
  72. package/{fonts → dist/assets/fonts}/DroidSerif-Bold.ttf +0 -0
  73. package/{fonts → dist/assets/fonts}/DroidSerif-BoldItalic.ttf +0 -0
  74. package/{fonts → dist/assets/fonts}/DroidSerif-Italic.ttf +0 -0
  75. package/{fonts → dist/assets/fonts}/DroidSerif-Regular.ttf +0 -0
  76. package/{fonts → dist/assets/fonts}/Ubuntu-B.ttf +0 -0
  77. package/{fonts → dist/assets/fonts}/Ubuntu-BI.ttf +0 -0
  78. package/{fonts → dist/assets/fonts}/Ubuntu-R.ttf +0 -0
  79. package/{fonts → dist/assets/fonts}/Ubuntu-RI.ttf +0 -0
  80. package/{fonts → dist/assets/fonts}/UbuntuMono-B.ttf +0 -0
  81. package/{fonts → dist/assets/fonts}/UbuntuMono-BI.ttf +0 -0
  82. package/{fonts → dist/assets/fonts}/UbuntuMono-R.ttf +0 -0
  83. package/{fonts → dist/assets/fonts}/UbuntuMono-RI.ttf +0 -0
  84. package/dist/assets/hatching/0.png +0 -0
  85. package/dist/assets/hatching/1.png +0 -0
  86. package/dist/assets/hatching/10.png +0 -0
  87. package/dist/assets/hatching/11.png +0 -0
  88. package/dist/assets/hatching/12.png +0 -0
  89. package/dist/assets/hatching/13.png +0 -0
  90. package/dist/assets/hatching/14.png +0 -0
  91. package/dist/assets/hatching/15.png +0 -0
  92. package/dist/assets/hatching/16.png +0 -0
  93. package/dist/assets/hatching/17.png +0 -0
  94. package/dist/assets/hatching/18.png +0 -0
  95. package/dist/assets/hatching/19.png +0 -0
  96. package/dist/assets/hatching/2.png +0 -0
  97. package/dist/assets/hatching/3.png +0 -0
  98. package/dist/assets/hatching/4.png +0 -0
  99. package/dist/assets/hatching/5.png +0 -0
  100. package/dist/assets/hatching/6.png +0 -0
  101. package/dist/assets/hatching/7.png +0 -0
  102. package/dist/assets/hatching/8.png +0 -0
  103. package/dist/assets/hatching/9.png +0 -0
  104. package/dist/{images → assets/images}/ExamineViewer.png +0 -0
  105. package/dist/{images → assets/images}/FlyViewer.png +0 -0
  106. package/dist/{images → assets/images}/NoneViewer.png +0 -0
  107. package/dist/{images → assets/images}/PlaneViewer.png +0 -0
  108. package/dist/{images → assets/images}/PrimitiveQuality.png +0 -0
  109. package/dist/{images → assets/images}/TextureQuality.png +0 -0
  110. package/dist/{images → assets/images}/Time.png +0 -0
  111. package/dist/{images → assets/images}/Viewpoint.png +0 -0
  112. package/dist/{images → assets/images}/WalkViewer.png +0 -0
  113. package/dist/assets/images/go-next.png +0 -0
  114. package/dist/{images → assets/images}/gtk-fullscreen.png +0 -0
  115. package/dist/{images → assets/images}/gtk-leave-fullscreen.png +0 -0
  116. package/dist/{images → assets/images}/gtk-zoom-fit.png +0 -0
  117. package/dist/{images → assets/images}/gtk-zoom-in.png +0 -0
  118. package/dist/{images → assets/images}/help-about.png +0 -0
  119. package/dist/{images → assets/images}/icon.bw.png +0 -0
  120. package/dist/{images → assets/images}/icon.png +0 -0
  121. package/dist/assets/images/logo.128.png +0 -0
  122. package/dist/{images → assets/images}/logo.bw.png +0 -0
  123. package/dist/{images → assets/images}/logo.png +0 -0
  124. package/dist/assets/linetype/0.png +0 -0
  125. package/dist/assets/linetype/1.png +0 -0
  126. package/dist/assets/linetype/10.png +0 -0
  127. package/dist/assets/linetype/11.png +0 -0
  128. package/dist/assets/linetype/12.png +0 -0
  129. package/dist/assets/linetype/13.png +0 -0
  130. package/dist/assets/linetype/14.png +0 -0
  131. package/dist/assets/linetype/15.png +0 -0
  132. package/dist/assets/linetype/16.png +0 -0
  133. package/dist/assets/linetype/2.png +0 -0
  134. package/dist/assets/linetype/3.png +0 -0
  135. package/dist/assets/linetype/4.png +0 -0
  136. package/dist/assets/linetype/5.png +0 -0
  137. package/dist/assets/linetype/6.png +0 -0
  138. package/dist/assets/linetype/7.png +0 -0
  139. package/dist/assets/linetype/8.png +0 -0
  140. package/dist/assets/linetype/9.png +0 -0
  141. package/dist/assets/shaders/webgl1/Background.fs +23 -0
  142. package/dist/assets/shaders/webgl1/Background.vs +16 -0
  143. package/dist/assets/shaders/webgl1/Depth.fs +60 -0
  144. package/dist/assets/shaders/webgl1/Depth.vs +13 -0
  145. package/dist/assets/shaders/webgl1/Fallback.fs +28 -0
  146. package/dist/assets/shaders/webgl1/Fallback.vs +24 -0
  147. package/dist/assets/shaders/webgl1/FallbackUnlit.fs +16 -0
  148. package/dist/assets/shaders/webgl1/FallbackUnlit.vs +18 -0
  149. package/dist/assets/shaders/webgl1/Gouraud.fs +529 -0
  150. package/dist/assets/shaders/webgl1/Gouraud.vs +108 -0
  151. package/dist/assets/shaders/webgl1/Phong.fs +838 -0
  152. package/dist/assets/shaders/webgl1/Phong.vs +52 -0
  153. package/dist/assets/shaders/webgl1/PointSet.fs +541 -0
  154. package/dist/assets/shaders/webgl1/PointSet.vs +48 -0
  155. package/dist/assets/shaders/webgl1/Unlit.fs +541 -0
  156. package/dist/assets/shaders/webgl1/Unlit.vs +52 -0
  157. package/dist/assets/shaders/webgl1/Wireframe.fs +93 -0
  158. package/dist/assets/shaders/webgl1/Wireframe.vs +47 -0
  159. package/dist/assets/shaders/webgl2/Background.fs +25 -0
  160. package/dist/assets/shaders/webgl2/Background.vs +17 -0
  161. package/dist/assets/shaders/webgl2/Depth.fs +62 -0
  162. package/dist/assets/shaders/webgl2/Depth.vs +14 -0
  163. package/dist/assets/shaders/webgl2/Gouraud.fs +684 -0
  164. package/dist/assets/shaders/webgl2/Gouraud.vs +109 -0
  165. package/dist/assets/shaders/webgl2/Phong.fs +1014 -0
  166. package/dist/assets/shaders/webgl2/Phong.vs +53 -0
  167. package/dist/assets/shaders/webgl2/PointSet.fs +696 -0
  168. package/dist/assets/shaders/webgl2/PointSet.vs +49 -0
  169. package/dist/assets/shaders/webgl2/Unlit.fs +696 -0
  170. package/dist/assets/shaders/webgl2/Unlit.vs +53 -0
  171. package/dist/assets/shaders/webgl2/Wireframe.fs +102 -0
  172. package/dist/assets/shaders/webgl2/Wireframe.vs +48 -0
  173. package/dist/example.html +8 -7
  174. package/dist/x_ite.css +180 -59
  175. package/dist/x_ite.js +74696 -68048
  176. package/dist/x_ite.min.js +42 -41
  177. package/dist/x_ite.zip +0 -0
  178. package/docs/404.md +5 -0
  179. package/docs/Accessing-the-External-Browser.md +290 -0
  180. package/docs/Browser-Support.md +47 -0
  181. package/docs/Custom-Shaders.md +905 -0
  182. package/docs/Features.md +49 -0
  183. package/docs/Glossary.md +339 -0
  184. package/docs/How-To-Configure-Your-Web-Server.md +56 -0
  185. package/docs/Supported-Nodes.md +370 -0
  186. package/docs/What's-New.md +1240 -0
  187. package/docs/XHTML-DOM-Integration.md +82 -0
  188. package/docs/_config.yml +140 -0
  189. package/docs/_data/navigation.yml +137 -0
  190. package/docs/assets/css/main.scss +100 -0
  191. package/docs/assets/images/logo.png +0 -0
  192. package/docs/google3696ee938394d7b6.html +1 -0
  193. package/docs/index.md +1026 -0
  194. package/docs/reference/Browser-Services.md +333 -0
  195. package/docs/reference/Constants-Services.md +376 -0
  196. package/docs/reference/ECMAScript-Object-and-Function-Definitions.md +128 -0
  197. package/docs/reference/Field-Services-and-Objects.md +1006 -0
  198. package/docs/reference/Prototype-Services.md +121 -0
  199. package/docs/reference/Route-Services.md +49 -0
  200. package/docs/reference/Scene-Services.md +360 -0
  201. package/docs/reference/Script-Node-Authoring-Interface.md +334 -0
  202. package/docs/tutorials/Adding-backgrounds.md +268 -0
  203. package/docs/tutorials/Adding-fog.md +67 -0
  204. package/docs/tutorials/Adding-sound.md +326 -0
  205. package/docs/tutorials/Animating-transforms.md +385 -0
  206. package/docs/tutorials/Basic-Nodes.md +317 -0
  207. package/docs/tutorials/Building-a-X3D-world.md +152 -0
  208. package/docs/tutorials/Building-elevation-grids.md +170 -0
  209. package/docs/tutorials/Building-extruded-shapes.md +145 -0
  210. package/docs/tutorials/Building-primitive-shapes.md +204 -0
  211. package/docs/tutorials/Building-shapes-out-of-points,-lines,-and-faces.md +311 -0
  212. package/docs/tutorials/Controlling-appearance-with-materials.md +186 -0
  213. package/docs/tutorials/Controlling-color-on-coordinate-based-geometry.md +208 -0
  214. package/docs/tutorials/Controlling-detail.md +130 -0
  215. package/docs/tutorials/Controlling-how-textures-are-mapped.md +277 -0
  216. package/docs/tutorials/Controlling-navigation.md +70 -0
  217. package/docs/tutorials/Controlling-shading-on-coordinate-based-geometry.md +180 -0
  218. package/docs/tutorials/Controlling-the-viewpoint.md +49 -0
  219. package/docs/tutorials/Creating-new-node-types.md +313 -0
  220. package/docs/tutorials/Grouping-nodes.md +237 -0
  221. package/docs/tutorials/Hello,-World!.md +204 -0
  222. package/docs/tutorials/Improving-Performance.md +227 -0
  223. package/docs/tutorials/Increasing-Rendering-Speed.md +110 -0
  224. package/docs/tutorials/Introducing-X3D.md +94 -0
  225. package/docs/tutorials/Introducing-animation.md +211 -0
  226. package/docs/tutorials/Introducing-script-use.md +127 -0
  227. package/docs/tutorials/Lighting-your-world.md +139 -0
  228. package/docs/tutorials/Mapping-textures.md +212 -0
  229. package/docs/tutorials/Naming-nodes.md +161 -0
  230. package/docs/tutorials/Providing-information-about-your-world.md +30 -0
  231. package/docs/tutorials/Sensing-the-viewer.md +205 -0
  232. package/docs/tutorials/Sensing-viewer-actions.md +214 -0
  233. package/docs/tutorials/Transforming-Shapes.md +270 -0
  234. package/docs/tutorials/Writing-program-scripts-with-ECMAScript.md +631 -0
  235. package/docs/tutorials/index.md +78 -0
  236. package/meta/logo/logo.png +0 -0
  237. package/meta/logo/logo.svg +216 -217
  238. package/meta/web3d.html +76 -54
  239. package/package.json +41 -24
  240. package/src/assets/components/annotation.js +87 -0
  241. package/src/assets/components/cad-geometry.js +88 -0
  242. package/src/assets/components/cube-map-texturing.js +78 -0
  243. package/src/assets/components/dis.js +84 -0
  244. package/src/assets/components/event-utilities.js +93 -0
  245. package/src/assets/components/geometry2d.js +93 -0
  246. package/src/assets/components/geospatial.js +102 -0
  247. package/src/assets/components/h-anim.js +83 -0
  248. package/src/assets/components/key-device-sensor.js +78 -0
  249. package/src/assets/components/layout.js +87 -0
  250. package/src/assets/components/nurbs.js +118 -0
  251. package/src/assets/components/particle-systems.js +105 -0
  252. package/src/assets/components/picking.js +87 -0
  253. package/src/assets/components/projective-texture-mapping.js +75 -0
  254. package/src/assets/components/rigid-body-physics.js +123 -0
  255. package/src/assets/components/scripting.js +72 -0
  256. package/src/assets/components/texturing-3d.js +91 -0
  257. package/src/assets/components/volume-rendering.js +118 -0
  258. package/src/assets/components/x_ite.js +69 -0
  259. package/src/assets/fonts/DroidSerif-Bold.ttf +0 -0
  260. package/src/assets/fonts/DroidSerif-BoldItalic.ttf +0 -0
  261. package/src/assets/fonts/DroidSerif-Italic.ttf +0 -0
  262. package/src/assets/fonts/DroidSerif-Regular.ttf +0 -0
  263. package/src/assets/fonts/Ubuntu-B.ttf +0 -0
  264. package/src/assets/fonts/Ubuntu-BI.ttf +0 -0
  265. package/src/assets/fonts/Ubuntu-R.ttf +0 -0
  266. package/src/assets/fonts/Ubuntu-RI.ttf +0 -0
  267. package/src/assets/fonts/UbuntuMono-B.ttf +0 -0
  268. package/src/assets/fonts/UbuntuMono-BI.ttf +0 -0
  269. package/src/assets/fonts/UbuntuMono-R.ttf +0 -0
  270. package/src/assets/fonts/UbuntuMono-RI.ttf +0 -0
  271. package/src/assets/hatching/0.png +0 -0
  272. package/src/assets/hatching/1.png +0 -0
  273. package/src/assets/hatching/10.png +0 -0
  274. package/src/assets/hatching/11.png +0 -0
  275. package/src/assets/hatching/12.png +0 -0
  276. package/src/assets/hatching/13.png +0 -0
  277. package/src/assets/hatching/14.png +0 -0
  278. package/src/assets/hatching/15.png +0 -0
  279. package/src/assets/hatching/16.png +0 -0
  280. package/src/assets/hatching/17.png +0 -0
  281. package/src/assets/hatching/18.png +0 -0
  282. package/src/assets/hatching/19.png +0 -0
  283. package/src/assets/hatching/2.png +0 -0
  284. package/src/assets/hatching/3.png +0 -0
  285. package/src/assets/hatching/4.png +0 -0
  286. package/src/assets/hatching/5.png +0 -0
  287. package/src/assets/hatching/6.png +0 -0
  288. package/src/assets/hatching/7.png +0 -0
  289. package/src/assets/hatching/8.png +0 -0
  290. package/src/assets/hatching/9.png +0 -0
  291. package/src/{images → assets/images}/ExamineViewer.png +0 -0
  292. package/src/{images → assets/images}/FlyViewer.png +0 -0
  293. package/src/{images → assets/images}/NoneViewer.png +0 -0
  294. package/src/{images → assets/images}/PlaneViewer.png +0 -0
  295. package/src/{images → assets/images}/PrimitiveQuality.png +0 -0
  296. package/src/{images → assets/images}/TextureQuality.png +0 -0
  297. package/src/{images → assets/images}/Time.png +0 -0
  298. package/src/{images → assets/images}/Viewpoint.png +0 -0
  299. package/src/{images → assets/images}/WalkViewer.png +0 -0
  300. package/src/assets/images/go-next.png +0 -0
  301. package/src/{images → assets/images}/gtk-fullscreen.png +0 -0
  302. package/src/{images → assets/images}/gtk-leave-fullscreen.png +0 -0
  303. package/src/{images → assets/images}/gtk-zoom-fit.png +0 -0
  304. package/src/{images → assets/images}/gtk-zoom-in.png +0 -0
  305. package/src/{images → assets/images}/help-about.png +0 -0
  306. package/src/{images → assets/images}/icon.bw.png +0 -0
  307. package/src/{images → assets/images}/icon.png +0 -0
  308. package/src/assets/images/logo.128.png +0 -0
  309. package/src/{images → assets/images}/logo.bw.png +0 -0
  310. package/src/{images → assets/images}/logo.png +0 -0
  311. package/src/assets/linetype/0.png +0 -0
  312. package/src/assets/linetype/1.png +0 -0
  313. package/src/assets/linetype/10.png +0 -0
  314. package/src/assets/linetype/11.png +0 -0
  315. package/src/assets/linetype/12.png +0 -0
  316. package/src/assets/linetype/13.png +0 -0
  317. package/src/assets/linetype/14.png +0 -0
  318. package/src/assets/linetype/15.png +0 -0
  319. package/src/assets/linetype/16.png +0 -0
  320. package/src/assets/linetype/2.png +0 -0
  321. package/src/assets/linetype/3.png +0 -0
  322. package/src/assets/linetype/4.png +0 -0
  323. package/src/assets/linetype/5.png +0 -0
  324. package/src/assets/linetype/6.png +0 -0
  325. package/src/assets/linetype/7.png +0 -0
  326. package/src/assets/linetype/8.png +0 -0
  327. package/src/assets/linetype/9.png +0 -0
  328. package/src/assets/shaders/Types.glsl +102 -0
  329. package/src/assets/shaders/webgl1/Background.fs +16 -0
  330. package/src/assets/shaders/webgl1/Background.vs +22 -0
  331. package/src/assets/shaders/webgl1/Depth.fs +16 -0
  332. package/src/assets/shaders/webgl1/Depth.vs +20 -0
  333. package/src/assets/shaders/webgl1/Fallback.fs +38 -0
  334. package/src/assets/shaders/webgl1/Fallback.vs +30 -0
  335. package/src/assets/shaders/webgl1/FallbackUnlit.fs +22 -0
  336. package/src/assets/shaders/webgl1/FallbackUnlit.vs +24 -0
  337. package/src/assets/shaders/webgl1/Gouraud.fs +66 -0
  338. package/src/assets/shaders/webgl1/Gouraud.vs +148 -0
  339. package/src/assets/shaders/webgl1/Phong.fs +173 -0
  340. package/src/assets/shaders/webgl1/Phong.vs +67 -0
  341. package/src/assets/shaders/webgl1/PointSet.fs +100 -0
  342. package/src/assets/shaders/webgl1/PointSet.vs +70 -0
  343. package/src/assets/shaders/webgl1/Unlit.fs +89 -0
  344. package/src/assets/shaders/webgl1/Unlit.vs +67 -0
  345. package/src/assets/shaders/webgl1/Wireframe.fs +74 -0
  346. package/src/assets/shaders/webgl1/Wireframe.vs +63 -0
  347. package/src/assets/shaders/webgl1/include/ClipPlanes.glsl +16 -0
  348. package/src/assets/shaders/webgl1/include/Fog.glsl +38 -0
  349. package/src/assets/shaders/webgl1/include/Hatch.glsl +18 -0
  350. package/src/assets/shaders/webgl1/include/Pack.glsl +51 -0
  351. package/src/assets/shaders/webgl1/include/Perlin.glsl +40 -0
  352. package/src/assets/shaders/webgl1/include/Shadow.glsl +310 -0
  353. package/src/assets/shaders/webgl1/include/Texture.glsl +488 -0
  354. package/src/assets/shaders/webgl2/Background.fs +19 -0
  355. package/src/assets/shaders/webgl2/Background.vs +23 -0
  356. package/src/assets/shaders/webgl2/Depth.fs +19 -0
  357. package/src/assets/shaders/webgl2/Depth.vs +21 -0
  358. package/src/assets/shaders/webgl2/Gouraud.fs +64 -0
  359. package/src/assets/shaders/webgl2/Gouraud.vs +149 -0
  360. package/src/assets/shaders/webgl2/Phong.fs +171 -0
  361. package/src/assets/shaders/webgl2/Phong.vs +68 -0
  362. package/src/assets/shaders/webgl2/PointSet.fs +99 -0
  363. package/src/assets/shaders/webgl2/PointSet.vs +71 -0
  364. package/src/assets/shaders/webgl2/Unlit.fs +88 -0
  365. package/src/assets/shaders/webgl2/Unlit.vs +68 -0
  366. package/src/assets/shaders/webgl2/Wireframe.fs +73 -0
  367. package/src/assets/shaders/webgl2/Wireframe.vs +64 -0
  368. package/src/assets/shaders/webgl2/include/ClipPlanes.glsl +16 -0
  369. package/src/assets/shaders/webgl2/include/Fog.glsl +46 -0
  370. package/src/assets/shaders/webgl2/include/Hatch.glsl +18 -0
  371. package/src/assets/shaders/webgl2/include/Pack.glsl +51 -0
  372. package/src/assets/shaders/webgl2/include/Perlin.glsl +40 -0
  373. package/src/assets/shaders/webgl2/include/Shadow.glsl +324 -0
  374. package/src/assets/shaders/webgl2/include/Texture.glsl +623 -0
  375. package/src/bookmarks.js +83 -164
  376. package/src/dummy.js +1 -0
  377. package/src/example.html +8 -7
  378. package/src/examples.js +150 -0
  379. package/src/lib/ammojs/AmmoJS.js +58 -0
  380. package/src/lib/ammojs/Makefile +26 -0
  381. package/src/lib/ammojs/ammo.idl +1031 -0
  382. package/src/lib/ammojs/ammo.js +40 -0
  383. package/src/lib/jpeg/jpeg.js +1019 -0
  384. package/src/lib/nurbs/extras/sample.js +242 -0
  385. package/src/lib/nurbs/nurbs.js +342 -0
  386. package/src/lib/nurbs/src/evaluate.js +413 -0
  387. package/src/lib/nurbs/src/numerical-derivative.js +54 -0
  388. package/src/lib/nurbs/src/support.js +151 -0
  389. package/src/lib/nurbs/src/transform.js +78 -0
  390. package/src/lib/nurbs/src/utils/accessor-preamble.js +33 -0
  391. package/src/lib/nurbs/src/utils/bisection-search.js +28 -0
  392. package/src/lib/nurbs/src/utils/cache-key.js +57 -0
  393. package/src/lib/nurbs/src/utils/create-accessors.js +110 -0
  394. package/src/lib/nurbs/src/utils/infer-type.js +52 -0
  395. package/src/lib/nurbs/src/utils/is-array-like.js +10 -0
  396. package/src/lib/nurbs/src/utils/is-ndarray-like.js +18 -0
  397. package/src/lib/nurbs/src/utils/is-ndarray.js +21 -0
  398. package/src/lib/nurbs/src/utils/ndloop.js +23 -0
  399. package/src/lib/nurbs/src/utils/size-getter.js +22 -0
  400. package/src/lib/nurbs/src/utils/variable.js +31 -0
  401. package/src/locale/de.po +8 -3
  402. package/src/locale/fr.po +9 -4
  403. package/src/locale/gettext.js +3 -3
  404. package/src/spinner.css +21 -8
  405. package/src/standard/Geospatial/Geodetic.js +48 -48
  406. package/src/standard/Geospatial/ReferenceEllipsoids.js +1 -1
  407. package/src/standard/Geospatial/UniversalTransverseMercator.js +43 -43
  408. package/src/standard/Math/Algorithm.js +25 -41
  409. package/src/standard/Math/Algorithms/Bezier.js +147 -0
  410. package/src/standard/Math/Algorithms/MergeSort.js +2 -2
  411. package/src/standard/Math/Algorithms/PartialSort.js +97 -0
  412. package/src/standard/Math/Algorithms/QuickSort.js +8 -6
  413. package/src/standard/Math/Algorithms/SAT.js +4 -8
  414. package/src/standard/Math/Algorithms/eigendecomposition.js +37 -33
  415. package/src/standard/Math/Geometry/Box2.js +84 -56
  416. package/src/standard/Math/Geometry/Box3.js +457 -284
  417. package/src/standard/Math/Geometry/Camera.js +24 -15
  418. package/src/standard/Math/Geometry/Cylinder3.js +13 -13
  419. package/src/standard/Math/Geometry/Line3.js +61 -53
  420. package/src/standard/Math/Geometry/Plane3.js +16 -16
  421. package/src/standard/Math/Geometry/Sphere3.js +122 -105
  422. package/src/standard/Math/Geometry/Spheroid3.js +1 -1
  423. package/src/standard/Math/Geometry/Triangle2.js +6 -6
  424. package/src/standard/Math/Geometry/Triangle3.js +80 -88
  425. package/src/standard/Math/Geometry/ViewVolume.js +315 -116
  426. package/src/standard/Math/Numbers/Color3.js +45 -29
  427. package/src/standard/Math/Numbers/Color4.js +25 -14
  428. package/src/standard/Math/Numbers/Complex.js +15 -22
  429. package/src/standard/Math/Numbers/Matrix2.js +37 -17
  430. package/src/standard/Math/Numbers/Matrix3.js +181 -212
  431. package/src/standard/Math/Numbers/Matrix4.js +204 -262
  432. package/src/standard/Math/Numbers/Quaternion.js +60 -147
  433. package/src/standard/Math/Numbers/Rotation4.js +197 -129
  434. package/src/standard/Math/Numbers/Vector2.js +53 -109
  435. package/src/standard/Math/Numbers/Vector3.js +75 -144
  436. package/src/standard/Math/Numbers/Vector4.js +85 -155
  437. package/src/standard/Math/Utility/BVH.js +35 -30
  438. package/src/standard/Math/Utility/MatrixStack.js +6 -9
  439. package/src/standard/Networking/BinaryTransport.js +8 -8
  440. package/src/standard/Time/MicroTime.js +79 -0
  441. package/src/standard/Utility/DataStorage.js +40 -17
  442. package/src/standard/Utility/MapUtilities.js +69 -0
  443. package/src/standard/Utility/ObjectCache.js +2 -3
  444. package/src/standard/Utility/Shuffle.js +5 -6
  445. package/src/tests.js +386 -0
  446. package/src/x_ite/Base/Events.js +22 -30
  447. package/src/x_ite/Base/X3DChildObject.js +35 -19
  448. package/src/x_ite/Base/X3DEventObject.js +10 -12
  449. package/src/x_ite/Base/X3DObject.js +63 -43
  450. package/src/x_ite/Basic/FieldDefinitionArray.js +16 -10
  451. package/src/x_ite/Basic/X3DArrayField.js +3 -430
  452. package/src/x_ite/Basic/X3DBaseNode.js +551 -288
  453. package/src/x_ite/Basic/X3DField.js +133 -96
  454. package/src/x_ite/Basic/X3DFieldDefinition.js +0 -4
  455. package/src/x_ite/Basic/X3DObjectArrayField.js +545 -0
  456. package/src/x_ite/Basic/X3DTypedArrayField.js +839 -0
  457. package/src/x_ite/Bits/TraverseType.js +2 -5
  458. package/src/x_ite/Bits/X3DConstants.js +12 -322
  459. package/src/x_ite/Browser/Core/BrowserOptions.js +205 -77
  460. package/src/x_ite/Browser/Core/BrowserProperties.js +2 -4
  461. package/src/x_ite/Browser/Core/BrowserTimings.js +16 -15
  462. package/src/x_ite/Browser/Core/ContextMenu.js +202 -80
  463. package/src/x_ite/Browser/Core/Notification.js +14 -6
  464. package/src/x_ite/Browser/Core/PrimitiveQuality.js +3 -7
  465. package/src/x_ite/Browser/Core/RenderingProperties.js +10 -11
  466. package/src/x_ite/Browser/Core/Shading.js +66 -0
  467. package/src/x_ite/Browser/Core/TextureQuality.js +3 -7
  468. package/src/x_ite/Browser/Core/X3DCoreContext.js +495 -48
  469. package/src/x_ite/Browser/Core/X3DCoreContext.js.~1~ +714 -0
  470. package/src/x_ite/Browser/EnvironmentalEffects/X3DEnvironmentalEffectsContext.js +17 -23
  471. package/src/x_ite/Browser/Followers/X3DArrayChaserTemplate.js +12 -20
  472. package/src/x_ite/Browser/Followers/X3DArrayFollowerTemplate.js +82 -34
  473. package/src/x_ite/Browser/Geometry2D/Arc2DOptions.js +3 -5
  474. package/src/x_ite/Browser/Geometry2D/ArcClose2DOptions.js +3 -5
  475. package/src/x_ite/Browser/Geometry2D/Circle2DOptions.js +12 -9
  476. package/src/x_ite/Browser/Geometry2D/Disk2DOptions.js +60 -42
  477. package/src/x_ite/Browser/Geometry2D/Rectangle2DOptions.js +16 -20
  478. package/src/x_ite/Browser/Geometry2D/X3DGeometry2DContext.js +51 -12
  479. package/src/x_ite/Browser/Geometry3D/BoxOptions.js +17 -21
  480. package/src/x_ite/Browser/Geometry3D/ConeOptions.js +2 -4
  481. package/src/x_ite/Browser/Geometry3D/CylinderOptions.js +2 -4
  482. package/src/x_ite/Browser/Geometry3D/IcoSphereOptions.js +2 -4
  483. package/src/x_ite/Browser/Geometry3D/QuadSphereOptions.js +3 -5
  484. package/src/x_ite/Browser/Geometry3D/X3DGeometry3DContext.js +8 -9
  485. package/src/x_ite/Browser/Grouping/X3DGroupingContext.js +98 -0
  486. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator.js +12 -12
  487. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolator1.js +2 -4
  488. package/src/x_ite/Browser/Interpolation/CatmullRomSplineInterpolatorTemplate.js +2 -4
  489. package/src/x_ite/Browser/KeyDeviceSensor/X3DKeyDeviceSensorContext.js +22 -200
  490. package/src/x_ite/Browser/Layout/ScreenText.js +287 -295
  491. package/src/x_ite/Browser/Layout/X3DLayoutContext.js +15 -12
  492. package/src/x_ite/Browser/Lighting/X3DLightingContext.js +18 -12
  493. package/src/x_ite/Browser/NURBS/NURBS.js +481 -0
  494. package/src/x_ite/Browser/Navigation/ExamineViewer.js +587 -127
  495. package/src/x_ite/Browser/Navigation/FlyViewer.js +23 -5
  496. package/src/x_ite/Browser/Navigation/LookAtViewer.js +402 -18
  497. package/src/x_ite/Browser/Navigation/NoneViewer.js +13 -3
  498. package/src/x_ite/Browser/Navigation/PlaneViewer.js +46 -28
  499. package/src/x_ite/Browser/Navigation/WalkViewer.js +45 -17
  500. package/src/x_ite/Browser/Navigation/X3DFlyViewer.js +414 -207
  501. package/src/x_ite/Browser/Navigation/X3DNavigationContext.js +65 -48
  502. package/src/x_ite/Browser/Navigation/X3DViewer.js +99 -45
  503. package/src/x_ite/Browser/Networking/X3DNetworkingContext.js +39 -38
  504. package/src/x_ite/Browser/Networking/urls.js +34 -5
  505. package/src/x_ite/Browser/ParticleSystems/X3DParticleSystemsContext.js +7 -9
  506. package/src/x_ite/Browser/Picking/IntersectionType.js +63 -0
  507. package/src/x_ite/Browser/Picking/MatchCriterion.js +64 -0
  508. package/src/x_ite/Browser/Picking/SortOrder.js +65 -0
  509. package/src/x_ite/Browser/Picking/VolumePicker.js +197 -0
  510. package/src/x_ite/Browser/Picking/X3DPickingContext.js +130 -0
  511. package/src/x_ite/Browser/PointingDeviceSensor/PointingDevice.js +89 -30
  512. package/src/x_ite/Browser/PointingDeviceSensor/PointingDeviceSensorContainer.js +1 -3
  513. package/src/x_ite/Browser/PointingDeviceSensor/X3DPointingDeviceSensorContext.js +33 -15
  514. package/src/x_ite/Browser/Rendering/X3DRenderingContext.js +39 -151
  515. package/src/x_ite/Browser/RigidBodyPhysics/AppliedParametersType.js +70 -0
  516. package/src/x_ite/Browser/Shaders/Shader.js +150 -50
  517. package/src/x_ite/Browser/Shaders/ShaderSource.js +140 -0
  518. package/src/x_ite/Browser/Shaders/ShaderTest.js +94 -77
  519. package/src/x_ite/Browser/Shaders/X3DShadersContext.js +220 -5
  520. package/src/x_ite/Browser/Shape/AlphaMode.js +65 -0
  521. package/src/x_ite/Browser/Shape/LineStipples.xcf +0 -0
  522. package/src/x_ite/Browser/Shape/X3DShapeContext.js +108 -4
  523. package/src/x_ite/Browser/Sound/X3DSoundContext.js +1 -20
  524. package/src/x_ite/Browser/Text/PolygonText.js +165 -359
  525. package/src/x_ite/Browser/Text/TextAlignment.js +3 -7
  526. package/src/x_ite/Browser/Text/X3DTextContext.js +38 -30
  527. package/src/x_ite/Browser/Text/X3DTextGeometry.js +58 -84
  528. package/src/x_ite/Browser/Texturing/MultiTextureFunctionType.js +64 -0
  529. package/src/x_ite/Browser/Texturing/MultiTextureModeType.js +81 -0
  530. package/src/x_ite/Browser/Texturing/MultiTextureSourceType.js +65 -0
  531. package/src/x_ite/Browser/Texturing/TextureCoordinateGeneratorModeType.js +73 -0
  532. package/src/x_ite/Browser/Texturing/X3DTexturingContext.js +148 -41
  533. package/src/x_ite/Browser/Texturing3D/DICOMParser.js +1126 -0
  534. package/src/x_ite/Browser/Texturing3D/NRRDParser.js +686 -0
  535. package/src/x_ite/Browser/Time/X3DTimeContext.js +20 -17
  536. package/src/x_ite/Browser/VERSION.js +2 -2
  537. package/src/x_ite/Browser/VolumeRendering/VolumeStyle.fs +120 -0
  538. package/src/x_ite/Browser/VolumeRendering/VolumeStyle.vs +28 -0
  539. package/src/x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext.js +114 -0
  540. package/src/x_ite/Browser/X3DBrowser.js +282 -182
  541. package/src/x_ite/Browser/X3DBrowserContext.js +77 -43
  542. package/src/x_ite/Components/Annotation/AnnotationLayer.js +108 -0
  543. package/src/x_ite/Components/Annotation/AnnotationTarget.js +101 -0
  544. package/src/x_ite/Components/{PointingDeviceSensor/TouchGroup.js → Annotation/GroupAnnotation.js} +30 -24
  545. package/src/x_ite/Components/Annotation/IconAnnotation.js +110 -0
  546. package/src/x_ite/Components/Annotation/TextAnnotation.js +102 -0
  547. package/src/x_ite/Components/Annotation/URLAnnotation.js +101 -0
  548. package/src/x_ite/Components/Annotation/X3DAnnotationNode.js +76 -0
  549. package/src/x_ite/Components/CADGeometry/CADAssembly.js +6 -8
  550. package/src/x_ite/Components/CADGeometry/CADFace.js +137 -33
  551. package/src/x_ite/Components/CADGeometry/CADLayer.js +5 -18
  552. package/src/x_ite/Components/CADGeometry/CADPart.js +6 -12
  553. package/src/x_ite/Components/CADGeometry/IndexedQuadSet.js +20 -36
  554. package/src/x_ite/Components/CADGeometry/QuadSet.js +11 -24
  555. package/src/x_ite/Components/CADGeometry/X3DProductStructureChildNode.js +2 -4
  556. package/src/x_ite/Components/Core/MetadataBoolean.js +2 -4
  557. package/src/x_ite/Components/Core/MetadataDouble.js +2 -4
  558. package/src/x_ite/Components/Core/MetadataFloat.js +2 -4
  559. package/src/x_ite/Components/Core/MetadataInteger.js +2 -4
  560. package/src/x_ite/Components/Core/MetadataSet.js +2 -4
  561. package/src/x_ite/Components/Core/MetadataString.js +2 -4
  562. package/src/x_ite/Components/Core/WorldInfo.js +18 -10
  563. package/src/x_ite/Components/Core/X3DBindableNode.js +5 -36
  564. package/src/x_ite/Components/Core/X3DChildNode.js +16 -5
  565. package/src/x_ite/Components/Core/X3DInfoNode.js +2 -4
  566. package/src/x_ite/Components/Core/X3DMetadataObject.js +1 -3
  567. package/src/x_ite/Components/Core/X3DNode.js +2 -64
  568. package/src/x_ite/Components/Core/X3DPrototypeInstance.js +190 -210
  569. package/src/x_ite/Components/Core/X3DSensorNode.js +2 -4
  570. package/src/x_ite/Components/Core.js +111 -0
  571. package/src/x_ite/Components/CubeMapTexturing/ComposedCubeMapTexture.js +42 -50
  572. package/src/x_ite/Components/CubeMapTexturing/GeneratedCubeMapTexture.js +41 -42
  573. package/src/x_ite/Components/CubeMapTexturing/ImageCubeMapTexture.js +44 -59
  574. package/src/x_ite/Components/CubeMapTexturing/X3DEnvironmentTextureNode.js +48 -46
  575. package/src/x_ite/Components/DIS/DISEntityManager.js +2 -4
  576. package/src/x_ite/Components/DIS/DISEntityTypeMapping.js +2 -4
  577. package/src/x_ite/Components/DIS/EspduTransform.js +13 -9
  578. package/src/x_ite/Components/DIS/ReceiverPdu.js +13 -9
  579. package/src/x_ite/Components/DIS/SignalPdu.js +13 -9
  580. package/src/x_ite/Components/DIS/TransmitterPdu.js +13 -9
  581. package/src/x_ite/Components/EnvironmentalEffects/Background.js +2 -4
  582. package/src/x_ite/Components/EnvironmentalEffects/Fog.js +15 -18
  583. package/src/x_ite/Components/EnvironmentalEffects/FogCoordinate.js +59 -7
  584. package/src/x_ite/Components/EnvironmentalEffects/LocalFog.js +12 -10
  585. package/src/x_ite/Components/EnvironmentalEffects/TextureBackground.js +2 -4
  586. package/src/x_ite/Components/EnvironmentalEffects/X3DBackgroundNode.js +149 -143
  587. package/src/x_ite/Components/EnvironmentalEffects/X3DFogObject.js +61 -22
  588. package/src/x_ite/Components/EnvironmentalEffects.js +90 -0
  589. package/src/x_ite/Components/EnvironmentalSensor/ProximitySensor.js +121 -121
  590. package/src/x_ite/Components/EnvironmentalSensor/TransformSensor.js +173 -53
  591. package/src/x_ite/Components/EnvironmentalSensor/VisibilitySensor.js +33 -31
  592. package/src/x_ite/Components/EnvironmentalSensor/X3DEnvironmentalSensorNode.js +19 -11
  593. package/src/x_ite/Components/EnvironmentalSensor.js +81 -0
  594. package/src/x_ite/Components/EventUtilities/BooleanFilter.js +2 -4
  595. package/src/x_ite/Components/EventUtilities/BooleanSequencer.js +2 -4
  596. package/src/x_ite/Components/EventUtilities/BooleanToggle.js +2 -4
  597. package/src/x_ite/Components/EventUtilities/BooleanTrigger.js +2 -4
  598. package/src/x_ite/Components/EventUtilities/IntegerSequencer.js +2 -4
  599. package/src/x_ite/Components/EventUtilities/IntegerTrigger.js +2 -4
  600. package/src/x_ite/Components/EventUtilities/TimeTrigger.js +2 -4
  601. package/src/x_ite/Components/EventUtilities/X3DSequencerNode.js +2 -4
  602. package/src/x_ite/Components/EventUtilities/X3DTriggerNode.js +2 -4
  603. package/src/x_ite/Components/Followers/ColorChaser.js +3 -7
  604. package/src/x_ite/Components/Followers/ColorDamper.js +3 -7
  605. package/src/x_ite/Components/Followers/CoordinateChaser.js +3 -11
  606. package/src/x_ite/Components/Followers/CoordinateDamper.js +2 -10
  607. package/src/x_ite/Components/Followers/OrientationChaser.js +9 -7
  608. package/src/x_ite/Components/Followers/OrientationDamper.js +9 -7
  609. package/src/x_ite/Components/Followers/PositionChaser.js +3 -7
  610. package/src/x_ite/Components/Followers/PositionChaser2D.js +3 -7
  611. package/src/x_ite/Components/Followers/PositionDamper.js +3 -7
  612. package/src/x_ite/Components/Followers/PositionDamper2D.js +3 -7
  613. package/src/x_ite/Components/Followers/ScalarChaser.js +7 -7
  614. package/src/x_ite/Components/Followers/ScalarDamper.js +3 -7
  615. package/src/x_ite/Components/Followers/TexCoordChaser2D.js +3 -11
  616. package/src/x_ite/Components/Followers/TexCoordDamper2D.js +3 -11
  617. package/src/x_ite/Components/Followers/X3DChaserNode.js +26 -26
  618. package/src/x_ite/Components/Followers/X3DDamperNode.js +6 -10
  619. package/src/x_ite/Components/Followers/X3DFollowerNode.js +11 -11
  620. package/src/x_ite/Components/Followers.js +120 -0
  621. package/src/x_ite/Components/Geometry2D/Arc2D.js +28 -30
  622. package/src/x_ite/Components/Geometry2D/ArcClose2D.js +95 -93
  623. package/src/x_ite/Components/Geometry2D/Circle2D.js +16 -15
  624. package/src/x_ite/Components/Geometry2D/Disk2D.js +80 -88
  625. package/src/x_ite/Components/Geometry2D/Polyline2D.js +13 -19
  626. package/src/x_ite/Components/Geometry2D/Polypoint2D.js +12 -18
  627. package/src/x_ite/Components/Geometry2D/Rectangle2D.js +13 -13
  628. package/src/x_ite/Components/Geometry2D/TriangleSet2D.js +31 -30
  629. package/src/x_ite/Components/Geometry3D/Box.js +12 -12
  630. package/src/x_ite/Components/Geometry3D/Cone.js +34 -36
  631. package/src/x_ite/Components/Geometry3D/Cylinder.js +52 -54
  632. package/src/x_ite/Components/Geometry3D/ElevationGrid.js +90 -52
  633. package/src/x_ite/Components/Geometry3D/Extrusion.js +472 -388
  634. package/src/x_ite/Components/Geometry3D/IndexedFaceSet.js +193 -163
  635. package/src/x_ite/Components/Geometry3D/Sphere.js +17 -19
  636. package/src/x_ite/Components/Geometry3D.js +90 -0
  637. package/src/x_ite/Components/Geospatial/GeoCoordinate.js +124 -61
  638. package/src/x_ite/Components/Geospatial/GeoElevationGrid.js +54 -36
  639. package/src/x_ite/Components/Geospatial/GeoLOD.js +190 -98
  640. package/src/x_ite/Components/Geospatial/GeoLocation.js +8 -10
  641. package/src/x_ite/Components/Geospatial/GeoMetadata.js +2 -4
  642. package/src/x_ite/Components/Geospatial/GeoOrigin.js +2 -4
  643. package/src/x_ite/Components/Geospatial/GeoPositionInterpolator.js +4 -4
  644. package/src/x_ite/Components/Geospatial/GeoProximitySensor.js +10 -7
  645. package/src/x_ite/Components/Geospatial/GeoTouchSensor.js +4 -4
  646. package/src/x_ite/Components/Geospatial/GeoTransform.js +13 -13
  647. package/src/x_ite/Components/Geospatial/GeoViewpoint.js +131 -78
  648. package/src/x_ite/Components/Geospatial/X3DGeospatialObject.js +7 -9
  649. package/src/x_ite/Components/Grouping/Group.js +5 -7
  650. package/src/x_ite/Components/Grouping/StaticGroup.js +194 -22
  651. package/src/x_ite/Components/Grouping/Switch.js +174 -25
  652. package/src/x_ite/Components/Grouping/Transform.js +5 -7
  653. package/src/x_ite/Components/Grouping/X3DBoundedObject.js +70 -16
  654. package/src/x_ite/Components/Grouping/X3DGroupingNode.js +442 -151
  655. package/src/x_ite/Components/Grouping/X3DTransformMatrix3DNode.js +53 -29
  656. package/src/x_ite/Components/Grouping/X3DTransformNode.js +6 -9
  657. package/src/x_ite/Components/Grouping.js +93 -0
  658. package/src/x_ite/Components/{H-Anim → HAnim}/HAnimDisplacer.js +8 -10
  659. package/src/x_ite/Components/HAnim/HAnimHumanoid.js +360 -0
  660. package/src/x_ite/Components/{H-Anim → HAnim}/HAnimJoint.js +108 -23
  661. package/src/x_ite/Components/HAnim/HAnimMotion.js +113 -0
  662. package/src/x_ite/Components/{H-Anim → HAnim}/HAnimSegment.js +14 -14
  663. package/src/x_ite/Components/{H-Anim → HAnim}/HAnimSite.js +14 -16
  664. package/src/x_ite/Components/Interpolation/ColorInterpolator.js +13 -11
  665. package/src/x_ite/Components/Interpolation/CoordinateInterpolator.js +21 -13
  666. package/src/x_ite/Components/Interpolation/CoordinateInterpolator2D.js +19 -11
  667. package/src/x_ite/Components/Interpolation/EaseInEaseOut.js +8 -8
  668. package/src/x_ite/Components/Interpolation/NormalInterpolator.js +28 -14
  669. package/src/x_ite/Components/Interpolation/OrientationInterpolator.js +27 -16
  670. package/src/x_ite/Components/Interpolation/PositionInterpolator.js +10 -8
  671. package/src/x_ite/Components/Interpolation/PositionInterpolator2D.js +10 -8
  672. package/src/x_ite/Components/Interpolation/ScalarInterpolator.js +2 -4
  673. package/src/x_ite/Components/Interpolation/SplinePositionInterpolator.js +7 -9
  674. package/src/x_ite/Components/Interpolation/SplinePositionInterpolator2D.js +7 -9
  675. package/src/x_ite/Components/Interpolation/SplineScalarInterpolator.js +7 -9
  676. package/src/x_ite/Components/Interpolation/SquadOrientationInterpolator.js +10 -11
  677. package/src/x_ite/Components/Interpolation/X3DInterpolatorNode.js +2 -4
  678. package/src/x_ite/Components/Interpolation.js +111 -0
  679. package/src/x_ite/Components/KeyDeviceSensor/KeySensor.js +72 -8
  680. package/src/x_ite/Components/KeyDeviceSensor/StringSensor.js +65 -4
  681. package/src/x_ite/Components/KeyDeviceSensor/X3DKeyDeviceSensorNode.js +5 -29
  682. package/src/x_ite/Components/Layering/Layer.js +14 -6
  683. package/src/x_ite/Components/Layering/LayerSet.js +6 -10
  684. package/src/x_ite/Components/Layering/Viewport.js +10 -12
  685. package/src/x_ite/Components/Layering/X3DLayerNode.js +76 -69
  686. package/src/x_ite/Components/Layering/X3DViewportNode.js +2 -6
  687. package/src/x_ite/Components/Layering.js +84 -0
  688. package/src/x_ite/Components/Layout/Layout.js +163 -173
  689. package/src/x_ite/Components/Layout/LayoutGroup.js +20 -19
  690. package/src/x_ite/Components/Layout/LayoutLayer.js +12 -9
  691. package/src/x_ite/Components/Layout/ScreenFontStyle.js +4 -8
  692. package/src/x_ite/Components/Layout/ScreenGroup.js +63 -56
  693. package/src/x_ite/Components/Layout/X3DLayoutNode.js +2 -4
  694. package/src/x_ite/Components/Lighting/DirectionalLight.js +41 -31
  695. package/src/x_ite/Components/Lighting/PointLight.js +117 -104
  696. package/src/x_ite/Components/Lighting/SpotLight.js +77 -53
  697. package/src/x_ite/Components/Lighting/X3DLightNode.js +90 -68
  698. package/src/x_ite/Components/Lighting.js +81 -0
  699. package/src/x_ite/Components/NURBS/Contour2D.js +47 -5
  700. package/src/x_ite/Components/NURBS/ContourPolyline2D.js +69 -5
  701. package/src/x_ite/Components/NURBS/CoordinateDouble.js +2 -4
  702. package/src/x_ite/Components/NURBS/NurbsCurve.js +140 -10
  703. package/src/x_ite/Components/NURBS/NurbsCurve2D.js +117 -8
  704. package/src/x_ite/Components/NURBS/NurbsOrientationInterpolator.js +139 -10
  705. package/src/x_ite/Components/NURBS/NurbsPatchSurface.js +3 -5
  706. package/src/x_ite/Components/NURBS/NurbsPositionInterpolator.js +125 -10
  707. package/src/x_ite/Components/NURBS/NurbsSet.js +92 -11
  708. package/src/x_ite/Components/NURBS/NurbsSurfaceInterpolator.js +96 -12
  709. package/src/x_ite/Components/NURBS/NurbsSweptSurface.js +88 -7
  710. package/src/x_ite/Components/NURBS/NurbsSwungSurface.js +88 -7
  711. package/src/x_ite/Components/NURBS/NurbsTextureCoordinate.js +62 -13
  712. package/src/x_ite/Components/NURBS/NurbsTrimmedSurface.js +41 -6
  713. package/src/x_ite/Components/NURBS/X3DNurbsControlCurveNode.js +2 -4
  714. package/src/x_ite/Components/NURBS/X3DNurbsSurfaceGeometryNode.js +333 -7
  715. package/src/x_ite/Components/NURBS/X3DParametricGeometryNode.js +9 -5
  716. package/src/x_ite/Components/Navigation/Billboard.js +14 -15
  717. package/src/x_ite/Components/Navigation/Collision.js +13 -12
  718. package/src/x_ite/Components/Navigation/LOD.js +221 -66
  719. package/src/x_ite/Components/Navigation/NavigationInfo.js +110 -99
  720. package/src/x_ite/Components/Navigation/OrthoViewpoint.js +138 -45
  721. package/src/x_ite/Components/Navigation/Viewpoint.js +55 -33
  722. package/src/x_ite/Components/Navigation/ViewpointGroup.js +18 -10
  723. package/src/x_ite/Components/Navigation/X3DViewpointNode.js +241 -181
  724. package/src/x_ite/Components/Navigation.js +93 -0
  725. package/src/x_ite/Components/Networking/Anchor.js +24 -28
  726. package/src/x_ite/Components/Networking/Inline.js +68 -50
  727. package/src/x_ite/Components/Networking/LoadSensor.js +2 -4
  728. package/src/x_ite/Components/Networking/X3DNetworkSensorNode.js +2 -4
  729. package/src/x_ite/Components/Networking/X3DUrlObject.js +93 -11
  730. package/src/x_ite/Components/Networking.js +84 -0
  731. package/src/x_ite/Components/ParticleSystems/BoundedPhysicsModel.js +6 -8
  732. package/src/x_ite/Components/ParticleSystems/ConeEmitter.js +8 -4
  733. package/src/x_ite/Components/ParticleSystems/ExplosionEmitter.js +7 -4
  734. package/src/x_ite/Components/ParticleSystems/ForcePhysicsModel.js +4 -4
  735. package/src/x_ite/Components/ParticleSystems/ParticleSystem.js +451 -287
  736. package/src/x_ite/Components/ParticleSystems/PointEmitter.js +7 -4
  737. package/src/x_ite/Components/ParticleSystems/PolylineEmitter.js +53 -40
  738. package/src/x_ite/Components/ParticleSystems/SurfaceEmitter.js +62 -55
  739. package/src/x_ite/Components/ParticleSystems/VolumeEmitter.js +133 -123
  740. package/src/x_ite/Components/ParticleSystems/WindPhysicsModel.js +25 -22
  741. package/src/x_ite/Components/ParticleSystems/X3DParticleEmitterNode.js +28 -27
  742. package/src/x_ite/Components/ParticleSystems/X3DParticlePhysicsModelNode.js +2 -4
  743. package/src/x_ite/Components/Picking/LinePickSensor.js +253 -10
  744. package/src/x_ite/Components/Picking/PickableGroup.js +121 -10
  745. package/src/x_ite/Components/Picking/PointPickSensor.js +262 -12
  746. package/src/x_ite/Components/Picking/PrimitivePickSensor.js +176 -8
  747. package/src/x_ite/Components/Picking/VolumePickSensor.js +152 -8
  748. package/src/x_ite/Components/Picking/X3DPickSensorNode.js +378 -7
  749. package/src/x_ite/Components/Picking/X3DPickableObject.js +22 -4
  750. package/src/x_ite/Components/PointingDeviceSensor/CylinderSensor.js +33 -15
  751. package/src/x_ite/Components/PointingDeviceSensor/PlaneSensor.js +7 -4
  752. package/src/x_ite/Components/PointingDeviceSensor/SphereSensor.js +2 -4
  753. package/src/x_ite/Components/PointingDeviceSensor/TouchSensor.js +4 -4
  754. package/src/x_ite/Components/PointingDeviceSensor/X3DDragSensorNode.js +4 -4
  755. package/src/x_ite/Components/PointingDeviceSensor/X3DPointingDeviceSensorNode.js +3 -5
  756. package/src/x_ite/Components/PointingDeviceSensor/X3DTouchSensorNode.js +2 -4
  757. package/src/x_ite/Components/PointingDeviceSensor.js +90 -0
  758. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorParallel.js +282 -0
  759. package/src/x_ite/Components/ProjectiveTextureMapping/TextureProjectorPerspective.js +227 -0
  760. package/src/x_ite/Components/ProjectiveTextureMapping/X3DTextureProjectorNode.js +217 -0
  761. package/src/x_ite/Components/Rendering/ClipPlane.js +12 -16
  762. package/src/x_ite/Components/Rendering/Color.js +62 -17
  763. package/src/x_ite/Components/Rendering/ColorRGBA.js +65 -17
  764. package/src/x_ite/Components/Rendering/Coordinate.js +4 -4
  765. package/src/x_ite/Components/Rendering/IndexedLineSet.js +68 -81
  766. package/src/x_ite/Components/Rendering/IndexedTriangleFanSet.js +20 -19
  767. package/src/x_ite/Components/Rendering/IndexedTriangleSet.js +10 -7
  768. package/src/x_ite/Components/Rendering/IndexedTriangleStripSet.js +21 -23
  769. package/src/x_ite/Components/Rendering/LineSet.js +54 -37
  770. package/src/x_ite/Components/Rendering/Normal.js +65 -13
  771. package/src/x_ite/Components/Rendering/PointSet.js +52 -33
  772. package/src/x_ite/Components/Rendering/TriangleFanSet.js +10 -14
  773. package/src/x_ite/Components/Rendering/TriangleSet.js +2 -4
  774. package/src/x_ite/Components/Rendering/TriangleStripSet.js +9 -13
  775. package/src/x_ite/Components/Rendering/X3DColorNode.js +13 -12
  776. package/src/x_ite/Components/Rendering/X3DComposedGeometryNode.js +118 -79
  777. package/src/x_ite/Components/Rendering/X3DCoordinateNode.js +103 -44
  778. package/src/x_ite/Components/Rendering/X3DGeometricPropertyNode.js +2 -4
  779. package/src/x_ite/Components/Rendering/X3DGeometryNode.js +722 -591
  780. package/src/x_ite/Components/Rendering/X3DLineGeometryNode.js +129 -92
  781. package/src/x_ite/Components/Rendering/X3DNormalNode.js +2 -4
  782. package/src/x_ite/Components/Rendering.js +132 -0
  783. package/src/x_ite/Components/RigidBodyPhysics/BallJoint.js +116 -7
  784. package/src/x_ite/Components/RigidBodyPhysics/CollidableOffset.js +199 -11
  785. package/src/x_ite/Components/RigidBodyPhysics/CollidableShape.js +436 -11
  786. package/src/x_ite/Components/RigidBodyPhysics/CollisionCollection.js +118 -10
  787. package/src/x_ite/Components/RigidBodyPhysics/CollisionSensor.js +192 -9
  788. package/src/x_ite/Components/RigidBodyPhysics/CollisionSpace.js +84 -8
  789. package/src/x_ite/Components/RigidBodyPhysics/Contact.js +20 -14
  790. package/src/x_ite/Components/RigidBodyPhysics/DoubleAxisHingeJoint.js +200 -12
  791. package/src/x_ite/Components/RigidBodyPhysics/MotorJoint.js +14 -4
  792. package/src/x_ite/Components/RigidBodyPhysics/RigidBody.js +424 -17
  793. package/src/x_ite/Components/RigidBodyPhysics/RigidBodyCollection.js +295 -19
  794. package/src/x_ite/Components/RigidBodyPhysics/SingleAxisHingeJoint.js +162 -10
  795. package/src/x_ite/Components/RigidBodyPhysics/SliderJoint.js +135 -8
  796. package/src/x_ite/Components/RigidBodyPhysics/UniversalJoint.js +10 -6
  797. package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollidableNode.js +93 -9
  798. package/src/x_ite/Components/RigidBodyPhysics/X3DNBodyCollisionSpaceNode.js +5 -8
  799. package/src/x_ite/Components/RigidBodyPhysics/X3DRigidJointNode.js +150 -4
  800. package/src/x_ite/Components/Scripting/Script.js +156 -105
  801. package/src/x_ite/Components/Scripting/X3DScriptNode.js +3 -7
  802. package/src/x_ite/Components/Shaders/ComposedShader.js +38 -53
  803. package/src/x_ite/Components/Shaders/FloatVertexAttribute.js +38 -15
  804. package/src/x_ite/Components/Shaders/Matrix3VertexAttribute.js +32 -14
  805. package/src/x_ite/Components/Shaders/Matrix4VertexAttribute.js +32 -14
  806. package/src/x_ite/Components/Shaders/PackagedShader.js +19 -17
  807. package/src/x_ite/Components/Shaders/ProgramShader.js +2 -4
  808. package/src/x_ite/Components/Shaders/ShaderPart.js +38 -26
  809. package/src/x_ite/Components/Shaders/ShaderProgram.js +16 -14
  810. package/src/x_ite/Components/Shaders/X3DProgrammableShaderObject.js +836 -699
  811. package/src/x_ite/Components/Shaders/X3DShaderNode.js +61 -101
  812. package/src/x_ite/Components/Shaders/X3DVertexAttributeNode.js +2 -4
  813. package/src/x_ite/Components/Shaders.js +102 -0
  814. package/src/x_ite/Components/Shape/Appearance.js +179 -69
  815. package/src/x_ite/Components/Shape/FillProperties.js +65 -8
  816. package/src/x_ite/Components/Shape/LineProperties.js +29 -9
  817. package/src/x_ite/Components/Shape/Material.js +50 -64
  818. package/src/x_ite/Components/Shape/PointProperties.js +162 -0
  819. package/src/x_ite/Components/Shape/Shape.js +116 -68
  820. package/src/x_ite/Components/Shape/TwoSidedMaterial.js +56 -62
  821. package/src/x_ite/Components/Shape/UnlitMaterial.js +109 -0
  822. package/src/x_ite/Components/Shape/X3DAppearanceChildNode.js +2 -4
  823. package/src/x_ite/Components/Shape/X3DAppearanceNode.js +14 -11
  824. package/src/x_ite/Components/Shape/X3DMaterialNode.js +17 -6
  825. package/src/x_ite/Components/Shape/X3DOneSidedMaterialNode.js +111 -0
  826. package/src/x_ite/Components/Shape/X3DShapeNode.js +54 -29
  827. package/src/x_ite/Components/Shape.js +108 -0
  828. package/src/x_ite/Components/Sound/AudioClip.js +47 -57
  829. package/src/x_ite/Components/Sound/Sound.js +177 -83
  830. package/src/x_ite/Components/Sound/X3DSoundNode.js +2 -4
  831. package/src/x_ite/Components/Sound/X3DSoundSourceNode.js +38 -24
  832. package/src/x_ite/Components/Sound.js +81 -0
  833. package/src/x_ite/Components/Text/FontStyle.js +4 -6
  834. package/src/x_ite/Components/Text/Text.js +21 -18
  835. package/src/x_ite/Components/Text/X3DFontStyleNode.js +58 -93
  836. package/src/x_ite/Components/Text.js +78 -0
  837. package/src/x_ite/Components/Texturing/ImageTexture.js +57 -67
  838. package/src/x_ite/Components/Texturing/MovieTexture.js +59 -70
  839. package/src/x_ite/Components/Texturing/MultiTexture.js +238 -15
  840. package/src/x_ite/Components/Texturing/MultiTextureCoordinate.js +85 -8
  841. package/src/x_ite/Components/Texturing/MultiTextureTransform.js +47 -8
  842. package/src/x_ite/Components/Texturing/PixelTexture.js +61 -27
  843. package/src/x_ite/Components/Texturing/TextureCoordinate.js +72 -22
  844. package/src/x_ite/Components/Texturing/TextureCoordinateGenerator.js +69 -11
  845. package/src/x_ite/Components/Texturing/TextureProperties.js +98 -69
  846. package/src/x_ite/Components/Texturing/TextureTransform.js +58 -52
  847. package/src/x_ite/Components/Texturing/X3DSingleTextureCoordinateNode.js +91 -0
  848. package/src/x_ite/Components/Texturing/X3DSingleTextureNode.js +183 -0
  849. package/src/x_ite/Components/Texturing/X3DSingleTextureTransformNode.js +77 -0
  850. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js +42 -97
  851. package/src/x_ite/Components/Texturing/X3DTexture2DNode.js.~1~ +209 -0
  852. package/src/x_ite/Components/Texturing/X3DTextureCoordinateNode.js +4 -12
  853. package/src/x_ite/Components/Texturing/X3DTextureNode.js +10 -71
  854. package/src/x_ite/Components/Texturing/X3DTextureTransformNode.js +5 -14
  855. package/src/x_ite/Components/Texturing.js +120 -0
  856. package/src/x_ite/Components/Texturing3D/ComposedTexture3D.js +90 -8
  857. package/src/x_ite/Components/Texturing3D/ImageTexture3D.js +106 -16
  858. package/src/x_ite/Components/Texturing3D/PixelTexture3D.js +126 -8
  859. package/src/x_ite/Components/Texturing3D/TextureCoordinate3D.js +75 -25
  860. package/src/x_ite/Components/Texturing3D/TextureCoordinate4D.js +74 -24
  861. package/src/x_ite/Components/Texturing3D/TextureTransform3D.js +42 -36
  862. package/src/x_ite/Components/Texturing3D/TextureTransformMatrix3D.js +19 -16
  863. package/src/x_ite/Components/Texturing3D/X3DTexture3DNode.js +110 -8
  864. package/src/x_ite/Components/Time/TimeSensor.js +68 -38
  865. package/src/x_ite/Components/Time/X3DTimeDependentNode.js +29 -29
  866. package/src/x_ite/Components/Time.js +75 -0
  867. package/src/x_ite/Components/VolumeRendering/BlendedVolumeStyle.js +311 -12
  868. package/src/x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle.js +60 -8
  869. package/src/x_ite/Components/VolumeRendering/CartoonVolumeStyle.js +219 -10
  870. package/src/x_ite/Components/VolumeRendering/ComposedVolumeStyle.js +134 -7
  871. package/src/x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle.js +88 -9
  872. package/src/x_ite/Components/VolumeRendering/IsoSurfaceVolumeData.js +311 -15
  873. package/src/x_ite/Components/VolumeRendering/OpacityMapVolumeStyle.js +87 -7
  874. package/src/x_ite/Components/VolumeRendering/ProjectionVolumeStyle.js +136 -6
  875. package/src/x_ite/Components/VolumeRendering/SegmentedVolumeData.js +224 -13
  876. package/src/x_ite/Components/VolumeRendering/ShadedVolumeStyle.js +193 -12
  877. package/src/x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle.js +87 -10
  878. package/src/x_ite/Components/VolumeRendering/ToneMappedVolumeStyle.js +97 -9
  879. package/src/x_ite/Components/VolumeRendering/VolumeData.js +155 -12
  880. package/src/x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode.js +2 -4
  881. package/src/x_ite/Components/VolumeRendering/X3DVolumeDataNode.js +155 -5
  882. package/src/x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode.js +64 -4
  883. package/src/x_ite/Components/X_ITE/BlendMode.js +206 -0
  884. package/src/x_ite/Components.js +110 -0
  885. package/src/x_ite/Configuration/ComponentInfo.js +21 -15
  886. package/src/x_ite/Configuration/ComponentInfoArray.js +11 -16
  887. package/src/x_ite/Configuration/ProfileInfo.js +10 -10
  888. package/src/x_ite/Configuration/ProfileInfoArray.js +10 -3
  889. package/src/x_ite/Configuration/SupportedComponents.js +312 -303
  890. package/src/x_ite/Configuration/SupportedNodes.js +44 -716
  891. package/src/x_ite/Configuration/SupportedProfiles.js +196 -168
  892. package/src/x_ite/Configuration/UnitInfo.js +22 -8
  893. package/src/x_ite/Configuration/UnitInfoArray.js +2 -3
  894. package/src/x_ite/Configuration/X3DInfoArray.js +46 -26
  895. package/src/x_ite/DEBUG.js +4 -5
  896. package/src/x_ite/Execution/BindableList.js +99 -34
  897. package/src/x_ite/Execution/BindableStack.js +65 -74
  898. package/src/x_ite/Execution/ExportedNode.js +32 -9
  899. package/src/x_ite/Execution/ImportedNode.js +144 -63
  900. package/src/x_ite/Execution/Scene.js +33 -35
  901. package/src/x_ite/Execution/World.js +31 -29
  902. package/src/x_ite/Execution/X3DExecutionContext.js +452 -194
  903. package/src/x_ite/Execution/X3DScene.js +303 -74
  904. package/src/x_ite/{Error.js → Fallback.js} +25 -24
  905. package/src/x_ite/Fields/ArrayFields.js +315 -112
  906. package/src/x_ite/Fields/SFBool.js +11 -10
  907. package/src/x_ite/Fields/SFColor.js +43 -19
  908. package/src/x_ite/Fields/SFColorRGBA.js +40 -18
  909. package/src/x_ite/Fields/SFDouble.js +17 -10
  910. package/src/x_ite/Fields/SFFloat.js +18 -11
  911. package/src/x_ite/Fields/SFImage.js +47 -38
  912. package/src/x_ite/Fields/SFInt32.js +10 -9
  913. package/src/x_ite/Fields/SFMatrix3.js +24 -17
  914. package/src/x_ite/Fields/SFMatrix4.js +24 -17
  915. package/src/x_ite/Fields/SFMatrixPrototypeTemplate.js +15 -8
  916. package/src/x_ite/Fields/SFNode.js +119 -39
  917. package/src/x_ite/Fields/SFNodeCache.js +89 -0
  918. package/src/x_ite/Fields/SFRotation.js +42 -27
  919. package/src/x_ite/Fields/SFString.js +14 -15
  920. package/src/x_ite/Fields/SFTime.js +12 -11
  921. package/src/x_ite/Fields/SFVec2.js +17 -14
  922. package/src/x_ite/Fields/SFVec3.js +23 -17
  923. package/src/x_ite/Fields/SFVec4.js +25 -19
  924. package/src/x_ite/Fields/SFVecPrototypeTemplate.js +51 -19
  925. package/src/x_ite/Fields.js +3 -9
  926. package/src/x_ite/InputOutput/FileLoader.js +264 -181
  927. package/src/x_ite/InputOutput/Generator.js +136 -60
  928. package/src/x_ite/Parser/HTMLSupport.js +3 -596
  929. package/src/x_ite/Parser/JSONParser.js +446 -0
  930. package/src/x_ite/Parser/Parser.js +617 -652
  931. package/src/x_ite/Parser/X3DParser.js +176 -0
  932. package/src/x_ite/Parser/XMLParser.js +359 -94
  933. package/src/x_ite/Prototype/ExternProtoDeclarationArray.js +19 -3
  934. package/src/x_ite/Prototype/ProtoDeclarationArray.js +19 -3
  935. package/src/x_ite/Prototype/X3DExternProtoDeclaration.js +120 -61
  936. package/src/x_ite/Prototype/X3DProtoDeclaration.js +144 -59
  937. package/src/x_ite/Prototype/X3DProtoDeclarationNode.js +16 -18
  938. package/src/x_ite/Rendering/DependentRenderer.js +9 -13
  939. package/src/x_ite/Rendering/{DepthBuffer.js → TextureBuffer.js} +84 -53
  940. package/src/x_ite/Rendering/X3DRenderObject.js +640 -531
  941. package/src/x_ite/Routing/RouteArray.js +38 -16
  942. package/src/x_ite/Routing/X3DRoute.js +67 -68
  943. package/src/x_ite/Routing/X3DRoutingContext.js +6 -6
  944. package/src/x_ite/X3D.js +74 -70
  945. package/src/x_ite.config.js +91 -0
  946. package/src/x_ite.css +175 -53
  947. package/src/x_ite.html +128 -439
  948. package/src/x_ite.js +87 -25
  949. package/tests/{SEE.txt → README.md} +1 -0
  950. package/tests/tests.mdproj +1 -1
  951. package/x_ite.min.html +128 -439
  952. package/.bzrignore +0 -3
  953. package/.npmignore +0 -3
  954. package/AUTHORS.md +0 -6
  955. package/STYLE_GUIDE.md +0 -51
  956. package/X_ITE.sln +0 -56
  957. package/X_ITE.userprefs +0 -13
  958. package/build/build.mdproj +0 -24
  959. package/build/dist.pl +0 -97
  960. package/build/parts/end.frag +0 -10
  961. package/build/parts/start.frag +0 -7
  962. package/dist/LICENCES.txt +0 -344
  963. package/dist/dist.mdproj +0 -45
  964. package/dist/images/logo.128.png +0 -0
  965. package/fonts/fonts.mdproj +0 -29
  966. package/meta/meta.mdproj +0 -35
  967. package/require.build.js +0 -15
  968. package/require.build.min.js +0 -15
  969. package/src/images/logo.128.png +0 -0
  970. package/src/lib/jquery-contextMenu/README.md +0 -355
  971. package/src/lib/jquery-contextMenu/dist/images/cut.png +0 -0
  972. package/src/lib/jquery-contextMenu/dist/images/door.png +0 -0
  973. package/src/lib/jquery-contextMenu/dist/images/page_white_add.png +0 -0
  974. package/src/lib/jquery-contextMenu/dist/images/page_white_copy.png +0 -0
  975. package/src/lib/jquery-contextMenu/dist/images/page_white_delete.png +0 -0
  976. package/src/lib/jquery-contextMenu/dist/images/page_white_edit.png +0 -0
  977. package/src/lib/jquery-contextMenu/dist/images/page_white_paste.png +0 -0
  978. package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.css +0 -155
  979. package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.js +0 -1811
  980. package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.css +0 -16
  981. package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.css.map +0 -1
  982. package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.js +0 -18
  983. package/src/lib/jquery-contextMenu/dist/jquery.contextMenu.min.js.map +0 -1
  984. package/src/lib/jquery-contextMenu/dist/jquery.ui.position.js +0 -517
  985. package/src/lib/jquery-contextMenu/dist/jquery.ui.position.min.js +0 -4
  986. package/src/lib/jquery-contextMenu/package.json +0 -99
  987. package/src/lib/opentype.js/.npmignore +0 -5
  988. package/src/locale/de.mo +0 -0
  989. package/src/locale/fr.mo +0 -0
  990. package/src/require.config.js +0 -51
  991. package/src/src.mdproj +0 -729
  992. package/src/standard/Networking/URI.js +0 -687
  993. package/src/x_ite/Browser/Shaders/BackgroundSphereFragmentShader.fs +0 -29
  994. package/src/x_ite/Browser/Shaders/BackgroundSphereVertexShader.vs +0 -22
  995. package/src/x_ite/Browser/Shaders/Bits/Line3.h +0 -14
  996. package/src/x_ite/Browser/Shaders/Bits/Plane3.h +0 -47
  997. package/src/x_ite/Browser/Shaders/Bits/Random.h +0 -31
  998. package/src/x_ite/Browser/Shaders/Depth.fs +0 -51
  999. package/src/x_ite/Browser/Shaders/Depth.vs +0 -20
  1000. package/src/x_ite/Browser/Shaders/Gouraud.fs +0 -110
  1001. package/src/x_ite/Browser/Shaders/Gouraud.vs +0 -188
  1002. package/src/x_ite/Browser/Shaders/Phong.fs +0 -255
  1003. package/src/x_ite/Browser/Shaders/Phong.vs +0 -38
  1004. package/src/x_ite/Browser/Shaders/PointSet.fs +0 -64
  1005. package/src/x_ite/Browser/Shaders/Wireframe.fs +0 -61
  1006. package/src/x_ite/Browser/Shaders/Wireframe.vs +0 -55
  1007. package/src/x_ite/Components/H-Anim/HAnimHumanoid.js +0 -118
@@ -0,0 +1,3966 @@
1
+ (function () {
2
+
3
+ var
4
+ define = X3D .define,
5
+ require = X3D .require,
6
+ module = { };
7
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
8
+ *******************************************************************************
9
+ *
10
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11
+ *
12
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
13
+ *
14
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
15
+ *
16
+ * The copyright notice above does not evidence any actual of intended
17
+ * publication of such source code, and is an unpublished work by create3000.
18
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
19
+ * create3000.
20
+ *
21
+ * No permission is granted to copy, distribute, or create derivative works from
22
+ * the contents of this software, in whole or in part, without the prior written
23
+ * permission of create3000.
24
+ *
25
+ * NON-MILITARY USE ONLY
26
+ *
27
+ * All create3000 software are effectively free software with a non-military use
28
+ * restriction. It is free. Well commented source is provided. You may reuse the
29
+ * source in any way you please with the exception anything that uses it must be
30
+ * marked to indicate is contains 'non-military use only' components.
31
+ *
32
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
+ *
34
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
35
+ *
36
+ * This file is part of the X_ITE Project.
37
+ *
38
+ * X_ITE is free software: you can redistribute it and/or modify it under the
39
+ * terms of the GNU General Public License version 3 only, as published by the
40
+ * Free Software Foundation.
41
+ *
42
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
43
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
44
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
45
+ * details (a copy is included in the LICENSE file that accompanied this code).
46
+ *
47
+ * You should have received a copy of the GNU General Public License version 3
48
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
49
+ * copy of the GPLv3 License.
50
+ *
51
+ * For Silvio, Joy and Adi.
52
+ *
53
+ ******************************************************************************/
54
+
55
+
56
+ define ('x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode',[
57
+ "x_ite/Components/Core/X3DNode",
58
+ "x_ite/Bits/X3DConstants",
59
+ ],
60
+ function (X3DNode,
61
+ X3DConstants)
62
+ {
63
+ "use strict";
64
+
65
+ function X3DVolumeRenderStyleNode (executionContext)
66
+ {
67
+ X3DNode .call (this, executionContext);
68
+
69
+ this .addType (X3DConstants .X3DVolumeRenderStyleNode);
70
+
71
+ this .volumeDataNodes = new Set ();
72
+ }
73
+
74
+ X3DVolumeRenderStyleNode .prototype = Object .assign (Object .create (X3DNode .prototype),
75
+ {
76
+ constructor: X3DVolumeRenderStyleNode,
77
+ addShaderFields: function (shaderNode)
78
+ { },
79
+ getUniformsText: function ()
80
+ {
81
+ return "";
82
+ },
83
+ getFunctionsText: function ()
84
+ {
85
+ return "";
86
+ },
87
+ getVolumeData: function ()
88
+ {
89
+ return this .volumeDataNodes;
90
+ },
91
+ addVolumeData: function (volumeDataNode)
92
+ {
93
+ this .volumeDataNodes .add (volumeDataNode);
94
+ },
95
+ removeVolumeData: function (volumeDataNode)
96
+ {
97
+ this .volumeDataNodes .delete (volumeDataNode);
98
+ },
99
+ getNormalText: function (surfaceNormalsNode)
100
+ {
101
+ var string = "";
102
+
103
+ if (surfaceNormalsNode)
104
+ {
105
+ string += "uniform sampler3D surfaceNormals_" + this .getId () + ";\n";
106
+
107
+ string += "\n";
108
+ string += "vec4\n";
109
+ string += "getNormal_" + this .getId () + " (in vec3 texCoord)\n";
110
+ string += "{\n";
111
+ string += " vec3 n = texture (surfaceNormals_" + this .getId () + ", texCoord) .xyz * 2.0 - 1.0;\n";
112
+ string += "\n";
113
+ string += " return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n";
114
+ string += "}\n";
115
+ }
116
+ else
117
+ {
118
+ string += "\n";
119
+ string += "vec4\n";
120
+ string += "getNormal_" + this .getId () + " (in vec3 texCoord)\n";
121
+ string += "{\n";
122
+ string += " vec4 offset = vec4 (1.0 / x3d_TextureSize, 0.0);\n";
123
+ string += " float i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n";
124
+ string += " float i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n";
125
+ string += " float i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n";
126
+ string += " float i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n";
127
+ string += " float i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n";
128
+ string += " float i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n";
129
+ string += " vec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n";
130
+ string += "\n";
131
+ string += " return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n";
132
+ string += "}\n";
133
+ }
134
+
135
+ return string;
136
+ },
137
+ });
138
+
139
+ return X3DVolumeRenderStyleNode;
140
+ });
141
+
142
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
143
+ *******************************************************************************
144
+ *
145
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
146
+ *
147
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
148
+ *
149
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
150
+ *
151
+ * The copyright notice above does not evidence any actual of intended
152
+ * publication of such source code, and is an unpublished work by create3000.
153
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
154
+ * create3000.
155
+ *
156
+ * No permission is granted to copy, distribute, or create derivative works from
157
+ * the contents of this software, in whole or in part, without the prior written
158
+ * permission of create3000.
159
+ *
160
+ * NON-MILITARY USE ONLY
161
+ *
162
+ * All create3000 software are effectively free software with a non-military use
163
+ * restriction. It is free. Well commented source is provided. You may reuse the
164
+ * source in any way you please with the exception anything that uses it must be
165
+ * marked to indicate is contains 'non-military use only' components.
166
+ *
167
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
168
+ *
169
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
170
+ *
171
+ * This file is part of the X_ITE Project.
172
+ *
173
+ * X_ITE is free software: you can redistribute it and/or modify it under the
174
+ * terms of the GNU General Public License version 3 only, as published by the
175
+ * Free Software Foundation.
176
+ *
177
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
178
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
179
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
180
+ * details (a copy is included in the LICENSE file that accompanied this code).
181
+ *
182
+ * You should have received a copy of the GNU General Public License version 3
183
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
184
+ * copy of the GPLv3 License.
185
+ *
186
+ * For Silvio, Joy and Adi.
187
+ *
188
+ ******************************************************************************/
189
+
190
+
191
+ define ('x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode',[
192
+ "x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",
193
+ "x_ite/Bits/X3DConstants",
194
+ ],
195
+ function (X3DVolumeRenderStyleNode,
196
+ X3DConstants)
197
+ {
198
+ "use strict";
199
+
200
+ function X3DComposableVolumeRenderStyleNode (executionContext)
201
+ {
202
+ X3DVolumeRenderStyleNode .call (this, executionContext);
203
+
204
+ this .addType (X3DConstants .X3DComposableVolumeRenderStyleNode);
205
+ }
206
+
207
+ X3DComposableVolumeRenderStyleNode .prototype = Object .assign (Object .create (X3DVolumeRenderStyleNode .prototype),
208
+ {
209
+ constructor: X3DComposableVolumeRenderStyleNode,
210
+ });
211
+
212
+ return X3DComposableVolumeRenderStyleNode;
213
+ });
214
+
215
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
216
+ *******************************************************************************
217
+ *
218
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
219
+ *
220
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
221
+ *
222
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
223
+ *
224
+ * The copyright notice above does not evidence any actual of intended
225
+ * publication of such source code, and is an unpublished work by create3000.
226
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
227
+ * create3000.
228
+ *
229
+ * No permission is granted to copy, distribute, or create derivative works from
230
+ * the contents of this software, in whole or in part, without the prior written
231
+ * permission of create3000.
232
+ *
233
+ * NON-MILITARY USE ONLY
234
+ *
235
+ * All create3000 software are effectively free software with a non-military use
236
+ * restriction. It is free. Well commented source is provided. You may reuse the
237
+ * source in any way you please with the exception anything that uses it must be
238
+ * marked to indicate is contains 'non-military use only' components.
239
+ *
240
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
241
+ *
242
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
243
+ *
244
+ * This file is part of the X_ITE Project.
245
+ *
246
+ * X_ITE is free software: you can redistribute it and/or modify it under the
247
+ * terms of the GNU General Public License version 3 only, as published by the
248
+ * Free Software Foundation.
249
+ *
250
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
251
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
252
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
253
+ * details (a copy is included in the LICENSE file that accompanied this code).
254
+ *
255
+ * You should have received a copy of the GNU General Public License version 3
256
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
257
+ * copy of the GPLv3 License.
258
+ *
259
+ * For Silvio, Joy and Adi.
260
+ *
261
+ ******************************************************************************/
262
+
263
+
264
+ define ('x_ite/Components/VolumeRendering/OpacityMapVolumeStyle',[
265
+ "x_ite/Fields",
266
+ "x_ite/Basic/X3DFieldDefinition",
267
+ "x_ite/Basic/FieldDefinitionArray",
268
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
269
+ "x_ite/Bits/X3DConstants",
270
+ "x_ite/Bits/X3DCast",
271
+ ],
272
+ function (Fields,
273
+ X3DFieldDefinition,
274
+ FieldDefinitionArray,
275
+ X3DComposableVolumeRenderStyleNode,
276
+ X3DConstants,
277
+ X3DCast)
278
+ {
279
+ "use strict";
280
+
281
+ function OpacityMapVolumeStyle (executionContext)
282
+ {
283
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
284
+
285
+ this .addType (X3DConstants .OpacityMapVolumeStyle);
286
+ }
287
+
288
+ OpacityMapVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
289
+ {
290
+ constructor: OpacityMapVolumeStyle,
291
+ fieldDefinitions: new FieldDefinitionArray ([
292
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
293
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
294
+ new X3DFieldDefinition (X3DConstants .inputOutput, "transferFunction", new Fields .SFNode ()),
295
+ ]),
296
+ getTypeName: function ()
297
+ {
298
+ return "OpacityMapVolumeStyle";
299
+ },
300
+ getComponentName: function ()
301
+ {
302
+ return "VolumeRendering";
303
+ },
304
+ getContainerField: function ()
305
+ {
306
+ return "renderStyle";
307
+ },
308
+ initialize: function ()
309
+ {
310
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
311
+
312
+ var gl = this .getBrowser () .getContext ();
313
+
314
+ if (gl .getVersion () < 2)
315
+ return;
316
+
317
+ this .transferFunction_ .addInterest ("set_transferFunction__", this);
318
+
319
+ this .set_transferFunction__ ();
320
+ },
321
+ set_transferFunction__: function ()
322
+ {
323
+ this .transferFunctionNode = X3DCast (X3DConstants .X3DTexture2DNode, this .transferFunction_);
324
+
325
+ if (! this .transferFunctionNode)
326
+ this .transferFunctionNode = X3DCast (X3DConstants .X3DTexture3DNode, this .transferFunction_);
327
+
328
+ if (! this .transferFunctionNode)
329
+ this .transferFunctionNode = this .getBrowser () .getDefaultTransferFunction ();
330
+ },
331
+ addShaderFields: function (shaderNode)
332
+ {
333
+ if (! this .enabled_ .getValue ())
334
+ return;
335
+
336
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "transferFunction_" + this .getId (), new Fields .SFNode (this .transferFunctionNode));
337
+ },
338
+ getUniformsText: function ()
339
+ {
340
+ if (! this .enabled_ .getValue ())
341
+ return "";
342
+
343
+ var string = "";
344
+
345
+ string += "\n";
346
+ string += "// OpacityMapVolumeStyle\n";
347
+ string += "\n";
348
+
349
+ if (this .transferFunctionNode .getType () .indexOf (X3DConstants .X3DTexture2DNode) !== -1)
350
+ {
351
+ string += "uniform sampler2D transferFunction_" + this .getId () + ";\n";
352
+
353
+ string += "\n";
354
+ string += "vec4\n";
355
+ string += "getOpacityMapStyle_" + this .getId () + " (in vec4 originalColor)\n";
356
+ string += "{\n";
357
+ string += " return texture (transferFunction_" + this .getId () + ", originalColor .rg);\n";
358
+ string += "}\n";
359
+ }
360
+ else
361
+ {
362
+ string += "uniform sampler3D transferFunction_" + this .getId () + ";\n";
363
+
364
+ string += "\n";
365
+ string += "vec4\n";
366
+ string += "getOpacityMapStyle_" + this .getId () + " (in vec4 originalColor)\n";
367
+ string += "{\n";
368
+ string += " return texture (transferFunction_" + this .getId () + ", originalColor .rgb);\n";
369
+ string += "}\n";
370
+ }
371
+
372
+ return string;
373
+ },
374
+ getFunctionsText: function ()
375
+ {
376
+ if (! this .enabled_ .getValue ())
377
+ return "";
378
+
379
+ var string = "";
380
+
381
+ string += "\n";
382
+ string += " // OpacityMapVolumeStyle\n";
383
+ string += "\n";
384
+ string += " textureColor = getOpacityMapStyle_" + this .getId () + " (textureColor);\n";
385
+
386
+ return string;
387
+ },
388
+ });
389
+
390
+ return OpacityMapVolumeStyle;
391
+ });
392
+
393
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
394
+ *******************************************************************************
395
+ *
396
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
397
+ *
398
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
399
+ *
400
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
401
+ *
402
+ * The copyright notice above does not evidence any actual of intended
403
+ * publication of such source code, and is an unpublished work by create3000.
404
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
405
+ * create3000.
406
+ *
407
+ * No permission is granted to copy, distribute, or create derivative works from
408
+ * the contents of this software, in whole or in part, without the prior written
409
+ * permission of create3000.
410
+ *
411
+ * NON-MILITARY USE ONLY
412
+ *
413
+ * All create3000 software are effectively free software with a non-military use
414
+ * restriction. It is free. Well commented source is provided. You may reuse the
415
+ * source in any way you please with the exception anything that uses it must be
416
+ * marked to indicate is contains 'non-military use only' components.
417
+ *
418
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
419
+ *
420
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
421
+ *
422
+ * This file is part of the X_ITE Project.
423
+ *
424
+ * X_ITE is free software: you can redistribute it and/or modify it under the
425
+ * terms of the GNU General Public License version 3 only, as published by the
426
+ * Free Software Foundation.
427
+ *
428
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
429
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
430
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
431
+ * details (a copy is included in the LICENSE file that accompanied this code).
432
+ *
433
+ * You should have received a copy of the GNU General Public License version 3
434
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
435
+ * copy of the GPLv3 License.
436
+ *
437
+ * For Silvio, Joy and Adi.
438
+ *
439
+ ******************************************************************************/
440
+
441
+
442
+ define ('x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext',[
443
+ "x_ite/Components/Texturing/PixelTexture",
444
+ "x_ite/Components/Texturing/TextureProperties",
445
+ "x_ite/Components/VolumeRendering/OpacityMapVolumeStyle",
446
+ ],
447
+ function (PixelTexture,
448
+ TextureProperties,
449
+ OpacityMapVolumeStyle)
450
+ {
451
+ "use strict";
452
+
453
+ function X3DVolumeRenderingContext () { }
454
+
455
+ X3DVolumeRenderingContext .prototype =
456
+ {
457
+ getDefaultVolumeStyle: function ()
458
+ {
459
+ this .defaultVolumeStyle = new OpacityMapVolumeStyle (this .getPrivateScene ());
460
+ this .defaultVolumeStyle .setup ();
461
+
462
+ this .getDefaultVolumeStyle = function () { return this .defaultVolumeStyle; };
463
+
464
+ return this .defaultVolumeStyle;
465
+ },
466
+ getDefaultBlendedVolumeStyle: function ()
467
+ {
468
+ this .defaultBlendedVolumeStyle = new OpacityMapVolumeStyle (this .getPrivateScene ());
469
+ this .defaultBlendedVolumeStyle .setup ();
470
+
471
+ this .getDefaultBlendedVolumeStyle = function () { return this .defaultBlendedVolumeStyle; };
472
+
473
+ return this .defaultBlendedVolumeStyle;
474
+ },
475
+ getDefaultTransferFunction: function ()
476
+ {
477
+ this .defaultTransferFunction = new PixelTexture (this .getPrivateScene ());
478
+
479
+ var textureProperties = new TextureProperties (this .getPrivateScene ());
480
+
481
+ textureProperties .generateMipMaps_ = true;
482
+ textureProperties .boundaryModeS_ = "CLAMP_TO_EDGE";
483
+ textureProperties .boundaryModeT_ = "REPEAT";
484
+
485
+ this .defaultTransferFunction .textureProperties_ = textureProperties;
486
+
487
+ this .defaultTransferFunction .image_ .width = 256;
488
+ this .defaultTransferFunction .image_ .height = 1;
489
+ this .defaultTransferFunction .image_ .comp = 2;
490
+
491
+ var array = this .defaultTransferFunction .image_ .array;
492
+
493
+ for (var i = 0; i < 256; ++ i)
494
+ array [i] = (i << 8) | i;
495
+
496
+ textureProperties .setup ();
497
+ this .defaultTransferFunction .setup ();
498
+
499
+ this .getDefaultTransferFunction = function () { return this .defaultTransferFunction; };
500
+
501
+ return this .defaultTransferFunction;
502
+ },
503
+ };
504
+
505
+ return X3DVolumeRenderingContext;
506
+ });
507
+
508
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
509
+ *******************************************************************************
510
+ *
511
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
512
+ *
513
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
514
+ *
515
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
516
+ *
517
+ * The copyright notice above does not evidence any actual of intended
518
+ * publication of such source code, and is an unpublished work by create3000.
519
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
520
+ * create3000.
521
+ *
522
+ * No permission is granted to copy, distribute, or create derivative works from
523
+ * the contents of this software, in whole or in part, without the prior written
524
+ * permission of create3000.
525
+ *
526
+ * NON-MILITARY USE ONLY
527
+ *
528
+ * All create3000 software are effectively free software with a non-military use
529
+ * restriction. It is free. Well commented source is provided. You may reuse the
530
+ * source in any way you please with the exception anything that uses it must be
531
+ * marked to indicate is contains 'non-military use only' components.
532
+ *
533
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
534
+ *
535
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
536
+ *
537
+ * This file is part of the X_ITE Project.
538
+ *
539
+ * X_ITE is free software: you can redistribute it and/or modify it under the
540
+ * terms of the GNU General Public License version 3 only, as published by the
541
+ * Free Software Foundation.
542
+ *
543
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
544
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
545
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
546
+ * details (a copy is included in the LICENSE file that accompanied this code).
547
+ *
548
+ * You should have received a copy of the GNU General Public License version 3
549
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
550
+ * copy of the GPLv3 License.
551
+ *
552
+ * For Silvio, Joy and Adi.
553
+ *
554
+ ******************************************************************************/
555
+
556
+
557
+ define ('x_ite/Components/VolumeRendering/BlendedVolumeStyle',[
558
+ "x_ite/Fields",
559
+ "x_ite/Basic/X3DFieldDefinition",
560
+ "x_ite/Basic/FieldDefinitionArray",
561
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
562
+ "x_ite/Bits/X3DConstants",
563
+ "x_ite/Bits/X3DCast",
564
+ "x_ite/DEBUG",
565
+ ],
566
+ function (Fields,
567
+ X3DFieldDefinition,
568
+ FieldDefinitionArray,
569
+ X3DComposableVolumeRenderStyleNode,
570
+ X3DConstants,
571
+ X3DCast,
572
+ DEBUG)
573
+ {
574
+ "use strict";
575
+
576
+ function BlendedVolumeStyle (executionContext)
577
+ {
578
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
579
+
580
+ this .addType (X3DConstants .BlendedVolumeStyle);
581
+ }
582
+
583
+ BlendedVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
584
+ {
585
+ constructor: BlendedVolumeStyle,
586
+ fieldDefinitions: new FieldDefinitionArray ([
587
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
588
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
589
+ new X3DFieldDefinition (X3DConstants .inputOutput, "weightConstant1", new Fields .SFFloat (0.5)),
590
+ new X3DFieldDefinition (X3DConstants .inputOutput, "weightConstant2", new Fields .SFFloat (0.5)),
591
+ new X3DFieldDefinition (X3DConstants .inputOutput, "weightFunction1", new Fields .SFString ("CONSTANT")),
592
+ new X3DFieldDefinition (X3DConstants .inputOutput, "weightFunction2", new Fields .SFString ("CONSTANT")),
593
+ new X3DFieldDefinition (X3DConstants .inputOutput, "weightTransferFunction1", new Fields .SFNode ()),
594
+ new X3DFieldDefinition (X3DConstants .inputOutput, "weightTransferFunction2", new Fields .SFNode ()),
595
+ new X3DFieldDefinition (X3DConstants .inputOutput, "renderStyle", new Fields .SFNode ()),
596
+ new X3DFieldDefinition (X3DConstants .inputOutput, "voxels", new Fields .SFNode ()),
597
+ ]),
598
+ getTypeName: function ()
599
+ {
600
+ return "BlendedVolumeStyle";
601
+ },
602
+ getComponentName: function ()
603
+ {
604
+ return "VolumeRendering";
605
+ },
606
+ getContainerField: function ()
607
+ {
608
+ return "renderStyle";
609
+ },
610
+ initialize: function ()
611
+ {
612
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
613
+
614
+ var gl = this .getBrowser () .getContext ();
615
+
616
+ if (gl .getVersion () < 2)
617
+ return;
618
+
619
+ this .weightTransferFunction1_ .addInterest ("set_weightTransferFunction1__", this);
620
+ this .weightTransferFunction2_ .addInterest ("set_weightTransferFunction2__", this);
621
+ this .renderStyle_ .addInterest ("set_renderStyle__", this);
622
+ this .voxels_ .addInterest ("set_voxels__", this);
623
+
624
+ this .set_weightTransferFunction1__ ();
625
+ this .set_weightTransferFunction2__ ();
626
+ this .set_renderStyle__ ();
627
+ this .set_voxels__ ();
628
+ },
629
+ addVolumeData: function (volumeDataNode)
630
+ {
631
+ X3DComposableVolumeRenderStyleNode .prototype .addVolumeData .call (this, volumeDataNode);
632
+
633
+ if (this .renderStyleNode)
634
+ this .renderStyleNode .addVolumeData (volumeDataNode);
635
+ },
636
+ removeVolumeData: function (volumeDataNode)
637
+ {
638
+ X3DComposableVolumeRenderStyleNode .prototype .removeVolumeData .call (this, volumeDataNode);
639
+
640
+ if (this .renderStyleNode)
641
+ this .renderStyleNode .removeVolumeData (volumeDataNode);
642
+ },
643
+ set_weightTransferFunction1__: function ()
644
+ {
645
+ this .weightTransferFunction1Node = X3DCast (X3DConstants .X3DTexture2DNode, this .weightTransferFunction1_);
646
+ },
647
+ set_weightTransferFunction2__: function ()
648
+ {
649
+ this .weightTransferFunction2Node = X3DCast (X3DConstants .X3DTexture2DNode, this .weightTransferFunction2_);
650
+ },
651
+ set_renderStyle__: function ()
652
+ {
653
+ if (this .renderStyleNode)
654
+ {
655
+ this .renderStyleNode .removeInterest ("addNodeEvent", this);
656
+
657
+ this .getVolumeData () .forEach (function (volumeDataNode)
658
+ {
659
+ this .renderStyleNode .removeVolumeData (volumeDataNode);
660
+ }
661
+ .bind (this));
662
+ }
663
+
664
+ this .renderStyleNode = X3DCast (X3DConstants .X3DComposableVolumeRenderStyleNode, this .renderStyle_);
665
+
666
+ if (this .renderStyleNode)
667
+ {
668
+ this .renderStyleNode .addInterest ("addNodeEvent", this);
669
+
670
+ this .getVolumeData () .forEach (function (volumeDataNode)
671
+ {
672
+ this .renderStyleNode .addVolumeData (volumeDataNode);
673
+ }
674
+ .bind (this));
675
+ }
676
+ },
677
+ set_voxels__: function ()
678
+ {
679
+ if (this .voxelsNode)
680
+ this .voxelsNode .removeInterest ("set_textureSize__", this);
681
+
682
+ this .voxelsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .voxels_);
683
+
684
+ if (this .voxelsNode)
685
+ {
686
+ this .voxelsNode .addInterest ("set_textureSize__", this);
687
+
688
+ this .set_textureSize__ ();
689
+ }
690
+ },
691
+ set_textureSize__: function ()
692
+ {
693
+ this .getVolumeData () .forEach (function (volumeDataNode)
694
+ {
695
+ try
696
+ {
697
+ var textureSize = volumeDataNode .getShader () .getField ("textureSize_" + this .getId ());
698
+
699
+ textureSize .x = this .voxelsNode .getWidth ();
700
+ textureSize .y = this .voxelsNode .getHeight ();
701
+ textureSize .z = this .voxelsNode .getDepth ();
702
+ }
703
+ catch (error)
704
+ {
705
+ if (DEBUG)
706
+ console .log (error);
707
+ }
708
+ }
709
+ .bind (this));
710
+ },
711
+ addShaderFields: function (shaderNode)
712
+ {
713
+ if (! this .enabled_ .getValue ())
714
+ return;
715
+
716
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "weightConstant1_" + this .getId (), this .weightConstant1_ .copy ());
717
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "weightConstant2_" + this .getId (), this .weightConstant2_ .copy ());
718
+
719
+ if (this .weightTransferFunction1Node)
720
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "weightTransferFunction1_" + this .getId (), new Fields .SFNode (this .weightTransferFunction1Node));
721
+
722
+ if (this .weightTransferFunction2Node)
723
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "weightTransferFunction2_" + this .getId (), new Fields .SFNode (this .weightTransferFunction2Node));
724
+
725
+ if (this .voxelsNode)
726
+ {
727
+ var textureSize = new Fields .SFVec3f (this .voxelsNode .getWidth (), this .voxelsNode .getHeight (), this .voxelsNode .getDepth ());
728
+
729
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "voxels_" + this .getId (), new Fields .SFNode (this .voxelsNode));
730
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "textureSize_" + this .getId (), textureSize);
731
+ }
732
+ else
733
+ {
734
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "textureSize_" + this .getId (), new Fields .SFVec3f ());
735
+ }
736
+
737
+ this .getBrowser () .getDefaultBlendedVolumeStyle () .addShaderFields (shaderNode);
738
+
739
+ if (this .renderStyleNode)
740
+ this .renderStyleNode .addShaderFields (shaderNode);
741
+ },
742
+ getUniformsText: function ()
743
+ {
744
+ if (! this .enabled_ .getValue ())
745
+ return "";
746
+
747
+ if (! this .voxelsNode)
748
+ return "";
749
+
750
+ var string = "";
751
+
752
+ string += "\n";
753
+ string += "// BlendedVolumeStyle\n";
754
+ string += "\n";
755
+ string += "uniform float weightConstant1_" + this .getId () + ";\n";
756
+ string += "uniform float weightConstant2_" + this .getId () + ";\n";
757
+
758
+ if (this .weightTransferFunction1Node)
759
+ string += "uniform sampler2D weightTransferFunction1_" + this .getId () + ";\n";
760
+
761
+ if (this .weightTransferFunction2Node)
762
+ string += "uniform sampler2D weightTransferFunction2_" + this .getId () + ";\n";
763
+
764
+ string += "uniform sampler3D voxels_" + this .getId () + ";\n";
765
+ string += "uniform vec3 textureSize_" + this .getId () + ";\n";
766
+
767
+ var uniformsText = this .getBrowser () .getDefaultBlendedVolumeStyle () .getUniformsText ();
768
+
769
+ if (this .renderStyleNode)
770
+ uniformsText += this .renderStyleNode .getUniformsText ();
771
+
772
+ uniformsText = uniformsText .replace (/x3d_Texture3D \[0\]/g, "voxels_" + this .getId ());
773
+ uniformsText = uniformsText .replace (/x3d_TextureSize/g, "textureSize_" + this .getId ());
774
+
775
+ string += "\n";
776
+ string += uniformsText;
777
+
778
+ string += "\n";
779
+ string += "vec4\n";
780
+ string += "getBlendedStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
781
+ string += "{\n";
782
+
783
+ string += " vec4 blendColor_" + this .getId () + " = texture (voxels_" + this .getId () + ", texCoord);";
784
+
785
+ var functionsText = this .getBrowser () .getDefaultBlendedVolumeStyle () .getFunctionsText ();
786
+
787
+ if (this .renderStyleNode)
788
+ functionsText += this .renderStyleNode .getFunctionsText ();
789
+
790
+ functionsText = functionsText .replace (/textureColor/g, "blendColor_" + this .getId ());
791
+
792
+ string += "\n";
793
+ string += functionsText;
794
+
795
+ switch (this .weightFunction1_ .getValue ())
796
+ {
797
+ default: // CONSTANT
798
+ {
799
+ string += " float w1_" + this .getId () + " = weightConstant1_" + this .getId () + ";\n";
800
+ break;
801
+ }
802
+ case "ALPHA0":
803
+ {
804
+ string += " float w1_" + this .getId () + " = originalColor .a;\n";
805
+ break;
806
+ }
807
+ case "ALPHA1":
808
+ {
809
+ string += " float w1_" + this .getId () + " = blendColor_ " + this .getId () + " .a;\n";
810
+ break;
811
+ }
812
+ case "ONE_MINUS_ALPHA0":
813
+ {
814
+ string += " float w1_" + this .getId () + " = 1.0 - originalColor .a;\n";
815
+ break;
816
+ }
817
+ case "ONE_MINUS_ALPHA1":
818
+ {
819
+ string += " float w1_" + this .getId () + " = 1.0 - blendColor_ " + this .getId () + " .a;\n";
820
+ break;
821
+ }
822
+ case "TABLE":
823
+ {
824
+ if (this .weightTransferFunction1Node)
825
+ {
826
+ string += " float w1_" + this .getId () + " = texture (weightTransferFunction1_" + this .getId () + ", vec2 (originalColor .a, blendColor_" + this .getId () + " .a)) .r;\n";
827
+ }
828
+ else
829
+ {
830
+ // Use default CONSTANT value.
831
+ string += " float w1_" + this .getId () + " = weightConstant1_" + this .getId () + ";\n";
832
+ }
833
+
834
+ break;
835
+ }
836
+ }
837
+
838
+ switch (this .weightFunction2_ .getValue ())
839
+ {
840
+ default: // CONSTANT
841
+ {
842
+ string += " float w2_" + this .getId () + " = weightConstant2_" + this .getId () + ";\n";
843
+ break;
844
+ }
845
+ case "ALPHA0":
846
+ {
847
+ string += " float w2_" + this .getId () + " = originalColor .a;\n";
848
+ break;
849
+ }
850
+ case "ALPHA1":
851
+ {
852
+ string += " float w2_" + this .getId () + " = blendColor_ " + this .getId () + " .a;\n";
853
+ break;
854
+ }
855
+ case "ONE_MINUS_ALPHA0":
856
+ {
857
+ string += " float w2_" + this .getId () + " = 1.0 - originalColor .a;\n";
858
+ break;
859
+ }
860
+ case "ONE_MINUS_ALPHA1":
861
+ {
862
+ string += " float w2_" + this .getId () + " = 1.0 - blendColor_ " + this .getId () + " .a;\n";
863
+ break;
864
+ }
865
+ case "TABLE":
866
+ {
867
+ if (this .weightTransferFunction2Node)
868
+ {
869
+ string += " float w2_" + this .getId () + " = texture (weightTransferFunction2_" + this .getId () + ", vec2 (originalColor .a, blendColor_" + this .getId () + " .a)) .r;\n";
870
+ }
871
+ else
872
+ {
873
+ // Use default CONSTANT value.
874
+ string += " float w2_" + this .getId () + " = weightConstant2_" + this .getId () + ";\n";
875
+ }
876
+
877
+ break;
878
+ }
879
+ }
880
+
881
+ string += "\n";
882
+ string += " return clamp (originalColor * w1_" + this .getId () + " + blendColor_" + this .getId () + " * w2_" + this .getId () + ", 0.0, 1.0);\n";
883
+ string += "}\n";
884
+
885
+ return string;
886
+ },
887
+ getFunctionsText: function ()
888
+ {
889
+ if (! this .enabled_ .getValue ())
890
+ return "";
891
+
892
+ if (! this .voxelsNode)
893
+ return "";
894
+
895
+ var string = "";
896
+
897
+ string += "\n";
898
+ string += " // BlendedVolumeStyle\n";
899
+ string += "\n";
900
+ string += " textureColor = getBlendedStyle_" + this .getId () + " (textureColor, texCoord);\n";
901
+
902
+ return string;
903
+ },
904
+ });
905
+
906
+ return BlendedVolumeStyle;
907
+ });
908
+
909
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
910
+ *******************************************************************************
911
+ *
912
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
913
+ *
914
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
915
+ *
916
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
917
+ *
918
+ * The copyright notice above does not evidence any actual of intended
919
+ * publication of such source code, and is an unpublished work by create3000.
920
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
921
+ * create3000.
922
+ *
923
+ * No permission is granted to copy, distribute, or create derivative works from
924
+ * the contents of this software, in whole or in part, without the prior written
925
+ * permission of create3000.
926
+ *
927
+ * NON-MILITARY USE ONLY
928
+ *
929
+ * All create3000 software are effectively free software with a non-military use
930
+ * restriction. It is free. Well commented source is provided. You may reuse the
931
+ * source in any way you please with the exception anything that uses it must be
932
+ * marked to indicate is contains 'non-military use only' components.
933
+ *
934
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
935
+ *
936
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
937
+ *
938
+ * This file is part of the X_ITE Project.
939
+ *
940
+ * X_ITE is free software: you can redistribute it and/or modify it under the
941
+ * terms of the GNU General Public License version 3 only, as published by the
942
+ * Free Software Foundation.
943
+ *
944
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
945
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
946
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
947
+ * details (a copy is included in the LICENSE file that accompanied this code).
948
+ *
949
+ * You should have received a copy of the GNU General Public License version 3
950
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
951
+ * copy of the GPLv3 License.
952
+ *
953
+ * For Silvio, Joy and Adi.
954
+ *
955
+ ******************************************************************************/
956
+
957
+
958
+ define ('x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle',[
959
+ "x_ite/Fields",
960
+ "x_ite/Basic/X3DFieldDefinition",
961
+ "x_ite/Basic/FieldDefinitionArray",
962
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
963
+ "x_ite/Bits/X3DConstants",
964
+ ],
965
+ function (Fields,
966
+ X3DFieldDefinition,
967
+ FieldDefinitionArray,
968
+ X3DComposableVolumeRenderStyleNode,
969
+ X3DConstants)
970
+ {
971
+ "use strict";
972
+
973
+ function BoundaryEnhancementVolumeStyle (executionContext)
974
+ {
975
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
976
+
977
+ this .addType (X3DConstants .BoundaryEnhancementVolumeStyle);
978
+ }
979
+
980
+ BoundaryEnhancementVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
981
+ {
982
+ constructor: BoundaryEnhancementVolumeStyle,
983
+ fieldDefinitions: new FieldDefinitionArray ([
984
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
985
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
986
+ new X3DFieldDefinition (X3DConstants .inputOutput, "retainedOpacity", new Fields .SFFloat (0.2)),
987
+ new X3DFieldDefinition (X3DConstants .inputOutput, "boundaryOpacity", new Fields .SFFloat (0.9)),
988
+ new X3DFieldDefinition (X3DConstants .inputOutput, "opacityFactor", new Fields .SFFloat (2)),
989
+ ]),
990
+ getTypeName: function ()
991
+ {
992
+ return "BoundaryEnhancementVolumeStyle";
993
+ },
994
+ getComponentName: function ()
995
+ {
996
+ return "VolumeRendering";
997
+ },
998
+ getContainerField: function ()
999
+ {
1000
+ return "renderStyle";
1001
+ },
1002
+ addShaderFields: function (shaderNode)
1003
+ {
1004
+ if (! this .enabled_ .getValue ())
1005
+ return;
1006
+
1007
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "retainedOpacity_" + this .getId (), this .retainedOpacity_ .copy ());
1008
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "boundaryOpacity_" + this .getId (), this .boundaryOpacity_ .copy ());
1009
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "opacityFactor_" + this .getId (), this .opacityFactor_ .copy ());
1010
+ },
1011
+ getUniformsText: function ()
1012
+ {
1013
+ if (! this .enabled_ .getValue ())
1014
+ return "";
1015
+
1016
+ var string = "";
1017
+
1018
+ string += "\n";
1019
+ string += "// BoundaryEnhancementVolumeStyle\n";
1020
+ string += "\n";
1021
+ string += "uniform float retainedOpacity_" + this .getId () + ";\n";
1022
+ string += "uniform float boundaryOpacity_" + this .getId () + ";\n";
1023
+ string += "uniform float opacityFactor_" + this .getId () + ";\n";
1024
+
1025
+ string += "\n";
1026
+ string += "vec4\n";
1027
+ string += "getBoundaryEnhancementStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
1028
+ string += "{\n";
1029
+ string += " float f0 = texture (x3d_Texture3D [0], texCoord) .r;\n";
1030
+ string += " float f1 = texture (x3d_Texture3D [0], texCoord + vec3 (0.0, 0.0, 1.0 / x3d_TextureSize .z)) .r;\n";
1031
+ string += " float f = abs (f0 - f1);\n";
1032
+ string += "\n";
1033
+ string += " float retainedOpacity = retainedOpacity_" + this .getId () + ";\n";
1034
+ string += " float boundaryOpacity = boundaryOpacity_" + this .getId () + ";\n";
1035
+ string += " float opacityFactor = opacityFactor_" + this .getId () + ";\n";
1036
+ string += "\n";
1037
+ string += " return vec4 (originalColor .rgb, originalColor .a * (retainedOpacity + boundaryOpacity * pow (f, opacityFactor)));\n";
1038
+ string += "}\n";
1039
+
1040
+ return string;
1041
+ },
1042
+ getFunctionsText: function ()
1043
+ {
1044
+ if (! this .enabled_ .getValue ())
1045
+ return "";
1046
+
1047
+ var string = "";
1048
+
1049
+ string += "\n";
1050
+ string += " // BoundaryEnhancementVolumeStyle\n";
1051
+ string += "\n";
1052
+ string += " textureColor = getBoundaryEnhancementStyle_" + this .getId () + " (textureColor, texCoord);\n";
1053
+
1054
+ return string;
1055
+ },
1056
+ });
1057
+
1058
+ return BoundaryEnhancementVolumeStyle;
1059
+ });
1060
+
1061
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1062
+ *******************************************************************************
1063
+ *
1064
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1065
+ *
1066
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
1067
+ *
1068
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
1069
+ *
1070
+ * The copyright notice above does not evidence any actual of intended
1071
+ * publication of such source code, and is an unpublished work by create3000.
1072
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
1073
+ * create3000.
1074
+ *
1075
+ * No permission is granted to copy, distribute, or create derivative works from
1076
+ * the contents of this software, in whole or in part, without the prior written
1077
+ * permission of create3000.
1078
+ *
1079
+ * NON-MILITARY USE ONLY
1080
+ *
1081
+ * All create3000 software are effectively free software with a non-military use
1082
+ * restriction. It is free. Well commented source is provided. You may reuse the
1083
+ * source in any way you please with the exception anything that uses it must be
1084
+ * marked to indicate is contains 'non-military use only' components.
1085
+ *
1086
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1087
+ *
1088
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
1089
+ *
1090
+ * This file is part of the X_ITE Project.
1091
+ *
1092
+ * X_ITE is free software: you can redistribute it and/or modify it under the
1093
+ * terms of the GNU General Public License version 3 only, as published by the
1094
+ * Free Software Foundation.
1095
+ *
1096
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
1097
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1098
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
1099
+ * details (a copy is included in the LICENSE file that accompanied this code).
1100
+ *
1101
+ * You should have received a copy of the GNU General Public License version 3
1102
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
1103
+ * copy of the GPLv3 License.
1104
+ *
1105
+ * For Silvio, Joy and Adi.
1106
+ *
1107
+ ******************************************************************************/
1108
+
1109
+
1110
+ define ('x_ite/Components/VolumeRendering/CartoonVolumeStyle',[
1111
+ "x_ite/Fields",
1112
+ "x_ite/Basic/X3DFieldDefinition",
1113
+ "x_ite/Basic/FieldDefinitionArray",
1114
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
1115
+ "x_ite/Bits/X3DConstants",
1116
+ "x_ite/Bits/X3DCast",
1117
+ ],
1118
+ function (Fields,
1119
+ X3DFieldDefinition,
1120
+ FieldDefinitionArray,
1121
+ X3DComposableVolumeRenderStyleNode,
1122
+ X3DConstants,
1123
+ X3DCast)
1124
+ {
1125
+ "use strict";
1126
+
1127
+ function CartoonVolumeStyle (executionContext)
1128
+ {
1129
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
1130
+
1131
+ this .addType (X3DConstants .CartoonVolumeStyle);
1132
+ }
1133
+
1134
+ CartoonVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
1135
+ {
1136
+ constructor: CartoonVolumeStyle,
1137
+ fieldDefinitions: new FieldDefinitionArray ([
1138
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1139
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1140
+ new X3DFieldDefinition (X3DConstants .inputOutput, "colorSteps", new Fields .SFInt32 (4)),
1141
+ new X3DFieldDefinition (X3DConstants .inputOutput, "orthogonalColor", new Fields .SFColorRGBA (1, 1, 1, 1)),
1142
+ new X3DFieldDefinition (X3DConstants .inputOutput, "parallelColor", new Fields .SFColorRGBA (0, 0, 0, 1)),
1143
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceNormals", new Fields .SFNode ()),
1144
+ ]),
1145
+ getTypeName: function ()
1146
+ {
1147
+ return "CartoonVolumeStyle";
1148
+ },
1149
+ getComponentName: function ()
1150
+ {
1151
+ return "VolumeRendering";
1152
+ },
1153
+ getContainerField: function ()
1154
+ {
1155
+ return "renderStyle";
1156
+ },
1157
+ initialize: function ()
1158
+ {
1159
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
1160
+
1161
+ var gl = this .getBrowser () .getContext ();
1162
+
1163
+ if (gl .getVersion () < 2)
1164
+ return;
1165
+
1166
+ this .surfaceNormals_ .addInterest ("set_surfaceNormals__", this);
1167
+
1168
+ this .set_surfaceNormals__ ();
1169
+ },
1170
+ set_surfaceNormals__: function ()
1171
+ {
1172
+ this .surfaceNormalsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .surfaceNormals_);
1173
+ },
1174
+ addShaderFields: function (shaderNode)
1175
+ {
1176
+ if (! this .enabled_ .getValue ())
1177
+ return;
1178
+
1179
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "colorSteps_" + this .getId (), this .colorSteps_ .copy ());
1180
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "orthogonalColor_" + this .getId (), this .orthogonalColor_ .copy ());
1181
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "parallelColor_" + this .getId (), this .parallelColor_ .copy ());
1182
+
1183
+ if (this .surfaceNormalsNode)
1184
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceNormals_" + this .getId (), new Fields .SFNode (this .surfaceNormalsNode));
1185
+ },
1186
+ getUniformsText: function ()
1187
+ {
1188
+ if (! this .enabled_ .getValue ())
1189
+ return "";
1190
+
1191
+ var string = "";
1192
+
1193
+ string += "\n";
1194
+ string += "// CartoonVolumeStyle\n";
1195
+ string += "\n";
1196
+ string += "uniform int colorSteps_" + this .getId () + ";\n";
1197
+ string += "uniform vec4 orthogonalColor_" + this .getId () + ";\n";
1198
+ string += "uniform vec4 parallelColor_" + this .getId () + ";\n";
1199
+
1200
+ string += this .getNormalText (this .surfaceNormalsNode);
1201
+
1202
+ string += "\n";
1203
+ string += "vec3\n";
1204
+ string += "rgb2hsv_" + this .getId () + " (in vec3 color)\n";
1205
+ string += "{\n";
1206
+ string += " float h = 0.0;\n";
1207
+ string += " float s = 0.0;\n";
1208
+ string += " float v = 0.0;\n";
1209
+ string += "\n";
1210
+ string += " float min = min (min (color .r, color .g), color .b);\n";
1211
+ string += " float max = max (max (color .r, color .g), color .b);\n";
1212
+ string += " v = max; // value\n";
1213
+ string += "\n";
1214
+ string += " float delta = max - min;\n";
1215
+ string += "\n";
1216
+ string += " if (max != 0.0 && delta != 0.0)\n";
1217
+ string += " {\n";
1218
+ string += " s = delta / max; // s\n";
1219
+ string += "\n";
1220
+ string += " if (color .r == max)\n";
1221
+ string += " h = (color .g - color .b) / delta; // between yellow & magenta\n";
1222
+ string += " else if (color .g == max)\n";
1223
+ string += " h = 2.0 + (color .b - color .r) / delta; // between cyan & yellow\n";
1224
+ string += " else\n";
1225
+ string += " h = 4.0 + (color .r - color .g) / delta; // between magenta & cyan\n";
1226
+ string += "\n";
1227
+ string += " h *= M_PI / 3.0; // radiants\n";
1228
+ string += " if (h < 0.0)\n";
1229
+ string += " h += M_PI * 2.0;\n";
1230
+ string += " }\n";
1231
+ string += " else\n";
1232
+ string += " s = h = 0.0; // s = 0, h is undefined\n";
1233
+ string += "\n";
1234
+ string += " return vec3 (h, s, v);\n";
1235
+ string += "}\n";
1236
+
1237
+ string += "\n";
1238
+ string += "vec3\n";
1239
+ string += "hsv2rgb_" + this .getId () + " (in vec3 hsv)\n";
1240
+ string += "{\n";
1241
+ string += " float h = hsv [0];\n";
1242
+ string += " float s = clamp (hsv [1], 0.0, 1.0);\n";
1243
+ string += " float v = clamp (hsv [2], 0.0, 1.0);\n";
1244
+ string += "\n";
1245
+ string += " // H is given on [0, 2 * Pi]. S and V are given on [0, 1].\n";
1246
+ string += " // RGB are each returned on [0, 1].\n";
1247
+ string += "\n";
1248
+ string += " if (s == 0.0)\n";
1249
+ string += " {\n";
1250
+ string += " // achromatic (grey)\n";
1251
+ string += " return vec3 (v, v, v);\n";
1252
+ string += " }\n";
1253
+ string += " else\n";
1254
+ string += " {\n";
1255
+ string += " float w = (h * (180.0 / M_PI)) / 60.0; // sector 0 to 5\n";
1256
+ string += "\n";
1257
+ string += " float i = floor (w);\n";
1258
+ string += " float f = w - i; // factorial part of h\n";
1259
+ string += " float p = v * ( 1.0 - s );\n";
1260
+ string += " float q = v * ( 1.0 - s * f );\n";
1261
+ string += " float t = v * ( 1.0 - s * ( 1.0 - f ) );\n";
1262
+ string += "\n";
1263
+ string += " switch (int (i) % 6)\n";
1264
+ string += " {\n";
1265
+ string += " case 0: return vec3 (v, t, p);\n";
1266
+ string += " case 1: return vec3 (q, v, p);\n";
1267
+ string += " case 2: return vec3 (p, v, t);\n";
1268
+ string += " case 3: return vec3 (p, q, v);\n";
1269
+ string += " case 4: return vec3 (t, p, v);\n";
1270
+ string += " default: return vec3 (v, p, q);\n";
1271
+ string += " }\n";
1272
+ string += " }\n";
1273
+ string += "\n";
1274
+ string += " return vec3 (0.0);\n";
1275
+ string += "}\n";
1276
+
1277
+ string += "\n";
1278
+ string += "vec3\n";
1279
+ string += "mix_hsv_" + this .getId () + " (in vec3 a, in vec3 b, in float t)\n";
1280
+ string += "{\n";
1281
+ string += " // Linearely interpolate in HSV space between source color @a a and destination color @a b by an amount of @a t.\n";
1282
+ string += " // Source and destination color must be in HSV space.\n";
1283
+ string += "\n";
1284
+ string += " float ha = a [0];\n";
1285
+ string += " float sa = a [1];\n";
1286
+ string += " float va = a [2];\n";
1287
+ string += "\n";
1288
+ string += " float hb = b [0];\n";
1289
+ string += " float sb = b [1];\n";
1290
+ string += " float vb = b [2];\n";
1291
+ string += "\n";
1292
+ string += " if (sa == 0.0)\n";
1293
+ string += " ha = hb;\n";
1294
+ string += "\n";
1295
+ string += " if (sb == 0.0)\n";
1296
+ string += " hb = ha;\n";
1297
+ string += "\n";
1298
+ string += " float range = abs (hb - ha);\n";
1299
+ string += "\n";
1300
+ string += " if (range <= M_PI)\n";
1301
+ string += " {\n";
1302
+ string += " float h = ha + t * (hb - ha);\n";
1303
+ string += " float s = sa + t * (sb - sa);\n";
1304
+ string += " float v = va + t * (vb - va);\n";
1305
+ string += " return vec3 (h, s, v);\n";
1306
+ string += " }\n";
1307
+ string += "\n";
1308
+ string += " float PI2 = M_PI * 2.0;\n";
1309
+ string += " float step = (PI2 - range) * t;\n";
1310
+ string += " float h = ha < hb ? ha - step : ha + step;\n";
1311
+ string += "\n";
1312
+ string += " if (h < 0.0)\n";
1313
+ string += " h += PI2;\n";
1314
+ string += "\n";
1315
+ string += " else if (h > PI2)\n";
1316
+ string += " h -= PI2;\n";
1317
+ string += "\n";
1318
+ string += " float s = sa + t * (sb - sa);\n";
1319
+ string += " float v = va + t * (vb - va);\n";
1320
+ string += " return vec3 (h, s, v);\n";
1321
+ string += "}\n";
1322
+
1323
+ string += "\n";
1324
+ string += "vec4\n";
1325
+ string += "getCartoonStyle_" + this .getId () + " (in vec4 originalColor, vec3 texCoord)\n";
1326
+ string += "{\n";
1327
+ string += " vec4 surfaceNormal = getNormal_" + this .getId () + " (texCoord);\n";
1328
+ string += "\n";
1329
+ string += " if (surfaceNormal .w == 0.0)\n";
1330
+ string += " return vec4 (0.0);\n";
1331
+ string += "\n";
1332
+ string += " vec4 orthogonalColor = orthogonalColor_" + this .getId () + ";\n";
1333
+ string += " vec4 parallelColor = parallelColor_" + this .getId () + ";\n";
1334
+ string += " int colorSteps = colorSteps_" + this .getId () + ";\n";
1335
+ string += "\n";
1336
+ string += " float steps = clamp (float (colorSteps), 1.0, 64.0);\n";
1337
+ string += " float step = M_PI / 2.0 / steps;\n";
1338
+ string += " float cosTheta = min (dot (surfaceNormal .xyz, normalize (vertex)), 1.0);\n";
1339
+ string += "\n";
1340
+ string += " if (cosTheta < 0.0)\n";
1341
+ string += " return vec4 (0.0);\n";
1342
+ string += "\n";
1343
+ string += " float t = cos (min (floor (acos (cosTheta) / step) * (steps > 1.0 ? steps / (steps - 1.0) : 1.0), steps) * step);\n";
1344
+ string += " vec3 orthogonalHSV = rgb2hsv_" + this .getId () + " (orthogonalColor .rgb);\n";
1345
+ string += " vec3 parallelHSV = rgb2hsv_" + this .getId () + " (parallelColor .rgb);\n";
1346
+ string += "\n";
1347
+ string += " return vec4 (hsv2rgb_" + this .getId () + " (mix_hsv_" + this .getId () + " (orthogonalHSV, parallelHSV, t)), originalColor .a);\n";
1348
+ string += "}\n";
1349
+
1350
+ return string;
1351
+ },
1352
+ getFunctionsText: function ()
1353
+ {
1354
+ if (! this .enabled_ .getValue ())
1355
+ return "";
1356
+
1357
+ var string = "";
1358
+
1359
+ string += "\n";
1360
+ string += " // CartoonVolumeStyle\n";
1361
+ string += "\n";
1362
+ string += " textureColor = getCartoonStyle_" + this .getId () + " (textureColor, texCoord);\n";
1363
+
1364
+ return string;
1365
+ },
1366
+ });
1367
+
1368
+ return CartoonVolumeStyle;
1369
+ });
1370
+
1371
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1372
+ *******************************************************************************
1373
+ *
1374
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1375
+ *
1376
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
1377
+ *
1378
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
1379
+ *
1380
+ * The copyright notice above does not evidence any actual of intended
1381
+ * publication of such source code, and is an unpublished work by create3000.
1382
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
1383
+ * create3000.
1384
+ *
1385
+ * No permission is granted to copy, distribute, or create derivative works from
1386
+ * the contents of this software, in whole or in part, without the prior written
1387
+ * permission of create3000.
1388
+ *
1389
+ * NON-MILITARY USE ONLY
1390
+ *
1391
+ * All create3000 software are effectively free software with a non-military use
1392
+ * restriction. It is free. Well commented source is provided. You may reuse the
1393
+ * source in any way you please with the exception anything that uses it must be
1394
+ * marked to indicate is contains 'non-military use only' components.
1395
+ *
1396
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1397
+ *
1398
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
1399
+ *
1400
+ * This file is part of the X_ITE Project.
1401
+ *
1402
+ * X_ITE is free software: you can redistribute it and/or modify it under the
1403
+ * terms of the GNU General Public License version 3 only, as published by the
1404
+ * Free Software Foundation.
1405
+ *
1406
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
1407
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1408
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
1409
+ * details (a copy is included in the LICENSE file that accompanied this code).
1410
+ *
1411
+ * You should have received a copy of the GNU General Public License version 3
1412
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
1413
+ * copy of the GPLv3 License.
1414
+ *
1415
+ * For Silvio, Joy and Adi.
1416
+ *
1417
+ ******************************************************************************/
1418
+
1419
+
1420
+ define ('x_ite/Components/VolumeRendering/ComposedVolumeStyle',[
1421
+ "x_ite/Fields",
1422
+ "x_ite/Basic/X3DFieldDefinition",
1423
+ "x_ite/Basic/FieldDefinitionArray",
1424
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
1425
+ "x_ite/Bits/X3DConstants",
1426
+ "x_ite/Bits/X3DCast",
1427
+ ],
1428
+ function (Fields,
1429
+ X3DFieldDefinition,
1430
+ FieldDefinitionArray,
1431
+ X3DComposableVolumeRenderStyleNode,
1432
+ X3DConstants,
1433
+ X3DCast)
1434
+ {
1435
+ "use strict";
1436
+
1437
+ function ComposedVolumeStyle (executionContext)
1438
+ {
1439
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
1440
+
1441
+ this .addType (X3DConstants .ComposedVolumeStyle);
1442
+
1443
+ this .renderStyleNodes = [ ];
1444
+ }
1445
+
1446
+ ComposedVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
1447
+ {
1448
+ constructor: ComposedVolumeStyle,
1449
+ fieldDefinitions: new FieldDefinitionArray ([
1450
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1451
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1452
+ new X3DFieldDefinition (X3DConstants .inputOutput, "renderStyle", new Fields .MFNode ()),
1453
+ ]),
1454
+ getTypeName: function ()
1455
+ {
1456
+ return "ComposedVolumeStyle";
1457
+ },
1458
+ getComponentName: function ()
1459
+ {
1460
+ return "VolumeRendering";
1461
+ },
1462
+ getContainerField: function ()
1463
+ {
1464
+ return "renderStyle";
1465
+ },
1466
+ initialize: function ()
1467
+ {
1468
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
1469
+
1470
+ var gl = this .getBrowser () .getContext ();
1471
+
1472
+ if (gl .getVersion () < 2)
1473
+ return;
1474
+
1475
+ this .renderStyle_ .addInterest ("set_renderStyle__", this);
1476
+
1477
+ this .set_renderStyle__ ();
1478
+ },
1479
+ addVolumeData: function (volumeDataNode)
1480
+ {
1481
+ X3DComposableVolumeRenderStyleNode .prototype .addVolumeData .call (this, volumeDataNode);
1482
+
1483
+ var renderStyleNodes = this .renderStyleNodes;
1484
+
1485
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1486
+ {
1487
+ var renderStyleNode = renderStyleNodes [i];
1488
+
1489
+ renderStyleNode .addVolumeData (volumeDataNode);
1490
+ }
1491
+ },
1492
+ removeVolumeData: function (volumeDataNode)
1493
+ {
1494
+ X3DComposableVolumeRenderStyleNode .prototype .removeVolumeData .call (this, volumeDataNode);
1495
+
1496
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1497
+ {
1498
+ var renderStyleNode = renderStyleNodes [i];
1499
+
1500
+ renderStyleNode .removeVolumeData (volumeDataNode);
1501
+ }
1502
+ },
1503
+ set_renderStyle__: function ()
1504
+ {
1505
+ var renderStyleNodes = this .renderStyleNodes;
1506
+
1507
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1508
+ {
1509
+ var renderStyleNode = renderStyleNodes [i];
1510
+
1511
+ renderStyleNode .removeInterest ("addNodeEvent", this);
1512
+
1513
+ this .getVolumeData () .forEach (function (volumeDataNode)
1514
+ {
1515
+ renderStyleNode .removeVolumeData (volumeDataNode);
1516
+ });
1517
+ }
1518
+
1519
+ renderStyleNodes .length = 0;
1520
+
1521
+ for (var i = 0, length = this .renderStyle_ .length; i < length; ++ i)
1522
+ {
1523
+ var renderStyleNode = X3DCast (X3DConstants .X3DComposableVolumeRenderStyleNode, this .renderStyle_ [i]);
1524
+
1525
+ if (renderStyleNode)
1526
+ renderStyleNodes .push (renderStyleNode);
1527
+ }
1528
+
1529
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1530
+ {
1531
+ var renderStyleNode = renderStyleNodes [i];
1532
+
1533
+ renderStyleNode .addInterest ("addNodeEvent", this);
1534
+
1535
+ this .getVolumeData () .forEach (function (volumeDataNode)
1536
+ {
1537
+ renderStyleNode .addVolumeData (volumeDataNode);
1538
+ });
1539
+ }
1540
+ },
1541
+ addShaderFields: function (shaderNode)
1542
+ {
1543
+ if (! this .enabled_ .getValue ())
1544
+ return;
1545
+
1546
+ var renderStyleNodes = this .renderStyleNodes;
1547
+
1548
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1549
+ renderStyleNodes [i] .addShaderFields (shaderNode);
1550
+ },
1551
+ getUniformsText: function ()
1552
+ {
1553
+ if (! this .enabled_ .getValue ())
1554
+ return "";
1555
+
1556
+ var
1557
+ renderStyleNodes = this .renderStyleNodes,
1558
+ string = "";
1559
+
1560
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1561
+ string += renderStyleNodes [i] .getUniformsText ();
1562
+
1563
+ string += "\n";
1564
+ string += "vec4\n";
1565
+ string += "getComposedStyle_" + this .getId () + " (in vec4 textureColor, in vec3 texCoord)\n";
1566
+ string += "{\n";
1567
+
1568
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
1569
+ string += renderStyleNodes [i] .getFunctionsText ();
1570
+
1571
+ string += "\n";
1572
+ string += " return textureColor;\n";
1573
+ string += "}\n";
1574
+
1575
+ return string;
1576
+ },
1577
+ getFunctionsText: function ()
1578
+ {
1579
+ if (! this .enabled_ .getValue ())
1580
+ return "";
1581
+
1582
+ var string = "";
1583
+
1584
+ string += "\n";
1585
+ string += " // ComposedVolumeStyle\n";
1586
+ string += "\n";
1587
+ string += " textureColor = getComposedStyle_" + this .getId () + " (textureColor, texCoord);\n";
1588
+
1589
+ return string;
1590
+ }
1591
+ });
1592
+
1593
+ return ComposedVolumeStyle;
1594
+ });
1595
+
1596
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1597
+ *******************************************************************************
1598
+ *
1599
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1600
+ *
1601
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
1602
+ *
1603
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
1604
+ *
1605
+ * The copyright notice above does not evidence any actual of intended
1606
+ * publication of such source code, and is an unpublished work by create3000.
1607
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
1608
+ * create3000.
1609
+ *
1610
+ * No permission is granted to copy, distribute, or create derivative works from
1611
+ * the contents of this software, in whole or in part, without the prior written
1612
+ * permission of create3000.
1613
+ *
1614
+ * NON-MILITARY USE ONLY
1615
+ *
1616
+ * All create3000 software are effectively free software with a non-military use
1617
+ * restriction. It is free. Well commented source is provided. You may reuse the
1618
+ * source in any way you please with the exception anything that uses it must be
1619
+ * marked to indicate is contains 'non-military use only' components.
1620
+ *
1621
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1622
+ *
1623
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
1624
+ *
1625
+ * This file is part of the X_ITE Project.
1626
+ *
1627
+ * X_ITE is free software: you can redistribute it and/or modify it under the
1628
+ * terms of the GNU General Public License version 3 only, as published by the
1629
+ * Free Software Foundation.
1630
+ *
1631
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
1632
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1633
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
1634
+ * details (a copy is included in the LICENSE file that accompanied this code).
1635
+ *
1636
+ * You should have received a copy of the GNU General Public License version 3
1637
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
1638
+ * copy of the GPLv3 License.
1639
+ *
1640
+ * For Silvio, Joy and Adi.
1641
+ *
1642
+ ******************************************************************************/
1643
+
1644
+
1645
+ define ('x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle',[
1646
+ "x_ite/Fields",
1647
+ "x_ite/Basic/X3DFieldDefinition",
1648
+ "x_ite/Basic/FieldDefinitionArray",
1649
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
1650
+ "x_ite/Bits/X3DConstants",
1651
+ "x_ite/Bits/X3DCast",
1652
+ ],
1653
+ function (Fields,
1654
+ X3DFieldDefinition,
1655
+ FieldDefinitionArray,
1656
+ X3DComposableVolumeRenderStyleNode,
1657
+ X3DConstants,
1658
+ X3DCast)
1659
+ {
1660
+ "use strict";
1661
+
1662
+ function EdgeEnhancementVolumeStyle (executionContext)
1663
+ {
1664
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
1665
+
1666
+ this .addType (X3DConstants .EdgeEnhancementVolumeStyle);
1667
+ }
1668
+
1669
+ EdgeEnhancementVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
1670
+ {
1671
+ constructor: EdgeEnhancementVolumeStyle,
1672
+ fieldDefinitions: new FieldDefinitionArray ([
1673
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
1674
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
1675
+ new X3DFieldDefinition (X3DConstants .inputOutput, "edgeColor", new Fields .SFColorRGBA (0, 0, 0, 1)),
1676
+ new X3DFieldDefinition (X3DConstants .inputOutput, "gradientThreshold", new Fields .SFFloat (0.4)),
1677
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceNormals", new Fields .SFNode ()),
1678
+ ]),
1679
+ getTypeName: function ()
1680
+ {
1681
+ return "EdgeEnhancementVolumeStyle";
1682
+ },
1683
+ getComponentName: function ()
1684
+ {
1685
+ return "VolumeRendering";
1686
+ },
1687
+ getContainerField: function ()
1688
+ {
1689
+ return "renderStyle";
1690
+ },
1691
+ initialize: function ()
1692
+ {
1693
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
1694
+
1695
+ var gl = this .getBrowser () .getContext ();
1696
+
1697
+ if (gl .getVersion () < 2)
1698
+ return;
1699
+
1700
+ this .surfaceNormals_ .addInterest ("set_surfaceNormals__", this);
1701
+
1702
+ this .set_surfaceNormals__ ();
1703
+ },
1704
+ set_surfaceNormals__: function ()
1705
+ {
1706
+ this .surfaceNormalsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .surfaceNormals_);
1707
+ },
1708
+ addShaderFields: function (shaderNode)
1709
+ {
1710
+ if (! this .enabled_ .getValue ())
1711
+ return;
1712
+
1713
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "edgeColor_" + this .getId (), this .edgeColor_ .copy ());
1714
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "gradientThreshold_" + this .getId (), this .gradientThreshold_ .copy ());
1715
+
1716
+ if (this .surfaceNormalsNode)
1717
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceNormals_" + this .getId (), new Fields .SFNode (this .surfaceNormalsNode));
1718
+ },
1719
+ getUniformsText: function ()
1720
+ {
1721
+ if (! this .enabled_ .getValue ())
1722
+ return "";
1723
+
1724
+ var string = "";
1725
+
1726
+ string += "\n";
1727
+ string += "// EdgeEnhancementVolumeStyle\n";
1728
+ string += "\n";
1729
+ string += "uniform vec4 edgeColor_" + this .getId () + ";\n";
1730
+ string += "uniform float gradientThreshold_" + this .getId () + ";\n";
1731
+
1732
+ string += this .getNormalText (this .surfaceNormalsNode);
1733
+
1734
+ string += "\n";
1735
+ string += "vec4\n";
1736
+ string += "getEdgeEnhacementStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
1737
+ string += "{\n";
1738
+ string += " vec4 surfaceNormal = getNormal_" + this .getId () + " (texCoord);\n";
1739
+ string += "\n";
1740
+ string += " if (surfaceNormal .w == 0.0)\n";
1741
+ string += " return vec4 (0.0);\n";
1742
+ string += "\n";
1743
+ string += " vec4 edgeColor = edgeColor_" + this .getId () + ";\n";
1744
+ string += " float gradientThreshold = gradientThreshold_" + this .getId () + ";\n";
1745
+ string += "\n";
1746
+ string += " float angle = abs (dot (surfaceNormal .xyz, normalize (vertex)));\n";
1747
+ string += "\n";
1748
+ string += " if (angle >= cos (gradientThreshold))\n";
1749
+ string += " return originalColor;\n";
1750
+ string += " else\n";
1751
+ string += " return vec4 (mix (edgeColor .rgb, originalColor.rgb, angle), originalColor .a);\n";
1752
+ string += "}\n";
1753
+
1754
+ return string;
1755
+ },
1756
+ getFunctionsText: function ()
1757
+ {
1758
+ if (! this .enabled_ .getValue ())
1759
+ return "";
1760
+
1761
+ var string = "";
1762
+
1763
+ string += "\n";
1764
+ string += " // EdgeEnhancementVolumeStyle\n";
1765
+ string += "\n";
1766
+ string += " textureColor = getEdgeEnhacementStyle_" + this .getId () + " (textureColor, texCoord);\n";
1767
+
1768
+ return string;
1769
+ },
1770
+ });
1771
+
1772
+ return EdgeEnhancementVolumeStyle;
1773
+ });
1774
+
1775
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
1776
+ *******************************************************************************
1777
+ *
1778
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1779
+ *
1780
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
1781
+ *
1782
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
1783
+ *
1784
+ * The copyright notice above does not evidence any actual of intended
1785
+ * publication of such source code, and is an unpublished work by create3000.
1786
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
1787
+ * create3000.
1788
+ *
1789
+ * No permission is granted to copy, distribute, or create derivative works from
1790
+ * the contents of this software, in whole or in part, without the prior written
1791
+ * permission of create3000.
1792
+ *
1793
+ * NON-MILITARY USE ONLY
1794
+ *
1795
+ * All create3000 software are effectively free software with a non-military use
1796
+ * restriction. It is free. Well commented source is provided. You may reuse the
1797
+ * source in any way you please with the exception anything that uses it must be
1798
+ * marked to indicate is contains 'non-military use only' components.
1799
+ *
1800
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1801
+ *
1802
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
1803
+ *
1804
+ * This file is part of the X_ITE Project.
1805
+ *
1806
+ * X_ITE is free software: you can redistribute it and/or modify it under the
1807
+ * terms of the GNU General Public License version 3 only, as published by the
1808
+ * Free Software Foundation.
1809
+ *
1810
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
1811
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
1812
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
1813
+ * details (a copy is included in the LICENSE file that accompanied this code).
1814
+ *
1815
+ * You should have received a copy of the GNU General Public License version 3
1816
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
1817
+ * copy of the GPLv3 License.
1818
+ *
1819
+ * For Silvio, Joy and Adi.
1820
+ *
1821
+ ******************************************************************************/
1822
+
1823
+
1824
+ define ('x_ite/Components/VolumeRendering/X3DVolumeDataNode',[
1825
+ "x_ite/Fields",
1826
+ "x_ite/Components/Core/X3DChildNode",
1827
+ "x_ite/Components/Grouping/X3DBoundedObject",
1828
+ "x_ite/Bits/X3DConstants",
1829
+ "x_ite/Browser/Core/TextureQuality",
1830
+ "standard/Math/Numbers/Vector3",
1831
+ ],
1832
+ function (Fields,
1833
+ X3DChildNode,
1834
+ X3DBoundedObject,
1835
+ X3DConstants,
1836
+ TextureQuality,
1837
+ Vector3)
1838
+ {
1839
+ "use strict";
1840
+
1841
+ function X3DVolumeDataNode (executionContext)
1842
+ {
1843
+ X3DChildNode .call (this, executionContext);
1844
+ X3DBoundedObject .call (this, executionContext);
1845
+
1846
+ this .addType (X3DConstants .X3DVolumeDataNode);
1847
+
1848
+ this .proximitySensorNode = executionContext .createNode ("ProximitySensor", false);
1849
+ this .transformNode = executionContext .createNode ("Transform", false);
1850
+ this .shapeNode = executionContext .createNode ("Shape", false);
1851
+ this .appearanceNode = executionContext .createNode ("Appearance", false);
1852
+ this .textureTransformNode = executionContext .createNode ("TextureTransform3D", false);
1853
+ this .geometryNode = executionContext .createNode ("QuadSet", false);
1854
+ this .textureCoordinateNode = executionContext .createNode ("TextureCoordinate3D", false);
1855
+ this .coordinateNode = executionContext .createNode ("Coordinate", false);
1856
+
1857
+ this .setCameraObject (true);
1858
+ }
1859
+
1860
+ X3DVolumeDataNode .prototype = Object .assign (Object .create (X3DChildNode .prototype),
1861
+ X3DBoundedObject .prototype,
1862
+ {
1863
+ constructor: X3DVolumeDataNode,
1864
+ initialize: function ()
1865
+ {
1866
+ X3DChildNode .prototype .initialize .call (this);
1867
+ X3DBoundedObject .prototype .initialize .call (this);
1868
+
1869
+ var
1870
+ browser = this .getBrowser (),
1871
+ gl = browser .getContext ();
1872
+
1873
+ browser .getBrowserOptions () .TextureQuality_ .addInterest ("set_dimensions__", this);
1874
+
1875
+ if (gl .getVersion () >= 2)
1876
+ {
1877
+ this .dimensions_ .addInterest ("set_dimensions__", this);
1878
+
1879
+ this .set_dimensions__ ();
1880
+ }
1881
+
1882
+ this .appearanceNode .setPrivate (true);
1883
+
1884
+ this .proximitySensorNode .size_ = new Fields .SFVec3f (-1, -1, -1);
1885
+ this .transformNode .children_ = new Fields .MFNode (this .shapeNode);
1886
+ this .shapeNode .appearance_ = this .appearanceNode;
1887
+ this .shapeNode .geometry_ = this .geometryNode;
1888
+ this .appearanceNode .alphaMode_ = "BLEND";
1889
+ this .appearanceNode .textureTransform_ = this .textureTransformNode;
1890
+ this .textureTransformNode .translation_ = new Fields .SFVec3f (0.5, 0.5, 0.5);
1891
+ this .textureTransformNode .center_ = new Fields .SFVec3f (-0.5, -0.5, -0.5);
1892
+ this .geometryNode .texCoord_ = this .textureCoordinateNode;
1893
+ this .geometryNode .coord_ = this .coordinateNode;
1894
+
1895
+ this .coordinateNode .setup ();
1896
+ this .textureCoordinateNode .setup ();
1897
+ this .geometryNode .setup ();
1898
+ this .textureTransformNode .setup ();
1899
+ this .appearanceNode .setup ();
1900
+ this .shapeNode .setup ();
1901
+ this .transformNode .setup ();
1902
+ this .proximitySensorNode .setup ();
1903
+
1904
+ this .proximitySensorNode .orientation_changed_ .addFieldInterest (this .transformNode .rotation_);
1905
+ this .proximitySensorNode .orientation_changed_ .addFieldInterest (this .textureTransformNode .rotation_);
1906
+
1907
+ this .textureTransformNode .addInterest ("set_textureTransform__", this);
1908
+ },
1909
+ getBBox: function (bbox, shadow)
1910
+ {
1911
+ if (this .bboxSize_ .getValue () .equals (this .getDefaultBBoxSize ()))
1912
+ return bbox .set (this .dimensions_ .getValue (), Vector3 .Zero);
1913
+
1914
+ return bbox .set (this .bboxSize_ .getValue (), this .bboxCenter_ .getValue ());
1915
+ },
1916
+ getAppearance: function ()
1917
+ {
1918
+ return this .appearanceNode;
1919
+ },
1920
+ setShader: function (shaderNode)
1921
+ {
1922
+ this .getAppearance () .shaders_ [0] = shaderNode;
1923
+
1924
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureNormalMatrix" , new Fields .SFMatrix3f ());
1925
+ shaderNode .setup ();
1926
+
1927
+ this .set_textureTransform__ ();
1928
+ },
1929
+ getShader: function ()
1930
+ {
1931
+ var node = this .appearanceNode .shaders_ [0];
1932
+
1933
+ if (node)
1934
+ return node .getValue ();
1935
+
1936
+ return null;
1937
+ },
1938
+ getNumPlanes: function ()
1939
+ {
1940
+ switch (this .getBrowser () .getBrowserOptions () .getTextureQuality ())
1941
+ {
1942
+ case TextureQuality .LOW:
1943
+ {
1944
+ return 200;
1945
+ }
1946
+ case TextureQuality .MEDIUM:
1947
+ {
1948
+ return 400;
1949
+ }
1950
+ case TextureQuality .HIGH:
1951
+ {
1952
+ return 600;
1953
+ }
1954
+ }
1955
+
1956
+ return 200;
1957
+ },
1958
+ set_dimensions__: function ()
1959
+ {
1960
+ var
1961
+ NUM_PLANES = this .getNumPlanes (),
1962
+ size = this .dimensions_ .getValue () .abs (),
1963
+ size1_2 = size / 2,
1964
+ points = [ ];
1965
+
1966
+ this .coordinateNode .point_ .length = 0;
1967
+
1968
+ for (var i = 0; i < NUM_PLANES; ++ i)
1969
+ {
1970
+ var z = i / (NUM_PLANES - 1) - 0.5;
1971
+
1972
+ points .push ( size1_2, size1_2, size * z,
1973
+ -size1_2, size1_2, size * z,
1974
+ -size1_2, -size1_2, size * z,
1975
+ size1_2, -size1_2, size * z);
1976
+ }
1977
+
1978
+ this .coordinateNode .point_ = points;
1979
+ this .textureCoordinateNode .point_ = points;
1980
+
1981
+ this .textureTransformNode .scale_ = new Fields .SFVec3f (1 / this .dimensions_ .x, 1 / this .dimensions_ .y, 1 / this .dimensions_ .z);
1982
+ },
1983
+ set_textureTransform__: function ()
1984
+ {
1985
+ var shaderNode = this .getShader ();
1986
+
1987
+ if (shaderNode)
1988
+ {
1989
+ var invTextureMatrix = shaderNode .getField ("x3d_TextureNormalMatrix");
1990
+
1991
+ invTextureMatrix .setValue (this .textureTransformNode .getMatrix () .submatrix .inverse () .transpose ());
1992
+ }
1993
+ },
1994
+ traverse: function (type, renderObject)
1995
+ {
1996
+ this .proximitySensorNode .traverse (type, renderObject);
1997
+ this .transformNode .traverse (type, renderObject);
1998
+ }
1999
+ });
2000
+
2001
+ return X3DVolumeDataNode;
2002
+ });
2003
+
2004
+
2005
+ define('text!x_ite/Browser/VolumeRendering/VolumeStyle.vs',[],function () { return '#version 300 es\n\nprecision highp float;\nprecision highp int;\n\nuniform mat4 x3d_ProjectionMatrix;\nuniform mat4 x3d_ModelViewMatrix;\nuniform mat4 x3d_TextureMatrix [1];\n\nin float x3d_FogDepth;\nin vec4 x3d_TexCoord0;\nin vec4 x3d_Vertex;\n\nout float fogDepth;\nout vec3 vertex;\nout vec4 texCoord;\n\nvoid\nmain ()\n{\n\tvec4 position = x3d_ModelViewMatrix * x3d_Vertex;\n\n\tfogDepth = x3d_FogDepth;\n\tvertex = position .xyz;\n\ttexCoord = x3d_TextureMatrix [0] * x3d_TexCoord0;\n\n\tgl_Position = x3d_ProjectionMatrix * position;\n}\n';});
2006
+
2007
+
2008
+ define('text!x_ite/Browser/VolumeRendering/VolumeStyle.fs',[],function () { return '#version 300 es\n\nprecision highp float;\nprecision highp int;\nprecision highp sampler3D;\n\nuniform int x3d_NumLights;\nuniform x3d_LightSourceParameters x3d_LightSource [x3d_MaxLights];\n\nuniform int x3d_NumTextures;\nuniform sampler3D x3d_Texture3D [1];\nuniform vec3 x3d_TextureSize;\n\nuniform mat3 x3d_TextureNormalMatrix;\n\nconst float M_PI = 3.14159265359;\n\nin float fogDepth;\nin vec3 vertex;\nin vec4 texCoord;\n\n\nuniform x3d_FogParameters x3d_Fog;\n\nfloat\ngetFogInterpolant ()\n{\n\t// Returns 0.0 for fog color and 1.0 for material color.\n\n\tif (x3d_Fog .type == x3d_None)\n\t\treturn 1.0;\n\n\tif (x3d_Fog .fogCoord)\n\t\treturn clamp (1.0 - fogDepth, 0.0, 1.0);\n\n\tfloat visibilityRange = x3d_Fog .visibilityRange;\n\n\tif (visibilityRange <= 0.0)\n\t\treturn 1.0;\n\n\tfloat dV = length (x3d_Fog .matrix * vertex);\n\n\tif (dV >= visibilityRange)\n\t\treturn 0.0;\n\n\tswitch (x3d_Fog .type)\n\t{\n\t\tcase x3d_LinearFog:\n\t\t{\n\t\t\treturn (visibilityRange - dV) / visibilityRange;\n\t\t}\n\t\tcase x3d_ExponentialFog:\n\t\t{\n\t\t\treturn exp (-dV / (visibilityRange - dV));\n\t\t}\n\t\tdefault:\n\t\t{\n\t\t\treturn 1.0;\n\t\t}\n\t}\n}\n\nvec3\ngetFogColor (const in vec3 color)\n{\n\treturn mix (x3d_Fog .color, color, getFogInterpolant ());\n}\n\n// VOLUME_STYLES_UNIFORMS\n\nout vec4 x3d_FragColor;\n\n\nuniform int x3d_NumClipPlanes;\nuniform vec4 x3d_ClipPlane [x3d_MaxClipPlanes];\n\nvoid\nclip ()\n{\n\tfor (int i = 0; i < x3d_MaxClipPlanes; ++ i)\n\t{\n\t\tif (i == x3d_NumClipPlanes)\n\t\t\tbreak;\n\n\t\tif (dot (vertex, x3d_ClipPlane [i] .xyz) - x3d_ClipPlane [i] .w < 0.0)\n\t\t\tdiscard;\n\t}\n}\n\nvec4\ngetTextureColor (in vec3 texCoord)\n{\n\tif (x3d_NumTextures == 0)\n\t\tdiscard;\n\n\tif (texCoord .s < 0.0 || texCoord .s > 1.0)\n\t\tdiscard;\n\n\tif (texCoord .t < 0.0 || texCoord .t > 1.0)\n\t\tdiscard;\n\n\tif (texCoord .p < 0.0 || texCoord .p > 1.0)\n\t\tdiscard;\n\n\tvec4 textureColor = texture (x3d_Texture3D [0], texCoord);\n\n\t// Apply volume styles.\n\n// VOLUME_STYLES_FUNCTIONS\n\n\treturn textureColor;\n}\n\nvoid\nmain ()\n{\n\tclip ();\n\n\tx3d_FragColor = getTextureColor (texCoord .stp / texCoord .q);\n}\n';});
2009
+
2010
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
2011
+ *******************************************************************************
2012
+ *
2013
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2014
+ *
2015
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
2016
+ *
2017
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
2018
+ *
2019
+ * The copyright notice above does not evidence any actual of intended
2020
+ * publication of such source code, and is an unpublished work by create3000.
2021
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
2022
+ * create3000.
2023
+ *
2024
+ * No permission is granted to copy, distribute, or create derivative works from
2025
+ * the contents of this software, in whole or in part, without the prior written
2026
+ * permission of create3000.
2027
+ *
2028
+ * NON-MILITARY USE ONLY
2029
+ *
2030
+ * All create3000 software are effectively free software with a non-military use
2031
+ * restriction. It is free. Well commented source is provided. You may reuse the
2032
+ * source in any way you please with the exception anything that uses it must be
2033
+ * marked to indicate is contains 'non-military use only' components.
2034
+ *
2035
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2036
+ *
2037
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
2038
+ *
2039
+ * This file is part of the X_ITE Project.
2040
+ *
2041
+ * X_ITE is free software: you can redistribute it and/or modify it under the
2042
+ * terms of the GNU General Public License version 3 only, as published by the
2043
+ * Free Software Foundation.
2044
+ *
2045
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
2046
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
2047
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
2048
+ * details (a copy is included in the LICENSE file that accompanied this code).
2049
+ *
2050
+ * You should have received a copy of the GNU General Public License version 3
2051
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
2052
+ * copy of the GPLv3 License.
2053
+ *
2054
+ * For Silvio, Joy and Adi.
2055
+ *
2056
+ ******************************************************************************/
2057
+
2058
+
2059
+ define ('x_ite/Components/VolumeRendering/IsoSurfaceVolumeData',[
2060
+ "x_ite/Fields",
2061
+ "x_ite/Basic/X3DFieldDefinition",
2062
+ "x_ite/Basic/FieldDefinitionArray",
2063
+ "x_ite/Components/VolumeRendering/X3DVolumeDataNode",
2064
+ "x_ite/Components/Shaders/ComposedShader",
2065
+ "x_ite/Components/Shaders/ShaderPart",
2066
+ "x_ite/Bits/X3DConstants",
2067
+ "x_ite/Bits/X3DCast",
2068
+ "text!x_ite/Browser/VolumeRendering/VolumeStyle.vs",
2069
+ "text!x_ite/Browser/VolumeRendering/VolumeStyle.fs",
2070
+ "x_ite/DEBUG",
2071
+ ],
2072
+ function (Fields,
2073
+ X3DFieldDefinition,
2074
+ FieldDefinitionArray,
2075
+ X3DVolumeDataNode,
2076
+ ComposedShader,
2077
+ ShaderPart,
2078
+ X3DConstants,
2079
+ X3DCast,
2080
+ vs,
2081
+ fs,
2082
+ DEBUG)
2083
+ {
2084
+ "use strict";
2085
+
2086
+ function IsoSurfaceVolumeData (executionContext)
2087
+ {
2088
+ X3DVolumeDataNode .call (this, executionContext);
2089
+
2090
+ this .addType (X3DConstants .IsoSurfaceVolumeData);
2091
+
2092
+ this .renderStyleNodes = [ ];
2093
+ }
2094
+
2095
+ IsoSurfaceVolumeData .prototype = Object .assign (Object .create (X3DVolumeDataNode .prototype),
2096
+ {
2097
+ constructor: IsoSurfaceVolumeData,
2098
+ fieldDefinitions: new FieldDefinitionArray ([
2099
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
2100
+ new X3DFieldDefinition (X3DConstants .inputOutput, "dimensions", new Fields .SFVec3f (1, 1, 1)),
2101
+ new X3DFieldDefinition (X3DConstants .inputOutput, "contourStepSize", new Fields .SFFloat (0)),
2102
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceValues", new Fields .MFFloat ()),
2103
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceTolerance", new Fields .SFFloat (0)),
2104
+ new X3DFieldDefinition (X3DConstants .inputOutput, "visible", new Fields .SFBool (true)),
2105
+ new X3DFieldDefinition (X3DConstants .inputOutput, "bboxDisplay", new Fields .SFBool ()),
2106
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxCenter", new Fields .SFVec3f (0, 0, 0)),
2107
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxSize", new Fields .SFVec3f (-1, -1, -1)),
2108
+ new X3DFieldDefinition (X3DConstants .inputOutput, "renderStyle", new Fields .MFNode ()),
2109
+ new X3DFieldDefinition (X3DConstants .inputOutput, "gradients", new Fields .SFNode ()),
2110
+ new X3DFieldDefinition (X3DConstants .inputOutput, "voxels", new Fields .SFNode ()),
2111
+ ]),
2112
+ getTypeName: function ()
2113
+ {
2114
+ return "IsoSurfaceVolumeData";
2115
+ },
2116
+ getComponentName: function ()
2117
+ {
2118
+ return "VolumeRendering";
2119
+ },
2120
+ getContainerField: function ()
2121
+ {
2122
+ return "children";
2123
+ },
2124
+ initialize: function ()
2125
+ {
2126
+ X3DVolumeDataNode .prototype .initialize .call (this);
2127
+
2128
+ var gl = this .getBrowser () .getContext ();
2129
+
2130
+ if (gl .getVersion () < 2)
2131
+ return;
2132
+
2133
+ this .gradients_ .addInterest ("set_gradients__", this);
2134
+ this .renderStyle_ .addInterest ("set_renderStyle__", this);
2135
+ this .voxels_ .addFieldInterest (this .getAppearance () .texture_);
2136
+
2137
+ this .contourStepSize_ .addInterest ("update", this);
2138
+ this .surfaceValues_ .addInterest ("update", this);
2139
+ this .surfaceTolerance_ .addInterest ("update", this);
2140
+ this .renderStyle_ .addInterest ("update", this);
2141
+
2142
+ this .getAppearance () .texture_ = this .voxels_;
2143
+
2144
+ this .set_gradients__ ();
2145
+ this .set_renderStyle__ ();
2146
+ this .set_voxels__ ();
2147
+
2148
+ this .update ();
2149
+ },
2150
+ set_gradients__: function ()
2151
+ {
2152
+ this .gradientsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .gradients_);
2153
+ },
2154
+ set_renderStyle__: function ()
2155
+ {
2156
+ var renderStyleNodes = this .renderStyleNodes;
2157
+
2158
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
2159
+ {
2160
+ var renderStyleNode = renderStyleNodes [i];
2161
+
2162
+ renderStyleNode .removeInterest ("update", this);
2163
+ renderStyleNode .removeVolumeData (this);
2164
+ }
2165
+
2166
+ renderStyleNodes .length = 0;
2167
+
2168
+ for (var i = 0, length = this .renderStyle_ .length; i < length; ++ i)
2169
+ {
2170
+ var renderStyleNode = X3DCast (X3DConstants .X3DComposableVolumeRenderStyleNode, this .renderStyle_ [i]);
2171
+
2172
+ if (renderStyleNode)
2173
+ renderStyleNodes .push (renderStyleNode);
2174
+ }
2175
+
2176
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
2177
+ {
2178
+ var renderStyleNode = renderStyleNodes [i];
2179
+
2180
+ renderStyleNode .addInterest ("update", this);
2181
+ renderStyleNode .addVolumeData (this);
2182
+ }
2183
+ },
2184
+ set_voxels__: function ()
2185
+ {
2186
+ if (this .voxelsNode)
2187
+ this .voxelsNode .removeInterest ("set_textureSize__", this);
2188
+
2189
+ this .voxelsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .voxels_);
2190
+
2191
+ if (this .voxelsNode)
2192
+ {
2193
+ this .voxelsNode .addInterest ("set_textureSize__", this);
2194
+
2195
+ this .set_textureSize__ ();
2196
+ }
2197
+ },
2198
+ set_textureSize__: function ()
2199
+ {
2200
+ try
2201
+ {
2202
+ var textureSize = this .getShader () .getField ("x3d_TextureSize");
2203
+
2204
+ textureSize .x = this .voxelsNode .getWidth ();
2205
+ textureSize .y = this .voxelsNode .getHeight ();
2206
+ textureSize .z = this .voxelsNode .getDepth ();
2207
+ }
2208
+ catch (error)
2209
+ {
2210
+ if (DEBUG)
2211
+ console .log (error .message);
2212
+ }
2213
+ },
2214
+ update: function ()
2215
+ {
2216
+ this .setShader (this .createShader (vs, fs));
2217
+ },
2218
+ createShader: function (vs, fs)
2219
+ {
2220
+ // if (DEBUG)
2221
+ // console .log ("Creating VolumeData Shader ...");
2222
+
2223
+ var
2224
+ opacityMapVolumeStyle = this .getBrowser () .getDefaultVolumeStyle (),
2225
+ styleUniforms = opacityMapVolumeStyle .getUniformsText (),
2226
+ styleFunctions = opacityMapVolumeStyle .getFunctionsText ();
2227
+
2228
+ styleUniforms += "\n";
2229
+ styleUniforms += "uniform float surfaceValues [" + this .surfaceValues_ .length + "];\n";
2230
+ styleUniforms += "uniform float surfaceTolerance;\n";
2231
+
2232
+ for (var i = 0, length = this .renderStyleNodes .length; i < length; ++ i)
2233
+ styleUniforms += this .renderStyleNodes [i] .getUniformsText ();
2234
+
2235
+ styleFunctions += "\n";
2236
+ styleFunctions += " // IsoSurfaceVolumeData\n";
2237
+ styleFunctions += "\n";
2238
+
2239
+ if (this .gradientsNode)
2240
+ {
2241
+ styleUniforms += "\n";
2242
+ styleUniforms += "uniform sampler3D gradients;\n";
2243
+
2244
+ styleFunctions += " if (length (texture (gradients, texCoord) .xyz * 2.0 - 1.0) < surfaceTolerance)\n";
2245
+ styleFunctions += " discard;\n";
2246
+ }
2247
+ else
2248
+ {
2249
+ styleUniforms += "\n";
2250
+ styleUniforms += "vec4\n";
2251
+ styleUniforms += "getNormal (in vec3 texCoord)\n";
2252
+ styleUniforms += "{\n";
2253
+ styleUniforms += " vec4 offset = vec4 (1.0 / x3d_TextureSize, 0.0);\n";
2254
+ styleUniforms += " float i0 = texture (x3d_Texture3D [0], texCoord + offset .xww) .r;\n";
2255
+ styleUniforms += " float i1 = texture (x3d_Texture3D [0], texCoord - offset .xww) .r;\n";
2256
+ styleUniforms += " float i2 = texture (x3d_Texture3D [0], texCoord + offset .wyw) .r;\n";
2257
+ styleUniforms += " float i3 = texture (x3d_Texture3D [0], texCoord - offset .wyw) .r;\n";
2258
+ styleUniforms += " float i4 = texture (x3d_Texture3D [0], texCoord + offset .wwz) .r;\n";
2259
+ styleUniforms += " float i5 = texture (x3d_Texture3D [0], texCoord - offset .wwz) .r;\n";
2260
+ styleUniforms += " vec3 n = vec3 (i1 - i0, i3 - i2, i5 - i4);\n";
2261
+ styleUniforms += "\n";
2262
+ styleUniforms += " return vec4 (normalize (x3d_TextureNormalMatrix * n), length (n));\n";
2263
+ styleUniforms += "}\n";
2264
+
2265
+ styleFunctions += " if (getNormal (texCoord) .w < surfaceTolerance)\n";
2266
+ styleFunctions += " discard;\n";
2267
+ }
2268
+
2269
+ styleFunctions += "\n";
2270
+ styleFunctions += " float intensity = textureColor .r;\n";
2271
+ styleFunctions += "\n";
2272
+
2273
+ if (this .surfaceValues_ .length === 1)
2274
+ {
2275
+ var contourStepSize = Math .abs (this .contourStepSize_ .getValue ());
2276
+
2277
+ if (contourStepSize === 0)
2278
+ {
2279
+ styleFunctions += " if (intensity > surfaceValues [0])\n";
2280
+ styleFunctions += " {\n";
2281
+ styleFunctions += " textureColor = vec4 (vec3 (surfaceValues [0]), 1.0);\n";
2282
+
2283
+ if (this .renderStyleNodes .length)
2284
+ {
2285
+ styleFunctions += this .renderStyleNodes [0] .getFunctionsText ();
2286
+ }
2287
+
2288
+ styleFunctions += " }\n";
2289
+ styleFunctions += " else\n";
2290
+ styleFunctions += " {\n";
2291
+ styleFunctions += " discard;\n";
2292
+ styleFunctions += " }\n";
2293
+ styleFunctions += "\n";
2294
+ }
2295
+ else
2296
+ {
2297
+ var surfaceValues = [ ];
2298
+
2299
+ for (var v = this .surfaceValues_ [0] - contourStepSize; v > 0; v -= contourStepSize)
2300
+ surfaceValues .unshift (v);
2301
+
2302
+ surfaceValues .push (this .surfaceValues_ [0]);
2303
+
2304
+ for (var v = this .surfaceValues_ [0] + contourStepSize; v < 1; v += contourStepSize)
2305
+ surfaceValues .push (v);
2306
+
2307
+ styleFunctions += " if (false)\n";
2308
+ styleFunctions += " { }\n";
2309
+
2310
+ for (var i = surfaceValues_ .length - 1; i >= 0; -- i)
2311
+ {
2312
+ styleFunctions += " else if (intensity > " + surfaceValues [i] + ")\n";
2313
+ styleFunctions += " {\n";
2314
+ styleFunctions += " textureColor = vec4 (vec3 (" + surfaceValues [i] + "), 1.0);\n";
2315
+
2316
+ if (this .renderStyleNodes .length)
2317
+ {
2318
+ styleFunctions += this .renderStyleNodes [0] .getFunctionsText ();
2319
+ }
2320
+
2321
+ styleFunctions += " }\n";
2322
+ }
2323
+
2324
+ styleFunctions += " else\n";
2325
+ styleFunctions += " {\n";
2326
+ styleFunctions += " discard;\n";
2327
+ styleFunctions += " }\n";
2328
+ styleFunctions += "\n";
2329
+ }
2330
+ }
2331
+ else
2332
+ {
2333
+ styleFunctions += " if (false)\n";
2334
+ styleFunctions += " { }\n";
2335
+
2336
+ for (var i = this .surfaceValues_ .length - 1; i >= 0; -- i)
2337
+ {
2338
+ styleFunctions += " else if (intensity > surfaceValues [" + i + "])\n";
2339
+ styleFunctions += " {\n";
2340
+ styleFunctions += " textureColor = vec4 (vec3 (surfaceValues [" + i + "]), 1.0);\n";
2341
+
2342
+ if (this .renderStyleNodes .length)
2343
+ {
2344
+ var r = Math .min (i, this .renderStyleNodes .length - 1);
2345
+
2346
+ styleFunctions += this .renderStyleNodes [r] .getFunctionsText ();
2347
+ }
2348
+
2349
+ styleFunctions += " }\n";
2350
+ }
2351
+
2352
+ styleFunctions += " else\n";
2353
+ styleFunctions += " {\n";
2354
+ styleFunctions += " discard;\n";
2355
+ styleFunctions += " }\n";
2356
+ styleFunctions += "\n";
2357
+ }
2358
+
2359
+ fs = fs .replace (/\/\/ VOLUME_STYLES_UNIFORMS\n/, styleUniforms);
2360
+ fs = fs .replace (/\/\/ VOLUME_STYLES_FUNCTIONS\n/, styleFunctions);
2361
+
2362
+ // if (DEBUG)
2363
+ // this .getBrowser () .print (fs);
2364
+
2365
+ var vertexShader = new ShaderPart (this .getExecutionContext ());
2366
+ vertexShader .setName ("VolumeDataVertexShader");
2367
+ vertexShader .url_ .push ("data:x-shader/x-vertex," + vs);
2368
+ vertexShader .setup ();
2369
+
2370
+ var fragmentShader = new ShaderPart (this .getExecutionContext ());
2371
+ fragmentShader .setName ("VolumeDataFragmentShader");
2372
+ fragmentShader .type_ = "FRAGMENT";
2373
+ fragmentShader .url_ .push ("data:x-shader/x-fragment," + fs);
2374
+ fragmentShader .setup ();
2375
+
2376
+ var shaderNode = new ComposedShader (this .getExecutionContext ());
2377
+ shaderNode .setName ("VolumeDataShader");
2378
+ shaderNode .language_ = "GLSL";
2379
+ shaderNode .parts_ .push (vertexShader);
2380
+ shaderNode .parts_ .push (fragmentShader);
2381
+
2382
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceValues", this .surfaceValues_ .copy ());
2383
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceTolerance", this .surfaceTolerance_ .copy ());
2384
+
2385
+ if (this .gradientsNode)
2386
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "grandients", new Fields .SFNode (this .gradientsNode));
2387
+
2388
+ if (this .voxelsNode)
2389
+ {
2390
+ var textureSize = new Fields .SFVec3f (this .voxelsNode .getWidth (), this .voxelsNode .getHeight (), this .voxelsNode .getDepth ());
2391
+
2392
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureSize", textureSize);
2393
+ }
2394
+ else
2395
+ {
2396
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureSize", new Fields .SFVec3f ());
2397
+ }
2398
+
2399
+ opacityMapVolumeStyle .addShaderFields (shaderNode);
2400
+
2401
+ for (var i = 0, length = this .renderStyleNodes .length; i < length; ++ i)
2402
+ this .renderStyleNodes [i] .addShaderFields (shaderNode);
2403
+
2404
+ return shaderNode;
2405
+ },
2406
+ });
2407
+
2408
+ return IsoSurfaceVolumeData;
2409
+ });
2410
+
2411
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
2412
+ *******************************************************************************
2413
+ *
2414
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2415
+ *
2416
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
2417
+ *
2418
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
2419
+ *
2420
+ * The copyright notice above does not evidence any actual of intended
2421
+ * publication of such source code, and is an unpublished work by create3000.
2422
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
2423
+ * create3000.
2424
+ *
2425
+ * No permission is granted to copy, distribute, or create derivative works from
2426
+ * the contents of this software, in whole or in part, without the prior written
2427
+ * permission of create3000.
2428
+ *
2429
+ * NON-MILITARY USE ONLY
2430
+ *
2431
+ * All create3000 software are effectively free software with a non-military use
2432
+ * restriction. It is free. Well commented source is provided. You may reuse the
2433
+ * source in any way you please with the exception anything that uses it must be
2434
+ * marked to indicate is contains 'non-military use only' components.
2435
+ *
2436
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2437
+ *
2438
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
2439
+ *
2440
+ * This file is part of the X_ITE Project.
2441
+ *
2442
+ * X_ITE is free software: you can redistribute it and/or modify it under the
2443
+ * terms of the GNU General Public License version 3 only, as published by the
2444
+ * Free Software Foundation.
2445
+ *
2446
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
2447
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
2448
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
2449
+ * details (a copy is included in the LICENSE file that accompanied this code).
2450
+ *
2451
+ * You should have received a copy of the GNU General Public License version 3
2452
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
2453
+ * copy of the GPLv3 License.
2454
+ *
2455
+ * For Silvio, Joy and Adi.
2456
+ *
2457
+ ******************************************************************************/
2458
+
2459
+
2460
+ define ('x_ite/Components/VolumeRendering/ProjectionVolumeStyle',[
2461
+ "x_ite/Fields",
2462
+ "x_ite/Basic/X3DFieldDefinition",
2463
+ "x_ite/Basic/FieldDefinitionArray",
2464
+ "x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",
2465
+ "x_ite/Bits/X3DConstants",
2466
+ ],
2467
+ function (Fields,
2468
+ X3DFieldDefinition,
2469
+ FieldDefinitionArray,
2470
+ X3DVolumeRenderStyleNode,
2471
+ X3DConstants)
2472
+ {
2473
+ "use strict";
2474
+
2475
+ function ProjectionVolumeStyle (executionContext)
2476
+ {
2477
+ X3DVolumeRenderStyleNode .call (this, executionContext);
2478
+
2479
+ this .addType (X3DConstants .ProjectionVolumeStyle);
2480
+ }
2481
+
2482
+ ProjectionVolumeStyle .prototype = Object .assign (Object .create (X3DVolumeRenderStyleNode .prototype),
2483
+ {
2484
+ constructor: ProjectionVolumeStyle,
2485
+ fieldDefinitions: new FieldDefinitionArray ([
2486
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
2487
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
2488
+ new X3DFieldDefinition (X3DConstants .inputOutput, "type", new Fields .SFString ("MAX")),
2489
+ new X3DFieldDefinition (X3DConstants .inputOutput, "intensityThreshold", new Fields .SFFloat (0)),
2490
+ ]),
2491
+ getTypeName: function ()
2492
+ {
2493
+ return "ProjectionVolumeStyle";
2494
+ },
2495
+ getComponentName: function ()
2496
+ {
2497
+ return "VolumeRendering";
2498
+ },
2499
+ getContainerField: function ()
2500
+ {
2501
+ return "renderStyle";
2502
+ },
2503
+ addShaderFields: function (shaderNode)
2504
+ {
2505
+ if (! this .enabled_ .getValue ())
2506
+ return;
2507
+
2508
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "intensityThreshold_" + this .getId (), this .intensityThreshold_ .copy ());
2509
+ },
2510
+ getUniformsText: function ()
2511
+ {
2512
+ if (! this .enabled_ .getValue ())
2513
+ return "";
2514
+
2515
+ var string = "";
2516
+
2517
+ string += "\n";
2518
+ string += "// ProjectionVolumeStyle\n";
2519
+ string += "\n";
2520
+ string += "uniform float intensityThreshold_" + this .getId () + ";\n";
2521
+
2522
+ string += "\n";
2523
+ string += "vec4\n";
2524
+ string += "getProjectionStyle_" + this .getId () + "(in vec4 originalColor, in vec3 texCoord)\n";
2525
+ string += "{\n";
2526
+ switch (this .type_ .getValue ())
2527
+ {
2528
+ default:
2529
+ case "MAX":
2530
+ {
2531
+ string += " float projectionColor = 0.0;\n";
2532
+ break;
2533
+ }
2534
+ case "MIN":
2535
+ {
2536
+ string += " float projectionColor = 1.0;\n";
2537
+ break;
2538
+ }
2539
+ case "AVERAGE":
2540
+ {
2541
+ string += " float projectionColor = 0.0;\n";
2542
+ break;
2543
+ }
2544
+ }
2545
+
2546
+ string += " const int samples = 32;\n";
2547
+ string += " vec3 step = normalize (x3d_TextureNormalMatrix * vec3 (0.0, 0.0, 1.0)) / float (samples);\n";
2548
+ string += " vec3 ray = texCoord - step * float (samples) * 0.5;\n";
2549
+ string += " bool first = false;\n";
2550
+ string += "\n";
2551
+ string += " for (int i = 0; i < samples; ++ i, ray += step)\n";
2552
+ string += " {\n";
2553
+ string += " if (ray .s < 0.0 || ray .s > 1.0)\n";
2554
+ string += " continue;\n";
2555
+ string += "\n";
2556
+ string += " if (ray .t < 0.0 || ray .t > 1.0)\n";
2557
+ string += " continue;\n";
2558
+ string += "\n";
2559
+ string += " if (ray .p < 0.0 || ray .p > 1.0)\n";
2560
+ string += " continue;\n";
2561
+ string += "\n";
2562
+ string += " float intensity = texture (x3d_Texture3D [0], ray) .r;\n";
2563
+ string += "\n";
2564
+
2565
+ switch (this .type_ .getValue ())
2566
+ {
2567
+ default:
2568
+ case "MAX":
2569
+ {
2570
+ string += " if (intensity < intensityThreshold_" + this .getId () + ")\n";
2571
+ string += " continue;\n";
2572
+ string += "\n";
2573
+ string += " if (intensityThreshold_" + this .getId () + " > 0.0 && first)\n";
2574
+ string += " break;\n";
2575
+ string += "\n";
2576
+ string += " if (intensity <= projectionColor)\n";
2577
+ string += " {\n";
2578
+ string += " first = true;\n";
2579
+ string += " continue;\n";
2580
+ string += " }\n";
2581
+ string += "\n";
2582
+ string += " projectionColor = intensity;\n";
2583
+ break;
2584
+ }
2585
+ case "MIN":
2586
+ {
2587
+ string += " if (intensity < intensityThreshold_" + this .getId () + ")\n";
2588
+ string += " continue;\n";
2589
+ string += "\n";
2590
+ string += " if (intensityThreshold_" + this .getId () + " > 0.0 && first)\n";
2591
+ string += " break;\n";
2592
+ string += "\n";
2593
+ string += " if (intensity >= projectionColor)\n";
2594
+ string += " {\n";
2595
+ string += " first = true;\n";
2596
+ string += " continue;\n";
2597
+ string += " }\n";
2598
+ string += "\n";
2599
+ string += " projectionColor = intensity;\n";
2600
+ break;
2601
+ }
2602
+ case "AVERAGE":
2603
+ {
2604
+ string += " projectionColor += intensity;\n";
2605
+ break;
2606
+ }
2607
+ }
2608
+
2609
+ string += " }\n";
2610
+ string += "\n";
2611
+
2612
+ if (this .type_ .getValue () === "AVERAGE")
2613
+ string += " projectionColor /= float (samples);\n";
2614
+
2615
+ string += " return vec4 (vec3 (projectionColor), originalColor .a);\n";
2616
+ string += "}\n";
2617
+
2618
+ return string;
2619
+ },
2620
+ getFunctionsText: function ()
2621
+ {
2622
+ if (! this .enabled_ .getValue ())
2623
+ return "";
2624
+
2625
+ var string = "";
2626
+
2627
+ string += "\n";
2628
+ string += " // ProjectionVolumeStyle\n";
2629
+ string += "\n";
2630
+ string += " textureColor = getProjectionStyle_" + this .getId () + " (textureColor, texCoord);\n";
2631
+
2632
+ return string;
2633
+ },
2634
+ });
2635
+
2636
+ return ProjectionVolumeStyle;
2637
+ });
2638
+
2639
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
2640
+ *******************************************************************************
2641
+ *
2642
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2643
+ *
2644
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
2645
+ *
2646
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
2647
+ *
2648
+ * The copyright notice above does not evidence any actual of intended
2649
+ * publication of such source code, and is an unpublished work by create3000.
2650
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
2651
+ * create3000.
2652
+ *
2653
+ * No permission is granted to copy, distribute, or create derivative works from
2654
+ * the contents of this software, in whole or in part, without the prior written
2655
+ * permission of create3000.
2656
+ *
2657
+ * NON-MILITARY USE ONLY
2658
+ *
2659
+ * All create3000 software are effectively free software with a non-military use
2660
+ * restriction. It is free. Well commented source is provided. You may reuse the
2661
+ * source in any way you please with the exception anything that uses it must be
2662
+ * marked to indicate is contains 'non-military use only' components.
2663
+ *
2664
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2665
+ *
2666
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
2667
+ *
2668
+ * This file is part of the X_ITE Project.
2669
+ *
2670
+ * X_ITE is free software: you can redistribute it and/or modify it under the
2671
+ * terms of the GNU General Public License version 3 only, as published by the
2672
+ * Free Software Foundation.
2673
+ *
2674
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
2675
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
2676
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
2677
+ * details (a copy is included in the LICENSE file that accompanied this code).
2678
+ *
2679
+ * You should have received a copy of the GNU General Public License version 3
2680
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
2681
+ * copy of the GPLv3 License.
2682
+ *
2683
+ * For Silvio, Joy and Adi.
2684
+ *
2685
+ ******************************************************************************/
2686
+
2687
+
2688
+ define ('x_ite/Components/VolumeRendering/SegmentedVolumeData',[
2689
+ "x_ite/Fields",
2690
+ "x_ite/Basic/X3DFieldDefinition",
2691
+ "x_ite/Basic/FieldDefinitionArray",
2692
+ "x_ite/Components/VolumeRendering/X3DVolumeDataNode",
2693
+ "x_ite/Components/Shaders/ComposedShader",
2694
+ "x_ite/Components/Shaders/ShaderPart",
2695
+ "x_ite/Bits/X3DConstants",
2696
+ "x_ite/Bits/X3DCast",
2697
+ "text!x_ite/Browser/VolumeRendering/VolumeStyle.vs",
2698
+ "text!x_ite/Browser/VolumeRendering/VolumeStyle.fs",
2699
+ "x_ite/DEBUG",
2700
+ ],
2701
+ function (Fields,
2702
+ X3DFieldDefinition,
2703
+ FieldDefinitionArray,
2704
+ X3DVolumeDataNode,
2705
+ ComposedShader,
2706
+ ShaderPart,
2707
+ X3DConstants,
2708
+ X3DCast,
2709
+ vs,
2710
+ fs,
2711
+ DEBUG)
2712
+ {
2713
+ "use strict";
2714
+
2715
+ function SegmentedVolumeData (executionContext)
2716
+ {
2717
+ X3DVolumeDataNode .call (this, executionContext);
2718
+
2719
+ this .addType (X3DConstants .SegmentedVolumeData);
2720
+
2721
+ this .segmentIdentifiersNode = null;
2722
+ this .renderStyleNodes = [ ];
2723
+ }
2724
+
2725
+ SegmentedVolumeData .prototype = Object .assign (Object .create (X3DVolumeDataNode .prototype),
2726
+ {
2727
+ constructor: SegmentedVolumeData,
2728
+ fieldDefinitions: new FieldDefinitionArray ([
2729
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
2730
+ new X3DFieldDefinition (X3DConstants .inputOutput, "dimensions", new Fields .SFVec3f (1, 1, 1)),
2731
+ new X3DFieldDefinition (X3DConstants .inputOutput, "segmentEnabled", new Fields .MFBool ()),
2732
+ new X3DFieldDefinition (X3DConstants .inputOutput, "visible", new Fields .SFBool (true)),
2733
+ new X3DFieldDefinition (X3DConstants .inputOutput, "bboxDisplay", new Fields .SFBool ()),
2734
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxCenter", new Fields .SFVec3f (0, 0, 0)),
2735
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxSize", new Fields .SFVec3f (-1, -1, -1)),
2736
+ new X3DFieldDefinition (X3DConstants .inputOutput, "segmentIdentifiers", new Fields .SFNode ()),
2737
+ new X3DFieldDefinition (X3DConstants .inputOutput, "renderStyle", new Fields .MFNode ()),
2738
+ new X3DFieldDefinition (X3DConstants .inputOutput, "voxels", new Fields .SFNode ()),
2739
+ ]),
2740
+ getTypeName: function ()
2741
+ {
2742
+ return "SegmentedVolumeData";
2743
+ },
2744
+ getComponentName: function ()
2745
+ {
2746
+ return "VolumeRendering";
2747
+ },
2748
+ getContainerField: function ()
2749
+ {
2750
+ return "children";
2751
+ },
2752
+ initialize: function ()
2753
+ {
2754
+ X3DVolumeDataNode .prototype .initialize .call (this);
2755
+
2756
+ var gl = this .getBrowser () .getContext ();
2757
+
2758
+ if (gl .getVersion () < 2)
2759
+ return;
2760
+
2761
+ this .segmentIdentifiers_ .addInterest ("set_segmentIdentifiers__", this);
2762
+ this .renderStyle_ .addInterest ("set_renderStyle__", this);
2763
+ this .voxels_ .addFieldInterest (this .getAppearance () .texture_);
2764
+
2765
+ this .segmentEnabled_ .addInterest ("update", this);
2766
+ this .segmentIdentifiers_ .addInterest ("update", this);
2767
+ this .renderStyle_ .addInterest ("update", this);
2768
+
2769
+ this .getAppearance () .texture_ = this .voxels_;
2770
+
2771
+ this .set_segmentIdentifiers__ ();
2772
+ this .set_renderStyle__ ();
2773
+ this .set_voxels__ ();
2774
+
2775
+ this .update ();
2776
+ },
2777
+ getSegmentEnabled: function (index)
2778
+ {
2779
+ return index < this .segmentEnabled_ .length ? this .segmentEnabled_ [index] : true;
2780
+ },
2781
+ set_segmentIdentifiers__: function ()
2782
+ {
2783
+ this .segmentIdentifiersNode = X3DCast (X3DConstants .X3DTexture3DNode, this .segmentIdentifiers_);
2784
+ },
2785
+ set_renderStyle__: function ()
2786
+ {
2787
+ var renderStyleNodes = this .renderStyleNodes;
2788
+
2789
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
2790
+ {
2791
+ var renderStyleNode = renderStyleNodes [i];
2792
+
2793
+ renderStyleNode .removeInterest ("update", this);
2794
+ renderStyleNode .removeVolumeData (this);
2795
+ }
2796
+
2797
+ renderStyleNodes .length = 0;
2798
+
2799
+ for (var i = 0, length = this .renderStyle_ .length; i < length; ++ i)
2800
+ {
2801
+ var renderStyleNode = X3DCast (X3DConstants .X3DComposableVolumeRenderStyleNode, this .renderStyle_ [i]);
2802
+
2803
+ if (renderStyleNode)
2804
+ renderStyleNodes .push (renderStyleNode);
2805
+ }
2806
+
2807
+ for (var i = 0, length = renderStyleNodes .length; i < length; ++ i)
2808
+ {
2809
+ var renderStyleNode = renderStyleNodes [i];
2810
+
2811
+ renderStyleNode .addInterest ("update", this);
2812
+ renderStyleNode .addVolumeData (this);
2813
+ }
2814
+ },
2815
+ set_voxels__: function ()
2816
+ {
2817
+ if (this .voxelsNode)
2818
+ this .voxelsNode .removeInterest ("set_textureSize__", this);
2819
+
2820
+ this .voxelsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .voxels_);
2821
+
2822
+ if (this .voxelsNode)
2823
+ {
2824
+ this .voxelsNode .addInterest ("set_textureSize__", this);
2825
+
2826
+ this .set_textureSize__ ();
2827
+ }
2828
+ },
2829
+ set_textureSize__: function ()
2830
+ {
2831
+ try
2832
+ {
2833
+ var textureSize = this .getShader () .getField ("x3d_TextureSize");
2834
+
2835
+ textureSize .x = this .voxelsNode .getWidth ();
2836
+ textureSize .y = this .voxelsNode .getHeight ();
2837
+ textureSize .z = this .voxelsNode .getDepth ();
2838
+ }
2839
+ catch (error)
2840
+ {
2841
+ if (DEBUG)
2842
+ console .log (error .message);
2843
+ }
2844
+ },
2845
+ update: function ()
2846
+ {
2847
+ this .setShader (this .createShader (vs, fs));
2848
+ },
2849
+ createShader: function (vs, fs)
2850
+ {
2851
+ // if (DEBUG)
2852
+ // console .log ("Creating SegmentedVolumeData Shader ...");
2853
+
2854
+ var
2855
+ opacityMapVolumeStyle = this .getBrowser () .getDefaultVolumeStyle (),
2856
+ styleUniforms = opacityMapVolumeStyle .getUniformsText (),
2857
+ styleFunctions = opacityMapVolumeStyle .getFunctionsText ();
2858
+
2859
+ if (this .segmentIdentifiersNode)
2860
+ {
2861
+ styleUniforms += "\n";
2862
+ styleUniforms += "uniform sampler3D segmentIdentifiers;\n";
2863
+ styleFunctions += "\n";
2864
+
2865
+ styleFunctions += "\n";
2866
+ styleFunctions += " int segment = int (texture (segmentIdentifiers, texCoord) .r * 255.0);\n";
2867
+ }
2868
+ else
2869
+ {
2870
+ styleFunctions += " int segment = 0;\n";
2871
+ }
2872
+
2873
+ if (this .renderStyleNodes .length)
2874
+ {
2875
+ styleFunctions += "\n";
2876
+ styleFunctions += " switch (segment)\n";
2877
+ styleFunctions += " {\n";
2878
+
2879
+ for (var i = 0, length = this .renderStyleNodes .length; i < length; ++ i)
2880
+ {
2881
+ styleFunctions += " case " + i + ":\n";
2882
+ styleFunctions += " {\n";
2883
+
2884
+ if (this .getSegmentEnabled (i))
2885
+ {
2886
+ styleUniforms += this .renderStyleNodes [i] .getUniformsText (),
2887
+ styleFunctions += this .renderStyleNodes [i] .getFunctionsText ();
2888
+ styleFunctions += " break;\n";
2889
+ }
2890
+ else
2891
+ {
2892
+ styleFunctions += " discard;\n";
2893
+ }
2894
+
2895
+ styleFunctions += " }\n";
2896
+ }
2897
+
2898
+ styleFunctions += " }\n";
2899
+ }
2900
+
2901
+ fs = fs .replace (/\/\/ VOLUME_STYLES_UNIFORMS\n/, styleUniforms);
2902
+ fs = fs .replace (/\/\/ VOLUME_STYLES_FUNCTIONS\n/, styleFunctions);
2903
+
2904
+ // if (DEBUG)
2905
+ // this .getBrowser () .print (fs);
2906
+
2907
+ var vertexShader = new ShaderPart (this .getExecutionContext ());
2908
+ vertexShader .setName ("SegmentedVolumeDataVertexShader");
2909
+ vertexShader .url_ .push ("data:x-shader/x-vertex," + vs);
2910
+ vertexShader .setup ();
2911
+
2912
+ var fragmentShader = new ShaderPart (this .getExecutionContext ());
2913
+ fragmentShader .setName ("SegmentedVolumeDataFragmentShader");
2914
+ fragmentShader .type_ = "FRAGMENT";
2915
+ fragmentShader .url_ .push ("data:x-shader/x-fragment," + fs);
2916
+ fragmentShader .setup ();
2917
+
2918
+ var shaderNode = new ComposedShader (this .getExecutionContext ());
2919
+ shaderNode .setName ("SegmentedVolumeDataShader");
2920
+ shaderNode .language_ = "GLSL";
2921
+ shaderNode .parts_ .push (vertexShader);
2922
+ shaderNode .parts_ .push (fragmentShader);
2923
+
2924
+ if (this .voxelsNode)
2925
+ {
2926
+ var textureSize = new Fields .SFVec3f (this .voxelsNode .getWidth (), this .voxelsNode .getHeight (), this .voxelsNode .getDepth ());
2927
+
2928
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureSize", textureSize);
2929
+ }
2930
+ else
2931
+ {
2932
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureSize", new Fields .SFVec3f ());
2933
+ }
2934
+
2935
+ if (this .segmentIdentifiersNode)
2936
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "segmentIdentifiers", new Fields .SFNode (this .segmentIdentifiersNode));
2937
+
2938
+ opacityMapVolumeStyle .addShaderFields (shaderNode);
2939
+
2940
+ for (var i = 0, length = this .renderStyleNodes .length; i < length; ++ i)
2941
+ {
2942
+ if (this .getSegmentEnabled (i))
2943
+ this .renderStyleNodes [i] .addShaderFields (shaderNode);
2944
+ }
2945
+
2946
+ return shaderNode;
2947
+ },
2948
+ });
2949
+
2950
+ return SegmentedVolumeData;
2951
+ });
2952
+
2953
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
2954
+ *******************************************************************************
2955
+ *
2956
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2957
+ *
2958
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
2959
+ *
2960
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
2961
+ *
2962
+ * The copyright notice above does not evidence any actual of intended
2963
+ * publication of such source code, and is an unpublished work by create3000.
2964
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
2965
+ * create3000.
2966
+ *
2967
+ * No permission is granted to copy, distribute, or create derivative works from
2968
+ * the contents of this software, in whole or in part, without the prior written
2969
+ * permission of create3000.
2970
+ *
2971
+ * NON-MILITARY USE ONLY
2972
+ *
2973
+ * All create3000 software are effectively free software with a non-military use
2974
+ * restriction. It is free. Well commented source is provided. You may reuse the
2975
+ * source in any way you please with the exception anything that uses it must be
2976
+ * marked to indicate is contains 'non-military use only' components.
2977
+ *
2978
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2979
+ *
2980
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
2981
+ *
2982
+ * This file is part of the X_ITE Project.
2983
+ *
2984
+ * X_ITE is free software: you can redistribute it and/or modify it under the
2985
+ * terms of the GNU General Public License version 3 only, as published by the
2986
+ * Free Software Foundation.
2987
+ *
2988
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
2989
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
2990
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
2991
+ * details (a copy is included in the LICENSE file that accompanied this code).
2992
+ *
2993
+ * You should have received a copy of the GNU General Public License version 3
2994
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
2995
+ * copy of the GPLv3 License.
2996
+ *
2997
+ * For Silvio, Joy and Adi.
2998
+ *
2999
+ ******************************************************************************/
3000
+
3001
+
3002
+ define ('x_ite/Components/VolumeRendering/ShadedVolumeStyle',[
3003
+ "x_ite/Fields",
3004
+ "x_ite/Basic/X3DFieldDefinition",
3005
+ "x_ite/Basic/FieldDefinitionArray",
3006
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
3007
+ "x_ite/Bits/X3DConstants",
3008
+ "x_ite/Bits/X3DCast",
3009
+ ],
3010
+ function (Fields,
3011
+ X3DFieldDefinition,
3012
+ FieldDefinitionArray,
3013
+ X3DComposableVolumeRenderStyleNode,
3014
+ X3DConstants,
3015
+ X3DCast)
3016
+ {
3017
+ "use strict";
3018
+
3019
+ function ShadedVolumeStyle (executionContext)
3020
+ {
3021
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
3022
+
3023
+ this .addType (X3DConstants .ShadedVolumeStyle);
3024
+ }
3025
+
3026
+ ShadedVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
3027
+ {
3028
+ constructor: ShadedVolumeStyle,
3029
+ fieldDefinitions: new FieldDefinitionArray ([
3030
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
3031
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
3032
+ new X3DFieldDefinition (X3DConstants .inputOutput, "lighting", new Fields .SFBool ()),
3033
+ new X3DFieldDefinition (X3DConstants .inputOutput, "shadows", new Fields .SFBool ()),
3034
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "phaseFunction", new Fields .SFString ("Henyey-Greenstein")),
3035
+ new X3DFieldDefinition (X3DConstants .inputOutput, "material", new Fields .SFNode ()),
3036
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceNormals", new Fields .SFNode ()),
3037
+ ]),
3038
+ getTypeName: function ()
3039
+ {
3040
+ return "ShadedVolumeStyle";
3041
+ },
3042
+ getComponentName: function ()
3043
+ {
3044
+ return "VolumeRendering";
3045
+ },
3046
+ getContainerField: function ()
3047
+ {
3048
+ return "renderStyle";
3049
+ },
3050
+ initialize: function ()
3051
+ {
3052
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
3053
+
3054
+ var gl = this .getBrowser () .getContext ();
3055
+
3056
+ if (gl .getVersion () < 2)
3057
+ return;
3058
+
3059
+ this .material_ .addInterest ("set_material__", this);
3060
+ this .surfaceNormals_ .addInterest ("set_surfaceNormals__", this);
3061
+
3062
+ this .set_material__ ();
3063
+ this .set_surfaceNormals__ ();
3064
+ },
3065
+ set_material__: function ()
3066
+ {
3067
+ if (this .materialNode)
3068
+ this .materialNode .removeInterest ("addNodeEvent", this);
3069
+
3070
+ this .materialNode = X3DCast (X3DConstants .X3DMaterialNode, this .material_);
3071
+
3072
+ if (this .materialNode)
3073
+ this .materialNode .addInterest ("addNodeEvent", this);
3074
+ },
3075
+ set_surfaceNormals__: function ()
3076
+ {
3077
+ this .surfaceNormalsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .surfaceNormals_);
3078
+ },
3079
+ addShaderFields: function (shaderNode)
3080
+ {
3081
+ if (! this .enabled_ .getValue ())
3082
+ return;
3083
+
3084
+ if (this .materialNode)
3085
+ {
3086
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "ambientIntensity_" + this .getId (), this .materialNode .ambientIntensity_ .copy ());
3087
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "diffuseColor_" + this .getId (), this .materialNode .diffuseColor_ .copy ());
3088
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "specularColor_" + this .getId (), this .materialNode .specularColor_ .copy ());
3089
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "emissiveColor_" + this .getId (), this .materialNode .emissiveColor_ .copy ());
3090
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "shininess_" + this .getId (), this .materialNode .shininess_ .copy ());
3091
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "transparency_" + this .getId (), this .materialNode .transparency_ .copy ());
3092
+ }
3093
+
3094
+ if (this .surfaceNormalsNode)
3095
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceNormals_" + this .getId (), new Fields .SFNode (this .surfaceNormalsNode));
3096
+ },
3097
+ getUniformsText: function ()
3098
+ {
3099
+ if (! this .enabled_ .getValue ())
3100
+ return "";
3101
+
3102
+ var string = "";
3103
+
3104
+ string += "\n";
3105
+ string += "// ShadedVolumeStyle\n";
3106
+ string += "\n";
3107
+ string += "uniform float ambientIntensity_" + this .getId () + ";\n";
3108
+ string += "uniform vec3 diffuseColor_" + this .getId () + ";\n";
3109
+ string += "uniform vec3 specularColor_" + this .getId () + ";\n";
3110
+ string += "uniform vec3 emissiveColor_" + this .getId () + ";\n";
3111
+ string += "uniform float shininess_" + this .getId () + ";\n";
3112
+ string += "uniform float transparency_" + this .getId () + ";\n";
3113
+
3114
+ string += this .getNormalText (this .surfaceNormalsNode);
3115
+
3116
+ string += "\n";
3117
+ string += "float\n";
3118
+ string += "getSpotFactor_" + this .getId () + " (const in float cutOffAngle, const in float beamWidth, const in vec3 L, const in vec3 d)\n";
3119
+ string += "{\n";
3120
+ string += " float spotAngle = acos (clamp (dot (-L, d), -1.0, 1.0));\n";
3121
+ string += "\n";
3122
+ string += " if (spotAngle >= cutOffAngle)\n";
3123
+ string += " return 0.0;\n";
3124
+ string += " else if (spotAngle <= beamWidth)\n";
3125
+ string += " return 1.0;\n";
3126
+ string += "\n";
3127
+ string += " return (spotAngle - cutOffAngle) / (beamWidth - cutOffAngle);\n";
3128
+ string += "}\n";
3129
+
3130
+ string += "\n";
3131
+ string += "vec4\n";
3132
+ string += "getShadedStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
3133
+ string += "{\n";
3134
+ string += " vec4 surfaceNormal = getNormal_" + this .getId () + " (texCoord);\n";
3135
+ string += "\n";
3136
+ string += " if (surfaceNormal .w == 0.0)\n";
3137
+ string += " return vec4 (0.0);\n";
3138
+ string += "\n";
3139
+ string += " vec4 shadedColor = vec4 (0.0);\n";
3140
+
3141
+ if (this .lighting_ .getValue ())
3142
+ {
3143
+ if (this .materialNode)
3144
+ {
3145
+ string += " vec3 diffuseFactor = diffuseColor_" + this .getId () + ";\n";
3146
+ string += " vec3 ambientTerm = diffuseFactor * ambientIntensity_" + this .getId () + ";\n";
3147
+ string += "\n";
3148
+ string += " shadedColor .a = originalColor .a * (1.0 - transparency_" + this .getId () + ");\n";
3149
+ }
3150
+ else
3151
+ {
3152
+ string += " vec3 diffuseFactor = originalColor .rgb;\n";
3153
+ string += " vec3 ambientTerm = vec3 (0.0);\n";
3154
+ string += "\n";
3155
+ string += " shadedColor .a = originalColor .a;\n";
3156
+ }
3157
+
3158
+ string += "\n";
3159
+ string += " vec3 N = surfaceNormal .xyz;\n";
3160
+ string += " vec3 V = normalize (-vertex); // normalized vector from point on geometry to viewer's position\n";
3161
+ string += "\n";
3162
+ string += " for (int i = 0; i < x3d_MaxLights; ++ i)\n";
3163
+ string += " {\n";
3164
+ string += " if (i == x3d_NumLights)\n";
3165
+ string += " break;\n";
3166
+ string += "\n";
3167
+ string += " x3d_LightSourceParameters light = x3d_LightSource [i];\n";
3168
+ string += "\n";
3169
+ string += " vec3 vL = light .location - vertex; // Light to fragment\n";
3170
+ string += " float dL = length (light .matrix * vL);\n";
3171
+ string += " bool di = light .type == x3d_DirectionalLight;\n";
3172
+ string += "\n";
3173
+ string += " if (di || dL <= light .radius)\n";
3174
+ string += " {\n";
3175
+ string += " vec3 d = light .direction;\n";
3176
+ string += " vec3 c = light .attenuation;\n";
3177
+ string += " vec3 L = di ? -d : normalize (vL); // Normalized vector from point on geometry to light source i position.\n";
3178
+ string += " vec3 H = normalize (L + V); // Specular term\n";
3179
+ string += "\n";
3180
+ string += " float lightAngle = max (dot (N, L), 0.0); // Angle between normal and light ray.\n";
3181
+ string += " vec3 diffuseTerm = diffuseFactor * lightAngle;\n";
3182
+ string += " float specularFactor = shininess_" + this .getId () + " > 0.0 ? pow (max (dot (N, H), 0.0), shininess_" + this .getId () + " * 128.0) : 1.0;\n";
3183
+ string += " vec3 specularTerm = light .intensity * specularColor_" + this .getId () + " * specularFactor;\n";
3184
+ string += "\n";
3185
+ string += " float attenuationFactor = di ? 1.0 : 1.0 / max (c [0] + c [1] * dL + c [2] * (dL * dL), 1.0);\n";
3186
+ string += " float spotFactor = light .type == x3d_SpotLight ? getSpotFactor_" + this .getId () + " (light .cutOffAngle, light .beamWidth, L, d) : 1.0;\n";
3187
+ string += " float attenuationSpotFactor = attenuationFactor * spotFactor;\n";
3188
+ string += " vec3 ambientColor = light .ambientIntensity * ambientTerm;\n";
3189
+ string += " vec3 diffuseSpecularColor = light .intensity * (diffuseTerm + specularTerm);\n";
3190
+ string += "\n";
3191
+ string += " shadedColor .rgb += attenuationSpotFactor * light .color * (ambientColor + diffuseSpecularColor);\n";
3192
+ string += " }\n";
3193
+ string += "\n";
3194
+ string += " shadedColor .rgb += emissiveColor_" + this .getId () + ";\n";
3195
+ string += " shadedColor .rgb = getFogColor (shadedColor .rgb);\n";
3196
+ string += " }\n";
3197
+ }
3198
+ else
3199
+ {
3200
+ if (this .materialNode)
3201
+ {
3202
+ string += " shadedColor .rgb = diffuseColor_" + this .getId () + ";\n";
3203
+ string += " shadedColor .a = originalColor .a * (1.0 - transparency_" + this .getId () + ");\n";
3204
+ }
3205
+ else
3206
+ {
3207
+ string += " shadedColor = originalColor;\n";
3208
+ }
3209
+ }
3210
+
3211
+ string += "\n";
3212
+ string += " return shadedColor;\n";
3213
+ string += "}\n";
3214
+
3215
+ return string;
3216
+ },
3217
+ getFunctionsText: function ()
3218
+ {
3219
+ if (! this .enabled_ .getValue ())
3220
+ return "";
3221
+
3222
+ var string = "";
3223
+
3224
+ string += "\n";
3225
+ string += " // ShadedVolumeStyle\n";
3226
+ string += "\n";
3227
+ string += " textureColor = getShadedStyle_" + this .getId () + " (textureColor, texCoord);\n";
3228
+
3229
+ return string;
3230
+ },
3231
+ });
3232
+
3233
+ return ShadedVolumeStyle;
3234
+ });
3235
+
3236
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
3237
+ *******************************************************************************
3238
+ *
3239
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3240
+ *
3241
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
3242
+ *
3243
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
3244
+ *
3245
+ * The copyright notice above does not evidence any actual of intended
3246
+ * publication of such source code, and is an unpublished work by create3000.
3247
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
3248
+ * create3000.
3249
+ *
3250
+ * No permission is granted to copy, distribute, or create derivative works from
3251
+ * the contents of this software, in whole or in part, without the prior written
3252
+ * permission of create3000.
3253
+ *
3254
+ * NON-MILITARY USE ONLY
3255
+ *
3256
+ * All create3000 software are effectively free software with a non-military use
3257
+ * restriction. It is free. Well commented source is provided. You may reuse the
3258
+ * source in any way you please with the exception anything that uses it must be
3259
+ * marked to indicate is contains 'non-military use only' components.
3260
+ *
3261
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3262
+ *
3263
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
3264
+ *
3265
+ * This file is part of the X_ITE Project.
3266
+ *
3267
+ * X_ITE is free software: you can redistribute it and/or modify it under the
3268
+ * terms of the GNU General Public License version 3 only, as published by the
3269
+ * Free Software Foundation.
3270
+ *
3271
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
3272
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
3273
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
3274
+ * details (a copy is included in the LICENSE file that accompanied this code).
3275
+ *
3276
+ * You should have received a copy of the GNU General Public License version 3
3277
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
3278
+ * copy of the GPLv3 License.
3279
+ *
3280
+ * For Silvio, Joy and Adi.
3281
+ *
3282
+ ******************************************************************************/
3283
+
3284
+
3285
+ define ('x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle',[
3286
+ "x_ite/Fields",
3287
+ "x_ite/Basic/X3DFieldDefinition",
3288
+ "x_ite/Basic/FieldDefinitionArray",
3289
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
3290
+ "x_ite/Bits/X3DConstants",
3291
+ "x_ite/Bits/X3DCast",
3292
+ ],
3293
+ function (Fields,
3294
+ X3DFieldDefinition,
3295
+ FieldDefinitionArray,
3296
+ X3DComposableVolumeRenderStyleNode,
3297
+ X3DConstants,
3298
+ X3DCast)
3299
+ {
3300
+ "use strict";
3301
+
3302
+ function SilhouetteEnhancementVolumeStyle (executionContext)
3303
+ {
3304
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
3305
+
3306
+ this .addType (X3DConstants .SilhouetteEnhancementVolumeStyle);
3307
+ }
3308
+
3309
+ SilhouetteEnhancementVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
3310
+ {
3311
+ constructor: SilhouetteEnhancementVolumeStyle,
3312
+ fieldDefinitions: new FieldDefinitionArray ([
3313
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
3314
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
3315
+ new X3DFieldDefinition (X3DConstants .inputOutput, "silhouetteRetainedOpacity", new Fields .SFFloat (1)),
3316
+ new X3DFieldDefinition (X3DConstants .inputOutput, "silhouetteBoundaryOpacity", new Fields .SFFloat (0)),
3317
+ new X3DFieldDefinition (X3DConstants .inputOutput, "silhouetteSharpness", new Fields .SFFloat (0.5)),
3318
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceNormals", new Fields .SFNode ()),
3319
+ ]),
3320
+ getTypeName: function ()
3321
+ {
3322
+ return "SilhouetteEnhancementVolumeStyle";
3323
+ },
3324
+ getComponentName: function ()
3325
+ {
3326
+ return "VolumeRendering";
3327
+ },
3328
+ getContainerField: function ()
3329
+ {
3330
+ return "renderStyle";
3331
+ },
3332
+ initialize: function ()
3333
+ {
3334
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
3335
+
3336
+ var gl = this .getBrowser () .getContext ();
3337
+
3338
+ if (gl .getVersion () < 2)
3339
+ return;
3340
+
3341
+ this .surfaceNormals_ .addInterest ("set_surfaceNormals__", this);
3342
+
3343
+ this .set_surfaceNormals__ ();
3344
+ },
3345
+ set_surfaceNormals__: function ()
3346
+ {
3347
+ this .surfaceNormalsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .surfaceNormals_);
3348
+ },
3349
+ addShaderFields: function (shaderNode)
3350
+ {
3351
+ if (! this .enabled_ .getValue ())
3352
+ return;
3353
+
3354
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "silhouetteRetainedOpacity_" + this .getId (), this .silhouetteRetainedOpacity_ .copy ());
3355
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "silhouetteBoundaryOpacity_" + this .getId (), this .silhouetteBoundaryOpacity_ .copy ());
3356
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "silhouetteSharpness_" + this .getId (), this .silhouetteSharpness_ .copy ());
3357
+
3358
+ if (this .surfaceNormalsNode)
3359
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceNormals_" + this .getId (), new Fields .SFNode (this .surfaceNormalsNode));
3360
+ },
3361
+ getUniformsText: function ()
3362
+ {
3363
+ if (! this .enabled_ .getValue ())
3364
+ return "";
3365
+
3366
+ var string = "";
3367
+
3368
+ string += "\n";
3369
+ string += "// SilhouetteEnhancementVolumeStyle\n";
3370
+ string += "\n";
3371
+ string += "uniform float silhouetteRetainedOpacity_" + this .getId () + ";\n";
3372
+ string += "uniform float silhouetteBoundaryOpacity_" + this .getId () + ";\n";
3373
+ string += "uniform float silhouetteSharpness_" + this .getId () + ";\n";
3374
+
3375
+ string += this .getNormalText (this .surfaceNormalsNode);
3376
+
3377
+ string += "\n";
3378
+ string += "vec4\n";
3379
+ string += "getSilhouetteEnhancementStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
3380
+ string += "{\n";
3381
+ string += " vec4 surfaceNormal = getNormal_" + this .getId () + " (texCoord);\n";
3382
+ string += "\n";
3383
+ string += " if (surfaceNormal .w == 0.0)\n";
3384
+ string += " return vec4 (0.0);\n";
3385
+ string += " \n";
3386
+ string += " float silhouetteRetainedOpacity = silhouetteRetainedOpacity_" + this .getId () + ";\n";
3387
+ string += " float silhouetteBoundaryOpacity = silhouetteBoundaryOpacity_" + this .getId () + ";\n";
3388
+ string += " float silhouetteSharpness = silhouetteSharpness_" + this .getId () + ";\n";
3389
+ string += "\n";
3390
+ string += " return vec4 (originalColor .rgb, originalColor .a * (silhouetteRetainedOpacity + silhouetteBoundaryOpacity * pow (1.0 - abs (dot (surfaceNormal .xyz, normalize (vertex))), silhouetteSharpness)));\n";
3391
+ string += "}\n";
3392
+
3393
+ return string;
3394
+ },
3395
+ getFunctionsText: function ()
3396
+ {
3397
+ if (! this .enabled_ .getValue ())
3398
+ return "";
3399
+
3400
+ var string = "";
3401
+
3402
+ string += "\n";
3403
+ string += " // SilhouetteEnhancementVolumeStyle\n";
3404
+ string += "\n";
3405
+ string += " textureColor = getSilhouetteEnhancementStyle_" + this .getId () + " (textureColor, texCoord);\n";
3406
+
3407
+ return string;
3408
+ },
3409
+ });
3410
+
3411
+ return SilhouetteEnhancementVolumeStyle;
3412
+ });
3413
+
3414
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
3415
+ *******************************************************************************
3416
+ *
3417
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3418
+ *
3419
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
3420
+ *
3421
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
3422
+ *
3423
+ * The copyright notice above does not evidence any actual of intended
3424
+ * publication of such source code, and is an unpublished work by create3000.
3425
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
3426
+ * create3000.
3427
+ *
3428
+ * No permission is granted to copy, distribute, or create derivative works from
3429
+ * the contents of this software, in whole or in part, without the prior written
3430
+ * permission of create3000.
3431
+ *
3432
+ * NON-MILITARY USE ONLY
3433
+ *
3434
+ * All create3000 software are effectively free software with a non-military use
3435
+ * restriction. It is free. Well commented source is provided. You may reuse the
3436
+ * source in any way you please with the exception anything that uses it must be
3437
+ * marked to indicate is contains 'non-military use only' components.
3438
+ *
3439
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3440
+ *
3441
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
3442
+ *
3443
+ * This file is part of the X_ITE Project.
3444
+ *
3445
+ * X_ITE is free software: you can redistribute it and/or modify it under the
3446
+ * terms of the GNU General Public License version 3 only, as published by the
3447
+ * Free Software Foundation.
3448
+ *
3449
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
3450
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
3451
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
3452
+ * details (a copy is included in the LICENSE file that accompanied this code).
3453
+ *
3454
+ * You should have received a copy of the GNU General Public License version 3
3455
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
3456
+ * copy of the GPLv3 License.
3457
+ *
3458
+ * For Silvio, Joy and Adi.
3459
+ *
3460
+ ******************************************************************************/
3461
+
3462
+
3463
+ define ('x_ite/Components/VolumeRendering/ToneMappedVolumeStyle',[
3464
+ "x_ite/Fields",
3465
+ "x_ite/Basic/X3DFieldDefinition",
3466
+ "x_ite/Basic/FieldDefinitionArray",
3467
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
3468
+ "x_ite/Bits/X3DConstants",
3469
+ "x_ite/Bits/X3DCast",
3470
+ ],
3471
+ function (Fields,
3472
+ X3DFieldDefinition,
3473
+ FieldDefinitionArray,
3474
+ X3DComposableVolumeRenderStyleNode,
3475
+ X3DConstants,
3476
+ X3DCast)
3477
+ {
3478
+ "use strict";
3479
+
3480
+ function ToneMappedVolumeStyle (executionContext)
3481
+ {
3482
+ X3DComposableVolumeRenderStyleNode .call (this, executionContext);
3483
+
3484
+ this .addType (X3DConstants .ToneMappedVolumeStyle);
3485
+ }
3486
+
3487
+ ToneMappedVolumeStyle .prototype = Object .assign (Object .create (X3DComposableVolumeRenderStyleNode .prototype),
3488
+ {
3489
+ constructor: ToneMappedVolumeStyle,
3490
+ fieldDefinitions: new FieldDefinitionArray ([
3491
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
3492
+ new X3DFieldDefinition (X3DConstants .inputOutput, "enabled", new Fields .SFBool (true)),
3493
+ new X3DFieldDefinition (X3DConstants .inputOutput, "coolColor", new Fields .SFColorRGBA (0, 0, 1, 0)),
3494
+ new X3DFieldDefinition (X3DConstants .inputOutput, "warmColor", new Fields .SFColorRGBA (1, 1, 0, 0)),
3495
+ new X3DFieldDefinition (X3DConstants .inputOutput, "surfaceNormals", new Fields .SFNode ()),
3496
+ ]),
3497
+ getTypeName: function ()
3498
+ {
3499
+ return "ToneMappedVolumeStyle";
3500
+ },
3501
+ getComponentName: function ()
3502
+ {
3503
+ return "VolumeRendering";
3504
+ },
3505
+ getContainerField: function ()
3506
+ {
3507
+ return "renderStyle";
3508
+ },
3509
+ initialize: function ()
3510
+ {
3511
+ X3DComposableVolumeRenderStyleNode .prototype .initialize .call (this);
3512
+
3513
+ var gl = this .getBrowser () .getContext ();
3514
+
3515
+ if (gl .getVersion () < 2)
3516
+ return;
3517
+
3518
+ this .surfaceNormals_ .addInterest ("set_surfaceNormals__", this);
3519
+
3520
+ this .set_surfaceNormals__ ();
3521
+ },
3522
+ set_surfaceNormals__: function ()
3523
+ {
3524
+ this .surfaceNormalsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .surfaceNormals_);
3525
+ },
3526
+ addShaderFields: function (shaderNode)
3527
+ {
3528
+ if (! this .enabled_ .getValue ())
3529
+ return;
3530
+
3531
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "coolColor_" + this .getId (), this .coolColor_ .copy ());
3532
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "warmColor_" + this .getId (), this .warmColor_ .copy ());
3533
+
3534
+ if (this .surfaceNormalsNode)
3535
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "surfaceNormals_" + this .getId (), new Fields .SFNode (this .surfaceNormalsNode));
3536
+ },
3537
+ getUniformsText: function ()
3538
+ {
3539
+ if (! this .enabled_ .getValue ())
3540
+ return "";
3541
+
3542
+ var string = "";
3543
+
3544
+ string += "\n";
3545
+ string += "// ToneMappedVolumeStyle\n";
3546
+ string += "\n";
3547
+ string += "uniform vec4 coolColor_" + this .getId () + ";\n";
3548
+ string += "uniform vec4 warmColor_" + this .getId () + ";\n";
3549
+
3550
+ string += this .getNormalText (this .surfaceNormalsNode);
3551
+
3552
+ string += "\n";
3553
+ string += "vec4\n";
3554
+ string += "getToneMappedStyle_" + this .getId () + " (in vec4 originalColor, in vec3 texCoord)\n";
3555
+ string += "{\n";
3556
+ string += " vec4 surfaceNormal = getNormal_" + this .getId () + " (texCoord);\n";
3557
+ string += "\n";
3558
+ string += " if (surfaceNormal .w == 0.0)\n";
3559
+ string += " return vec4 (0.0);\n";
3560
+ string += "\n";
3561
+ string += " vec3 toneColor = vec3 (0.0);\n";
3562
+ string += " vec3 coolColor = coolColor_" + this .getId () + " .rgb;\n";
3563
+ string += " vec3 warmColor = warmColor_" + this .getId () + " .rgb;\n";
3564
+ string += "\n";
3565
+ string += " for (int i = 0; i < x3d_MaxLights; ++ i)\n";
3566
+ string += " {\n";
3567
+ string += " if (i == x3d_NumLights)\n";
3568
+ string += " break;\n";
3569
+ string += "\n";
3570
+ string += " x3d_LightSourceParameters light = x3d_LightSource [i];\n";
3571
+ string += "\n";
3572
+ string += " vec3 L = light .type == x3d_DirectionalLight ? -light .direction : normalize (light .location - vertex);\n";
3573
+ string += " float colorFactor = (1.0 + dot (L, surfaceNormal .xyz)) * 0.5;\n";
3574
+ string += "\n";
3575
+ string += " toneColor += mix (warmColor .rgb, coolColor .rgb, colorFactor);\n";
3576
+ string += " }\n";
3577
+ string += "\n";
3578
+ string += " return vec4 (toneColor, originalColor .a);\n";
3579
+ string += "}\n";
3580
+
3581
+ return string;
3582
+ },
3583
+ getFunctionsText: function ()
3584
+ {
3585
+ if (! this .enabled_ .getValue ())
3586
+ return "";
3587
+
3588
+ var string = "";
3589
+
3590
+ string += "\n";
3591
+ string += " // ToneMappedVolumeStyle\n";
3592
+ string += "\n";
3593
+ string += " textureColor = getToneMappedStyle_" + this .getId () + " (textureColor, texCoord);\n";
3594
+
3595
+ return string;
3596
+ },
3597
+ });
3598
+
3599
+ return ToneMappedVolumeStyle;
3600
+ });
3601
+
3602
+ /* -*- Mode: JavaScript; coding: utf-8; tab-width: 3; indent-tabs-mode: tab; c-basic-offset: 3 -*-
3603
+ *******************************************************************************
3604
+ *
3605
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3606
+ *
3607
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
3608
+ *
3609
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
3610
+ *
3611
+ * The copyright notice above does not evidence any actual of intended
3612
+ * publication of such source code, and is an unpublished work by create3000.
3613
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
3614
+ * create3000.
3615
+ *
3616
+ * No permission is granted to copy, distribute, or create derivative works from
3617
+ * the contents of this software, in whole or in part, without the prior written
3618
+ * permission of create3000.
3619
+ *
3620
+ * NON-MILITARY USE ONLY
3621
+ *
3622
+ * All create3000 software are effectively free software with a non-military use
3623
+ * restriction. It is free. Well commented source is provided. You may reuse the
3624
+ * source in any way you please with the exception anything that uses it must be
3625
+ * marked to indicate is contains 'non-military use only' components.
3626
+ *
3627
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3628
+ *
3629
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
3630
+ *
3631
+ * This file is part of the X_ITE Project.
3632
+ *
3633
+ * X_ITE is free software: you can redistribute it and/or modify it under the
3634
+ * terms of the GNU General Public License version 3 only, as published by the
3635
+ * Free Software Foundation.
3636
+ *
3637
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
3638
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
3639
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
3640
+ * details (a copy is included in the LICENSE file that accompanied this code).
3641
+ *
3642
+ * You should have received a copy of the GNU General Public License version 3
3643
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
3644
+ * copy of the GPLv3 License.
3645
+ *
3646
+ * For Silvio, Joy and Adi.
3647
+ *
3648
+ ******************************************************************************/
3649
+
3650
+
3651
+ define ('x_ite/Components/VolumeRendering/VolumeData',[
3652
+ "x_ite/Fields",
3653
+ "x_ite/Basic/X3DFieldDefinition",
3654
+ "x_ite/Basic/FieldDefinitionArray",
3655
+ "x_ite/Components/VolumeRendering/X3DVolumeDataNode",
3656
+ "x_ite/Components/Shaders/ComposedShader",
3657
+ "x_ite/Components/Shaders/ShaderPart",
3658
+ "x_ite/Bits/X3DConstants",
3659
+ "x_ite/Bits/X3DCast",
3660
+ "text!x_ite/Browser/VolumeRendering/VolumeStyle.vs",
3661
+ "text!x_ite/Browser/VolumeRendering/VolumeStyle.fs",
3662
+ "x_ite/DEBUG",
3663
+ ],
3664
+ function (Fields,
3665
+ X3DFieldDefinition,
3666
+ FieldDefinitionArray,
3667
+ X3DVolumeDataNode,
3668
+ ComposedShader,
3669
+ ShaderPart,
3670
+ X3DConstants,
3671
+ X3DCast,
3672
+ vs,
3673
+ fs,
3674
+ DEBUG)
3675
+ {
3676
+ "use strict";
3677
+
3678
+ function VolumeData (executionContext)
3679
+ {
3680
+ X3DVolumeDataNode .call (this, executionContext);
3681
+
3682
+ this .addType (X3DConstants .VolumeData);
3683
+
3684
+ this .renderStyleNode = null;
3685
+ }
3686
+
3687
+ VolumeData .prototype = Object .assign (Object .create (X3DVolumeDataNode .prototype),
3688
+ {
3689
+ constructor: VolumeData,
3690
+ fieldDefinitions: new FieldDefinitionArray ([
3691
+ new X3DFieldDefinition (X3DConstants .inputOutput, "metadata", new Fields .SFNode ()),
3692
+ new X3DFieldDefinition (X3DConstants .inputOutput, "dimensions", new Fields .SFVec3f (1, 1, 1)),
3693
+ new X3DFieldDefinition (X3DConstants .inputOutput, "visible", new Fields .SFBool (true)),
3694
+ new X3DFieldDefinition (X3DConstants .inputOutput, "bboxDisplay", new Fields .SFBool ()),
3695
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxCenter", new Fields .SFVec3f (0, 0, 0)),
3696
+ new X3DFieldDefinition (X3DConstants .initializeOnly, "bboxSize", new Fields .SFVec3f (-1, -1, -1)),
3697
+ new X3DFieldDefinition (X3DConstants .inputOutput, "renderStyle", new Fields .SFNode ()),
3698
+ new X3DFieldDefinition (X3DConstants .inputOutput, "voxels", new Fields .SFNode ()),
3699
+ ]),
3700
+ getTypeName: function ()
3701
+ {
3702
+ return "VolumeData";
3703
+ },
3704
+ getComponentName: function ()
3705
+ {
3706
+ return "VolumeRendering";
3707
+ },
3708
+ getContainerField: function ()
3709
+ {
3710
+ return "children";
3711
+ },
3712
+ initialize: function ()
3713
+ {
3714
+ X3DVolumeDataNode .prototype .initialize .call (this);
3715
+
3716
+ var gl = this .getBrowser () .getContext ();
3717
+
3718
+ if (gl .getVersion () < 2)
3719
+ return;
3720
+
3721
+ this .renderStyle_ .addInterest ("set_renderStyle__", this);
3722
+ this .voxels_ .addInterest ("set_voxels__", this);
3723
+ this .voxels_ .addFieldInterest (this .getAppearance () .texture_);
3724
+
3725
+ this .renderStyle_ .addInterest ("update", this);
3726
+
3727
+ this .getAppearance () .texture_ = this .voxels_;
3728
+
3729
+ this .set_renderStyle__ ();
3730
+ this .set_voxels__ ();
3731
+
3732
+ this .update ();
3733
+ },
3734
+ set_renderStyle__: function ()
3735
+ {
3736
+ if (this .renderStyleNode)
3737
+ {
3738
+ this .renderStyleNode .removeInterest ("update", this);
3739
+ this .renderStyleNode .removeVolumeData (this);
3740
+ }
3741
+
3742
+ this .renderStyleNode = X3DCast (X3DConstants .X3DVolumeRenderStyleNode, this .renderStyle_);
3743
+
3744
+ if (this .renderStyleNode)
3745
+ {
3746
+ this .renderStyleNode .addInterest ("update", this);
3747
+ this .renderStyleNode .addVolumeData (this);
3748
+ }
3749
+ },
3750
+ set_voxels__: function ()
3751
+ {
3752
+ if (this .voxelsNode)
3753
+ this .voxelsNode .removeInterest ("set_textureSize__", this);
3754
+
3755
+ this .voxelsNode = X3DCast (X3DConstants .X3DTexture3DNode, this .voxels_);
3756
+
3757
+ if (this .voxelsNode)
3758
+ {
3759
+ this .voxelsNode .addInterest ("set_textureSize__", this);
3760
+
3761
+ this .set_textureSize__ ();
3762
+ }
3763
+ },
3764
+ set_textureSize__: function ()
3765
+ {
3766
+ try
3767
+ {
3768
+ var textureSize = this .getShader () .getField ("x3d_TextureSize");
3769
+
3770
+ textureSize .x = this .voxelsNode .getWidth ();
3771
+ textureSize .y = this .voxelsNode .getHeight ();
3772
+ textureSize .z = this .voxelsNode .getDepth ();
3773
+ }
3774
+ catch (error)
3775
+ {
3776
+ if (DEBUG)
3777
+ console .log (error .message);
3778
+ }
3779
+ },
3780
+ update: function ()
3781
+ {
3782
+ this .setShader (this .createShader (vs, fs));
3783
+ },
3784
+ createShader: function (vs, fs)
3785
+ {
3786
+ // if (DEBUG)
3787
+ // console .log ("Creating VolumeData Shader ...");
3788
+
3789
+ var
3790
+ opacityMapVolumeStyle = this .getBrowser () .getDefaultVolumeStyle (),
3791
+ styleUniforms = opacityMapVolumeStyle .getUniformsText (),
3792
+ styleFunctions = opacityMapVolumeStyle .getFunctionsText ();
3793
+
3794
+ if (this .renderStyleNode)
3795
+ {
3796
+ styleUniforms += this .renderStyleNode .getUniformsText (),
3797
+ styleFunctions += this .renderStyleNode .getFunctionsText ();
3798
+ }
3799
+
3800
+ fs = fs .replace (/\/\/ VOLUME_STYLES_UNIFORMS\n/, styleUniforms);
3801
+ fs = fs .replace (/\/\/ VOLUME_STYLES_FUNCTIONS\n/, styleFunctions);
3802
+
3803
+ // if (DEBUG)
3804
+ // this .getBrowser () .print (fs);
3805
+
3806
+ var vertexShader = new ShaderPart (this .getExecutionContext ());
3807
+ vertexShader .setName ("VolumeDataVertexShader");
3808
+ vertexShader .url_ .push ("data:x-shader/x-vertex," + vs);
3809
+ vertexShader .setup ();
3810
+
3811
+ var fragmentShader = new ShaderPart (this .getExecutionContext ());
3812
+ fragmentShader .setName ("VolumeDataFragmentShader");
3813
+ fragmentShader .type_ = "FRAGMENT";
3814
+ fragmentShader .url_ .push ("data:x-shader/x-fragment," + fs);
3815
+ fragmentShader .setup ();
3816
+
3817
+ var shaderNode = new ComposedShader (this .getExecutionContext ());
3818
+ shaderNode .setName ("VolumeDataShader");
3819
+ shaderNode .language_ = "GLSL";
3820
+ shaderNode .parts_ .push (vertexShader);
3821
+ shaderNode .parts_ .push (fragmentShader);
3822
+
3823
+ if (this .voxelsNode)
3824
+ {
3825
+ var textureSize = new Fields .SFVec3f (this .voxelsNode .getWidth (), this .voxelsNode .getHeight (), this .voxelsNode .getDepth ());
3826
+
3827
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureSize", textureSize);
3828
+ }
3829
+ else
3830
+ {
3831
+ shaderNode .addUserDefinedField (X3DConstants .inputOutput, "x3d_TextureSize", new Fields .SFVec3f ());
3832
+ }
3833
+
3834
+ opacityMapVolumeStyle .addShaderFields (shaderNode);
3835
+
3836
+ if (this .renderStyleNode)
3837
+ this .renderStyleNode .addShaderFields (shaderNode);
3838
+
3839
+ return shaderNode;
3840
+ },
3841
+ });
3842
+
3843
+ return VolumeData;
3844
+ });
3845
+
3846
+ /*******************************************************************************
3847
+ *
3848
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3849
+ *
3850
+ * Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011.
3851
+ *
3852
+ * All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
3853
+ *
3854
+ * The copyright notice above does not evidence any actual of intended
3855
+ * publication of such source code, and is an unpublished work by create3000.
3856
+ * This material contains CONFIDENTIAL INFORMATION that is the property of
3857
+ * create3000.
3858
+ *
3859
+ * No permission is granted to copy, distribute, or create derivative works from
3860
+ * the contents of this software, in whole or in part, without the prior written
3861
+ * permission of create3000.
3862
+ *
3863
+ * NON-MILITARY USE ONLY
3864
+ *
3865
+ * All create3000 software are effectively free software with a non-military use
3866
+ * restriction. It is free. Well commented source is provided. You may reuse the
3867
+ * source in any way you please with the exception anything that uses it must be
3868
+ * marked to indicate is contains 'non-military use only' components.
3869
+ *
3870
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3871
+ *
3872
+ * Copyright 2015, 2016 Holger Seelig <holger.seelig@yahoo.de>.
3873
+ *
3874
+ * This file is part of the X_ITE Project.
3875
+ *
3876
+ * X_ITE is free software: you can redistribute it and/or modify it under the
3877
+ * terms of the GNU General Public License version 3 only, as published by the
3878
+ * Free Software Foundation.
3879
+ *
3880
+ * X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
3881
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
3882
+ * A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
3883
+ * details (a copy is included in the LICENSE file that accompanied this code).
3884
+ *
3885
+ * You should have received a copy of the GNU General Public License version 3
3886
+ * along with X_ITE. If not, see <http://www.gnu.org/licenses/gpl.html> for a
3887
+ * copy of the GPLv3 License.
3888
+ *
3889
+ * For Silvio, Joy and Adi.
3890
+ *
3891
+ ******************************************************************************/
3892
+
3893
+
3894
+ define ([
3895
+ "x_ite/Components",
3896
+ "x_ite/Browser/VolumeRendering/X3DVolumeRenderingContext",
3897
+ "x_ite/Components/VolumeRendering/BlendedVolumeStyle",
3898
+ "x_ite/Components/VolumeRendering/BoundaryEnhancementVolumeStyle",
3899
+ "x_ite/Components/VolumeRendering/CartoonVolumeStyle",
3900
+ "x_ite/Components/VolumeRendering/ComposedVolumeStyle",
3901
+ "x_ite/Components/VolumeRendering/EdgeEnhancementVolumeStyle",
3902
+ "x_ite/Components/VolumeRendering/IsoSurfaceVolumeData",
3903
+ "x_ite/Components/VolumeRendering/OpacityMapVolumeStyle",
3904
+ "x_ite/Components/VolumeRendering/ProjectionVolumeStyle",
3905
+ "x_ite/Components/VolumeRendering/SegmentedVolumeData",
3906
+ "x_ite/Components/VolumeRendering/ShadedVolumeStyle",
3907
+ "x_ite/Components/VolumeRendering/SilhouetteEnhancementVolumeStyle",
3908
+ "x_ite/Components/VolumeRendering/ToneMappedVolumeStyle",
3909
+ "x_ite/Components/VolumeRendering/VolumeData",
3910
+ "x_ite/Components/VolumeRendering/X3DComposableVolumeRenderStyleNode",
3911
+ "x_ite/Components/VolumeRendering/X3DVolumeDataNode",
3912
+ "x_ite/Components/VolumeRendering/X3DVolumeRenderStyleNode",
3913
+ X3D .getComponentUrl ("cad-geometry"),
3914
+ X3D .getComponentUrl ("texturing-3d"),
3915
+ ],
3916
+ function (Components,
3917
+ X3DVolumeRenderingContext,
3918
+ BlendedVolumeStyle,
3919
+ BoundaryEnhancementVolumeStyle,
3920
+ CartoonVolumeStyle,
3921
+ ComposedVolumeStyle,
3922
+ EdgeEnhancementVolumeStyle,
3923
+ IsoSurfaceVolumeData,
3924
+ OpacityMapVolumeStyle,
3925
+ ProjectionVolumeStyle,
3926
+ SegmentedVolumeData,
3927
+ ShadedVolumeStyle,
3928
+ SilhouetteEnhancementVolumeStyle,
3929
+ ToneMappedVolumeStyle,
3930
+ VolumeData,
3931
+ X3DComposableVolumeRenderStyleNode,
3932
+ X3DVolumeDataNode,
3933
+ X3DVolumeRenderStyleNode)
3934
+ {
3935
+ "use strict";
3936
+
3937
+ Components .addComponent ({
3938
+ name: "VolumeRendering",
3939
+ types:
3940
+ {
3941
+ BlendedVolumeStyle: BlendedVolumeStyle,
3942
+ BoundaryEnhancementVolumeStyle: BoundaryEnhancementVolumeStyle,
3943
+ CartoonVolumeStyle: CartoonVolumeStyle,
3944
+ ComposedVolumeStyle: ComposedVolumeStyle,
3945
+ EdgeEnhancementVolumeStyle: EdgeEnhancementVolumeStyle,
3946
+ IsoSurfaceVolumeData: IsoSurfaceVolumeData,
3947
+ OpacityMapVolumeStyle: OpacityMapVolumeStyle,
3948
+ ProjectionVolumeStyle: ProjectionVolumeStyle,
3949
+ SegmentedVolumeData: SegmentedVolumeData,
3950
+ ShadedVolumeStyle: ShadedVolumeStyle,
3951
+ SilhouetteEnhancementVolumeStyle: SilhouetteEnhancementVolumeStyle,
3952
+ ToneMappedVolumeStyle: ToneMappedVolumeStyle,
3953
+ VolumeData: VolumeData,
3954
+ },
3955
+ abstractTypes:
3956
+ {
3957
+ X3DComposableVolumeRenderStyleNode: X3DComposableVolumeRenderStyleNode,
3958
+ X3DVolumeDataNode: X3DVolumeDataNode,
3959
+ X3DVolumeRenderStyleNode: X3DVolumeRenderStyleNode,
3960
+ },
3961
+ browser: X3DVolumeRenderingContext,
3962
+ });
3963
+ });
3964
+
3965
+
3966
+ }());