scaleXYZ.vwf.yaml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. # Copyright 2012 United States Government, as represented by the Secretary of Defense, Under
  2. # Secretary of Defense (Personnel & Readiness).
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  5. # in compliance with the License. You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software distributed under the License
  10. # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  11. # or implied. See the License for the specific language governing permissions and limitations under
  12. # the License.
  13. ---
  14. extends: http://vwf.example.com/node3.vwf
  15. implements:
  16. - http://vwf.example.com/scale-on-move.vwf
  17. methods:
  18. createGeometry:
  19. deleteGeometry:
  20. scripts:
  21. - |
  22. this.initialize = function() {
  23. //console.info( "initialize scaleXYZ.vwf" );
  24. }
  25. this.createGeometry = function() {
  26. if ( this.parent.ttPoints ) {
  27. var pos = [];
  28. var faces = [];
  29. var count = 0;
  30. // x positive
  31. pos.push( this.parent.ttPositions[0][0] );
  32. pos.push( this.parent.ttPositions[0][1] ); // 0
  33. pos.push( this.parent.ttPositions[0][2] );
  34. pos.push( this.parent.ttPositions[8][0] );
  35. pos.push( this.parent.ttPositions[8][1] ); // 1
  36. pos.push( this.parent.ttPositions[8][2] );
  37. pos.push( this.parent.ttPositions[9][0] );
  38. pos.push( this.parent.ttPositions[9][1] ); // 2
  39. pos.push( this.parent.ttPositions[9][2] );
  40. pos.push( this.parent.ttPositions[10][0] );
  41. pos.push( this.parent.ttPositions[10][1] ); // 3
  42. pos.push( this.parent.ttPositions[10][2] );
  43. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  44. count += 4;
  45. pos.push( this.parent.ttPositions[11][0] );
  46. pos.push( this.parent.ttPositions[11][1] ); // 4
  47. pos.push( this.parent.ttPositions[11][2] );
  48. pos.push( this.parent.ttPositions[1][0] );
  49. pos.push( this.parent.ttPositions[1][1] ); // 5
  50. pos.push( this.parent.ttPositions[1][2] );
  51. pos.push( this.parent.ttPositions[13][0] );
  52. pos.push( this.parent.ttPositions[13][1] ); // 6
  53. pos.push( this.parent.ttPositions[13][2] );
  54. pos.push( this.parent.ttPositions[12][0] );
  55. pos.push( this.parent.ttPositions[12][1] ); // 7
  56. pos.push( this.parent.ttPositions[12][2] );
  57. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  58. count += 4;
  59. pos.push( this.parent.ttPositions[15][0] );
  60. pos.push( this.parent.ttPositions[15][1] ); // 8
  61. pos.push( this.parent.ttPositions[15][2] );
  62. pos.push( this.parent.ttPositions[16][0] );
  63. pos.push( this.parent.ttPositions[16][1] ); // 9
  64. pos.push( this.parent.ttPositions[16][2] );
  65. pos.push( this.parent.ttPositions[5][0] );
  66. pos.push( this.parent.ttPositions[5][1] ); // 10
  67. pos.push( this.parent.ttPositions[5][2] );
  68. pos.push( this.parent.ttPositions[14][0] );
  69. pos.push( this.parent.ttPositions[14][1] ); // 11
  70. pos.push( this.parent.ttPositions[14][2] );
  71. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  72. count += 4;
  73. pos.push( this.parent.ttPositions[17][0] );
  74. pos.push( this.parent.ttPositions[17][1] ); // 12
  75. pos.push( this.parent.ttPositions[17][2] );
  76. pos.push( this.parent.ttPositions[18][0] );
  77. pos.push( this.parent.ttPositions[18][1] ); // 13
  78. pos.push( this.parent.ttPositions[18][2] );
  79. pos.push( this.parent.ttPositions[19][0] );
  80. pos.push( this.parent.ttPositions[19][1] ); // 14
  81. pos.push( this.parent.ttPositions[19][2] );
  82. pos.push( this.parent.ttPositions[4][0] );
  83. pos.push( this.parent.ttPositions[4][1] ); // 15
  84. pos.push( this.parent.ttPositions[4][2] );
  85. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  86. count += 4;
  87. // x negative
  88. pos.push( this.parent.ttPositions[3][0] );
  89. pos.push( this.parent.ttPositions[3][1] ); // 16
  90. pos.push( this.parent.ttPositions[3][2] );
  91. pos.push( this.parent.ttPositions[20][0] );
  92. pos.push( this.parent.ttPositions[20][1] ); // 17
  93. pos.push( this.parent.ttPositions[20][2] );
  94. pos.push( this.parent.ttPositions[21][0] );
  95. pos.push( this.parent.ttPositions[21][1] ); // 18
  96. pos.push( this.parent.ttPositions[21][2] );
  97. pos.push( this.parent.ttPositions[22][0] );
  98. pos.push( this.parent.ttPositions[22][1] ); // 19
  99. pos.push( this.parent.ttPositions[22][2] );
  100. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  101. count += 4;
  102. pos.push( this.parent.ttPositions[23][0] );
  103. pos.push( this.parent.ttPositions[23][1] ); // 20
  104. pos.push( this.parent.ttPositions[23][2] );
  105. pos.push( this.parent.ttPositions[2][0] );
  106. pos.push( this.parent.ttPositions[2][1] ); // 21
  107. pos.push( this.parent.ttPositions[2][2] );
  108. pos.push( this.parent.ttPositions[25][0] );
  109. pos.push( this.parent.ttPositions[25][1] ); // 22
  110. pos.push( this.parent.ttPositions[25][2] );
  111. pos.push( this.parent.ttPositions[24][0] );
  112. pos.push( this.parent.ttPositions[24][1] ); // 23
  113. pos.push( this.parent.ttPositions[24][2] );
  114. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  115. count += 4;
  116. pos.push( this.parent.ttPositions[27][0] );
  117. pos.push( this.parent.ttPositions[27][1] ); // 24
  118. pos.push( this.parent.ttPositions[27][2] );
  119. pos.push( this.parent.ttPositions[26][0] );
  120. pos.push( this.parent.ttPositions[26][1] ); // 25
  121. pos.push( this.parent.ttPositions[26][2] );
  122. pos.push( this.parent.ttPositions[6][0] );
  123. pos.push( this.parent.ttPositions[6][1] ); // 26
  124. pos.push( this.parent.ttPositions[6][2] );
  125. pos.push( this.parent.ttPositions[28][0] );
  126. pos.push( this.parent.ttPositions[28][1] ); // 27
  127. pos.push( this.parent.ttPositions[28][2] );
  128. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  129. count += 4;
  130. pos.push( this.parent.ttPositions[31][0] );
  131. pos.push( this.parent.ttPositions[31][1] ); // 28
  132. pos.push( this.parent.ttPositions[31][2] );
  133. pos.push( this.parent.ttPositions[30][0] );
  134. pos.push( this.parent.ttPositions[30][1] ); // 29
  135. pos.push( this.parent.ttPositions[30][2] );
  136. pos.push( this.parent.ttPositions[29][0] );
  137. pos.push( this.parent.ttPositions[29][1] ); // 30
  138. pos.push( this.parent.ttPositions[29][2] );
  139. pos.push( this.parent.ttPositions[7][0] );
  140. pos.push( this.parent.ttPositions[7][1] ); // 31
  141. pos.push( this.parent.ttPositions[7][2] );
  142. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  143. count += 4;
  144. // y positive
  145. pos.push( this.parent.ttPositions[2][0] );
  146. pos.push( this.parent.ttPositions[2][1] ); // 32
  147. pos.push( this.parent.ttPositions[2][2] );
  148. pos.push( this.parent.ttPositions[37][0] );
  149. pos.push( this.parent.ttPositions[37][1] ); // 33
  150. pos.push( this.parent.ttPositions[37][2] );
  151. pos.push( this.parent.ttPositions[50][0] );
  152. pos.push( this.parent.ttPositions[50][1] ); // 34
  153. pos.push( this.parent.ttPositions[50][2] );
  154. pos.push( this.parent.ttPositions[25][0] );
  155. pos.push( this.parent.ttPositions[25][1] ); // 35
  156. pos.push( this.parent.ttPositions[25][2] );
  157. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  158. count += 4;
  159. pos.push( this.parent.ttPositions[35][0] );
  160. pos.push( this.parent.ttPositions[35][1] ); // 36
  161. pos.push( this.parent.ttPositions[35][2] );
  162. pos.push( this.parent.ttPositions[1][0] );
  163. pos.push( this.parent.ttPositions[1][1] ); // 37
  164. pos.push( this.parent.ttPositions[1][2] );
  165. pos.push( this.parent.ttPositions[13][0] );
  166. pos.push( this.parent.ttPositions[13][1] ); // 38
  167. pos.push( this.parent.ttPositions[13][2] );
  168. pos.push( this.parent.ttPositions[49][0] );
  169. pos.push( this.parent.ttPositions[49][1] ); // 39
  170. pos.push( this.parent.ttPositions[49][2] );
  171. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  172. count += 4;
  173. pos.push( this.parent.ttPositions[48][0] );
  174. pos.push( this.parent.ttPositions[48][1] ); // 40
  175. pos.push( this.parent.ttPositions[48][2] );
  176. pos.push( this.parent.ttPositions[16][0] );
  177. pos.push( this.parent.ttPositions[16][1] ); // 41
  178. pos.push( this.parent.ttPositions[16][2] );
  179. pos.push( this.parent.ttPositions[5][0] );
  180. pos.push( this.parent.ttPositions[5][1] ); // 42
  181. pos.push( this.parent.ttPositions[5][2] );
  182. pos.push( this.parent.ttPositions[43][0] );
  183. pos.push( this.parent.ttPositions[43][1] ); // 43
  184. pos.push( this.parent.ttPositions[43][2] );
  185. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  186. count += 4;
  187. pos.push( this.parent.ttPositions[28][0] );
  188. pos.push( this.parent.ttPositions[28][1] ); // 44
  189. pos.push( this.parent.ttPositions[28][2] );
  190. pos.push( this.parent.ttPositions[51][0] );
  191. pos.push( this.parent.ttPositions[51][1] ); // 45
  192. pos.push( this.parent.ttPositions[51][2] );
  193. pos.push( this.parent.ttPositions[45][0] );
  194. pos.push( this.parent.ttPositions[45][1] ); // 46
  195. pos.push( this.parent.ttPositions[45][2] );
  196. pos.push( this.parent.ttPositions[6][0] );
  197. pos.push( this.parent.ttPositions[6][1] ); // 47
  198. pos.push( this.parent.ttPositions[6][2] );
  199. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  200. count += 4;
  201. // y negative
  202. pos.push( this.parent.ttPositions[3][0] );
  203. pos.push( this.parent.ttPositions[3][1] ); // 48
  204. pos.push( this.parent.ttPositions[3][2] );
  205. pos.push( this.parent.ttPositions[22][0] );
  206. pos.push( this.parent.ttPositions[22][1] ); // 49
  207. pos.push( this.parent.ttPositions[22][2] );
  208. pos.push( this.parent.ttPositions[54][0] );
  209. pos.push( this.parent.ttPositions[54][1] ); // 50
  210. pos.push( this.parent.ttPositions[54][2] );
  211. pos.push( this.parent.ttPositions[39][0] );
  212. pos.push( this.parent.ttPositions[39][1] ); // 51
  213. pos.push( this.parent.ttPositions[39][2] );
  214. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  215. count += 4;
  216. pos.push( this.parent.ttPositions[33][0] );
  217. pos.push( this.parent.ttPositions[33][1] ); // 52
  218. pos.push( this.parent.ttPositions[33][2] );
  219. pos.push( this.parent.ttPositions[0][0] );
  220. pos.push( this.parent.ttPositions[0][1] ); // 53
  221. pos.push( this.parent.ttPositions[0][2] );
  222. pos.push( this.parent.ttPositions[10][0] );
  223. pos.push( this.parent.ttPositions[10][1] ); // 54
  224. pos.push( this.parent.ttPositions[10][2] );
  225. pos.push( this.parent.ttPositions[53][0] );
  226. pos.push( this.parent.ttPositions[53][1] ); // 55
  227. pos.push( this.parent.ttPositions[53][2] );
  228. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  229. count += 4;
  230. pos.push( this.parent.ttPositions[52][0] );
  231. pos.push( this.parent.ttPositions[52][1] ); // 56
  232. pos.push( this.parent.ttPositions[52][2] );
  233. pos.push( this.parent.ttPositions[19][0] );
  234. pos.push( this.parent.ttPositions[19][1] ); // 57
  235. pos.push( this.parent.ttPositions[19][2] );
  236. pos.push( this.parent.ttPositions[4][0] );
  237. pos.push( this.parent.ttPositions[4][1] ); // 58
  238. pos.push( this.parent.ttPositions[4][2] );
  239. pos.push( this.parent.ttPositions[41][0] );
  240. pos.push( this.parent.ttPositions[41][1] ); // 59
  241. pos.push( this.parent.ttPositions[41][2] );
  242. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  243. count += 4;
  244. pos.push( this.parent.ttPositions[31][0] );
  245. pos.push( this.parent.ttPositions[31][1] ); // 60
  246. pos.push( this.parent.ttPositions[31][2] );
  247. pos.push( this.parent.ttPositions[55][0] );
  248. pos.push( this.parent.ttPositions[55][1] ); // 61
  249. pos.push( this.parent.ttPositions[55][2] );
  250. pos.push( this.parent.ttPositions[47][0] );
  251. pos.push( this.parent.ttPositions[47][1] ); // 62
  252. pos.push( this.parent.ttPositions[47][2] );
  253. pos.push( this.parent.ttPositions[7][0] );
  254. pos.push( this.parent.ttPositions[7][1] ); // 63
  255. pos.push( this.parent.ttPositions[7][2] );
  256. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  257. count += 4;
  258. // z positive
  259. pos.push( this.parent.ttPositions[2][0] );
  260. pos.push( this.parent.ttPositions[2][1] ); // 64
  261. pos.push( this.parent.ttPositions[2][2] );
  262. pos.push( this.parent.ttPositions[37][0] );
  263. pos.push( this.parent.ttPositions[37][1] ); // 65
  264. pos.push( this.parent.ttPositions[37][2] );
  265. pos.push( this.parent.ttPositions[36][0] );
  266. pos.push( this.parent.ttPositions[36][1] ); // 66
  267. pos.push( this.parent.ttPositions[36][2] );
  268. pos.push( this.parent.ttPositions[23][0] );
  269. pos.push( this.parent.ttPositions[23][1] ); // 67
  270. pos.push( this.parent.ttPositions[23][2] );
  271. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  272. count += 4;
  273. pos.push( this.parent.ttPositions[35][0] );
  274. pos.push( this.parent.ttPositions[35][1] ); // 68
  275. pos.push( this.parent.ttPositions[35][2] );
  276. pos.push( this.parent.ttPositions[1][0] );
  277. pos.push( this.parent.ttPositions[1][1] ); // 69
  278. pos.push( this.parent.ttPositions[1][2] );
  279. pos.push( this.parent.ttPositions[11][0] );
  280. pos.push( this.parent.ttPositions[11][1] ); // 70
  281. pos.push( this.parent.ttPositions[11][2] );
  282. pos.push( this.parent.ttPositions[34][0] );
  283. pos.push( this.parent.ttPositions[34][1] ); // 71
  284. pos.push( this.parent.ttPositions[34][2] );
  285. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  286. count += 4;
  287. pos.push( this.parent.ttPositions[32][0] );
  288. pos.push( this.parent.ttPositions[32][1] ); // 72
  289. pos.push( this.parent.ttPositions[32][2] );
  290. pos.push( this.parent.ttPositions[8][0] );
  291. pos.push( this.parent.ttPositions[8][1] ); // 73
  292. pos.push( this.parent.ttPositions[8][2] );
  293. pos.push( this.parent.ttPositions[0][0] );
  294. pos.push( this.parent.ttPositions[0][1] ); // 74
  295. pos.push( this.parent.ttPositions[0][2] );
  296. pos.push( this.parent.ttPositions[33][0] );
  297. pos.push( this.parent.ttPositions[33][1] ); // 75
  298. pos.push( this.parent.ttPositions[33][2] );
  299. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  300. count += 4;
  301. pos.push( this.parent.ttPositions[20][0] );
  302. pos.push( this.parent.ttPositions[20][1] ); // 76
  303. pos.push( this.parent.ttPositions[20][2] );
  304. pos.push( this.parent.ttPositions[38][0] );
  305. pos.push( this.parent.ttPositions[38][1] ); // 77
  306. pos.push( this.parent.ttPositions[38][2] );
  307. pos.push( this.parent.ttPositions[39][0] );
  308. pos.push( this.parent.ttPositions[39][1] ); // 78
  309. pos.push( this.parent.ttPositions[39][2] );
  310. pos.push( this.parent.ttPositions[3][0] );
  311. pos.push( this.parent.ttPositions[3][1] ); // 79
  312. pos.push( this.parent.ttPositions[3][2] );
  313. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  314. count += 4;
  315. // z negative
  316. pos.push( this.parent.ttPositions[6][0] );
  317. pos.push( this.parent.ttPositions[6][1] ); // 80
  318. pos.push( this.parent.ttPositions[6][2] );
  319. pos.push( this.parent.ttPositions[45][0] );
  320. pos.push( this.parent.ttPositions[45][1] ); // 81
  321. pos.push( this.parent.ttPositions[45][2] );
  322. pos.push( this.parent.ttPositions[44][0] );
  323. pos.push( this.parent.ttPositions[44][1] ); // 82
  324. pos.push( this.parent.ttPositions[44][2] );
  325. pos.push( this.parent.ttPositions[26][0] );
  326. pos.push( this.parent.ttPositions[26][1] ); // 83
  327. pos.push( this.parent.ttPositions[26][2] );
  328. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  329. count += 4;
  330. pos.push( this.parent.ttPositions[43][0] );
  331. pos.push( this.parent.ttPositions[43][1] ); // 84
  332. pos.push( this.parent.ttPositions[43][2] );
  333. pos.push( this.parent.ttPositions[5][0] );
  334. pos.push( this.parent.ttPositions[5][1] ); // 85
  335. pos.push( this.parent.ttPositions[5][2] );
  336. pos.push( this.parent.ttPositions[14][0] );
  337. pos.push( this.parent.ttPositions[14][1] ); // 86
  338. pos.push( this.parent.ttPositions[14][2] );
  339. pos.push( this.parent.ttPositions[42][0] );
  340. pos.push( this.parent.ttPositions[42][1] ); // 87
  341. pos.push( this.parent.ttPositions[42][2] );
  342. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  343. count += 4;
  344. pos.push( this.parent.ttPositions[40][0] );
  345. pos.push( this.parent.ttPositions[40][1] ); // 88
  346. pos.push( this.parent.ttPositions[40][2] );
  347. pos.push( this.parent.ttPositions[17][0] );
  348. pos.push( this.parent.ttPositions[17][1] ); // 89
  349. pos.push( this.parent.ttPositions[17][2] );
  350. pos.push( this.parent.ttPositions[4][0] );
  351. pos.push( this.parent.ttPositions[4][1] ); // 90
  352. pos.push( this.parent.ttPositions[4][2] );
  353. pos.push( this.parent.ttPositions[41][0] );
  354. pos.push( this.parent.ttPositions[41][1] ); // 91
  355. pos.push( this.parent.ttPositions[41][2] );
  356. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  357. count += 4;
  358. pos.push( this.parent.ttPositions[29][0] );
  359. pos.push( this.parent.ttPositions[29][1] ); // 92
  360. pos.push( this.parent.ttPositions[29][2] );
  361. pos.push( this.parent.ttPositions[46][0] );
  362. pos.push( this.parent.ttPositions[46][1] ); // 93
  363. pos.push( this.parent.ttPositions[46][2] );
  364. pos.push( this.parent.ttPositions[47][0] );
  365. pos.push( this.parent.ttPositions[47][1] ); // 94
  366. pos.push( this.parent.ttPositions[47][2] );
  367. pos.push( this.parent.ttPositions[7][0] );
  368. pos.push( this.parent.ttPositions[7][1] ); // 95
  369. pos.push( this.parent.ttPositions[7][2] );
  370. faces.push( count, count+3, count+1, count+1, count+3, count+2 );
  371. var surface = {
  372. "extends": "http://vwf.example.com/node3.vwf",
  373. "type": "mesh/definition",
  374. "properties": {
  375. "meshDefinition": { "positions": pos, "faces": faces, "color": [ 255, 255, 255 ], },
  376. },
  377. };
  378. this.children.create( "scaleSurfaces", surface );
  379. }
  380. }
  381. this.deleteGeometry = function() {
  382. if ( this.scaleSurfaces ) {
  383. this.children.delete( this.scaleSurfaces );
  384. }
  385. } //@ sourceURL=scaleXYZ.vwf