import { v3_matrix4_multiply } from "../../vec3/v3_matrix4_multiply.js";

/**
 * Matrix-transform an array of 3d points
 * Code is inlined for speed
 * @param {number[]|Float32Array|Float64Array} source
 * @param {number} source_offset
 * @param {number[]|Float32Array|Float64Array} destination
 * @param {number} destination_offset
 * @param {number} vertex_count
 * @param {mat4|number[]|Float32Array} mat4
 */
export function apply_mat4_transform_to_v3_array(
    source, source_offset,
    destination, destination_offset,
    vertex_count, mat4
) {

    for (let i = 0; i < vertex_count; i++) {
        const i3 = i * 3;

        const source_vertex_address = source_offset + i3;
        const destination_vertex_address = destination_offset + i3;

        v3_matrix4_multiply(destination,destination_vertex_address, source,source_vertex_address, mat4);

    }

}

