File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,7 +33,13 @@ var ColorMatrix = new Class({
3333 * @private
3434 * @since 3.50.0
3535 */
36- this . _matrix ;
36+ this . _matrix = [
37+ 1 , 0 , 0 , 0 , 0 ,
38+ 0 , 1 , 0 , 0 , 0 ,
39+ 0 , 0 , 1 , 0 , 0 ,
40+ 0 , 0 , 0 , 1 , 0 ,
41+ 0 , 0 , 0 , 0 , 1
42+ ] ;
3743
3844 /**
3945 * Is the ColorMatrix array dirty?
@@ -56,8 +62,6 @@ var ColorMatrix = new Class({
5662 * @since 3.50.0
5763 */
5864 this . _data ;
59-
60- this . reset ( ) ;
6165 } ,
6266
6367 /**
@@ -89,13 +93,40 @@ var ColorMatrix = new Class({
8993 */
9094 reset : function ( )
9195 {
92- this . _matrix = [
93- 1 , 0 , 0 , 0 , 0 ,
94- 0 , 1 , 0 , 0 , 0 ,
95- 0 , 0 , 1 , 0 , 0 ,
96- 0 , 0 , 0 , 1 , 0 ,
97- 0 , 0 , 0 , 0 , 1
98- ] ;
96+ // Long-winded, but saves on gc, which happens a lot in Post FX Shaders
97+ // that reset the ColorMatrix every frame.
98+
99+ var m = this . _matrix ;
100+
101+ m [ 0 ] = 1 ;
102+ m [ 1 ] = 0 ;
103+ m [ 2 ] = 0 ;
104+ m [ 3 ] = 0 ;
105+ m [ 4 ] = 0 ;
106+
107+ m [ 5 ] = 0 ;
108+ m [ 6 ] = 1 ;
109+ m [ 7 ] = 0 ;
110+ m [ 8 ] = 0 ;
111+ m [ 9 ] = 0 ;
112+
113+ m [ 10 ] = 0 ;
114+ m [ 11 ] = 0 ;
115+ m [ 12 ] = 1 ;
116+ m [ 13 ] = 0 ;
117+ m [ 14 ] = 0 ;
118+
119+ m [ 15 ] = 0 ;
120+ m [ 16 ] = 0 ;
121+ m [ 17 ] = 0 ;
122+ m [ 18 ] = 1 ;
123+ m [ 19 ] = 0 ;
124+
125+ m [ 20 ] = 0 ;
126+ m [ 21 ] = 0 ;
127+ m [ 22 ] = 0 ;
128+ m [ 23 ] = 0 ;
129+ m [ 24 ] = 1 ;
99130
100131 this . _dirty = true ;
101132
You can’t perform that action at this time.
0 commit comments