# 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.

## The component representation of an editable node3 behavior
## 
## @name node3edit.vwf
## @namespace

--- 
extends: http://vwf.example.com/node3.vwf
implements:
- http://vwf.example.com/planarDrag.vwf
methods:
  createGeometry:
  deleteGeometry:
scripts:
- |
  this.initialize = function() {
    //console.info( "initialize translateYPos.vwf id = " + this.id );
  }
  this.createGeometry = function() {
    if ( this.parent.ttPoints ) {
      var pos = [];
      pos.push( this.parent.ttPositions[48][0] );
      pos.push( this.parent.ttPositions[48][1] ); // 0       
      pos.push( this.parent.ttPositions[48][2] );

      pos.push( this.parent.ttPositions[49][0] );
      pos.push( this.parent.ttPositions[49][1] ); // 1       
      pos.push( this.parent.ttPositions[49][2] );
      
      pos.push( this.parent.ttPositions[50][0] );
      pos.push( this.parent.ttPositions[50][1] ); // 2       
      pos.push( this.parent.ttPositions[50][2] );
      
      pos.push( this.parent.ttPositions[51][0] );
      pos.push( this.parent.ttPositions[51][1] ); // 3   
      pos.push( this.parent.ttPositions[51][2] );       
      
      var surface = {
        "extends": "http://vwf.example.com/node3.vwf",
        "type": "mesh/definition",
        "children": {
          "material": {
            "extends": "http://vwf.example.com/material.vwf",
            "properties": {
              "transparent": true,
              "opacity": 0.25, 
            },
          },
        },
        "properties": { 
          "meshDefinition": { "positions": pos, "faces": [ 0, 3, 1, 1, 3, 2 ], "color": [ 255, 255, 255 ], },
        },
      };
      
      this.children.create( "translateYPositive", surface );
    }    
  } 
  this.deleteGeometry = function() {
    if ( this.translateYPositive ) {
      this.children.delete( this.translateYPositive );
    }
  }  //@ sourceURL=translateYPos.vwf