
import Foundation
import Metal

public class GooWavesRenderable: ConfiguredQuadRenderable<GooWavesRenderable.Config> {
    
    public struct Config: QuadRenderConfiguration {
        // matches GooWaves_Uniforms
        internal var resolution: ADVector2
        internal var time:      ADFloat

        public init(
            resolution: ADVector2 = .ones,
            time:       ADFloat   = .zero
        ) {
            self.resolution = resolution
            self.time       = time
        }

        public static var defaultConfiguration: Config {
            return Config()
        }
    }

    /// Name of the Metal fragment function in your `.metal` library
    override public var fragmentShaderName: String {
        return "goo_waves_fragment"
    }

    /// Hook to set up any extra state before drawing;
    /// here all your `Config` fields are bound automatically.
    override public var configureAction: ConfigureAction {
        return { encoder in
            super.configureAction(encoder)
            // if you ever need to tweak bindings manually, do it here
        }
    }
}
