Skip to content

Commit 721abd1

Browse files
author
David DeSimone
committed
Preventing issue where mutating the value of an array after setting it may propigate to changing the GLProgramState
1 parent fdaa7e2 commit 721abd1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cocos2d/shaders/CCGLProgramState.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ cc.UniformValue.prototype = {
6464
},
6565

6666
setVec2v: function setVec2v(value) {
67-
this._value = value;
67+
this._value = value.slice(0);
6868
this._type = types.GL_FLOAT_VEC2;
6969
},
7070

@@ -74,7 +74,7 @@ cc.UniformValue.prototype = {
7474
},
7575

7676
setVec3v: function setVec3v(value) {
77-
this._value = value;
77+
this._value = value.slice(0);
7878
this._type = types.GL_FLOAT_VEC3;
7979
},
8080

@@ -84,12 +84,12 @@ cc.UniformValue.prototype = {
8484
},
8585

8686
setVec4v: function setVec4v(value) {
87-
this._value = value;
87+
this._value = value.slice(0);
8888
this._type = types.GL_FLOAT_VEC4;
8989
},
9090

9191
setMat4: function setMat4(value) {
92-
this._value = value;
92+
this._value = value.slice(0);
9393
this._type = types.GL_FLOAT_MAT4;
9494
},
9595

0 commit comments

Comments
 (0)