aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/linear-gradient-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/linear-gradient-material.js')
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js426
1 files changed, 178 insertions, 248 deletions
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js
index 0db6fc90..51a7430c 100755
--- a/js/lib/rdge/materials/linear-gradient-material.js
+++ b/js/lib/rdge/materials/linear-gradient-material.js
@@ -11,36 +11,36 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
11 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
12 // Instance variables 12 // Instance variables
13 /////////////////////////////////////////////////////////////////////// 13 ///////////////////////////////////////////////////////////////////////
14 this._name = "LinearGradientMaterial"; 14 this._name = "LinearGradientMaterial";
15 this._shaderName = "linearGradient"; 15 this._shaderName = "linearGradient";
16 16
17 this._color1 = [1,0,0,1]; 17 this._color1 = [1, 0, 0, 1];
18 this._color2 = [0,1,0,1]; 18 this._color2 = [0, 1, 0, 1];
19 this._color3 = [0,0,1,1]; 19 this._color3 = [0, 0, 1, 1];
20 this._color4 = [0,1,1,1]; 20 this._color4 = [0, 1, 1, 1];
21 this._colorStop1 = 0.0; 21 this._colorStop1 = 0.0;
22 this._colorStop2 = 0.3; 22 this._colorStop2 = 0.3;
23 this._colorStop3 = 0.6; 23 this._colorStop3 = 0.6;
24 this._colorStop4 = 1.0; 24 this._colorStop4 = 1.0;
25// this._colorCount = 4; 25 // this._colorCount = 4;
26 this._angle = 0.0; // the shader takes [cos(a), sin(a)] 26 this._angle = 0.0; // the shader takes [cos(a), sin(a)]
27 27
28 /////////////////////////////////////////////////////////////////////// 28 ///////////////////////////////////////////////////////////////////////
29 // Property Accessors 29 // Property Accessors
30 /////////////////////////////////////////////////////////////////////// 30 ///////////////////////////////////////////////////////////////////////
31 this.getShaderName = function() { 31 this.getShaderName = function () {
32 return this._shaderName; 32 return this._shaderName;
33 }; 33 };
34 34
35 this.getName = function() { 35 this.getName = function () {
36 return this._name; 36 return this._name;
37 }; 37 };
38 38
39 this.getColor1 = function() { 39 this.getColor1 = function () {
40 return this._color1; 40 return this._color1;
41 }; 41 };
42 42
43 this.setColor1 = function(c) { 43 this.setColor1 = function (c) {
44 this._color1 = c.slice(); 44 this._color1 = c.slice();
45 45
46 if (this._shader && this._shader['default']) { 46 if (this._shader && this._shader['default']) {
@@ -48,11 +48,11 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
48 } 48 }
49 }; 49 };
50 50
51 this.getColor2 = function() { 51 this.getColor2 = function () {
52 return this._color2; 52 return this._color2;
53 }; 53 };
54 54
55 this.setColor2 = function(c) { 55 this.setColor2 = function (c) {
56 this._color2 = c.slice(); 56 this._color2 = c.slice();
57 57
58 if (this._shader && this._shader['default']) { 58 if (this._shader && this._shader['default']) {
@@ -60,23 +60,23 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
60 } 60 }
61 }; 61 };
62 62
63 this.getColor3 = function() { 63 this.getColor3 = function () {
64 return this._color3; 64 return this._color3;
65 }; 65 };
66 66
67 this.setColor3 = function(c) { 67 this.setColor3 = function (c) {
68 this._color3 = c.slice(); 68 this._color3 = c.slice();
69 69
70 if (this._shader && this._shader['default']) { 70 if (this._shader && this._shader['default']) {
71 this._shader['default'].u_color3.set(c); 71 this._shader['default'].u_color3.set(c);
72 } 72 }
73 }; 73 };
74 74
75 this.getColor4 = function() { 75 this.getColor4 = function () {
76 return this._color4; 76 return this._color4;
77 }; 77 };
78 78
79 this.setColor4 = function(c) { 79 this.setColor4 = function (c) {
80 this._color4 = c.slice(); 80 this._color4 = c.slice();
81 81
82 if (this._shader && this._shader['default']) { 82 if (this._shader && this._shader['default']) {
@@ -84,11 +84,11 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
84 } 84 }
85 }; 85 };
86 86
87 this.getColorStop1 = function() { 87 this.getColorStop1 = function () {
88 return this._colorStop1; 88 return this._colorStop1;
89 }; 89 };
90 90
91 this.setColorStop1 = function(s) { 91 this.setColorStop1 = function (s) {
92 this._colorStop1 = s; 92 this._colorStop1 = s;
93 93
94 if (this._shader && this._shader['default']) { 94 if (this._shader && this._shader['default']) {
@@ -96,11 +96,11 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
96 } 96 }
97 }; 97 };
98 98
99 this.getColorStop2 = function() { 99 this.getColorStop2 = function () {
100 return this._colorStop2; 100 return this._colorStop2;
101 }; 101 };
102 102
103 this.setColorStop2 = function(s) { 103 this.setColorStop2 = function (s) {
104 this._colorStop2 = s; 104 this._colorStop2 = s;
105 105
106 if (this._shader && this._shader['default']) { 106 if (this._shader && this._shader['default']) {
@@ -108,23 +108,23 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
108 } 108 }
109 }; 109 };
110 110
111 this.getColorStop3 = function() { 111 this.getColorStop3 = function () {
112 return this._colorStop3; 112 return this._colorStop3;
113 }; 113 };
114 114
115 this.setColorStop3 = function(s) { 115 this.setColorStop3 = function (s) {
116 this._colorStop3 = s; 116 this._colorStop3 = s;
117 117
118 if (this._shader && this._shader['default']) { 118 if (this._shader && this._shader['default']) {
119 this._shader['default'].u_colorStop3.set([s]); 119 this._shader['default'].u_colorStop3.set([s]);
120 } 120 }
121 } 121 };
122 122
123 this.getColorStop4 = function() { 123 this.getColorStop4 = function () {
124 return this._colorStop4; 124 return this._colorStop4;
125 }; 125 };
126 126
127 this.setColorStop4 = function(s) { 127 this.setColorStop4 = function (s) {
128 this._colorStop4 = s; 128 this._colorStop4 = s;
129 129
130 if (this._shader && this._shader['default']) { 130 if (this._shader && this._shader['default']) {
@@ -132,17 +132,17 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
132 } 132 }
133 }; 133 };
134 134
135// this.getColorCount = function() { return this._colorCount; }; 135 // this.getColorCount = function() { return this._colorCount; };
136// this.setColorCount = function(c) { this._colorCount = c; 136 // this.setColorCount = function(c) { this._colorCount = c;
137// if (this._shader && this._shader['default']) 137 // if (this._shader && this._shader['default'])
138// this._shader['default'].u_colorCount.set([c]); 138 // this._shader['default'].u_colorCount.set([c]);
139// }; 139 // };
140 140
141 this.getAngle = function() { 141 this.getAngle = function () {
142 return this._angle; 142 return this._angle;
143 }; 143 };
144 144
145 this.setAngle = function(a) { 145 this.setAngle = function (a) {
146 this._angle = a; 146 this._angle = a;
147 147
148 if (this._shader && this._shader['default']) { 148 if (this._shader && this._shader['default']) {
@@ -150,222 +150,152 @@ var LinearGradientMaterial = function LinearGradientMaterial() {
150 } 150 }
151 }; 151 };
152