function applyDyeMatrix(matrix, r, g, b) {
	// apply the color transformation
	let vin = vec4.fromValues(b, g, r, 1)
	let vout = vec4.create();
	vec4.transformMat4(vout, vin, matrix);

	// round and clamp the values
	let ob = Math.floor(Math.max(0, Math.min(255, Math.round(vout[0]))));
	let og = Math.floor(Math.max(0, Math.min(255, Math.round(vout[1]))));
	let or = Math.floor(Math.max(0, Math.min(255, Math.round(vout[2]))));

	return {
		r: or,
		g: og,
		b: ob
	};
}
// Note: this method is slow due to excessive allocations. See dyerender.js for a faster inline variant.
this method is slow due to excessive allocations. See dyerender.js for a faster inline variant.
this method is slow due to excessive allocations . See dyerender . js for a faster inline variant .
function applyDyeMatrix(matrix, r, g, b) {
	let vin = vec4.fromValues(b, g, r, 1)
	let vout = vec4.create();
	vec4.transformMat4(vout, vin, matrix);
	let ob = Math.floor(Math.max(0, Math.min(255, Math.round(vout[0]))));
	let og = Math.floor(Math.max(0, Math.min(255, Math.round(vout[1]))));
	let or = Math.floor(Math.max(0, Math.min(255, Math.round(vout[2]))));
	return {
		r: or,
		g: og,
		b: ob
	};
}
function applyDyeMatrix ( matrix , r , g , b ) { let vin = vec4 . fromValues ( b , g , r , 1 ) let vout = vec4 . create ( ) ; vec4 . transformMat4 ( vout , vin , matrix ) ; let ob = Math . floor ( Math . max ( 0 , Math . min ( 255 , Math . round ( vout [ 0 ] ) ) ) ) ; let og = Math . floor ( Math . max ( 0 , Math . min ( 255 , Math . round ( vout [ 1 ] ) ) ) ) ; let or = Math . floor ( Math . max ( 0 , Math . min ( 255 , Math . round ( vout [ 2 ] ) ) ) ) ; return { r : or , g : og , b : ob } ; }
Note: this method is slow due to excessive allocations.
Note : this method is slow due to excessive allocations .
// apply the color transformation // round and clamp the values