package me.earthme.luminol.collision;

public interface INativeCollisionBackend {
    String getName();
    void initialize() throws Exception;
    CollisionPushResult push(double[] aabb, int[] resultSizeOut);

    /**
     * Allocation-free broadphase: writes overlapping pair indices directly into the
     * caller-owned {@code outA}/{@code outB} arrays and returns the pair count.
     *
     * <p>Avoids the per-tick {@code new int[]} / anonymous {@link CollisionPushResult}
     * churn of {@link #push} and skips density (which the region push handler does not use).
     * If the broadphase finds more pairs than {@code outA.length}, it fills up to that
     * capacity and returns the capacity (extra pairs are dropped, same effect as the
     * per-entity collision cap downstream).
     *
     * @return number of valid pairs written (>= 0); {@code -1} if the backend cannot
     *         service this call (caller should treat as "no pairs").
     */
    int pushInto(double[] aabb, int count, int[] outA, int[] outB);

    void applyConfig();
    void destroy();
}
