当我记录我的 this.kernel 时,值不会改变。但我认为他们应该这样做。按照它应该工作的文档, http: //glmatrix.net/docs/2.2.0/symbols/vec3.html#.normalize
this.kernel = [];
this.kernelSize = 16.0;
var max = 1.0;
var min = -1.0;
var a = Math.random();
for (var i = 0; i < this.kernelSize; i++){
this.kernel.push(Math.random() * (max - min) + min); // random float, range -1..1
this.kernel.push(Math.random() * (max - min) + min);
this.kernel.push(Math.random()); //random float, range 0..1
vec3.normalize([this.kernel[i * 3], this.kernel[i * 3 + 1], this.kernel[i * 3 + 2]], [this.kernel[i * 3], this.kernel[i * 3 + 1], this.kernel[i * 3 +2]]);
console.log(this.kernel);
vec3.multiply([this.kernel[i * 3], this.kernel[i * 3 + 1], this.kernel[i * 3 + 2]], a, 1.0);
console.log(this.kernel);
}