# 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/spin-on-move.vwf methods: createGeometry: deleteGeometry: properties: spin-axis: [ 0, 0, 1 ] spin-rate: 100 spin-inputDim: "xy" scripts: - | this.initialize = function() { //console.info( "initialize rotationZ.vwf" ); } //this.pointerDown = this.events.add( function( pointerInfo, pickInfo ){ this.pointerDown = function( pointerInfo, pickInfo ){ console.info( 'pointerDown rotationZ' ); this.parent.editMode='rotate'; this.parent.axis=[0,0,1]; return false; } // } ) this.createGeometry = function() { if ( this.parent.ttPoints ) { var pos = []; var faces; pos.push( this.parent.ttPositions[12][0] ); pos.push( this.parent.ttPositions[12][1] ); // 0 pos.push( this.parent.ttPositions[12][2] ); pos.push( this.parent.ttPositions[13][0] ); pos.push( this.parent.ttPositions[13][1] ); // 1 pos.push( this.parent.ttPositions[13][2] ); pos.push( this.parent.ttPositions[16][0] ); pos.push( this.parent.ttPositions[16][1] ); // 2 pos.push( this.parent.ttPositions[16][2] ); pos.push( this.parent.ttPositions[15][0] ); pos.push( this.parent.ttPositions[15][1] ); // 3 pos.push( this.parent.ttPositions[15][2] ); faces = [ 0, 3, 1, 1, 3, 2 ]; pos.push( this.parent.ttPositions[10][0] ); pos.push( this.parent.ttPositions[10][1] ); // 4 pos.push( this.parent.ttPositions[10][2] ); pos.push( this.parent.ttPositions[9][0] ); pos.push( this.parent.ttPositions[9][1] ); // 5 pos.push( this.parent.ttPositions[9][2] ); pos.push( this.parent.ttPositions[18][0] ); pos.push( this.parent.ttPositions[18][1] ); // 6 pos.push( this.parent.ttPositions[18][2] ); pos.push( this.parent.ttPositions[19][0] ); pos.push( this.parent.ttPositions[19][1] ); // 7 pos.push( this.parent.ttPositions[19][2] ); faces.push( 4, 7, 5, 5, 7, 6 ); pos.push( this.parent.ttPositions[24][0] ); pos.push( this.parent.ttPositions[24][1] ); // 8 pos.push( this.parent.ttPositions[24][2] ); pos.push( this.parent.ttPositions[25][0] ); pos.push( this.parent.ttPositions[25][1] ); // 9 pos.push( this.parent.ttPositions[25][2] ); pos.push( this.parent.ttPositions[28][0] ); pos.push( this.parent.ttPositions[28][1] ); // 10 pos.push( this.parent.ttPositions[28][2] ); pos.push( this.parent.ttPositions[27][0] ); pos.push( this.parent.ttPositions[27][1] ); // 11 pos.push( this.parent.ttPositions[27][2] ); faces.push( 8, 11, 9, 9, 11, 10 ); pos.push( this.parent.ttPositions[22][0] ); pos.push( this.parent.ttPositions[22][1] ); // 12 pos.push( this.parent.ttPositions[22][2] ); pos.push( this.parent.ttPositions[21][0] ); pos.push( this.parent.ttPositions[21][1] ); // 13 pos.push( this.parent.ttPositions[21][2] ); pos.push( this.parent.ttPositions[30][0] ); pos.push( this.parent.ttPositions[30][1] ); // 14 pos.push( this.parent.ttPositions[30][2] ); pos.push( this.parent.ttPositions[31][0] ); pos.push( this.parent.ttPositions[31][1] ); // 15 pos.push( this.parent.ttPositions[31][2] ); faces.push( 12, 15, 13, 13, 15, 14 ); pos.push( this.parent.ttPositions[16][0] ); pos.push( this.parent.ttPositions[16][1] ); // 16 pos.push( this.parent.ttPositions[16][2] ); pos.push( this.parent.ttPositions[48][0] ); pos.push( this.parent.ttPositions[48][1] ); // 17 pos.push( this.parent.ttPositions[48][2] ); pos.push( this.parent.ttPositions[49][0] ); pos.push( this.parent.ttPositions[49][1] ); // 18 pos.push( this.parent.ttPositions[49][2] ); pos.push( this.parent.ttPositions[13][0] ); pos.push( this.parent.ttPositions[13][1] ); // 19 pos.push( this.parent.ttPositions[13][2] ); faces.push( 16, 19, 17, 17, 19, 18 ); pos.push( this.parent.ttPositions[28][0] ); pos.push( this.parent.ttPositions[28][1] ); // 20 pos.push( this.parent.ttPositions[28][2] ); pos.push( this.parent.ttPositions[51][0] ); pos.push( this.parent.ttPositions[51][1] ); // 21 pos.push( this.parent.ttPositions[51][2] ); pos.push( this.parent.ttPositions[50][0] ); pos.push( this.parent.ttPositions[50][1] ); // 22 pos.push( this.parent.ttPositions[50][2] ); pos.push( this.parent.ttPositions[25][0] ); pos.push( this.parent.ttPositions[25][1] ); // 23 pos.push( this.parent.ttPositions[25][2] ); faces.push( 20, 23, 21, 21, 23, 22 ); pos.push( this.parent.ttPositions[52][0] ); pos.push( this.parent.ttPositions[52][1] ); // 24 pos.push( this.parent.ttPositions[52][2] ); pos.push( this.parent.ttPositions[19][0] ); pos.push( this.parent.ttPositions[19][1] ); // 25 pos.push( this.parent.ttPositions[19][2] ); pos.push( this.parent.ttPositions[10][0] ); pos.push( this.parent.ttPositions[10][1] ); // 26 pos.push( this.parent.ttPositions[10][2] ); pos.push( this.parent.ttPositions[53][0] ); pos.push( this.parent.ttPositions[53][1] ); // 27 pos.push( this.parent.ttPositions[53][2] ); faces.push( 24, 27, 25, 25, 27, 26 ); pos.push( this.parent.ttPositions[22][0] ); pos.push( this.parent.ttPositions[22][1] ); // 28 pos.push( this.parent.ttPositions[22][2] ); pos.push( this.parent.ttPositions[54][0] ); pos.push( this.parent.ttPositions[54][1] ); // 29 pos.push( this.parent.ttPositions[54][2] ); pos.push( this.parent.ttPositions[55][0] ); pos.push( this.parent.ttPositions[55][1] ); // 30 pos.push( this.parent.ttPositions[55][2] ); pos.push( this.parent.ttPositions[31][0] ); pos.push( this.parent.ttPositions[31][1] ); // 31 pos.push( this.parent.ttPositions[31][2] ); faces.push( 28, 31, 29, 29, 31, 30 ); var surface = { "extends": "http://vwf.example.com/node3.vwf", "type": "mesh/definition", "properties": { "meshDefinition": { "positions": pos, "faces": faces, "color": [ 255, 0, 0 ], }, }, }; this.children.create( "rotateZ", surface ); } } this.deleteGeometry = function() { if ( this.rotateZ ) { this.children.delete( this.rotateZ ); } } //@ sourceURL=rotationZ.vwf