From 6c06aadd37b890d62d349efee4eb728b77f34d03 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Thu, 24 Aug 2017 18:35:16 -0700 Subject: [PATCH] [kit] Add target and feather properties to the Parameters struct --- MetaballsKit/Metaballs.swift | 10 ++++++---- MetaballsKit/Shaders.metal | 7 +++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/MetaballsKit/Metaballs.swift b/MetaballsKit/Metaballs.swift index b748598..4cdb5eb 100644 --- a/MetaballsKit/Metaballs.swift +++ b/MetaballsKit/Metaballs.swift @@ -36,12 +36,14 @@ public struct Parameters { var size = Size(width: 0, height: 0) var numberOfBalls: UInt16 = 0 - let unused1: UInt16 = 0xAB - let unused2: UInt32 = 0xCDEF - let unused3: UInt16 = 0xBA + private var _colorStyle = ColorStyle.singleColor.rawValue + + /// The target sample value. Above this value results in a colored pixel; below is a dark pixel. + var target: Float = 1.0 + /// The amount to feather the alpha of each ball. A value between 0.0 and 1.0. + var feather: Float = 0.0 // Color parameters - private var _colorStyle = ColorStyle.singleColor.rawValue public var color0 = Float4(r: 0, g: 1, b: 0, a: 1) public var color1 = Float4() public var color2 = Float4() diff --git a/MetaballsKit/Shaders.metal b/MetaballsKit/Shaders.metal index 0328390..3294bda 100644 --- a/MetaballsKit/Shaders.metal +++ b/MetaballsKit/Shaders.metal @@ -41,11 +41,10 @@ typedef struct { short2 size; ushort numberOfBalls; - ushort unused1; - uint unused2; - ushort unused3; - ushort colorStyle; + float target; + float feather; + float4 colors[4]; } Parameters;