diff options
author | Eric Guzman | 2012-02-13 10:30:26 -0800 |
---|---|---|
committer | Eric Guzman | 2012-02-13 10:30:26 -0800 |
commit | 672e6f61647b1b8a5f6f5831284fa44bcb7be883 (patch) | |
tree | 0c15656f1f82f194bfcab68634a88f68fd3d42cb /js/helper-classes/RDGE/Materials/LinearGradientMaterial.js | |
parent | 586c3f7bbea04e62638e5ed8cdce9933e88c0b67 (diff) | |
parent | e142611e22718b1f1d1696902ad9161ec5f33f98 (diff) | |
download | ninja-672e6f61647b1b8a5f6f5831284fa44bcb7be883.tar.gz |
Merge branch 'refs/heads/master' into PresetsPanel
Diffstat (limited to 'js/helper-classes/RDGE/Materials/LinearGradientMaterial.js')
-rw-r--r-- | js/helper-classes/RDGE/Materials/LinearGradientMaterial.js | 148 |
1 files changed, 94 insertions, 54 deletions
diff --git a/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js b/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js index 357ce275..7fe2be0c 100644 --- a/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js +++ b/js/helper-classes/RDGE/Materials/LinearGradientMaterial.js | |||
@@ -29,50 +29,50 @@ function LinearGradientMaterial() | |||
29 | this._colorStop2 = 0.3; | 29 | this._colorStop2 = 0.3; |
30 | this._colorStop3 = 0.6; | 30 | this._colorStop3 = 0.6; |
31 | this._colorStop4 = 1.0; | 31 | this._colorStop4 = 1.0; |
32 | this._colorCount = 4; | 32 | // this._colorCount = 4; |
33 | this._angle = 0.0; // the shader takes [cos(a), sin(a)] | 33 | this._angle = 0.0; // the shader takes [cos(a), sin(a)] |
34 | 34 | ||
35 | /////////////////////////////////////////////////////////////////////// | 35 | /////////////////////////////////////////////////////////////////////// |
36 | // Property Accessors | 36 | // Property Accessors |
37 | /////////////////////////////////////////////////////////////////////// | 37 | /////////////////////////////////////////////////////////////////////// |
38 | this.getShaderName = function() { return this._shaderName; } | 38 | this.getShaderName = function() { return this._shaderName; }; |
39 | this.getName = function() { return this._name; } | 39 | this.getName = function() { return this._name; }; |
40 | 40 | ||
41 | this.getColor1 = function() { return this._color1; } | 41 | this.getColor1 = function() { return this._color1; }; |
42 | this.setColor1 = function(c) { this._color1 = c.slice(); | 42 | this.setColor1 = function(c) { this._color1 = c.slice(); |
43 | if (this._shader && this._shader.default) | 43 | if (this._shader && this._shader.default) |
44 | this._shader.default.u_color1.set(c); | 44 | this._shader.default.u_color1.set(c); |
45 | } | 45 | }; |
46 | 46 | ||
47 | this.getColor2 = function() { return this._color2; } | 47 | this.getColor2 = function() { return this._color2; }; |
48 | this.setColor2 = function(c) { this._color2 = c.slice(); | 48 | this.setColor2 = function(c) { this._color2 = c.slice(); |
49 | if (this._shader && this._shader.default) | 49 | if (this._shader && this._shader.default) |
50 | this._shader.default.u_color2.set(c); | 50 | this._shader.default.u_color2.set(c); |
51 | } | 51 | }; |
52 | 52 | ||
53 | this.getColor3 = function() { return this._color3; } | 53 | this.getColor3 = function() { return this._color3; }; |
54 | this.setColor3 = function(c) { this._color3 = c.slice(); | 54 | this.setColor3 = function(c) { this._color3 = c.slice(); |
55 | if (this._shader && this._shader.default) | 55 | if (this._shader && this._shader.default) |
56 | this._shader.default.u_color3.set(c); | 56 | this._shader.default.u_color3.set(c); |
57 | } | 57 | }; |
58 | 58 | ||
59 | this.getColor4 = function() { return this._color4; } | 59 | this.getColor4 = function() { return this._color4; }; |
60 | this.setColor4 = function(c) { this._color4 = c.slice(); | 60 | this.setColor4 = function(c) { this._color4 = c.slice(); |
61 | if (this._shader && this._shader.default) | 61 | if (this._shader && this._shader.default) |
62 | this._shader.default.u_color4.set(c); | 62 | this._shader.default.u_color4.set(c); |
63 | } | 63 | }; |
64 | 64 | ||
65 | this.getColorStop1 = function() { return this._colorStop1; } | 65 | this.getColorStop1 = function() { return this._colorStop1; }; |
66 | this.setColorStop1 = function(s) { this._colorStop1 = s; | 66 | this.setColorStop1 = function(s) { this._colorStop1 = s; |
67 | if (this._shader && this._shader.default) | 67 | if (this._shader && this._shader.default) |
68 | this._shader.default.u_colorStop1.set([s]); | 68 | this._shader.default.u_colorStop1.set([s]); |
69 | } | 69 | }; |
70 | 70 | ||
71 | this.getColorStop2 = function() { return this._colorStop2; } | 71 | this.getColorStop2 = function() { return this._colorStop2; }; |
72 | this.setColorStop2 = function(s) { this._colorStop2 = s; | 72 | this.setColorStop2 = function(s) { this._colorStop2 = s; |
73 | if (this._shader && this._shader.default) | 73 | if (this._shader && this._shader.default) |
74 | this._shader.default.u_colorStop2.set([s]); | 74 | this._shader.default.u_colorStop2.set([s]); |
75 | } | 75 | }; |
76 | 76 | ||
77 | this.getColorStop3 = function() { return this._colorStop3; } | 77 | this.getColorStop3 = function() { return this._colorStop3; } |
78 | this.setColorStop3 = function(s) { this._colorStop3 = s; | 78 | this.setColorStop3 = function(s) { this._colorStop3 = s; |
@@ -80,35 +80,45 @@ function LinearGradientMaterial() | |||
80 | this._shader.default.u_colorStop3.set([s]); | 80 | this._shader.default.u_colorStop3.set([s]); |
81 | } | 81 | } |
82 | 82 | ||
83 | this.getColorStop4 = function() { return this._colorStop4; } | 83 | this.getColorStop4 = function() { return this._colorStop4; }; |
84 | this.setColorStop4 = function(s) { this._colorStop4 = s; | 84 | this.setColorStop4 = function(s) { this._colorStop4 = s; |
85 | if (this._shader && this._shader.default) | 85 | if (this._shader && this._shader.default) |
86 | this._shader.default.u_colorStop4.set([s]); | 86 | this._shader.default.u_colorStop4.set([s]); |
87 | } | 87 | }; |
88 | 88 | ||
89 | this.getColorCount = function() { return this._colorCount; } | 89 | // this.getColorCount = function() { return this._colorCount; }; |
90 | this.setColorCount = function(c) { this._colorCount = c; | 90 | // this.setColorCount = function(c) { this._colorCount = c; |
91 | if (this._shader && this._shader.default) | 91 | // if (this._shader && this._shader.default) |
92 | this._shader.default.u_colorCount.set([c]); | 92 | // this._shader.default.u_colorCount.set([c]); |
93 | } | 93 | // }; |
94 | 94 | ||
95 | this.getAngle = function() { return this._angle; } | 95 | this.getAngle = function() { return this._angle; }; |
96 | this.setAngle = function(a) { this._angle = a; | 96 | this.setAngle = function(a) { this._angle = a; |
97 | if (this._shader && this._shader.default) | 97 | if (this._shader && this._shader.default) |
98 | this._shader.default.u_cos_sin_angle.set([Math.cos(a), Math.sin(a)]); | 98 | this._shader.default.u_cos_sin_angle.set([Math.cos(a), Math.sin(a)]); |
99 | } | 99 | }; |
100 | |||
101 | this.isAnimated = function() { return false; }; | ||
100 | 102 | ||
101 | /////////////////////////////////////////////////////////////////////// | 103 | /////////////////////////////////////////////////////////////////////// |
102 | // Material Property Accessors | 104 | // Material Property Accessors |
103 | /////////////////////////////////////////////////////////////////////// | 105 | /////////////////////////////////////////////////////////////////////// |
104 | this._propNames = ["color1", "color2", "angle"]; | 106 | this._propNames = ["color1", "color2", "color3", "color4", "colorStop1", "colorStop2", "colorStop3", "colorStop4", "angle"]; |
105 | this._propLabels = ["Start Color", "Stop Color", "Angle"]; | 107 | this._propLabels = ["Color 1", "Color 2", "Color 3", "Color 4", "Color Stop 1", "Color Stop 2", "Color Stop 3", "Color Stop 4", "Angle"]; |
106 | this._propTypes = ["color", "color", "float"]; | 108 | this._propTypes = ["color", "color", "color", "color", "float", "float", "float", "float", "float"]; |
107 | this._propValues = []; | 109 | this._propValues = []; |
108 | 110 | ||
109 | this._propValues[ this._propNames[0] ] = this._color1.slice(0); | 111 | this._propValues[ this._propNames[0] ] = this._color1.slice(0); |
110 | this._propValues[ this._propNames[1] ] = this._color4.slice(0); | 112 | this._propValues[ this._propNames[1] ] = this._color2.slice(0); |
111 | this._propValues[ this._propNames[2] ] = this._angle; | 113 | this._propValues[ this._propNames[2] ] = this._color3.slice(0); |
114 | this._propValues[ this._propNames[3] ] = this._color4.slice(0); | ||
115 | |||
116 | this._propValues[ this._propNames[4] ] = this._colorStop1; | ||
117 | this._propValues[ this._propNames[5] ] = this._colorStop2; | ||
118 | this._propValues[ this._propNames[6] ] = this._colorStop3; | ||
119 | this._propValues[ this._propNames[7] ] = this._colorStop4; | ||
120 | |||
121 | this._propValues[ this._propNames[8] ] = this._angle; | ||
112 | 122 | ||
113 | this.setProperty = function( prop, value ) | 123 | this.setProperty = function( prop, value ) |
114 | { | 124 | { |
@@ -121,20 +131,28 @@ function LinearGradientMaterial() | |||
121 | 131 | ||
122 | switch (prop) | 132 | switch (prop) |
123 | { | 133 | { |
124 | case "color1": this.setColor1( value ); break; | 134 | case "color1": this.setColor1( value ); break; |
125 | case "color2": this.setColor2( value ); break; | 135 | case "color2": this.setColor2( value ); break; |
126 | case "angle": this.setAngle( value ); break; | 136 | case "color3": this.setColor3( value ); break; |
137 | case "color4": this.setColor4( value ); break; | ||
138 | case "colorStop1": this.setColorStop1( value ); break; | ||
139 | case "colorStop2": this.setColorStop2( value ); break; | ||
140 | case "colorStop3": this.setColorStop3( value ); break; | ||
141 | case "colorStop4": this.setColorStop4( value ); break; | ||
142 | case "angle": this.setAngle( value ); break; | ||
127 | } | 143 | } |
128 | } | 144 | }; |
129 | 145 | ||
130 | /////////////////////////////////////////////////////////////////////// | 146 | /////////////////////////////////////////////////////////////////////// |
131 | // Methods | 147 | // Methods |
132 |