Why here use a closures to set value for shader's uniform?

37 Views Asked by At

I'm looking at GPUImage3, My question is why closures are used here instead of direct assignments

public class LuminanceThreshold: BasicOperation {
    public var threshold:Float = 0.5 { didSet { uniformSettings["threshold"] = threshold } }
    
    public init() {
        super.init(fragmentFunctionName: "thresholdFragment", numberOfInputs:1)
        
        ({threshold = 0.5})() //this line
    }
}

I want to know why and how it works.

0

There are 0 best solutions below