├── doc
└── screenshot_01.png
├── Perlin-Swift.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── project.pbxproj
├── .gitignore
├── Perlin-SwiftTests
├── Info.plist
└── Perlin_SwiftTests.swift
├── README.md
├── LICENSE.md
└── Perlin-Swift
├── Images.xcassets
└── AppIcon.appiconset
│ └── Contents.json
├── Info.plist
├── AppDelegate.swift
├── Base.lproj
├── LaunchScreen.xib
└── Main.storyboard
├── ViewController.swift
└── PerlinGenerator.swift
/doc/screenshot_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lachlanhurst/perlin-swift/HEAD/doc/screenshot_01.png
--------------------------------------------------------------------------------
/Perlin-Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ### Xcode ###
2 | build/
3 | *.pbxuser
4 | !default.pbxuser
5 | *.mode1v3
6 | !default.mode1v3
7 | *.mode2v3
8 | !default.mode2v3
9 | *.perspectivev3
10 | !default.perspectivev3
11 | xcuserdata
12 | *.xccheckout
13 | *.moved-aside
14 | DerivedData
15 | *.xcuserstate
16 |
17 | # Workspace file - autogenerated by cocoa pods
18 | *.xcworkspace
19 |
20 |
21 | # CocoaPods
22 | Pods/
23 |
--------------------------------------------------------------------------------
/Perlin-SwiftTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # perlin-swift
2 | Perlin noise generator implemented in Swift
3 |
4 | 
5 |
6 | This project is a based on a port of the CZGPerlinGenerator class as implemented in the [perlin-iOS](https://github.com/czgarrett/perlin-ios) project.
7 |
8 | It contains a demo app for experimenting with the PerlinGenerator parameters.
9 |
10 | # Performance notes
11 | As of XCode 6.4 and an aging iPhone 4s, there is a noticable difference in performance between release and debug builds. A release build runs approximately 4 times quicker.
12 |
13 | The implementation of the PerlinGenerator in the `master` branch of this repository supports 4 dimensions, although only two are visualised in the demo app. I've implemented a 2D version of the noise generator in the `feature-2d-only` branch, it is much quicker and allows the demo app to update in real-time.
14 |
15 |
16 | # License
17 | MIT
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Perlin-SwiftTests/Perlin_SwiftTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Perlin_SwiftTests.swift
3 | // Perlin-SwiftTests
4 | //
5 | // Created by Lachlan Hurst on 24/08/2015.
6 | // Copyright (c) 2015 Lachlan Hurst. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import XCTest
11 |
12 | class Perlin_SwiftTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | XCTAssert(true, "Pass")
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measure() {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Lachlan Hurst
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Perlin-Swift/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "29x29",
36 | "scale" : "1x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "29x29",
41 | "scale" : "2x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "40x40",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "40x40",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "76x76",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "76x76",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
--------------------------------------------------------------------------------
/Perlin-Swift/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/Perlin-Swift/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Perlin-Swift
4 | //
5 | // Created by Lachlan Hurst on 24/08/2015.
6 | // Copyright (c) 2015 Lachlan Hurst. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/Perlin-Swift/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Perlin-Swift/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // Perlin-Swift
4 | //
5 | // Created by Lachlan Hurst on 24/08/2015.
6 | // Copyright (c) 2015 Lachlan Hurst. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import Foundation
11 |
12 | class ViewController: UIViewController, UITextFieldDelegate {
13 |
14 | @IBOutlet var zoomLabel: UILabel!
15 | @IBOutlet var persistenceLabel: UILabel!
16 | @IBOutlet var octavesLabel: UILabel!
17 |
18 | @IBOutlet var zoomSlider: UISlider!
19 | @IBOutlet var persistenceSlider: UISlider!
20 | @IBOutlet var octavesSlider: UISlider!
21 |
22 | @IBOutlet var sizeXtext: UITextField!
23 | @IBOutlet var sizeYtext: UITextField!
24 |
25 | @IBOutlet var imageView: UIImageView!
26 |
27 | fileprivate var generator = PerlinGenerator()
28 |
29 | @IBAction func aSliderChanged(_ sender: AnyObject) {
30 |
31 | let slider = sender as! UISlider
32 | if slider === zoomSlider {
33 | zoomLabel.textAlignment = NSTextAlignment.left
34 | zoomLabel.text = String(format: "Z = %.2f", slider.value)
35 | } else if slider === persistenceSlider {
36 | persistenceLabel.textAlignment = NSTextAlignment.left
37 | persistenceLabel.text = String(format: "P = %.2f", slider.value)
38 | } else if slider === octavesSlider {
39 | octavesLabel.textAlignment = NSTextAlignment.left
40 | octavesLabel.text = "O = \(Int(slider.value))"
41 | }
42 |
43 | updateNoiseImage()
44 | }
45 |
46 | @IBAction func newPressed(_ sender: AnyObject) {
47 | generator = PerlinGenerator()
48 | updateNoiseImage()
49 | }
50 |
51 | func updateNoiseImage() {
52 |
53 | generator.octaves = Int(octavesSlider.value)
54 | generator.zoom = zoomSlider.value
55 | generator.persistence = persistenceSlider.value
56 |
57 | let sizeX = CGFloat(NSString(string: sizeXtext.text!).floatValue)
58 | let sizeY = CGFloat(NSString(string: sizeYtext.text!).floatValue)
59 | let size = CGSize(width: sizeX, height: sizeY)
60 |
61 | let noise = generateNoiseImage(generator, size: size)
62 | imageView.image = noise
63 | }
64 |
65 |
66 | func generateNoiseImage(_ generator:PerlinGenerator, size:CGSize) -> UIImage {
67 |
68 | let width = Int(size.width)
69 | let height = Int(size.height)
70 |
71 | let startTime = CFAbsoluteTimeGetCurrent();
72 |
73 | var pixelArray = [PixelData](repeating: PixelData(a: 255, r:0, g: 0, b: 0), count: width * height)
74 |
75 | for i in 0 ..< height {
76 | for j in 0 ..< width {
77 | var val = abs(generator.perlinNoise(Float(j), y: Float(i), z: 0, t: 0))
78 | if val > 1 {
79 | val = 1
80 | }
81 | let index = i * width + j
82 | let u_I = UInt8(val * 255)
83 | pixelArray[index].r = u_I
84 | pixelArray[index].g = u_I
85 | pixelArray[index].b = 0
86 | }
87 | }
88 | let outputImage = imageFromARGB32Bitmap(pixelArray, width: width, height: height)
89 |
90 | print(" R RENDER:" + String(format: "%.4f", CFAbsoluteTimeGetCurrent() - startTime));
91 |
92 | return outputImage
93 |
94 | /*
95 | let bounds = CGRect(origin: CGPoint.zeroPoint, size: size)
96 | let opaque = false
97 | let scale: CGFloat = 0
98 | UIGraphicsBeginImageContextWithOptions(size, opaque, scale)
99 | let ctx = UIGraphicsGetCurrentContext()
100 |
101 | CGContextSetRGBFillColor(ctx, 1.000, 0.0, 0.000, 1.000); // light blue
102 | CGContextFillRect(ctx, CGRectMake(0.0, 0.0, size.width, size.height));
103 | for (var x:CGFloat = 0.0; x < size.width; x+=1.0) {
104 | for (var y:CGFloat=0.0; y < size.height; y+=1.0) {
105 | let val = generator.perlinNoise(Float(x), y: Float(y), z: 0, t: 0)
106 | CGContextSetRGBFillColor(ctx, 1.0, 1.0, 1.0, CGFloat(abs(val)))
107 | CGContextFillRect(ctx, CGRectMake(x, y, 1.0, 1.0));
108 | }
109 | }
110 |
111 | let image = UIGraphicsGetImageFromCurrentImageContext()
112 | UIGraphicsEndImageContext()
113 | return image*/
114 | }
115 |
116 | override func viewDidLoad() {
117 | super.viewDidLoad()
118 |
119 | sizeXtext.delegate = self
120 | sizeYtext.delegate = self
121 |
122 | //strech to fit but maintain aspect ratio
123 | imageView.contentMode = UIViewContentMode.scaleAspectFit
124 |
125 | //use nearest neighbour, we want to see the pixels (not blur them)
126 | imageView.layer.magnificationFilter = kCAFilterNearest
127 | }
128 |
129 | override func viewDidLayoutSubviews() {
130 | if sizeXtext.text == "" {
131 | let size = self.imageView.bounds.size
132 | sizeXtext.text = "\(Int(size.width/5))"
133 | sizeYtext.text = "\(Int(size.height/5))"
134 | }
135 | }
136 |
137 | override func viewDidAppear(_ animated: Bool) {
138 | updateNoiseImage()
139 | }
140 |
141 | override func didReceiveMemoryWarning() {
142 | super.didReceiveMemoryWarning()
143 | // Dispose of any resources that can be recreated.
144 | }
145 |
146 | //
147 | // UITextFieldDelegate funcs
148 | //
149 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
150 | textField.resignFirstResponder()
151 | return true
152 | }
153 |
154 | func textFieldDidEndEditing(_ textField: UITextField) {
155 | updateNoiseImage()
156 | }
157 |
158 | //
159 | // drawing images from pixel data
160 | // http://blog.human-friendly.com/drawing-images-from-pixel-data-in-swift
161 | //
162 | struct PixelData {
163 | var a:UInt8 = 255
164 | var r:UInt8
165 | var g:UInt8
166 | var b:UInt8
167 | }
168 |
169 | fileprivate let rgbColorSpace = CGColorSpaceCreateDeviceRGB()
170 | fileprivate let bitmapInfo:CGBitmapInfo = CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedFirst.rawValue)
171 |
172 | func imageFromARGB32Bitmap(_ pixels:[PixelData], width:Int, height:Int)->UIImage {
173 | let bitsPerComponent:Int = 8
174 | let bitsPerPixel:Int = 32
175 |
176 | assert(pixels.count == Int(width * height))
177 |
178 | var data = pixels // Copy to mutable []
179 | let bdata = Data(bytes: &data, count: data.count * MemoryLayout.size)
180 |
181 | let providerRef = CGDataProvider(data: bdata as CFData)
182 |
183 | let cgim = CGImage(
184 | width: width,
185 | height: height,
186 | bitsPerComponent: bitsPerComponent,
187 | bitsPerPixel: bitsPerPixel,
188 | bytesPerRow: width * Int(MemoryLayout.size),
189 | space: rgbColorSpace,
190 | bitmapInfo: bitmapInfo,
191 | provider: providerRef!,
192 | decode: nil,
193 | shouldInterpolate: false,
194 | intent: CGColorRenderingIntent.defaultIntent
195 | )
196 | return UIImage(cgImage: cgim!)
197 | }
198 |
199 |
200 | }
201 |
202 |
--------------------------------------------------------------------------------
/Perlin-Swift/PerlinGenerator.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Port of a Perlin noise Objective-C implementation in Swift
3 | // Original source https://github.com/czgarrett/perlin-ios
4 | //
5 | // For references on the Perlin algorithm:
6 | // Each of these has a slightly different way of explaining Perlin noise. They were all useful:
7 | // Overviews of Perlin: http://paulbourke.net/texture_colour/perlin/ and http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
8 | // Awesome C++ tutorial on Perlin: http://www.dreamincode.net/forums/topic/66480-perlin-noise/
9 |
10 | // MIT License:
11 |
12 | // Perlin-Swift Copyright (c) 2015 Lachlan Hurst
13 | // Perlin-iOS Copyright (C) 2011 by Christopher Z. Garrett
14 |
15 | // Permission is hereby granted, free of charge, to any person obtaining a copy
16 | // of this software and associated documentation files (the "Software"), to deal
17 | // in the Software without restriction, including without limitation the rights
18 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 | // copies of the Software, and to permit persons to whom the Software is
20 | // furnished to do so, subject to the following conditions:
21 |
22 | // The above copyright notice and this permission notice shall be included in
23 | // all copies or substantial portions of the Software.
24 |
25 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
31 |
32 |
33 | import Foundation
34 |
35 | let PERMUTATION_SIZE = 256
36 |
37 |
38 | class PerlinGenerator {
39 |
40 | static let gradient:[[Int8]] = [
41 | [ 1, 1, 1, 0], [ 1, 1, 0, 1], [ 1, 0, 1, 1], [ 0, 1, 1, 1],
42 | [ 1, 1, -1, 0], [ 1, 1, 0, -1], [ 1, 0, 1, -1], [ 0, 1, 1, -1],
43 | [ 1, -1, 1, 0], [ 1, -1, 0, 1], [ 1, 0, -1, 1], [ 0, 1, -1, 1],
44 | [ 1, -1, -1, 0], [ 1, -1, 0, -1], [ 1, 0, -1, -1], [ 0, 1, -1, -1],
45 | [-1, 1, 1, 0], [-1, 1, 0, 1], [-1, 0, 1, 1], [ 0, -1, 1, 1],
46 | [-1, 1, -1, 0], [-1, 1, 0, -1], [-1, 0, 1, -1], [ 0, -1, 1, -1],
47 | [-1, -1, 1, 0], [-1, -1, 0, 1], [-1, 0, -1, 1], [ 0, -1, -1, 1],
48 | [-1, -1, -1, 0], [-1, -1, 0, -1], [-1, 0, -1, -1], [ 0, -1, -1, -1]
49 | ]
50 |
51 | var permut:[Int]
52 |
53 | var octaves:Int
54 | var persistence:Float
55 | var zoom:Float
56 |
57 | init(){
58 | permut = []
59 | for _ in 0 ..< PERMUTATION_SIZE {
60 | permut.append(Int(arc4random() & 0xff))
61 | }
62 | octaves = 1
63 | persistence = 1.0
64 | zoom = 1.0
65 | }
66 |
67 | func gradientAt(_ i:Int, j:Int, k:Int, l:Int) -> Int {
68 | return (permut[(l + permut[(k + permut[(j + permut[i & 0xff])
69 | & 0xff])
70 | & 0xff])
71 | & 0xff]
72 | & 0x1f)
73 | }
74 |
75 | func productOf(_ a:Float, b:Int8) -> Float {
76 | if b > 0 {
77 | return a
78 | }
79 | if b < 0 {
80 | return -a
81 | }
82 | return 0
83 | }
84 |
85 | func dotProductI(_ x0:Float, x1:Int8,
86 | y0:Float, y1:Int8,
87 | z0:Float, z1:Int8,
88 | t0:Float, t1:Int8) -> Float {
89 | return self.productOf(x0, b: x1) +
90 | self.productOf(y0, b: y1) +
91 | self.productOf(z0, b: z1) +
92 | self.productOf(t0, b: t1)
93 | }
94 |
95 | func spline(_ state:Float) -> Float{
96 | let square = state * state
97 | let cubic = square * state
98 | return cubic * (6 * square - 15 * state + 10)
99 | }
100 |
101 | func interpolate(_ a:Float, b:Float, x:Float) -> Float {
102 | return a + x*(b-a)
103 | }
104 |
105 | func smoothNoise(_ x:Float, y:Float, z:Float, t:Float) -> Float {
106 | let x0 = Int(x > 0 ? x : x - 1)
107 | let y0 = Int(y > 0 ? y : y - 1)
108 | let z0 = Int(z > 0 ? z : z - 1)
109 | let t0 = Int(t > 0 ? t : t - 1)
110 |
111 | let x1 = x0+1
112 | let y1 = y0+1
113 | let z1 = z0+1
114 | let t1 = t0+1
115 |
116 | // The vectors
117 | var dx0 = x-Float(x0)
118 | var dy0 = y-Float(y0)
119 | var dz0 = z-Float(z0)
120 | var dt0 = t-Float(t0)
121 | let dx1 = x-Float(x1)
122 | let dy1 = y-Float(y1)
123 | let dz1 = z-Float(z1)
124 | let dt1 = t-Float(t1)
125 |
126 | // The 16 gradient values
127 | var g0000 = PerlinGenerator.gradient[self.gradientAt(x0, j: y0, k: z0, l: t0)]
128 | var g0001 = PerlinGenerator.gradient[self.gradientAt(x0, j: y0, k: z0, l: t1)]
129 | var g0010 = PerlinGenerator.gradient[self.gradientAt(x0, j: y0, k: z1, l: t0)]
130 | var g0011 = PerlinGenerator.gradient[self.gradientAt(x0, j: y0, k: z1, l: t1)]
131 | var g0100 = PerlinGenerator.gradient[self.gradientAt(x0, j: y1, k: z0, l: t0)]
132 | var g0101 = PerlinGenerator.gradient[self.gradientAt(x0, j: y1, k: z0, l: t1)]
133 | var g0110 = PerlinGenerator.gradient[self.gradientAt(x0, j: y1, k: z1, l: t0)]
134 | var g0111 = PerlinGenerator.gradient[self.gradientAt(x0, j: y1, k: z1, l: t1)]
135 | var g1000 = PerlinGenerator.gradient[self.gradientAt(x1, j: y0, k: z0, l: t0)]
136 | var g1001 = PerlinGenerator.gradient[self.gradientAt(x1, j: y0, k: z0, l: t1)]
137 | var g1010 = PerlinGenerator.gradient[self.gradientAt(x1, j: y0, k: z1, l: t0)]
138 | var g1011 = PerlinGenerator.gradient[self.gradientAt(x1, j: y0, k: z1, l: t1)]
139 | var g1100 = PerlinGenerator.gradient[self.gradientAt(x1, j: y1, k: z0, l: t0)]
140 | var g1101 = PerlinGenerator.gradient[self.gradientAt(x1, j: y1, k: z0, l: t1)]
141 | var g1110 = PerlinGenerator.gradient[self.gradientAt(x1, j: y1, k: z1, l: t0)]
142 | var g1111 = PerlinGenerator.gradient[self.gradientAt(x1, j: y1, k: z1, l: t1)]
143 |
144 | // The 16 dot products
145 | let b0000 = self.dotProductI(dx0, x1: g0000[0], y0:dy0, y1:g0000[1], z0:dz0, z1:g0000[2], t0:dt0, t1:g0000[3])
146 | let b0001 = self.dotProductI(dx0, x1: g0001[0], y0:dy0, y1:g0001[1], z0:dz0, z1:g0001[2], t0:dt1, t1:g0001[3])
147 | let b0010 = self.dotProductI(dx0, x1: g0010[0], y0:dy0, y1:g0010[1], z0:dz1, z1:g0010[2], t0:dt0, t1:g0010[3])
148 | let b0011 = self.dotProductI(dx0, x1: g0011[0], y0:dy0, y1:g0011[1], z0:dz1, z1:g0011[2], t0:dt1, t1:g0011[3])
149 | let b0100 = self.dotProductI(dx0, x1: g0100[0], y0:dy1, y1:g0100[1], z0:dz0, z1:g0100[2], t0:dt0, t1:g0100[3])
150 | let b0101 = self.dotProductI(dx0, x1: g0101[0], y0:dy1, y1:g0101[1], z0:dz0, z1:g0101[2], t0:dt1, t1:g0101[3])
151 | let b0110 = self.dotProductI(dx0, x1: g0110[0], y0:dy1, y1:g0110[1], z0:dz1, z1:g0110[2], t0:dt0, t1:g0110[3])
152 | let b0111 = self.dotProductI(dx0, x1: g0111[0], y0:dy1, y1:g0111[1], z0:dz1, z1:g0111[2], t0:dt1, t1:g0111[3])
153 | let b1000 = self.dotProductI(dx1, x1: g1000[0], y0:dy0, y1:g1000[1], z0:dz0, z1:g1000[2], t0:dt0, t1:g1000[3])
154 | let b1001 = self.dotProductI(dx1, x1: g1001[0], y0:dy0, y1:g1001[1], z0:dz0, z1:g1001[2], t0:dt1, t1:g1001[3])
155 | let b1010 = self.dotProductI(dx1, x1: g1010[0], y0:dy0, y1:g1010[1], z0:dz1, z1:g1010[2], t0:dt0, t1:g1010[3])
156 | let b1011 = self.dotProductI(dx1, x1: g1011[0], y0:dy0, y1:g1011[1], z0:dz1, z1:g1011[2], t0:dt1, t1:g1011[3])
157 | let b1100 = self.dotProductI(dx1, x1: g1100[0], y0:dy1, y1:g1100[1], z0:dz0, z1:g1100[2], t0:dt0, t1:g1100[3])
158 | let b1101 = self.dotProductI(dx1, x1: g1101[0], y0:dy1, y1:g1101[1], z0:dz0, z1:g1101[2], t0:dt1, t1:g1101[3])
159 | let b1110 = self.dotProductI(dx1, x1: g1110[0], y0:dy1, y1:g1110[1], z0:dz1, z1:g1110[2], t0:dt0, t1:g1110[3])
160 | let b1111 = self.dotProductI(dx1, x1: g1111[0], y0:dy1, y1:g1111[1], z0:dz1, z1:g1111[2], t0:dt1, t1:g1111[3])
161 |
162 | dx0 = self.spline(dx0)
163 | dy0 = self.spline(dy0)
164 | dz0 = self.spline(dz0)
165 | dt0 = self.spline(dt0)
166 |
167 | let b111 = self.interpolate(b1110, b:b1111, x:dt0)
168 | let b110 = self.interpolate(b1100, b:b1101, x:dt0)
169 | let b101 = self.interpolate(b1010, b:b1011, x:dt0)
170 | let b100 = self.interpolate(b1000, b:b1001, x:dt0)
171 | let b011 = self.interpolate(b0110, b:b0111, x:dt0)
172 | let b010 = self.interpolate(b0100, b:b0101, x:dt0)
173 | let b001 = self.interpolate(b0010, b:b0011, x:dt0)
174 | let b000 = self.interpolate(b0000, b:b0001, x:dt0)
175 |
176 | let b11 = self.interpolate(b110, b:b111, x:dz0)
177 | let b10 = self.interpolate(b100, b:b101, x:dz0)
178 | let b01 = self.interpolate(b010, b:b011, x:dz0)
179 | let b00 = self.interpolate(b000, b:b001, x:dz0)
180 |
181 | let b1 = self.interpolate(b10, b:b11, x:dy0)
182 | let b0 = self.interpolate(b00, b:b01, x:dy0)
183 |
184 | let result = self.interpolate(b0, b:b1, x:dx0)
185 |
186 | return result;
187 | }
188 |
189 | func perlinNoise(_ x:Float, y:Float, z:Float, t:Float) -> Float{
190 |
191 | var noise:Float = 0.0
192 | for octave in 0 ..< self.octaves {
193 | let frequency:Float = powf(2,Float(octave))
194 | let amplitude = powf(self.persistence, Float(octave))
195 |
196 | noise += self.smoothNoise(x * frequency/zoom,
197 | y: y * frequency/zoom,
198 | z: z * frequency/zoom,
199 | t: t * frequency/zoom) * amplitude
200 | }
201 | return noise
202 | }
203 | }
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
--------------------------------------------------------------------------------
/Perlin-Swift/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
32 |
39 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
104 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
--------------------------------------------------------------------------------
/Perlin-Swift.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 733D7DBE1B8B536D00CBE0E2 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 733D7DBD1B8B536C00CBE0E2 /* QuartzCore.framework */; };
11 | 73BB3E151B8B10AF0075074C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BB3E141B8B10AF0075074C /* AppDelegate.swift */; };
12 | 73BB3E171B8B10AF0075074C /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BB3E161B8B10AF0075074C /* ViewController.swift */; };
13 | 73BB3E1A1B8B10AF0075074C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73BB3E181B8B10AF0075074C /* Main.storyboard */; };
14 | 73BB3E1C1B8B10AF0075074C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 73BB3E1B1B8B10AF0075074C /* Images.xcassets */; };
15 | 73BB3E1F1B8B10AF0075074C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 73BB3E1D1B8B10AF0075074C /* LaunchScreen.xib */; };
16 | 73BB3E2B1B8B10AF0075074C /* Perlin_SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BB3E2A1B8B10AF0075074C /* Perlin_SwiftTests.swift */; };
17 | 73BB3E351B8B10F90075074C /* PerlinGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BB3E341B8B10F90075074C /* PerlinGenerator.swift */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | 73BB3E251B8B10AF0075074C /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = 73BB3E071B8B10AE0075074C /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = 73BB3E0E1B8B10AF0075074C;
26 | remoteInfo = "Perlin-Swift";
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 733D7DBD1B8B536C00CBE0E2 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
32 | 73BB3E0F1B8B10AF0075074C /* Perlin-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Perlin-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 73BB3E131B8B10AF0075074C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
34 | 73BB3E141B8B10AF0075074C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
35 | 73BB3E161B8B10AF0075074C /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
36 | 73BB3E191B8B10AF0075074C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
37 | 73BB3E1B1B8B10AF0075074C /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
38 | 73BB3E1E1B8B10AF0075074C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
39 | 73BB3E241B8B10AF0075074C /* Perlin-SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Perlin-SwiftTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
40 | 73BB3E291B8B10AF0075074C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
41 | 73BB3E2A1B8B10AF0075074C /* Perlin_SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Perlin_SwiftTests.swift; sourceTree = ""; };
42 | 73BB3E341B8B10F90075074C /* PerlinGenerator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerlinGenerator.swift; sourceTree = ""; };
43 | /* End PBXFileReference section */
44 |
45 | /* Begin PBXFrameworksBuildPhase section */
46 | 73BB3E0C1B8B10AF0075074C /* Frameworks */ = {
47 | isa = PBXFrameworksBuildPhase;
48 | buildActionMask = 2147483647;
49 | files = (
50 | 733D7DBE1B8B536D00CBE0E2 /* QuartzCore.framework in Frameworks */,
51 | );
52 | runOnlyForDeploymentPostprocessing = 0;
53 | };
54 | 73BB3E211B8B10AF0075074C /* Frameworks */ = {
55 | isa = PBXFrameworksBuildPhase;
56 | buildActionMask = 2147483647;
57 | files = (
58 | );
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | /* End PBXFrameworksBuildPhase section */
62 |
63 | /* Begin PBXGroup section */
64 | 73BB3E061B8B10AE0075074C = {
65 | isa = PBXGroup;
66 | children = (
67 | 733D7DBD1B8B536C00CBE0E2 /* QuartzCore.framework */,
68 | 73BB3E111B8B10AF0075074C /* Perlin-Swift */,
69 | 73BB3E271B8B10AF0075074C /* Perlin-SwiftTests */,
70 | 73BB3E101B8B10AF0075074C /* Products */,
71 | );
72 | sourceTree = "";
73 | };
74 | 73BB3E101B8B10AF0075074C /* Products */ = {
75 | isa = PBXGroup;
76 | children = (
77 | 73BB3E0F1B8B10AF0075074C /* Perlin-Swift.app */,
78 | 73BB3E241B8B10AF0075074C /* Perlin-SwiftTests.xctest */,
79 | );
80 | name = Products;
81 | sourceTree = "";
82 | };
83 | 73BB3E111B8B10AF0075074C /* Perlin-Swift */ = {
84 | isa = PBXGroup;
85 | children = (
86 | 73BB3E141B8B10AF0075074C /* AppDelegate.swift */,
87 | 73BB3E161B8B10AF0075074C /* ViewController.swift */,
88 | 73BB3E181B8B10AF0075074C /* Main.storyboard */,
89 | 73BB3E1B1B8B10AF0075074C /* Images.xcassets */,
90 | 73BB3E1D1B8B10AF0075074C /* LaunchScreen.xib */,
91 | 73BB3E121B8B10AF0075074C /* Supporting Files */,
92 | 73BB3E341B8B10F90075074C /* PerlinGenerator.swift */,
93 | );
94 | path = "Perlin-Swift";
95 | sourceTree = "";
96 | };
97 | 73BB3E121B8B10AF0075074C /* Supporting Files */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 73BB3E131B8B10AF0075074C /* Info.plist */,
101 | );
102 | name = "Supporting Files";
103 | sourceTree = "";
104 | };
105 | 73BB3E271B8B10AF0075074C /* Perlin-SwiftTests */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 73BB3E2A1B8B10AF0075074C /* Perlin_SwiftTests.swift */,
109 | 73BB3E281B8B10AF0075074C /* Supporting Files */,
110 | );
111 | path = "Perlin-SwiftTests";
112 | sourceTree = "";
113 | };
114 | 73BB3E281B8B10AF0075074C /* Supporting Files */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 73BB3E291B8B10AF0075074C /* Info.plist */,
118 | );
119 | name = "Supporting Files";
120 | sourceTree = "";
121 | };
122 | /* End PBXGroup section */
123 |
124 | /* Begin PBXNativeTarget section */
125 | 73BB3E0E1B8B10AF0075074C /* Perlin-Swift */ = {
126 | isa = PBXNativeTarget;
127 | buildConfigurationList = 73BB3E2E1B8B10AF0075074C /* Build configuration list for PBXNativeTarget "Perlin-Swift" */;
128 | buildPhases = (
129 | 73BB3E0B1B8B10AF0075074C /* Sources */,
130 | 73BB3E0C1B8B10AF0075074C /* Frameworks */,
131 | 73BB3E0D1B8B10AF0075074C /* Resources */,
132 | );
133 | buildRules = (
134 | );
135 | dependencies = (
136 | );
137 | name = "Perlin-Swift";
138 | productName = "Perlin-Swift";
139 | productReference = 73BB3E0F1B8B10AF0075074C /* Perlin-Swift.app */;
140 | productType = "com.apple.product-type.application";
141 | };
142 | 73BB3E231B8B10AF0075074C /* Perlin-SwiftTests */ = {
143 | isa = PBXNativeTarget;
144 | buildConfigurationList = 73BB3E311B8B10AF0075074C /* Build configuration list for PBXNativeTarget "Perlin-SwiftTests" */;
145 | buildPhases = (
146 | 73BB3E201B8B10AF0075074C /* Sources */,
147 | 73BB3E211B8B10AF0075074C /* Frameworks */,
148 | 73BB3E221B8B10AF0075074C /* Resources */,
149 | );
150 | buildRules = (
151 | );
152 | dependencies = (
153 | 73BB3E261B8B10AF0075074C /* PBXTargetDependency */,
154 | );
155 | name = "Perlin-SwiftTests";
156 | productName = "Perlin-SwiftTests";
157 | productReference = 73BB3E241B8B10AF0075074C /* Perlin-SwiftTests.xctest */;
158 | productType = "com.apple.product-type.bundle.unit-test";
159 | };
160 | /* End PBXNativeTarget section */
161 |
162 | /* Begin PBXProject section */
163 | 73BB3E071B8B10AE0075074C /* Project object */ = {
164 | isa = PBXProject;
165 | attributes = {
166 | LastSwiftMigration = 0700;
167 | LastSwiftUpdateCheck = 0700;
168 | LastUpgradeCheck = 0820;
169 | ORGANIZATIONNAME = "Lachlan Hurst";
170 | TargetAttributes = {
171 | 73BB3E0E1B8B10AF0075074C = {
172 | CreatedOnToolsVersion = 6.4;
173 | DevelopmentTeam = 4F7DKRYKP6;
174 | LastSwiftMigration = 0820;
175 | };
176 | 73BB3E231B8B10AF0075074C = {
177 | CreatedOnToolsVersion = 6.4;
178 | DevelopmentTeam = 4F7DKRYKP6;
179 | LastSwiftMigration = 0820;
180 | TestTargetID = 73BB3E0E1B8B10AF0075074C;
181 | };
182 | };
183 | };
184 | buildConfigurationList = 73BB3E0A1B8B10AE0075074C /* Build configuration list for PBXProject "Perlin-Swift" */;
185 | compatibilityVersion = "Xcode 3.2";
186 | developmentRegion = English;
187 | hasScannedForEncodings = 0;
188 | knownRegions = (
189 | en,
190 | Base,
191 | );
192 | mainGroup = 73BB3E061B8B10AE0075074C;
193 | productRefGroup = 73BB3E101B8B10AF0075074C /* Products */;
194 | projectDirPath = "";
195 | projectRoot = "";
196 | targets = (
197 | 73BB3E0E1B8B10AF0075074C /* Perlin-Swift */,
198 | 73BB3E231B8B10AF0075074C /* Perlin-SwiftTests */,
199 | );
200 | };
201 | /* End PBXProject section */
202 |
203 | /* Begin PBXResourcesBuildPhase section */
204 | 73BB3E0D1B8B10AF0075074C /* Resources */ = {
205 | isa = PBXResourcesBuildPhase;
206 | buildActionMask = 2147483647;
207 | files = (
208 | 73BB3E1A1B8B10AF0075074C /* Main.storyboard in Resources */,
209 | 73BB3E1F1B8B10AF0075074C /* LaunchScreen.xib in Resources */,
210 | 73BB3E1C1B8B10AF0075074C /* Images.xcassets in Resources */,
211 | );
212 | runOnlyForDeploymentPostprocessing = 0;
213 | };
214 | 73BB3E221B8B10AF0075074C /* Resources */ = {
215 | isa = PBXResourcesBuildPhase;
216 | buildActionMask = 2147483647;
217 | files = (
218 | );
219 | runOnlyForDeploymentPostprocessing = 0;
220 | };
221 | /* End PBXResourcesBuildPhase section */
222 |
223 | /* Begin PBXSourcesBuildPhase section */
224 | 73BB3E0B1B8B10AF0075074C /* Sources */ = {
225 | isa = PBXSourcesBuildPhase;
226 | buildActionMask = 2147483647;
227 | files = (
228 | 73BB3E351B8B10F90075074C /* PerlinGenerator.swift in Sources */,
229 | 73BB3E171B8B10AF0075074C /* ViewController.swift in Sources */,
230 | 73BB3E151B8B10AF0075074C /* AppDelegate.swift in Sources */,
231 | );
232 | runOnlyForDeploymentPostprocessing = 0;
233 | };
234 | 73BB3E201B8B10AF0075074C /* Sources */ = {
235 | isa = PBXSourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | 73BB3E2B1B8B10AF0075074C /* Perlin_SwiftTests.swift in Sources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXSourcesBuildPhase section */
243 |
244 | /* Begin PBXTargetDependency section */
245 | 73BB3E261B8B10AF0075074C /* PBXTargetDependency */ = {
246 | isa = PBXTargetDependency;
247 | target = 73BB3E0E1B8B10AF0075074C /* Perlin-Swift */;
248 | targetProxy = 73BB3E251B8B10AF0075074C /* PBXContainerItemProxy */;
249 | };
250 | /* End PBXTargetDependency section */
251 |
252 | /* Begin PBXVariantGroup section */
253 | 73BB3E181B8B10AF0075074C /* Main.storyboard */ = {
254 | isa = PBXVariantGroup;
255 | children = (
256 | 73BB3E191B8B10AF0075074C /* Base */,
257 | );
258 | name = Main.storyboard;
259 | sourceTree = "";
260 | };
261 | 73BB3E1D1B8B10AF0075074C /* LaunchScreen.xib */ = {
262 | isa = PBXVariantGroup;
263 | children = (
264 | 73BB3E1E1B8B10AF0075074C /* Base */,
265 | );
266 | name = LaunchScreen.xib;
267 | sourceTree = "";
268 | };
269 | /* End PBXVariantGroup section */
270 |
271 | /* Begin XCBuildConfiguration section */
272 | 73BB3E2C1B8B10AF0075074C /* Debug */ = {
273 | isa = XCBuildConfiguration;
274 | buildSettings = {
275 | ALWAYS_SEARCH_USER_PATHS = NO;
276 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
277 | CLANG_CXX_LIBRARY = "libc++";
278 | CLANG_ENABLE_MODULES = YES;
279 | CLANG_ENABLE_OBJC_ARC = YES;
280 | CLANG_WARN_BOOL_CONVERSION = YES;
281 | CLANG_WARN_CONSTANT_CONVERSION = YES;
282 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
283 | CLANG_WARN_EMPTY_BODY = YES;
284 | CLANG_WARN_ENUM_CONVERSION = YES;
285 | CLANG_WARN_INFINITE_RECURSION = YES;
286 | CLANG_WARN_INT_CONVERSION = YES;
287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
288 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
289 | CLANG_WARN_UNREACHABLE_CODE = YES;
290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
292 | COPY_PHASE_STRIP = NO;
293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
294 | ENABLE_STRICT_OBJC_MSGSEND = YES;
295 | ENABLE_TESTABILITY = YES;
296 | GCC_C_LANGUAGE_STANDARD = gnu99;
297 | GCC_DYNAMIC_NO_PIC = NO;
298 | GCC_NO_COMMON_BLOCKS = YES;
299 | GCC_OPTIMIZATION_LEVEL = 0;
300 | GCC_PREPROCESSOR_DEFINITIONS = (
301 | "DEBUG=1",
302 | "$(inherited)",
303 | );
304 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
305 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
306 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
307 | GCC_WARN_UNDECLARED_SELECTOR = YES;
308 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
309 | GCC_WARN_UNUSED_FUNCTION = YES;
310 | GCC_WARN_UNUSED_VARIABLE = YES;
311 | IPHONEOS_DEPLOYMENT_TARGET = 8.4;
312 | MTL_ENABLE_DEBUG_INFO = YES;
313 | ONLY_ACTIVE_ARCH = YES;
314 | SDKROOT = iphoneos;
315 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
316 | TARGETED_DEVICE_FAMILY = "1,2";
317 | };
318 | name = Debug;
319 | };
320 | 73BB3E2D1B8B10AF0075074C /* Release */ = {
321 | isa = XCBuildConfiguration;
322 | buildSettings = {
323 | ALWAYS_SEARCH_USER_PATHS = NO;
324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
325 | CLANG_CXX_LIBRARY = "libc++";
326 | CLANG_ENABLE_MODULES = YES;
327 | CLANG_ENABLE_OBJC_ARC = YES;
328 | CLANG_WARN_BOOL_CONVERSION = YES;
329 | CLANG_WARN_CONSTANT_CONVERSION = YES;
330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
331 | CLANG_WARN_EMPTY_BODY = YES;
332 | CLANG_WARN_ENUM_CONVERSION = YES;
333 | CLANG_WARN_INFINITE_RECURSION = YES;
334 | CLANG_WARN_INT_CONVERSION = YES;
335 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
336 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
337 | CLANG_WARN_UNREACHABLE_CODE = YES;
338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
340 | COPY_PHASE_STRIP = NO;
341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
342 | ENABLE_NS_ASSERTIONS = NO;
343 | ENABLE_STRICT_OBJC_MSGSEND = YES;
344 | GCC_C_LANGUAGE_STANDARD = gnu99;
345 | GCC_NO_COMMON_BLOCKS = YES;
346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348 | GCC_WARN_UNDECLARED_SELECTOR = YES;
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350 | GCC_WARN_UNUSED_FUNCTION = YES;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | IPHONEOS_DEPLOYMENT_TARGET = 8.4;
353 | MTL_ENABLE_DEBUG_INFO = NO;
354 | SDKROOT = iphoneos;
355 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
356 | TARGETED_DEVICE_FAMILY = "1,2";
357 | VALIDATE_PRODUCT = YES;
358 | };
359 | name = Release;
360 | };
361 | 73BB3E2F1B8B10AF0075074C /* Debug */ = {
362 | isa = XCBuildConfiguration;
363 | buildSettings = {
364 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
365 | DEVELOPMENT_TEAM = 4F7DKRYKP6;
366 | INFOPLIST_FILE = "Perlin-Swift/Info.plist";
367 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
368 | PRODUCT_BUNDLE_IDENTIFIER = "com.lachlanhurst.$(PRODUCT_NAME:rfc1034identifier)";
369 | PRODUCT_NAME = "$(TARGET_NAME)";
370 | SWIFT_VERSION = 3.0;
371 | };
372 | name = Debug;
373 | };
374 | 73BB3E301B8B10AF0075074C /* Release */ = {
375 | isa = XCBuildConfiguration;
376 | buildSettings = {
377 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
378 | DEVELOPMENT_TEAM = 4F7DKRYKP6;
379 | INFOPLIST_FILE = "Perlin-Swift/Info.plist";
380 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
381 | PRODUCT_BUNDLE_IDENTIFIER = "com.lachlanhurst.$(PRODUCT_NAME:rfc1034identifier)";
382 | PRODUCT_NAME = "$(TARGET_NAME)";
383 | SWIFT_VERSION = 3.0;
384 | };
385 | name = Release;
386 | };
387 | 73BB3E321B8B10AF0075074C /* Debug */ = {
388 | isa = XCBuildConfiguration;
389 | buildSettings = {
390 | BUNDLE_LOADER = "$(TEST_HOST)";
391 | DEVELOPMENT_TEAM = 4F7DKRYKP6;
392 | FRAMEWORK_SEARCH_PATHS = (
393 | "$(SDKROOT)/Developer/Library/Frameworks",
394 | "$(inherited)",
395 | );
396 | GCC_PREPROCESSOR_DEFINITIONS = (
397 | "DEBUG=1",
398 | "$(inherited)",
399 | );
400 | INFOPLIST_FILE = "Perlin-SwiftTests/Info.plist";
401 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
402 | PRODUCT_BUNDLE_IDENTIFIER = "com.lachlanhurst.$(PRODUCT_NAME:rfc1034identifier)";
403 | PRODUCT_NAME = "$(TARGET_NAME)";
404 | SWIFT_VERSION = 3.0;
405 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Perlin-Swift.app/Perlin-Swift";
406 | };
407 | name = Debug;
408 | };
409 | 73BB3E331B8B10AF0075074C /* Release */ = {
410 | isa = XCBuildConfiguration;
411 | buildSettings = {
412 | BUNDLE_LOADER = "$(TEST_HOST)";
413 | DEVELOPMENT_TEAM = 4F7DKRYKP6;
414 | FRAMEWORK_SEARCH_PATHS = (
415 | "$(SDKROOT)/Developer/Library/Frameworks",
416 | "$(inherited)",
417 | );
418 | INFOPLIST_FILE = "Perlin-SwiftTests/Info.plist";
419 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
420 | PRODUCT_BUNDLE_IDENTIFIER = "com.lachlanhurst.$(PRODUCT_NAME:rfc1034identifier)";
421 | PRODUCT_NAME = "$(TARGET_NAME)";
422 | SWIFT_VERSION = 3.0;
423 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Perlin-Swift.app/Perlin-Swift";
424 | };
425 | name = Release;
426 | };
427 | /* End XCBuildConfiguration section */
428 |
429 | /* Begin XCConfigurationList section */
430 | 73BB3E0A1B8B10AE0075074C /* Build configuration list for PBXProject "Perlin-Swift" */ = {
431 | isa = XCConfigurationList;
432 | buildConfigurations = (
433 | 73BB3E2C1B8B10AF0075074C /* Debug */,
434 | 73BB3E2D1B8B10AF0075074C /* Release */,
435 | );
436 | defaultConfigurationIsVisible = 0;
437 | defaultConfigurationName = Release;
438 | };
439 | 73BB3E2E1B8B10AF0075074C /* Build configuration list for PBXNativeTarget "Perlin-Swift" */ = {
440 | isa = XCConfigurationList;
441 | buildConfigurations = (
442 | 73BB3E2F1B8B10AF0075074C /* Debug */,
443 | 73BB3E301B8B10AF0075074C /* Release */,
444 | );
445 | defaultConfigurationIsVisible = 0;
446 | defaultConfigurationName = Release;
447 | };
448 | 73BB3E311B8B10AF0075074C /* Build configuration list for PBXNativeTarget "Perlin-SwiftTests" */ = {
449 | isa = XCConfigurationList;
450 | buildConfigurations = (
451 | 73BB3E321B8B10AF0075074C /* Debug */,
452 | 73BB3E331B8B10AF0075074C /* Release */,
453 | );
454 | defaultConfigurationIsVisible = 0;
455 | defaultConfigurationName = Release;
456 | };
457 | /* End XCConfigurationList section */
458 | };
459 | rootObject = 73BB3E071B8B10AE0075074C /* Project object */;
460 | }
461 |
--------------------------------------------------------------------------------