(assoc-instance-attr index entity instanced-entity attr-name uni-name)

Source

(defn assoc-instance-attr [index entity instanced-entity attr-name uni-name] (when (:program entity) (throw (ex-info "Only uncompiled entities can be assoc'ed to an instanced entity" {}))) (let [new-data (get-in entity [:uniforms uni-name]) data-len (count new-data) offset (* index data-len)] (update-in instanced-entity [:attributes attr-name] (fn [attr] (if attr (update attr :data (fn [old-data] (persistent! (reduce-kv (fn [data i n] (assoc! data (+ offset i) n)) (transient old-data) new-data)))) {:data (vec new-data), :divisor 1})))))