/*
This file contains proprietary software owned by Motorola Mobility, Inc.
No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
*/
var Material = require("js/lib/rdge/materials/material").Material;
var Texture = require("js/lib/rdge/texture").Texture;
///////////////////////////////////////////////////////////////////////
// Class GLMaterial
// RDGE representation of a material.
///////////////////////////////////////////////////////////////////////
var TaperMaterial = function TaperMaterial()
{
// initialize the inherited members
this.inheritedFrom = Material;
this.inheritedFrom();
///////////////////////////////////////////////////////////////////////
// Instance variables
///////////////////////////////////////////////////////////////////////
this._name = "Taper";
this._shaderName = "taper";
this._deltaTime = 0.0;
///////////////////////////////////////////////////////////////////////
// Property Accessors
///////////////////////////////////////////////////////////////////////
this.getShaderName = function () { return this._shaderName; };
this.isAnimated = function () { return true; };
this.getShaderDef = function() { return taperShaderDef; };
this.getTechniqueName = function() { return 'colorMe' };
this.hasVertexDeformation = function () { return this._hasVertexDeformation; };
this._hasVertexDeformation = true;
this._vertexDeformationTolerance = 0.02; // should be a property
this.getVertexDeformationTolerance = function() { return this._propValues[this._propNames[7]]; };
///////////////////////////////////////////////////////////////////////
// Methods
///////////////////////////////////////////////////////////////////////
this.init = function (world) {
this.setWorld(world);
// set up the shader
this._shader = new RDGE.jshader();
this._shader.def = taperShaderDef;
this._shader.init();
// set up the material node
this._materialNode = RDGE.createMaterialNode("taperMaterial" + "_" + world.generateUniqueNodeID());
this._materialNode.setShader(this._shader);
this._time = 0;
if (this._shader && this._shader['default']) {
this._shader['default'].u_time.set([this._time]);
}
// initialize the taper properties
this.setShaderValues();
};
this.resetToDefault = function()
{
this._propValues[this._propNames[0]] = 0.25;
this._propValues[this._propNames[1]] = 0.50;
this._propValues[this._propNames[2]] = 0.75;
this._propValues[this._propNames[3]] = -1;
this._propValues[this._propNames[4]] = 1;
this._propValues[this._propNames[5]] = 0.0;
this._propValues[this._propNames[6]] = 0.9;
this._propValues[this._propNames[7]] = this._vertexDeformationTolerance;
this._propValues[this._propNames[8]] = 1.0;
var nProps = this._propNames.length;
for (var i=0; i