import '../../../globals.js';
// Copyright 2023-2024, University of Colorado Boulder
/**
 * Represents an ancestor-to-descendant walk through a RenderProgram tree.
 *
 * @author Jonathan Olson <jonathan.olson@colorado.edu>
 */
import { alpenglow } from '../imports.js';
export default class RenderTrail {
    constructor(program, indices) {
        this.program = program;
        this.indices = indices;
    }
    equals(other) {
        return this.indices.length === other.indices.length && this.compare(other) === 0;
    }
    compare(other) {
        const minIndexLength = Math.min(this.indices.length, other.indices.length);
        for (let i = 0; i < minIndexLength; i++) {
            const index = this.indices[i];
            const otherIndex = other.indices[i];
            if (index !== otherIndex) {
                return Math.sign(index - otherIndex);
            }
        }
        return this.indices.length - other.indices.length;
    }
    static closureCompare(a, b) {
        return a.compare(b);
    }
}
alpenglow.register('RenderTrail', RenderTrail);
//# sourceMappingURL=RenderTrail.js.map