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 f6aa782c..595f5064 100644
--- a/js/lib/rdge/materials/taper-material.js
+++ b/js/lib/rdge/materials/taper-material.js
@@ -38,6 +38,8 @@ var TaperMaterial = function TaperMaterial()
38 this._hasVertexDeformation = true; 38 this._hasVertexDeformation = true;
39 this._vertexDeformationTolerance = 0.02; // should be a property 39 this._vertexDeformationTolerance = 0.02; // should be a property
40 40
41 this.getVertexDeformationTolerance = function() { return this._propValues[this._propNames[7]]; };
42
41 /////////////////////////////////////////////////////////////////////// 43 ///////////////////////////////////////////////////////////////////////
42 // Methods 44 // Methods
43 /////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////
@@ -62,13 +64,30 @@ var TaperMaterial = function TaperMaterial()
62 this.setShaderValues(); 64 this.setShaderValues();
63 }; 65 };
64 66
67 this.resetToDefault = function()
68 {
69 this._propValues[this._propNames[0]] = 0.25;
70 this._propValues[this._propNames[1]] = 0.50;
71 this._propValues[this._propNames[2]] = 0.75;
72 this._propValues[this._propNames[3]] = -1;
73 this._propValues[this._propNames[4]] = 1;
74 this._propValues[this._propNames[5]] = 0.0;
75 this._propValues[this._propNames[6]] = 0.9;
76 this._propValues[this._propNames[7]] = this._vertexDeformationTolerance;
77 this._propValues[this._propNames[8]] = 1.0;
78
79 var nProps = this._propNames.length;
80 for (var i=0; i<nProps; i++)
81 this.setProperty( this._propNames[i], this._propValues[this._propNames[i]] );
82 };
83
65 84
66 /////////////////////////////////////////////////////////////////////// 85 ///////////////////////////////////////////////////////////////////////
67 // Material Property Accessors 86 // Material Property Accessors
68 /////////////////////////////////////////////////////////////////////// 87 ///////////////////////////////////////////////////////////////////////
69 this._propNames = [ "u_limit1", "u_limit2", "u_limit3", "u_minVal", "u_maxVal", "u_center", "u_taperAmount", "u_speed" ]; 88 this._propNames = [ "u_limit1", "u_limit2", "u_limit3", "u_minVal", "u_maxVal", "u_center", "u_taperAmount", "facettol", "u_speed" ];
70 this._propLabels = [ "Minimum Parameter Value", "Center Paramater Value", "Maximum Parameter Value", "Minimum Data Bounds", "Maximum Data Bounds", "Center", "Taper Amount", "Speed" ]; 89 this._propLabels = [ "Minimum Parameter Value", "Center Paramater Value", "Maximum Parameter Value", "Minimum Data Bounds", "Maximum Data Bounds", "Center", "Taper Amount", "Faceting Tolerance", "Speed" ];
71 this._propTypes = [ "float", "float", "float", "float", "float", "float", "float", "float" ]; 90 this._propTypes = [ "float", "float", "float", "float", "float", "float", "float", "float", "float" ];
72 this._propValues = []; 91 this._propValues = [];
73 92
74 // initialize the property values 93 // initialize the property values
@@ -79,7 +98,8 @@ var TaperMaterial = function TaperMaterial()
79 this._propValues[this._propNames[4]] = 1; 98 this._propValues[this._propNames[4]] = 1;
80 this._propValues[this._propNames[5]] = 0.0; 99 this._propValues[this._propNames[5]] = 0.0;
81 this._propValues[this._propNames[6]] = 0.9; 100 this._propValues[this._propNames[6]] = 0.9;
82 this._propValues[this._propNames[7]] = 1.0; 101 this._propValues[this._propNames[7]] = this._vertexDeformationTolerance;
102 this._propValues[this._propNames[8]] = 1.0;
83 103
84 this.update = function (time) { 104 this.update = function (time) {
85 var speed = this._propValues["u_speed"]; 105 var speed = this._propValues["u_speed"];
@@ -135,6 +155,7 @@ taperShaderDef = {
135 'u_maxVal': { 'type': 'float' }, 155 'u_maxVal': { 'type': 'float' },
136 'u_center': { 'type': 'float' }, 156 'u_center': { 'type': 'float' },
137 'u_taperAmount': { 'type': 'float' }, 157 'u_taperAmount': { 'type': 'float' },
158 'facettol': { 'type': 'float' },
138 'u_speed': { 'type': 'float' } 159 'u_speed': { 'type': 'float' }
139 } 160 }
140 } 161 }