123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- # Copyright 2012 United States Government, as represented by the Secretary of Defense, Under
- # Secretary of Defense (Personnel & Readiness).
- #
- # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
- # in compliance with the License. You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software distributed under the License
- # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- # or implied. See the License for the specific language governing permissions and limitations under
- # the License.
- ---
- extends: http://vwf.example.com/node3.vwf
- implements:
- - http://vwf.example.com/scale-on-move.vwf
- methods:
- createGeometry:
- deleteGeometry:
- scripts:
- - |
- this.initialize = function() {
- //console.info( "initialize scaleXYZ.vwf" );
- }
- this.createGeometry = function() {
- if ( this.parent.ttPoints ) {
- var pos = [];
- var faces = [];
- var count = 0;
- // x positive
- pos.push( this.parent.ttPositions[0][0] );
- pos.push( this.parent.ttPositions[0][1] ); // 0
- pos.push( this.parent.ttPositions[0][2] );
- pos.push( this.parent.ttPositions[8][0] );
- pos.push( this.parent.ttPositions[8][1] ); // 1
- pos.push( this.parent.ttPositions[8][2] );
-
- pos.push( this.parent.ttPositions[9][0] );
- pos.push( this.parent.ttPositions[9][1] ); // 2
- pos.push( this.parent.ttPositions[9][2] );
-
- pos.push( this.parent.ttPositions[10][0] );
- pos.push( this.parent.ttPositions[10][1] ); // 3
- pos.push( this.parent.ttPositions[10][2] );
-
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
-
- pos.push( this.parent.ttPositions[11][0] );
- pos.push( this.parent.ttPositions[11][1] ); // 4
- pos.push( this.parent.ttPositions[11][2] );
- pos.push( this.parent.ttPositions[1][0] );
- pos.push( this.parent.ttPositions[1][1] ); // 5
- pos.push( this.parent.ttPositions[1][2] );
-
- pos.push( this.parent.ttPositions[13][0] );
- pos.push( this.parent.ttPositions[13][1] ); // 6
- pos.push( this.parent.ttPositions[13][2] );
-
- pos.push( this.parent.ttPositions[12][0] );
- pos.push( this.parent.ttPositions[12][1] ); // 7
- pos.push( this.parent.ttPositions[12][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
-
- pos.push( this.parent.ttPositions[15][0] );
- pos.push( this.parent.ttPositions[15][1] ); // 8
- pos.push( this.parent.ttPositions[15][2] );
- pos.push( this.parent.ttPositions[16][0] );
- pos.push( this.parent.ttPositions[16][1] ); // 9
- pos.push( this.parent.ttPositions[16][2] );
-
- pos.push( this.parent.ttPositions[5][0] );
- pos.push( this.parent.ttPositions[5][1] ); // 10
- pos.push( this.parent.ttPositions[5][2] );
-
- pos.push( this.parent.ttPositions[14][0] );
- pos.push( this.parent.ttPositions[14][1] ); // 11
- pos.push( this.parent.ttPositions[14][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[17][0] );
- pos.push( this.parent.ttPositions[17][1] ); // 12
- pos.push( this.parent.ttPositions[17][2] );
- pos.push( this.parent.ttPositions[18][0] );
- pos.push( this.parent.ttPositions[18][1] ); // 13
- pos.push( this.parent.ttPositions[18][2] );
-
- pos.push( this.parent.ttPositions[19][0] );
- pos.push( this.parent.ttPositions[19][1] ); // 14
- pos.push( this.parent.ttPositions[19][2] );
-
- pos.push( this.parent.ttPositions[4][0] );
- pos.push( this.parent.ttPositions[4][1] ); // 15
- pos.push( this.parent.ttPositions[4][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- // x negative
- pos.push( this.parent.ttPositions[3][0] );
- pos.push( this.parent.ttPositions[3][1] ); // 16
- pos.push( this.parent.ttPositions[3][2] );
- pos.push( this.parent.ttPositions[20][0] );
- pos.push( this.parent.ttPositions[20][1] ); // 17
- pos.push( this.parent.ttPositions[20][2] );
-
- pos.push( this.parent.ttPositions[21][0] );
- pos.push( this.parent.ttPositions[21][1] ); // 18
- pos.push( this.parent.ttPositions[21][2] );
-
- pos.push( this.parent.ttPositions[22][0] );
- pos.push( this.parent.ttPositions[22][1] ); // 19
- pos.push( this.parent.ttPositions[22][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[23][0] );
- pos.push( this.parent.ttPositions[23][1] ); // 20
- pos.push( this.parent.ttPositions[23][2] );
- pos.push( this.parent.ttPositions[2][0] );
- pos.push( this.parent.ttPositions[2][1] ); // 21
- pos.push( this.parent.ttPositions[2][2] );
-
- pos.push( this.parent.ttPositions[25][0] );
- pos.push( this.parent.ttPositions[25][1] ); // 22
- pos.push( this.parent.ttPositions[25][2] );
-
- pos.push( this.parent.ttPositions[24][0] );
- pos.push( this.parent.ttPositions[24][1] ); // 23
- pos.push( this.parent.ttPositions[24][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[27][0] );
- pos.push( this.parent.ttPositions[27][1] ); // 24
- pos.push( this.parent.ttPositions[27][2] );
- pos.push( this.parent.ttPositions[26][0] );
- pos.push( this.parent.ttPositions[26][1] ); // 25
- pos.push( this.parent.ttPositions[26][2] );
-
- pos.push( this.parent.ttPositions[6][0] );
- pos.push( this.parent.ttPositions[6][1] ); // 26
- pos.push( this.parent.ttPositions[6][2] );
-
- pos.push( this.parent.ttPositions[28][0] );
- pos.push( this.parent.ttPositions[28][1] ); // 27
- pos.push( this.parent.ttPositions[28][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[31][0] );
- pos.push( this.parent.ttPositions[31][1] ); // 28
- pos.push( this.parent.ttPositions[31][2] );
- pos.push( this.parent.ttPositions[30][0] );
- pos.push( this.parent.ttPositions[30][1] ); // 29
- pos.push( this.parent.ttPositions[30][2] );
-
- pos.push( this.parent.ttPositions[29][0] );
- pos.push( this.parent.ttPositions[29][1] ); // 30
- pos.push( this.parent.ttPositions[29][2] );
-
- pos.push( this.parent.ttPositions[7][0] );
- pos.push( this.parent.ttPositions[7][1] ); // 31
- pos.push( this.parent.ttPositions[7][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- // y positive
- pos.push( this.parent.ttPositions[2][0] );
- pos.push( this.parent.ttPositions[2][1] ); // 32
- pos.push( this.parent.ttPositions[2][2] );
- pos.push( this.parent.ttPositions[37][0] );
- pos.push( this.parent.ttPositions[37][1] ); // 33
- pos.push( this.parent.ttPositions[37][2] );
-
- pos.push( this.parent.ttPositions[50][0] );
- pos.push( this.parent.ttPositions[50][1] ); // 34
- pos.push( this.parent.ttPositions[50][2] );
-
- pos.push( this.parent.ttPositions[25][0] );
- pos.push( this.parent.ttPositions[25][1] ); // 35
- pos.push( this.parent.ttPositions[25][2] );
-
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[35][0] );
- pos.push( this.parent.ttPositions[35][1] ); // 36
- pos.push( this.parent.ttPositions[35][2] );
- pos.push( this.parent.ttPositions[1][0] );
- pos.push( this.parent.ttPositions[1][1] ); // 37
- pos.push( this.parent.ttPositions[1][2] );
-
- pos.push( this.parent.ttPositions[13][0] );
- pos.push( this.parent.ttPositions[13][1] ); // 38
- pos.push( this.parent.ttPositions[13][2] );
-
- pos.push( this.parent.ttPositions[49][0] );
- pos.push( this.parent.ttPositions[49][1] ); // 39
- pos.push( this.parent.ttPositions[49][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[48][0] );
- pos.push( this.parent.ttPositions[48][1] ); // 40
- pos.push( this.parent.ttPositions[48][2] );
- pos.push( this.parent.ttPositions[16][0] );
- pos.push( this.parent.ttPositions[16][1] ); // 41
- pos.push( this.parent.ttPositions[16][2] );
-
- pos.push( this.parent.ttPositions[5][0] );
- pos.push( this.parent.ttPositions[5][1] ); // 42
- pos.push( this.parent.ttPositions[5][2] );
-
- pos.push( this.parent.ttPositions[43][0] );
- pos.push( this.parent.ttPositions[43][1] ); // 43
- pos.push( this.parent.ttPositions[43][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[28][0] );
- pos.push( this.parent.ttPositions[28][1] ); // 44
- pos.push( this.parent.ttPositions[28][2] );
- pos.push( this.parent.ttPositions[51][0] );
- pos.push( this.parent.ttPositions[51][1] ); // 45
- pos.push( this.parent.ttPositions[51][2] );
-
- pos.push( this.parent.ttPositions[45][0] );
- pos.push( this.parent.ttPositions[45][1] ); // 46
- pos.push( this.parent.ttPositions[45][2] );
-
- pos.push( this.parent.ttPositions[6][0] );
- pos.push( this.parent.ttPositions[6][1] ); // 47
- pos.push( this.parent.ttPositions[6][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- // y negative
- pos.push( this.parent.ttPositions[3][0] );
- pos.push( this.parent.ttPositions[3][1] ); // 48
- pos.push( this.parent.ttPositions[3][2] );
- pos.push( this.parent.ttPositions[22][0] );
- pos.push( this.parent.ttPositions[22][1] ); // 49
- pos.push( this.parent.ttPositions[22][2] );
-
- pos.push( this.parent.ttPositions[54][0] );
- pos.push( this.parent.ttPositions[54][1] ); // 50
- pos.push( this.parent.ttPositions[54][2] );
-
- pos.push( this.parent.ttPositions[39][0] );
- pos.push( this.parent.ttPositions[39][1] ); // 51
- pos.push( this.parent.ttPositions[39][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[33][0] );
- pos.push( this.parent.ttPositions[33][1] ); // 52
- pos.push( this.parent.ttPositions[33][2] );
- pos.push( this.parent.ttPositions[0][0] );
- pos.push( this.parent.ttPositions[0][1] ); // 53
- pos.push( this.parent.ttPositions[0][2] );
-
- pos.push( this.parent.ttPositions[10][0] );
- pos.push( this.parent.ttPositions[10][1] ); // 54
- pos.push( this.parent.ttPositions[10][2] );
-
- pos.push( this.parent.ttPositions[53][0] );
- pos.push( this.parent.ttPositions[53][1] ); // 55
- pos.push( this.parent.ttPositions[53][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[52][0] );
- pos.push( this.parent.ttPositions[52][1] ); // 56
- pos.push( this.parent.ttPositions[52][2] );
- pos.push( this.parent.ttPositions[19][0] );
- pos.push( this.parent.ttPositions[19][1] ); // 57
- pos.push( this.parent.ttPositions[19][2] );
-
- pos.push( this.parent.ttPositions[4][0] );
- pos.push( this.parent.ttPositions[4][1] ); // 58
- pos.push( this.parent.ttPositions[4][2] );
-
- pos.push( this.parent.ttPositions[41][0] );
- pos.push( this.parent.ttPositions[41][1] ); // 59
- pos.push( this.parent.ttPositions[41][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[31][0] );
- pos.push( this.parent.ttPositions[31][1] ); // 60
- pos.push( this.parent.ttPositions[31][2] );
- pos.push( this.parent.ttPositions[55][0] );
- pos.push( this.parent.ttPositions[55][1] ); // 61
- pos.push( this.parent.ttPositions[55][2] );
-
- pos.push( this.parent.ttPositions[47][0] );
- pos.push( this.parent.ttPositions[47][1] ); // 62
- pos.push( this.parent.ttPositions[47][2] );
-
- pos.push( this.parent.ttPositions[7][0] );
- pos.push( this.parent.ttPositions[7][1] ); // 63
- pos.push( this.parent.ttPositions[7][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- // z positive
- pos.push( this.parent.ttPositions[2][0] );
- pos.push( this.parent.ttPositions[2][1] ); // 64
- pos.push( this.parent.ttPositions[2][2] );
- pos.push( this.parent.ttPositions[37][0] );
- pos.push( this.parent.ttPositions[37][1] ); // 65
- pos.push( this.parent.ttPositions[37][2] );
-
- pos.push( this.parent.ttPositions[36][0] );
- pos.push( this.parent.ttPositions[36][1] ); // 66
- pos.push( this.parent.ttPositions[36][2] );
-
- pos.push( this.parent.ttPositions[23][0] );
- pos.push( this.parent.ttPositions[23][1] ); // 67
- pos.push( this.parent.ttPositions[23][2] );
-
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
-
- pos.push( this.parent.ttPositions[35][0] );
- pos.push( this.parent.ttPositions[35][1] ); // 68
- pos.push( this.parent.ttPositions[35][2] );
- pos.push( this.parent.ttPositions[1][0] );
- pos.push( this.parent.ttPositions[1][1] ); // 69
- pos.push( this.parent.ttPositions[1][2] );
-
- pos.push( this.parent.ttPositions[11][0] );
- pos.push( this.parent.ttPositions[11][1] ); // 70
- pos.push( this.parent.ttPositions[11][2] );
-
- pos.push( this.parent.ttPositions[34][0] );
- pos.push( this.parent.ttPositions[34][1] ); // 71
- pos.push( this.parent.ttPositions[34][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
-
- pos.push( this.parent.ttPositions[32][0] );
- pos.push( this.parent.ttPositions[32][1] ); // 72
- pos.push( this.parent.ttPositions[32][2] );
- pos.push( this.parent.ttPositions[8][0] );
- pos.push( this.parent.ttPositions[8][1] ); // 73
- pos.push( this.parent.ttPositions[8][2] );
-
- pos.push( this.parent.ttPositions[0][0] );
- pos.push( this.parent.ttPositions[0][1] ); // 74
- pos.push( this.parent.ttPositions[0][2] );
-
- pos.push( this.parent.ttPositions[33][0] );
- pos.push( this.parent.ttPositions[33][1] ); // 75
- pos.push( this.parent.ttPositions[33][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[20][0] );
- pos.push( this.parent.ttPositions[20][1] ); // 76
- pos.push( this.parent.ttPositions[20][2] );
- pos.push( this.parent.ttPositions[38][0] );
- pos.push( this.parent.ttPositions[38][1] ); // 77
- pos.push( this.parent.ttPositions[38][2] );
-
- pos.push( this.parent.ttPositions[39][0] );
- pos.push( this.parent.ttPositions[39][1] ); // 78
- pos.push( this.parent.ttPositions[39][2] );
-
- pos.push( this.parent.ttPositions[3][0] );
- pos.push( this.parent.ttPositions[3][1] ); // 79
- pos.push( this.parent.ttPositions[3][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- // z negative
- pos.push( this.parent.ttPositions[6][0] );
- pos.push( this.parent.ttPositions[6][1] ); // 80
- pos.push( this.parent.ttPositions[6][2] );
- pos.push( this.parent.ttPositions[45][0] );
- pos.push( this.parent.ttPositions[45][1] ); // 81
- pos.push( this.parent.ttPositions[45][2] );
-
- pos.push( this.parent.ttPositions[44][0] );
- pos.push( this.parent.ttPositions[44][1] ); // 82
- pos.push( this.parent.ttPositions[44][2] );
-
- pos.push( this.parent.ttPositions[26][0] );
- pos.push( this.parent.ttPositions[26][1] ); // 83
- pos.push( this.parent.ttPositions[26][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[43][0] );
- pos.push( this.parent.ttPositions[43][1] ); // 84
- pos.push( this.parent.ttPositions[43][2] );
- pos.push( this.parent.ttPositions[5][0] );
- pos.push( this.parent.ttPositions[5][1] ); // 85
- pos.push( this.parent.ttPositions[5][2] );
-
- pos.push( this.parent.ttPositions[14][0] );
- pos.push( this.parent.ttPositions[14][1] ); // 86
- pos.push( this.parent.ttPositions[14][2] );
-
- pos.push( this.parent.ttPositions[42][0] );
- pos.push( this.parent.ttPositions[42][1] ); // 87
- pos.push( this.parent.ttPositions[42][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[40][0] );
- pos.push( this.parent.ttPositions[40][1] ); // 88
- pos.push( this.parent.ttPositions[40][2] );
- pos.push( this.parent.ttPositions[17][0] );
- pos.push( this.parent.ttPositions[17][1] ); // 89
- pos.push( this.parent.ttPositions[17][2] );
-
- pos.push( this.parent.ttPositions[4][0] );
- pos.push( this.parent.ttPositions[4][1] ); // 90
- pos.push( this.parent.ttPositions[4][2] );
-
- pos.push( this.parent.ttPositions[41][0] );
- pos.push( this.parent.ttPositions[41][1] ); // 91
- pos.push( this.parent.ttPositions[41][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- count += 4;
- pos.push( this.parent.ttPositions[29][0] );
- pos.push( this.parent.ttPositions[29][1] ); // 92
- pos.push( this.parent.ttPositions[29][2] );
- pos.push( this.parent.ttPositions[46][0] );
- pos.push( this.parent.ttPositions[46][1] ); // 93
- pos.push( this.parent.ttPositions[46][2] );
-
- pos.push( this.parent.ttPositions[47][0] );
- pos.push( this.parent.ttPositions[47][1] ); // 94
- pos.push( this.parent.ttPositions[47][2] );
-
- pos.push( this.parent.ttPositions[7][0] );
- pos.push( this.parent.ttPositions[7][1] ); // 95
- pos.push( this.parent.ttPositions[7][2] );
- faces.push( count, count+3, count+1, count+1, count+3, count+2 );
- var surface = {
- "extends": "http://vwf.example.com/node3.vwf",
- "type": "mesh/definition",
- "properties": {
- "meshDefinition": { "positions": pos, "faces": faces, "color": [ 255, 255, 255 ], },
- },
- };
-
- this.children.create( "scaleSurfaces", surface );
- }
- }
- this.deleteGeometry = function() {
- if ( this.scaleSurfaces ) {
- this.children.delete( this.scaleSurfaces );
- }
- } //@ sourceURL=scaleXYZ.vwf
|