rotationZ.vwf.yaml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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/spin-on-move.vwf
  17. methods:
  18. createGeometry:
  19. deleteGeometry:
  20. properties:
  21. spin-axis: [ 0, 0, 1 ]
  22. spin-rate: 100
  23. spin-inputDim: "xy"
  24. scripts:
  25. - |
  26. this.initialize = function() {
  27. //console.info( "initialize rotationZ.vwf" );
  28. }
  29. //this.pointerDown = this.events.add( function( pointerInfo, pickInfo ){
  30. this.pointerDown = function( pointerInfo, pickInfo ){
  31. console.info( 'pointerDown rotationZ' );
  32. this.parent.editMode='rotate';
  33. this.parent.axis=[0,0,1];
  34. return false;
  35. }
  36. // } )
  37. this.createGeometry = function() {
  38. if ( this.parent.ttPoints ) {
  39. var pos = [];
  40. var faces;
  41. pos.push( this.parent.ttPositions[12][0] );
  42. pos.push( this.parent.ttPositions[12][1] ); // 0
  43. pos.push( this.parent.ttPositions[12][2] );
  44. pos.push( this.parent.ttPositions[13][0] );
  45. pos.push( this.parent.ttPositions[13][1] ); // 1
  46. pos.push( this.parent.ttPositions[13][2] );
  47. pos.push( this.parent.ttPositions[16][0] );
  48. pos.push( this.parent.ttPositions[16][1] ); // 2
  49. pos.push( this.parent.ttPositions[16][2] );
  50. pos.push( this.parent.ttPositions[15][0] );
  51. pos.push( this.parent.ttPositions[15][1] ); // 3
  52. pos.push( this.parent.ttPositions[15][2] );
  53. faces = [ 0, 3, 1, 1, 3, 2 ];
  54. pos.push( this.parent.ttPositions[10][0] );
  55. pos.push( this.parent.ttPositions[10][1] ); // 4
  56. pos.push( this.parent.ttPositions[10][2] );
  57. pos.push( this.parent.ttPositions[9][0] );
  58. pos.push( this.parent.ttPositions[9][1] ); // 5
  59. pos.push( this.parent.ttPositions[9][2] );
  60. pos.push( this.parent.ttPositions[18][0] );
  61. pos.push( this.parent.ttPositions[18][1] ); // 6
  62. pos.push( this.parent.ttPositions[18][2] );
  63. pos.push( this.parent.ttPositions[19][0] );
  64. pos.push( this.parent.ttPositions[19][1] ); // 7
  65. pos.push( this.parent.ttPositions[19][2] );
  66. faces.push( 4, 7, 5, 5, 7, 6 );
  67. pos.push( this.parent.ttPositions[24][0] );
  68. pos.push( this.parent.ttPositions[24][1] ); // 8
  69. pos.push( this.parent.ttPositions[24][2] );
  70. pos.push( this.parent.ttPositions[25][0] );
  71. pos.push( this.parent.ttPositions[25][1] ); // 9
  72. pos.push( this.parent.ttPositions[25][2] );
  73. pos.push( this.parent.ttPositions[28][0] );
  74. pos.push( this.parent.ttPositions[28][1] ); // 10
  75. pos.push( this.parent.ttPositions[28][2] );
  76. pos.push( this.parent.ttPositions[27][0] );
  77. pos.push( this.parent.ttPositions[27][1] ); // 11
  78. pos.push( this.parent.ttPositions[27][2] );
  79. faces.push( 8, 11, 9, 9, 11, 10 );
  80. pos.push( this.parent.ttPositions[22][0] );
  81. pos.push( this.parent.ttPositions[22][1] ); // 12
  82. pos.push( this.parent.ttPositions[22][2] );
  83. pos.push( this.parent.ttPositions[21][0] );
  84. pos.push( this.parent.ttPositions[21][1] ); // 13
  85. pos.push( this.parent.ttPositions[21][2] );
  86. pos.push( this.parent.ttPositions[30][0] );
  87. pos.push( this.parent.ttPositions[30][1] ); // 14
  88. pos.push( this.parent.ttPositions[30][2] );
  89. pos.push( this.parent.ttPositions[31][0] );
  90. pos.push( this.parent.ttPositions[31][1] ); // 15
  91. pos.push( this.parent.ttPositions[31][2] );
  92. faces.push( 12, 15, 13, 13, 15, 14 );
  93. pos.push( this.parent.ttPositions[16][0] );
  94. pos.push( this.parent.ttPositions[16][1] ); // 16
  95. pos.push( this.parent.ttPositions[16][2] );
  96. pos.push( this.parent.ttPositions[48][0] );
  97. pos.push( this.parent.ttPositions[48][1] ); // 17
  98. pos.push( this.parent.ttPositions[48][2] );
  99. pos.push( this.parent.ttPositions[49][0] );
  100. pos.push( this.parent.ttPositions[49][1] ); // 18
  101. pos.push( this.parent.ttPositions[49][2] );
  102. pos.push( this.parent.ttPositions[13][0] );
  103. pos.push( this.parent.ttPositions[13][1] ); // 19
  104. pos.push( this.parent.ttPositions[13][2] );
  105. faces.push( 16, 19, 17, 17, 19, 18 );
  106. pos.push( this.parent.ttPositions[28][0] );
  107. pos.push( this.parent.ttPositions[28][1] ); // 20
  108. pos.push( this.parent.ttPositions[28][2] );
  109. pos.push( this.parent.ttPositions[51][0] );
  110. pos.push( this.parent.ttPositions[51][1] ); // 21
  111. pos.push( this.parent.ttPositions[51][2] );
  112. pos.push( this.parent.ttPositions[50][0] );
  113. pos.push( this.parent.ttPositions[50][1] ); // 22
  114. pos.push( this.parent.ttPositions[50][2] );
  115. pos.push( this.parent.ttPositions[25][0] );
  116. pos.push( this.parent.ttPositions[25][1] ); // 23
  117. pos.push( this.parent.ttPositions[25][2] );
  118. faces.push( 20, 23, 21, 21, 23, 22 );
  119. pos.push( this.parent.ttPositions[52][0] );
  120. pos.push( this.parent.ttPositions[52][1] ); // 24
  121. pos.push( this.parent.ttPositions[52][2] );
  122. pos.push( this.parent.ttPositions[19][0] );
  123. pos.push( this.parent.ttPositions[19][1] ); // 25
  124. pos.push( this.parent.ttPositions[19][2] );
  125. pos.push( this.parent.ttPositions[10][0] );
  126. pos.push( this.parent.ttPositions[10][1] ); // 26
  127. pos.push( this.parent.ttPositions[10][2] );
  128. pos.push( this.parent.ttPositions[53][0] );
  129. pos.push( this.parent.ttPositions[53][1] ); // 27
  130. pos.push( this.parent.ttPositions[53][2] );
  131. faces.push( 24, 27, 25, 25, 27, 26 );
  132. pos.push( this.parent.ttPositions[22][0] );
  133. pos.push( this.parent.ttPositions[22][1] ); // 28
  134. pos.push( this.parent.ttPositions[22][2] );
  135. pos.push( this.parent.ttPositions[54][0] );
  136. pos.push( this.parent.ttPositions[54][1] ); // 29
  137. pos.push( this.parent.ttPositions[54][2] );
  138. pos.push( this.parent.ttPositions[55][0] );
  139. pos.push( this.parent.ttPositions[55][1] ); // 30
  140. pos.push( this.parent.ttPositions[55][2] );
  141. pos.push( this.parent.ttPositions[31][0] );
  142. pos.push( this.parent.ttPositions[31][1] ); // 31
  143. pos.push( this.parent.ttPositions[31][2] );
  144. faces.push( 28, 31, 29, 29, 31, 30 );
  145. var surface = {
  146. "extends": "http://vwf.example.com/node3.vwf",
  147. "type": "mesh/definition",
  148. "properties": {
  149. "meshDefinition": { "positions": pos, "faces": faces, "color": [ 255, 0, 0 ], },
  150. },
  151. };
  152. this.children.create( "rotateZ", surface );
  153. }
  154. }
  155. this.deleteGeometry = function() {
  156. if ( this.rotateZ ) {
  157. this.children.delete( this.rotateZ );
  158. }
  159. } //@ sourceURL=rotationZ.vwf