|
@@ -241,12 +241,13 @@ export class Effect {
|
|
private _engine: Engine;
|
|
private _engine: Engine;
|
|
private _uniformBuffersNames: { [key: string]: number } = {};
|
|
private _uniformBuffersNames: { [key: string]: number } = {};
|
|
private _uniformsNames: string[];
|
|
private _uniformsNames: string[];
|
|
- private _samplers: string[];
|
|
|
|
|
|
+ private _samplerList: string[];
|
|
|
|
+ private _samplers: {[key: string]: number} = {};
|
|
private _isReady = false;
|
|
private _isReady = false;
|
|
private _compilationError = "";
|
|
private _compilationError = "";
|
|
private _attributesNames: string[];
|
|
private _attributesNames: string[];
|
|
private _attributes: number[];
|
|
private _attributes: number[];
|
|
- private _uniforms: Nullable<WebGLUniformLocation>[];
|
|
|
|
|
|
+ private _uniforms: {[key: string] :Nullable<WebGLUniformLocation>} = {};
|
|
/**
|
|
/**
|
|
* Key for the effect.
|
|
* Key for the effect.
|
|
* @hidden
|
|
* @hidden
|
|
@@ -291,7 +292,7 @@ export class Effect {
|
|
|
|
|
|
this._attributesNames = options.attributes;
|
|
this._attributesNames = options.attributes;
|
|
this._uniformsNames = options.uniformsNames.concat(options.samplers);
|
|
this._uniformsNames = options.uniformsNames.concat(options.samplers);
|
|
- this._samplers = options.samplers.slice();
|
|
|
|
|
|
+ this._samplerList = options.samplers.slice();
|
|
this.defines = options.defines;
|
|
this.defines = options.defines;
|
|
this.onError = options.onError;
|
|
this.onError = options.onError;
|
|
this.onCompiled = options.onCompiled;
|
|
this.onCompiled = options.onCompiled;
|
|
@@ -308,7 +309,7 @@ export class Effect {
|
|
this._engine = <Engine>engine;
|
|
this._engine = <Engine>engine;
|
|
this.defines = (defines == null ? "" : defines);
|
|
this.defines = (defines == null ? "" : defines);
|
|
this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);
|
|
this._uniformsNames = (<string[]>uniformsNamesOrEngine).concat(<string[]>samplers);
|
|
- this._samplers = samplers ? <string[]>samplers.slice() : [];
|
|
|
|
|
|
+ this._samplerList = samplers ? <string[]>samplers.slice() : [];
|
|
this._attributesNames = (<string[]>attributesNamesOrOptions);
|
|
this._attributesNames = (<string[]>attributesNamesOrOptions);
|
|
|
|
|
|
this.onError = onError;
|
|
this.onError = onError;
|
|
@@ -453,7 +454,7 @@ export class Effect {
|
|
* @returns the location of the uniform.
|
|
* @returns the location of the uniform.
|
|
*/
|
|
*/
|
|
public getUniform(uniformName: string): Nullable<WebGLUniformLocation> {
|
|
public getUniform(uniformName: string): Nullable<WebGLUniformLocation> {
|
|
- return this._uniforms[this._uniformsNames.indexOf(uniformName)];
|
|
|
|
|
|
+ return this._uniforms[uniformName];
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -461,7 +462,7 @@ export class Effect {
|
|
* @returns The array of sampler variable neames.
|
|
* @returns The array of sampler variable neames.
|
|
*/
|
|
*/
|
|
public getSamplers(): string[] {
|
|
public getSamplers(): string[] {
|
|
- return this._samplers;
|
|
|
|
|
|
+ return this._samplerList;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -834,19 +835,27 @@ export class Effect {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- this._uniforms = engine.getUniforms(this._program, this._uniformsNames);
|
|
|
|
|
|
+ let uniforms = engine.getUniforms(this._program, this._uniformsNames);
|
|
|
|
+ uniforms.forEach((uniform, index) => {
|
|
|
|
+ this._uniforms[this._uniformsNames[index]] = uniform;
|
|
|
|
+ });
|
|
|
|
+
|
|
this._attributes = engine.getAttributes(this._program, attributesNames);
|
|
this._attributes = engine.getAttributes(this._program, attributesNames);
|
|
|
|
|
|
var index: number;
|
|
var index: number;
|
|
- for (index = 0; index < this._samplers.length; index++) {
|
|
|
|
- var sampler = this.getUniform(this._samplers[index]);
|
|
|
|
|
|
+ for (index = 0; index < this._samplerList.length; index++) {
|
|
|
|
+ var sampler = this.getUniform(this._samplerList[index]);
|
|
|
|
|
|
if (sampler == null) {
|
|
if (sampler == null) {
|
|
- this._samplers.splice(index, 1);
|
|
|
|
|
|
+ this._samplerList.splice(index, 1);
|
|
index--;
|
|
index--;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this._samplerList.forEach((name, index) => {
|
|
|
|
+ this._samplers[name] = index;
|
|
|
|
+ })
|
|
|
|
+
|
|
engine.bindSamplers(this);
|
|
engine.bindSamplers(this);
|
|
|
|
|
|
this._compilationError = "";
|
|
this._compilationError = "";
|
|
@@ -926,7 +935,7 @@ export class Effect {
|
|
* @hidden
|
|
* @hidden
|
|
*/
|
|
*/
|
|
public _bindTexture(channel: string, texture: InternalTexture): void {
|
|
public _bindTexture(channel: string, texture: InternalTexture): void {
|
|
- this._engine._bindTexture(this._samplers.indexOf(channel), texture);
|
|
|
|
|
|
+ this._engine._bindTexture(this._samplers[channel], texture);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -935,7 +944,7 @@ export class Effect {
|
|
* @param texture Texture to set.
|
|
* @param texture Texture to set.
|
|
*/
|
|
*/
|
|
public setTexture(channel: string, texture: Nullable<BaseTexture>): void {
|
|
public setTexture(channel: string, texture: Nullable<BaseTexture>): void {
|
|
- this._engine.setTexture(this._samplers.indexOf(channel), this.getUniform(channel), texture);
|
|
|
|
|
|
+ this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -944,7 +953,7 @@ export class Effect {
|
|
* @param texture Texture to set.
|
|
* @param texture Texture to set.
|
|
*/
|
|
*/
|
|
public setDepthStencilTexture(channel: string, texture: Nullable<RenderTargetTexture>): void {
|
|
public setDepthStencilTexture(channel: string, texture: Nullable<RenderTargetTexture>): void {
|
|
- this._engine.setDepthStencilTexture(this._samplers.indexOf(channel), this.getUniform(channel), texture);
|
|
|
|
|
|
+ this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -953,14 +962,16 @@ export class Effect {
|
|
* @param textures Textures to set.
|
|
* @param textures Textures to set.
|
|
*/
|
|
*/
|
|
public setTextureArray(channel: string, textures: BaseTexture[]): void {
|
|
public setTextureArray(channel: string, textures: BaseTexture[]): void {
|
|
- if (this._samplers.indexOf(channel + "Ex") === -1) {
|
|
|
|
- var initialPos = this._samplers.indexOf(channel);
|
|
|
|
|
|
+ let exName = channel + "Ex";
|
|
|
|
+ if (this._samplerList.indexOf(exName) === -1) {
|
|
|
|
+ var initialPos = this._samplers[channel];
|
|
for (var index = 1; index < textures.length; index++) {
|
|
for (var index = 1; index < textures.length; index++) {
|
|
- this._samplers.splice(initialPos + index, 0, channel + "Ex");
|
|
|
|
|
|
+ this._samplerList.splice(initialPos + index, 0, exName);
|
|
|
|
+ this._samplers[exName] = initialPos + index;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- this._engine.setTextureArray(this._samplers.indexOf(channel), this.getUniform(channel), textures);
|
|
|
|
|
|
+ this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -969,7 +980,7 @@ export class Effect {
|
|
* @param postProcess Post process to get the input texture from.
|
|
* @param postProcess Post process to get the input texture from.
|
|
*/
|
|
*/
|
|
public setTextureFromPostProcess(channel: string, postProcess: Nullable<PostProcess>): void {
|
|
public setTextureFromPostProcess(channel: string, postProcess: Nullable<PostProcess>): void {
|
|
- this._engine.setTextureFromPostProcess(this._samplers.indexOf(channel), postProcess);
|
|
|
|
|
|
+ this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -979,7 +990,7 @@ export class Effect {
|
|
* @param postProcess Post process to get the output texture from.
|
|
* @param postProcess Post process to get the output texture from.
|
|
*/
|
|
*/
|
|
public setTextureFromPostProcessOutput(channel: string, postProcess: Nullable<PostProcess>): void {
|
|
public setTextureFromPostProcessOutput(channel: string, postProcess: Nullable<PostProcess>): void {
|
|
- this._engine.setTextureFromPostProcessOutput(this._samplers.indexOf(channel), postProcess);
|
|
|
|
|
|
+ this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess);
|
|
}
|
|
}
|
|
|
|
|
|
/** @hidden */
|
|
/** @hidden */
|
|
@@ -1110,7 +1121,7 @@ export class Effect {
|
|
|
|
|
|
this._valueCache[uniformName] = value;
|
|
this._valueCache[uniformName] = value;
|
|
|
|
|
|
- this._engine.setInt(this.getUniform(uniformName), value);
|
|
|
|
|
|
+ this._engine.setInt(this._uniforms[uniformName], value);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1123,7 +1134,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setIntArray(uniformName: string, array: Int32Array): Effect {
|
|
public setIntArray(uniformName: string, array: Int32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setIntArray(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setIntArray(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1136,7 +1147,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setIntArray2(uniformName: string, array: Int32Array): Effect {
|
|
public setIntArray2(uniformName: string, array: Int32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setIntArray2(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setIntArray2(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1149,7 +1160,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setIntArray3(uniformName: string, array: Int32Array): Effect {
|
|
public setIntArray3(uniformName: string, array: Int32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setIntArray3(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setIntArray3(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1162,7 +1173,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setIntArray4(uniformName: string, array: Int32Array): Effect {
|
|
public setIntArray4(uniformName: string, array: Int32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setIntArray4(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setIntArray4(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1175,7 +1186,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloatArray(uniformName: string, array: Float32Array): Effect {
|
|
public setFloatArray(uniformName: string, array: Float32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setFloatArray(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setFloatArray(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1188,7 +1199,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloatArray2(uniformName: string, array: Float32Array): Effect {
|
|
public setFloatArray2(uniformName: string, array: Float32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setFloatArray2(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setFloatArray2(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1201,7 +1212,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloatArray3(uniformName: string, array: Float32Array): Effect {
|
|
public setFloatArray3(uniformName: string, array: Float32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setFloatArray3(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setFloatArray3(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1214,7 +1225,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloatArray4(uniformName: string, array: Float32Array): Effect {
|
|
public setFloatArray4(uniformName: string, array: Float32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setFloatArray4(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setFloatArray4(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1227,7 +1238,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setArray(uniformName: string, array: number[]): Effect {
|
|
public setArray(uniformName: string, array: number[]): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setArray(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setArray(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1240,7 +1251,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setArray2(uniformName: string, array: number[]): Effect {
|
|
public setArray2(uniformName: string, array: number[]): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setArray2(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setArray2(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1253,7 +1264,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setArray3(uniformName: string, array: number[]): Effect {
|
|
public setArray3(uniformName: string, array: number[]): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setArray3(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setArray3(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1266,7 +1277,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setArray4(uniformName: string, array: number[]): Effect {
|
|
public setArray4(uniformName: string, array: number[]): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setArray4(this.getUniform(uniformName), array);
|
|
|
|
|
|
+ this._engine.setArray4(this._uniforms[uniformName], array);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1283,7 +1294,7 @@ export class Effect {
|
|
}
|
|
}
|
|
|
|
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setMatrices(this.getUniform(uniformName), matrices);
|
|
|
|
|
|
+ this._engine.setMatrices(this._uniforms[uniformName], matrices);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1296,7 +1307,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setMatrix(uniformName: string, matrix: Matrix): Effect {
|
|
public setMatrix(uniformName: string, matrix: Matrix): Effect {
|
|
if (this._cacheMatrix(uniformName, matrix)) {
|
|
if (this._cacheMatrix(uniformName, matrix)) {
|
|
- this._engine.setMatrix(this.getUniform(uniformName), matrix);
|
|
|
|
|
|
+ this._engine.setMatrix(this._uniforms[uniformName], matrix);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1309,7 +1320,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setMatrix3x3(uniformName: string, matrix: Float32Array): Effect {
|
|
public setMatrix3x3(uniformName: string, matrix: Float32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setMatrix3x3(this.getUniform(uniformName), matrix);
|
|
|
|
|
|
+ this._engine.setMatrix3x3(this._uniforms[uniformName], matrix);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1322,7 +1333,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setMatrix2x2(uniformName: string, matrix: Float32Array): Effect {
|
|
public setMatrix2x2(uniformName: string, matrix: Float32Array): Effect {
|
|
this._valueCache[uniformName] = null;
|
|
this._valueCache[uniformName] = null;
|
|
- this._engine.setMatrix2x2(this.getUniform(uniformName), matrix);
|
|
|
|
|
|
+ this._engine.setMatrix2x2(this._uniforms[uniformName], matrix);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1341,7 +1352,7 @@ export class Effect {
|
|
|
|
|
|
this._valueCache[uniformName] = value;
|
|
this._valueCache[uniformName] = value;
|
|
|
|
|
|
- this._engine.setFloat(this.getUniform(uniformName), value);
|
|
|
|
|
|
+ this._engine.setFloat(this._uniforms[uniformName], value);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1360,7 +1371,7 @@ export class Effect {
|
|
|
|
|
|
this._valueCache[uniformName] = bool;
|
|
this._valueCache[uniformName] = bool;
|
|
|
|
|
|
- this._engine.setBool(this.getUniform(uniformName), bool ? 1 : 0);
|
|
|
|
|
|
+ this._engine.setBool(this._uniforms[uniformName], bool ? 1 : 0);
|
|
|
|
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1373,7 +1384,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setVector2(uniformName: string, vector2: Vector2): Effect {
|
|
public setVector2(uniformName: string, vector2: Vector2): Effect {
|
|
if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {
|
|
if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {
|
|
- this._engine.setFloat2(this.getUniform(uniformName), vector2.x, vector2.y);
|
|
|
|
|
|
+ this._engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1387,7 +1398,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloat2(uniformName: string, x: number, y: number): Effect {
|
|
public setFloat2(uniformName: string, x: number, y: number): Effect {
|
|
if (this._cacheFloat2(uniformName, x, y)) {
|
|
if (this._cacheFloat2(uniformName, x, y)) {
|
|
- this._engine.setFloat2(this.getUniform(uniformName), x, y);
|
|
|
|
|
|
+ this._engine.setFloat2(this._uniforms[uniformName], x, y);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1400,7 +1411,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setVector3(uniformName: string, vector3: Vector3): Effect {
|
|
public setVector3(uniformName: string, vector3: Vector3): Effect {
|
|
if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {
|
|
if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {
|
|
- this._engine.setFloat3(this.getUniform(uniformName), vector3.x, vector3.y, vector3.z);
|
|
|
|
|
|
+ this._engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1415,7 +1426,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloat3(uniformName: string, x: number, y: number, z: number): Effect {
|
|
public setFloat3(uniformName: string, x: number, y: number, z: number): Effect {
|
|
if (this._cacheFloat3(uniformName, x, y, z)) {
|
|
if (this._cacheFloat3(uniformName, x, y, z)) {
|
|
- this._engine.setFloat3(this.getUniform(uniformName), x, y, z);
|
|
|
|
|
|
+ this._engine.setFloat3(this._uniforms[uniformName], x, y, z);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1428,7 +1439,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setVector4(uniformName: string, vector4: Vector4): Effect {
|
|
public setVector4(uniformName: string, vector4: Vector4): Effect {
|
|
if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {
|
|
if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {
|
|
- this._engine.setFloat4(this.getUniform(uniformName), vector4.x, vector4.y, vector4.z, vector4.w);
|
|
|
|
|
|
+ this._engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1444,7 +1455,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect {
|
|
public setFloat4(uniformName: string, x: number, y: number, z: number, w: number): Effect {
|
|
if (this._cacheFloat4(uniformName, x, y, z, w)) {
|
|
if (this._cacheFloat4(uniformName, x, y, z, w)) {
|
|
- this._engine.setFloat4(this.getUniform(uniformName), x, y, z, w);
|
|
|
|
|
|
+ this._engine.setFloat4(this._uniforms[uniformName], x, y, z, w);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1458,7 +1469,7 @@ export class Effect {
|
|
public setColor3(uniformName: string, color3: Color3): Effect {
|
|
public setColor3(uniformName: string, color3: Color3): Effect {
|
|
|
|
|
|
if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {
|
|
if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {
|
|
- this._engine.setColor3(this.getUniform(uniformName), color3);
|
|
|
|
|
|
+ this._engine.setColor3(this._uniforms[uniformName], color3);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1472,7 +1483,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setColor4(uniformName: string, color3: Color3, alpha: number): Effect {
|
|
public setColor4(uniformName: string, color3: Color3, alpha: number): Effect {
|
|
if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {
|
|
if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {
|
|
- this._engine.setColor4(this.getUniform(uniformName), color3, alpha);
|
|
|
|
|
|
+ this._engine.setColor4(this._uniforms[uniformName], color3, alpha);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1485,7 +1496,7 @@ export class Effect {
|
|
*/
|
|
*/
|
|
public setDirectColor4(uniformName: string, color4: Color4): Effect {
|
|
public setDirectColor4(uniformName: string, color4: Color4): Effect {
|
|
if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {
|
|
if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {
|
|
- this._engine.setDirectColor4(this.getUniform(uniformName), color4);
|
|
|
|
|
|
+ this._engine.setDirectColor4(this._uniforms[uniformName], color4);
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -1521,4 +1532,4 @@ export class Effect {
|
|
public static ResetCache() {
|
|
public static ResetCache() {
|
|
Effect._baseCache = {};
|
|
Effect._baseCache = {};
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|