setValueV4f method
void
setValueV4f(
- RenderingContext gl,
- dynamic v, [
- WebGLTextures? textures
])
Implementation
void setValueV4f(RenderingContext gl, v, [WebGLTextures? textures]) {
final cache = this.cache;
if (v is Vector4) {
if (cache[0] != v.x || cache[1] != v.y || cache[2] != v.z || cache[3] != v.w) {
gl.uniform4f(addr, v.x, v.y, v.z, v.w);
cache[0] = v.x;
cache[1] = v.y;
cache[2] = v.z;
cache[3] = v.w;
}
} else if (v is Color) {
if (cache[0] != v.red || cache[1] != v.green || cache[2] != v.blue || cache[3] != 1.0) {
gl.uniform4f(addr, v.red, v.green, v.blue, 1.0);
cache[0] = v.red.toDouble();
cache[1] = v.green.toDouble();
cache[2] = v.blue.toDouble();
cache[3] = 1.0;
}
} else if (v is List) {
if (cache[0] != v[0] || cache[1] != v[1] || cache[2] != v[2] || cache[3] != v[3]) {
gl.uniform4f(addr, v[0], v[1], v[2], v[3]);
cache[0] = v[0];
cache[1] = v[1];
cache[2] = v[2];
cache[3] = v[3];
}
} else {
if (arraysEqual(cache, v)) return;
gl.uniform4fv(addr, v);
copyArray(cache, v);
}
}