import { SkeletonPostProcessor } from './skeleton_postprocessor.js';

/**
 * Post-processor wrapper for IK solvers.
 *
 * Integrates IK solving into the skeleton post-processing pipeline.
 * The IK solver is executed each frame and results are blended with the base animation.
 *
 * @example
 * ```typescript
 * const ikChain = new IKChain([joint1, joint2, joint3]);
 * const ikSolver = new FABRIKSolver(ikChain);
 * const targetPos = new Vector3(1, 2, 3);
 * const processor = new IKPostProcessor(ikSolver, targetPos, 1.0);
 * skeleton.addPostProcessor(processor);
 * ```
 *
 * @public
 */ class IKPostProcessor extends SkeletonPostProcessor {
    _solver;
    _target;
    /**
   * Create an IK post-processor.
   *
   * @param solver - The IK solver to integrate
   * @param target - Target position for the end effector
   * @param weight - Blend weight [0-1] (default: 1.0)
   * @param priority - Priority for ordering (default: 50)
   */ constructor(solver, target, weight = 1.0, priority = 50){
        super(weight, priority);
        this._solver = solver;
        this._target = target.clone();
    }
    /**
   * Get the IK solver.
   */ get solver() {
        return this._solver;
    }
    /**
   * Get the current target position.
   */ get target() {
        return this._target.clone();
    }
    /**
   * Set the target position for the end effector.
   *
   * @param target - New target position (will be cloned)
   */ setTarget(target) {
        this._target.set(target);
    }
    /**
   * Apply IK solving to skeleton joints.
   */ apply(_skeleton, _deltaTime) {
        if (!this._enabled || this._weight <= 0) {
            return;
        }
        // Solve IK
        this._solver.solve(this._target);
        // Apply to nodes with blending
        this._solver.applyToNodes(this._weight);
    }
    /**
   * Reset the IK solver to initial state.
   */ reset() {
    // IK solvers typically don't need explicit reset
    // as they solve based on current joint positions
    }
}

export { IKPostProcessor };
//# sourceMappingURL=ik_postprocessor.js.map
