aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/taper-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/taper-material.js')
-rw-r--r--js/lib/rdge/materials/taper-material.js29
1 files changed, 25 insertions, 4 deletions
diff --git a/js/lib/rdge/materials/taper-material.js b/js/lib/rdge/materials/taper-material.js
index 2dc3e120..b4ff07d3 100644
--- a/js/lib/rdge/materials/taper-material.js
+++ b/js/lib/rdge/materials/taper-material.js
@@ -62,6 +62,8 @@ var TaperMaterial = function TaperMaterial()
62 this._hasVertexDeformation = true; 62 this._hasVertexDeformation = true;
63 this._vertexDeformationTolerance = 0.02; // should be a property 63 this._vertexDeformationTolerance = 0.02; // should be a property
64 64
65 this.getVertexDeformationTolerance = function() { return this._propValues[this._propNames[7]]; };
66
65 /////////////////////////////////////////////////////////////////////// 67 ///////////////////////////////////////////////////////////////////////
66 // Methods 68 // Methods
67 /////////////////////////////////////////////////////////////////////// 69 ///////////////////////////////////////////////////////////////////////
@@ -86,13 +88,30 @@ var TaperMaterial = function TaperMaterial()
86 this.setShaderValues(); 88 this.setShaderValues();
87 }; 89 };
88 90
91 this.resetToDefault = function()
92 {
93 this._propValues[this._propNames[0]] = 0.25;
94 this._propValues[this._propNames[1]] = 0.50;
95 this._propValues[this._propNames[2]] = 0.75;
96 this._propValues[this._propNames[3]] = -1;
97 this._propValues[this._propNames[4]] = 1;
98 this._propValues[this._propNames[5]] = 0.0;
99 this._propValues[this._propNames[6]] = 0.9;
100 this._propValues[this._propNames[7]] = this._vertexDeformationTolerance;
101 this._propValues[this._propNames[8]] = 1.0;
102
103 var nProps = this._propNames.length;
104 for (var i=0; i<nProps; i++)
105 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
106 };
107
89 108
90 /////////////////////////////////////////////////////////////////////// 109 ///////////////////////////////////////////////////////////////////////
91 // Material Property Accessors 110 // Material Property Accessors
92 /////////////////////////////////////////////////////////////////////// 111 ///////////////////////////////////////////////////////////////////////
93 this._propNames = [ "u_limit1", "u_limit2", "u_limit3", "u_minVal", "u_maxVal", "u_center", "u_taperAmount", "u_speed" ]; 112 this._propNames = [ "u_limit1", "u_limit2", "u_limit3", "u_minVal", "u_maxVal", "u_center", "u_taperAmount", "facettol", "u_speed" ];
94 this._propLabels = [ "Minimum Parameter Value", "Center Paramater Value", "Maximum Parameter Value", "Minimum Data Bounds", "Maximum Data Bounds", "Center", "Taper Amount", "Speed" ]; 113 this._propLabels = [ "Minimum Parameter Value", "Center Paramater Value", "Maximum Parameter Value", "Minimum Data Bounds", "Maximum Data Bounds", "Center", "Taper Amount", "Faceting Tolerance", "Speed" ];
95 this._propTypes = [ "float", "float", "float", "float", "float", "float", "float", "float" ]; 114 this._propTypes = [ "float", "float", "float", "float", "float", "float", "float", "float", "float" ];
96 this._propValues = []; 115 this._propValues = [];
97 116
98 // initialize the property values 117 // initialize the property values
@@ -103,7 +122,8 @@ var TaperMaterial = function TaperMaterial()
103 this._propValues[this._propNames[4]] = 1; 122 this._propValues[this._propNames[4]] = 1;
104 this._propValues[this._propNames[5]] = 0.0; 123 this._propValues[this._propNames[5]] = 0.0;
105 this._propValues[this._propNames[6]] = 0.9; 124 this._propValues[this._propNames[6]] = 0.9;
106 this._propValues[this._propNames[7]] = 1.0; 125 this._propValues[this._propNames[7]] = this._vertexDeformationTolerance;
126 this._propValues[this._propNames[8]] = 1.0;
107 127
108 this.update = function (time) { 128 this.update = function (time) {
109 var speed = this._propValues["u_speed"]; 129 var speed = this._propValues["u_speed"];
@@ -159,6 +179,7 @@ taperShaderDef = {
159 'u_maxVal': { 'type': 'float' }, 179 'u_maxVal': { 'type': 'float' },
160 'u_center': { 'type': 'float' }, 180 'u_center': { 'type': 'float' },
161 'u_taperAmount': { 'type': 'float' }, 181 'u_taperAmount': { 'type': 'float' },
182 'facettol': { 'type': 'float' },
162 'u_speed': { 'type': 'float' } 183 'u_speed': { 'type': 'float' }
163 } 184 }
164 } 185 }