David Catuhe 5 years ago
parent
commit
295b8d6ec4
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/Materials/effect.ts

+ 3 - 4
src/Materials/effect.ts

@@ -756,7 +756,7 @@ export class Effect implements IDisposable {
     /** @hidden */
     public _cacheFloat2(uniformName: string, x: number, y: number): boolean {
         var cache = this._valueCache[uniformName];
-        if (!cache) {
+        if (!cache || cache.length !== 2) {
             cache = [x, y];
             this._valueCache[uniformName] = cache;
             return true;
@@ -778,7 +778,7 @@ export class Effect implements IDisposable {
     /** @hidden */
     public _cacheFloat3(uniformName: string, x: number, y: number, z: number): boolean {
         var cache = this._valueCache[uniformName];
-        if (!cache) {
+        if (!cache || cache.length !== 3) {
             cache = [x, y, z];
             this._valueCache[uniformName] = cache;
             return true;
@@ -804,7 +804,7 @@ export class Effect implements IDisposable {
     /** @hidden */
     public _cacheFloat4(uniformName: string, x: number, y: number, z: number, w: number): boolean {
         var cache = this._valueCache[uniformName];
-        if (!cache) {
+        if (!cache || cache.length !== 4) {
             cache = [x, y, z, w];
             this._valueCache[uniformName] = cache;
             return true;
@@ -1214,7 +1214,6 @@ export class Effect implements IDisposable {
      * @returns this effect.
      */
     public setColor3(uniformName: string, color3: IColor3Like): Effect {
-
         if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {
             this._engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b);
         }