├── .gitignore
├── README.md
├── VR-iOS-Experiment.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── VR-iOS-Experiment
├── AppDelegate.swift
├── Base.lproj
│ ├── LaunchScreen.xib
│ └── Main.storyboard
├── FireParticles.scnp
├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── ViewController.swift
├── checkerboard_pattern.png
└── spark.png
├── VR-iOS-ExperimentTests
├── Info.plist
└── VR_iOS_ExperimentTests.swift
└── screenshot.png
/.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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # VR-iOS-Experiment
2 |
3 | A simple Virtual Reality proof-of-concept app written in Swift for iOS 8.
4 | SceneKit is used to generate a scene containing a bouncing
5 | [Boing Ball](https://en.wikipedia.org/wiki/Amiga) with a flame particle
6 | effect. Two `SCNView` views are used to create a stereoscopic view of the
7 | scene. Core Motion is used to track the user's head movements as they look
8 | around.
9 |
10 | 
11 |
12 | You'll need some kind of head-mount (maybe
13 | [Google Cardboard](http://en.wikipedia.org/wiki/Google_Cardboard) or
14 | a [Stooksy VR-Spektiv](http://www.stooksy.com/)?)
15 | or a pair of [loupes](https://en.wikipedia.org/wiki/Loupe), and, obviously,
16 | an [iPhone](https://www.apple.com/iphone-6/).
17 |
18 | ### License
19 |
20 | **VR-iOS-Experiment Copyright © 2014 Steven Saunders**
21 |
22 | ```
23 | This program is free software: you can redistribute it and/or modify
24 | it under the terms of the GNU General Public License as published by
25 | the Free Software Foundation, either version 3 of the License, or
26 | (at your option) any later version.
27 |
28 | This program is distributed in the hope that it will be useful,
29 | but WITHOUT ANY WARRANTY; without even the implied warranty of
30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31 | GNU General Public License for more details.
32 |
33 | You should have received a copy of the GNU General Public License
34 | along with this program. If not, see .
35 | ```
36 |
37 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 05ADC3C419DA200700B0EC7A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05ADC3C319DA200700B0EC7A /* AppDelegate.swift */; };
11 | 05ADC3C619DA200700B0EC7A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05ADC3C519DA200700B0EC7A /* ViewController.swift */; };
12 | 05ADC3C919DA200700B0EC7A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 05ADC3C719DA200700B0EC7A /* Main.storyboard */; };
13 | 05ADC3CB19DA200700B0EC7A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 05ADC3CA19DA200700B0EC7A /* Images.xcassets */; };
14 | 05ADC3CE19DA200700B0EC7A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 05ADC3CC19DA200700B0EC7A /* LaunchScreen.xib */; };
15 | 05ADC3DA19DA200700B0EC7A /* VR_iOS_ExperimentTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05ADC3D919DA200700B0EC7A /* VR_iOS_ExperimentTests.swift */; };
16 | 05ADC3E619DA20B000B0EC7A /* SceneKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05ADC3E519DA20B000B0EC7A /* SceneKit.framework */; };
17 | 05ADC3E819DA20B700B0EC7A /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05ADC3E719DA20B700B0EC7A /* CoreMotion.framework */; };
18 | 05ADC3EB19DA21CB00B0EC7A /* FireParticles.scnp in Resources */ = {isa = PBXBuildFile; fileRef = 05ADC3E919DA21CB00B0EC7A /* FireParticles.scnp */; };
19 | 05ADC3EC19DA21CB00B0EC7A /* spark.png in Resources */ = {isa = PBXBuildFile; fileRef = 05ADC3EA19DA21CB00B0EC7A /* spark.png */; };
20 | 05ADC3EE19DA25A600B0EC7A /* checkerboard_pattern.png in Resources */ = {isa = PBXBuildFile; fileRef = 05ADC3ED19DA25A600B0EC7A /* checkerboard_pattern.png */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXContainerItemProxy section */
24 | 05ADC3D419DA200700B0EC7A /* PBXContainerItemProxy */ = {
25 | isa = PBXContainerItemProxy;
26 | containerPortal = 05ADC3B619DA200700B0EC7A /* Project object */;
27 | proxyType = 1;
28 | remoteGlobalIDString = 05ADC3BD19DA200700B0EC7A;
29 | remoteInfo = "VR-iOS-Experiment";
30 | };
31 | /* End PBXContainerItemProxy section */
32 |
33 | /* Begin PBXFileReference section */
34 | 05ADC3BE19DA200700B0EC7A /* VR-iOS-Experiment.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "VR-iOS-Experiment.app"; sourceTree = BUILT_PRODUCTS_DIR; };
35 | 05ADC3C219DA200700B0EC7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
36 | 05ADC3C319DA200700B0EC7A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
37 | 05ADC3C519DA200700B0EC7A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
38 | 05ADC3C819DA200700B0EC7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
39 | 05ADC3CA19DA200700B0EC7A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
40 | 05ADC3CD19DA200700B0EC7A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
41 | 05ADC3D319DA200700B0EC7A /* VR-iOS-ExperimentTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "VR-iOS-ExperimentTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
42 | 05ADC3D819DA200700B0EC7A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
43 | 05ADC3D919DA200700B0EC7A /* VR_iOS_ExperimentTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VR_iOS_ExperimentTests.swift; sourceTree = ""; };
44 | 05ADC3E519DA20B000B0EC7A /* SceneKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SceneKit.framework; path = System/Library/Frameworks/SceneKit.framework; sourceTree = SDKROOT; };
45 | 05ADC3E719DA20B700B0EC7A /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
46 | 05ADC3E919DA21CB00B0EC7A /* FireParticles.scnp */ = {isa = PBXFileReference; lastKnownFileType = file.scp; path = FireParticles.scnp; sourceTree = ""; };
47 | 05ADC3EA19DA21CB00B0EC7A /* spark.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = spark.png; sourceTree = ""; };
48 | 05ADC3ED19DA25A600B0EC7A /* checkerboard_pattern.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = checkerboard_pattern.png; sourceTree = ""; };
49 | /* End PBXFileReference section */
50 |
51 | /* Begin PBXFrameworksBuildPhase section */
52 | 05ADC3BB19DA200700B0EC7A /* Frameworks */ = {
53 | isa = PBXFrameworksBuildPhase;
54 | buildActionMask = 2147483647;
55 | files = (
56 | 05ADC3E819DA20B700B0EC7A /* CoreMotion.framework in Frameworks */,
57 | 05ADC3E619DA20B000B0EC7A /* SceneKit.framework in Frameworks */,
58 | );
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | 05ADC3D019DA200700B0EC7A /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | );
66 | runOnlyForDeploymentPostprocessing = 0;
67 | };
68 | /* End PBXFrameworksBuildPhase section */
69 |
70 | /* Begin PBXGroup section */
71 | 05ADC3B519DA200700B0EC7A = {
72 | isa = PBXGroup;
73 | children = (
74 | 05ADC3E719DA20B700B0EC7A /* CoreMotion.framework */,
75 | 05ADC3E519DA20B000B0EC7A /* SceneKit.framework */,
76 | 05ADC3C019DA200700B0EC7A /* VR-iOS-Experiment */,
77 | 05ADC3D619DA200700B0EC7A /* VR-iOS-ExperimentTests */,
78 | 05ADC3BF19DA200700B0EC7A /* Products */,
79 | );
80 | sourceTree = "";
81 | };
82 | 05ADC3BF19DA200700B0EC7A /* Products */ = {
83 | isa = PBXGroup;
84 | children = (
85 | 05ADC3BE19DA200700B0EC7A /* VR-iOS-Experiment.app */,
86 | 05ADC3D319DA200700B0EC7A /* VR-iOS-ExperimentTests.xctest */,
87 | );
88 | name = Products;
89 | sourceTree = "";
90 | };
91 | 05ADC3C019DA200700B0EC7A /* VR-iOS-Experiment */ = {
92 | isa = PBXGroup;
93 | children = (
94 | 05ADC3ED19DA25A600B0EC7A /* checkerboard_pattern.png */,
95 | 05ADC3C319DA200700B0EC7A /* AppDelegate.swift */,
96 | 05ADC3C519DA200700B0EC7A /* ViewController.swift */,
97 | 05ADC3C719DA200700B0EC7A /* Main.storyboard */,
98 | 05ADC3CA19DA200700B0EC7A /* Images.xcassets */,
99 | 05ADC3CC19DA200700B0EC7A /* LaunchScreen.xib */,
100 | 05ADC3C119DA200700B0EC7A /* Supporting Files */,
101 | 05ADC3E919DA21CB00B0EC7A /* FireParticles.scnp */,
102 | 05ADC3EA19DA21CB00B0EC7A /* spark.png */,
103 | );
104 | path = "VR-iOS-Experiment";
105 | sourceTree = "";
106 | };
107 | 05ADC3C119DA200700B0EC7A /* Supporting Files */ = {
108 | isa = PBXGroup;
109 | children = (
110 | 05ADC3C219DA200700B0EC7A /* Info.plist */,
111 | );
112 | name = "Supporting Files";
113 | sourceTree = "";
114 | };
115 | 05ADC3D619DA200700B0EC7A /* VR-iOS-ExperimentTests */ = {
116 | isa = PBXGroup;
117 | children = (
118 | 05ADC3D919DA200700B0EC7A /* VR_iOS_ExperimentTests.swift */,
119 | 05ADC3D719DA200700B0EC7A /* Supporting Files */,
120 | );
121 | path = "VR-iOS-ExperimentTests";
122 | sourceTree = "";
123 | };
124 | 05ADC3D719DA200700B0EC7A /* Supporting Files */ = {
125 | isa = PBXGroup;
126 | children = (
127 | 05ADC3D819DA200700B0EC7A /* Info.plist */,
128 | );
129 | name = "Supporting Files";
130 | sourceTree = "";
131 | };
132 | /* End PBXGroup section */
133 |
134 | /* Begin PBXNativeTarget section */
135 | 05ADC3BD19DA200700B0EC7A /* VR-iOS-Experiment */ = {
136 | isa = PBXNativeTarget;
137 | buildConfigurationList = 05ADC3DD19DA200700B0EC7A /* Build configuration list for PBXNativeTarget "VR-iOS-Experiment" */;
138 | buildPhases = (
139 | 05ADC3BA19DA200700B0EC7A /* Sources */,
140 | 05ADC3BB19DA200700B0EC7A /* Frameworks */,
141 | 05ADC3BC19DA200700B0EC7A /* Resources */,
142 | );
143 | buildRules = (
144 | );
145 | dependencies = (
146 | );
147 | name = "VR-iOS-Experiment";
148 | productName = "VR-iOS-Experiment";
149 | productReference = 05ADC3BE19DA200700B0EC7A /* VR-iOS-Experiment.app */;
150 | productType = "com.apple.product-type.application";
151 | };
152 | 05ADC3D219DA200700B0EC7A /* VR-iOS-ExperimentTests */ = {
153 | isa = PBXNativeTarget;
154 | buildConfigurationList = 05ADC3E019DA200700B0EC7A /* Build configuration list for PBXNativeTarget "VR-iOS-ExperimentTests" */;
155 | buildPhases = (
156 | 05ADC3CF19DA200700B0EC7A /* Sources */,
157 | 05ADC3D019DA200700B0EC7A /* Frameworks */,
158 | 05ADC3D119DA200700B0EC7A /* Resources */,
159 | );
160 | buildRules = (
161 | );
162 | dependencies = (
163 | 05ADC3D519DA200700B0EC7A /* PBXTargetDependency */,
164 | );
165 | name = "VR-iOS-ExperimentTests";
166 | productName = "VR-iOS-ExperimentTests";
167 | productReference = 05ADC3D319DA200700B0EC7A /* VR-iOS-ExperimentTests.xctest */;
168 | productType = "com.apple.product-type.bundle.unit-test";
169 | };
170 | /* End PBXNativeTarget section */
171 |
172 | /* Begin PBXProject section */
173 | 05ADC3B619DA200700B0EC7A /* Project object */ = {
174 | isa = PBXProject;
175 | attributes = {
176 | LastUpgradeCheck = 0830;
177 | ORGANIZATIONNAME = "Steven Saunders";
178 | TargetAttributes = {
179 | 05ADC3BD19DA200700B0EC7A = {
180 | CreatedOnToolsVersion = 6.0.1;
181 | DevelopmentTeam = C8D57YLUAC;
182 | LastSwiftMigration = 0830;
183 | };
184 | 05ADC3D219DA200700B0EC7A = {
185 | CreatedOnToolsVersion = 6.0.1;
186 | LastSwiftMigration = 0830;
187 | TestTargetID = 05ADC3BD19DA200700B0EC7A;
188 | };
189 | };
190 | };
191 | buildConfigurationList = 05ADC3B919DA200700B0EC7A /* Build configuration list for PBXProject "VR-iOS-Experiment" */;
192 | compatibilityVersion = "Xcode 3.2";
193 | developmentRegion = English;
194 | hasScannedForEncodings = 0;
195 | knownRegions = (
196 | en,
197 | Base,
198 | );
199 | mainGroup = 05ADC3B519DA200700B0EC7A;
200 | productRefGroup = 05ADC3BF19DA200700B0EC7A /* Products */;
201 | projectDirPath = "";
202 | projectRoot = "";
203 | targets = (
204 | 05ADC3BD19DA200700B0EC7A /* VR-iOS-Experiment */,
205 | 05ADC3D219DA200700B0EC7A /* VR-iOS-ExperimentTests */,
206 | );
207 | };
208 | /* End PBXProject section */
209 |
210 | /* Begin PBXResourcesBuildPhase section */
211 | 05ADC3BC19DA200700B0EC7A /* Resources */ = {
212 | isa = PBXResourcesBuildPhase;
213 | buildActionMask = 2147483647;
214 | files = (
215 | 05ADC3C919DA200700B0EC7A /* Main.storyboard in Resources */,
216 | 05ADC3EC19DA21CB00B0EC7A /* spark.png in Resources */,
217 | 05ADC3EB19DA21CB00B0EC7A /* FireParticles.scnp in Resources */,
218 | 05ADC3EE19DA25A600B0EC7A /* checkerboard_pattern.png in Resources */,
219 | 05ADC3CE19DA200700B0EC7A /* LaunchScreen.xib in Resources */,
220 | 05ADC3CB19DA200700B0EC7A /* Images.xcassets in Resources */,
221 | );
222 | runOnlyForDeploymentPostprocessing = 0;
223 | };
224 | 05ADC3D119DA200700B0EC7A /* Resources */ = {
225 | isa = PBXResourcesBuildPhase;
226 | buildActionMask = 2147483647;
227 | files = (
228 | );
229 | runOnlyForDeploymentPostprocessing = 0;
230 | };
231 | /* End PBXResourcesBuildPhase section */
232 |
233 | /* Begin PBXSourcesBuildPhase section */
234 | 05ADC3BA19DA200700B0EC7A /* Sources */ = {
235 | isa = PBXSourcesBuildPhase;
236 | buildActionMask = 2147483647;
237 | files = (
238 | 05ADC3C619DA200700B0EC7A /* ViewController.swift in Sources */,
239 | 05ADC3C419DA200700B0EC7A /* AppDelegate.swift in Sources */,
240 | );
241 | runOnlyForDeploymentPostprocessing = 0;
242 | };
243 | 05ADC3CF19DA200700B0EC7A /* Sources */ = {
244 | isa = PBXSourcesBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | 05ADC3DA19DA200700B0EC7A /* VR_iOS_ExperimentTests.swift in Sources */,
248 | );
249 | runOnlyForDeploymentPostprocessing = 0;
250 | };
251 | /* End PBXSourcesBuildPhase section */
252 |
253 | /* Begin PBXTargetDependency section */
254 | 05ADC3D519DA200700B0EC7A /* PBXTargetDependency */ = {
255 | isa = PBXTargetDependency;
256 | target = 05ADC3BD19DA200700B0EC7A /* VR-iOS-Experiment */;
257 | targetProxy = 05ADC3D419DA200700B0EC7A /* PBXContainerItemProxy */;
258 | };
259 | /* End PBXTargetDependency section */
260 |
261 | /* Begin PBXVariantGroup section */
262 | 05ADC3C719DA200700B0EC7A /* Main.storyboard */ = {
263 | isa = PBXVariantGroup;
264 | children = (
265 | 05ADC3C819DA200700B0EC7A /* Base */,
266 | );
267 | name = Main.storyboard;
268 | sourceTree = "";
269 | };
270 | 05ADC3CC19DA200700B0EC7A /* LaunchScreen.xib */ = {
271 | isa = PBXVariantGroup;
272 | children = (
273 | 05ADC3CD19DA200700B0EC7A /* Base */,
274 | );
275 | name = LaunchScreen.xib;
276 | sourceTree = "";
277 | };
278 | /* End PBXVariantGroup section */
279 |
280 | /* Begin XCBuildConfiguration section */
281 | 05ADC3DB19DA200700B0EC7A /* Debug */ = {
282 | isa = XCBuildConfiguration;
283 | buildSettings = {
284 | ALWAYS_SEARCH_USER_PATHS = NO;
285 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
286 | CLANG_CXX_LIBRARY = "libc++";
287 | CLANG_ENABLE_MODULES = YES;
288 | CLANG_ENABLE_OBJC_ARC = YES;
289 | CLANG_WARN_BOOL_CONVERSION = YES;
290 | CLANG_WARN_CONSTANT_CONVERSION = YES;
291 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
292 | CLANG_WARN_EMPTY_BODY = YES;
293 | CLANG_WARN_ENUM_CONVERSION = YES;
294 | CLANG_WARN_INFINITE_RECURSION = YES;
295 | CLANG_WARN_INT_CONVERSION = YES;
296 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
297 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
298 | CLANG_WARN_UNREACHABLE_CODE = YES;
299 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
300 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
301 | COPY_PHASE_STRIP = NO;
302 | ENABLE_STRICT_OBJC_MSGSEND = YES;
303 | ENABLE_TESTABILITY = YES;
304 | GCC_C_LANGUAGE_STANDARD = gnu99;
305 | GCC_DYNAMIC_NO_PIC = NO;
306 | GCC_NO_COMMON_BLOCKS = YES;
307 | GCC_OPTIMIZATION_LEVEL = 0;
308 | GCC_PREPROCESSOR_DEFINITIONS = (
309 | "DEBUG=1",
310 | "$(inherited)",
311 | );
312 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
313 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
314 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
315 | GCC_WARN_UNDECLARED_SELECTOR = YES;
316 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
317 | GCC_WARN_UNUSED_FUNCTION = YES;
318 | GCC_WARN_UNUSED_VARIABLE = YES;
319 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
320 | MTL_ENABLE_DEBUG_INFO = YES;
321 | ONLY_ACTIVE_ARCH = YES;
322 | SDKROOT = iphoneos;
323 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
324 | };
325 | name = Debug;
326 | };
327 | 05ADC3DC19DA200700B0EC7A /* Release */ = {
328 | isa = XCBuildConfiguration;
329 | buildSettings = {
330 | ALWAYS_SEARCH_USER_PATHS = NO;
331 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
332 | CLANG_CXX_LIBRARY = "libc++";
333 | CLANG_ENABLE_MODULES = YES;
334 | CLANG_ENABLE_OBJC_ARC = YES;
335 | CLANG_WARN_BOOL_CONVERSION = YES;
336 | CLANG_WARN_CONSTANT_CONVERSION = YES;
337 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
338 | CLANG_WARN_EMPTY_BODY = YES;
339 | CLANG_WARN_ENUM_CONVERSION = YES;
340 | CLANG_WARN_INFINITE_RECURSION = YES;
341 | CLANG_WARN_INT_CONVERSION = YES;
342 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
343 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
344 | CLANG_WARN_UNREACHABLE_CODE = YES;
345 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
346 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
347 | COPY_PHASE_STRIP = YES;
348 | ENABLE_NS_ASSERTIONS = NO;
349 | ENABLE_STRICT_OBJC_MSGSEND = YES;
350 | GCC_C_LANGUAGE_STANDARD = gnu99;
351 | GCC_NO_COMMON_BLOCKS = YES;
352 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
353 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
354 | GCC_WARN_UNDECLARED_SELECTOR = YES;
355 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
356 | GCC_WARN_UNUSED_FUNCTION = YES;
357 | GCC_WARN_UNUSED_VARIABLE = YES;
358 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
359 | MTL_ENABLE_DEBUG_INFO = NO;
360 | SDKROOT = iphoneos;
361 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
362 | VALIDATE_PRODUCT = YES;
363 | };
364 | name = Release;
365 | };
366 | 05ADC3DE19DA200700B0EC7A /* Debug */ = {
367 | isa = XCBuildConfiguration;
368 | buildSettings = {
369 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
370 | DEVELOPMENT_TEAM = C8D57YLUAC;
371 | INFOPLIST_FILE = "VR-iOS-Experiment/Info.plist";
372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
373 | PRODUCT_BUNDLE_IDENTIFIER = "com.stevenjs.$(PRODUCT_NAME:rfc1034identifier)";
374 | PRODUCT_NAME = "$(TARGET_NAME)";
375 | SWIFT_VERSION = 3.0;
376 | };
377 | name = Debug;
378 | };
379 | 05ADC3DF19DA200700B0EC7A /* Release */ = {
380 | isa = XCBuildConfiguration;
381 | buildSettings = {
382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
383 | DEVELOPMENT_TEAM = C8D57YLUAC;
384 | INFOPLIST_FILE = "VR-iOS-Experiment/Info.plist";
385 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
386 | PRODUCT_BUNDLE_IDENTIFIER = "com.stevenjs.$(PRODUCT_NAME:rfc1034identifier)";
387 | PRODUCT_NAME = "$(TARGET_NAME)";
388 | SWIFT_VERSION = 3.0;
389 | };
390 | name = Release;
391 | };
392 | 05ADC3E119DA200700B0EC7A /* Debug */ = {
393 | isa = XCBuildConfiguration;
394 | buildSettings = {
395 | BUNDLE_LOADER = "$(TEST_HOST)";
396 | FRAMEWORK_SEARCH_PATHS = (
397 | "$(SDKROOT)/Developer/Library/Frameworks",
398 | "$(inherited)",
399 | );
400 | GCC_PREPROCESSOR_DEFINITIONS = (
401 | "DEBUG=1",
402 | "$(inherited)",
403 | );
404 | INFOPLIST_FILE = "VR-iOS-ExperimentTests/Info.plist";
405 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
406 | PRODUCT_BUNDLE_IDENTIFIER = "com.stevenjs.$(PRODUCT_NAME:rfc1034identifier)";
407 | PRODUCT_NAME = "$(TARGET_NAME)";
408 | SWIFT_VERSION = 3.0;
409 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/VR-iOS-Experiment.app/VR-iOS-Experiment";
410 | };
411 | name = Debug;
412 | };
413 | 05ADC3E219DA200700B0EC7A /* Release */ = {
414 | isa = XCBuildConfiguration;
415 | buildSettings = {
416 | BUNDLE_LOADER = "$(TEST_HOST)";
417 | FRAMEWORK_SEARCH_PATHS = (
418 | "$(SDKROOT)/Developer/Library/Frameworks",
419 | "$(inherited)",
420 | );
421 | INFOPLIST_FILE = "VR-iOS-ExperimentTests/Info.plist";
422 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
423 | PRODUCT_BUNDLE_IDENTIFIER = "com.stevenjs.$(PRODUCT_NAME:rfc1034identifier)";
424 | PRODUCT_NAME = "$(TARGET_NAME)";
425 | SWIFT_VERSION = 3.0;
426 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/VR-iOS-Experiment.app/VR-iOS-Experiment";
427 | };
428 | name = Release;
429 | };
430 | /* End XCBuildConfiguration section */
431 |
432 | /* Begin XCConfigurationList section */
433 | 05ADC3B919DA200700B0EC7A /* Build configuration list for PBXProject "VR-iOS-Experiment" */ = {
434 | isa = XCConfigurationList;
435 | buildConfigurations = (
436 | 05ADC3DB19DA200700B0EC7A /* Debug */,
437 | 05ADC3DC19DA200700B0EC7A /* Release */,
438 | );
439 | defaultConfigurationIsVisible = 0;
440 | defaultConfigurationName = Release;
441 | };
442 | 05ADC3DD19DA200700B0EC7A /* Build configuration list for PBXNativeTarget "VR-iOS-Experiment" */ = {
443 | isa = XCConfigurationList;
444 | buildConfigurations = (
445 | 05ADC3DE19DA200700B0EC7A /* Debug */,
446 | 05ADC3DF19DA200700B0EC7A /* Release */,
447 | );
448 | defaultConfigurationIsVisible = 0;
449 | defaultConfigurationName = Release;
450 | };
451 | 05ADC3E019DA200700B0EC7A /* Build configuration list for PBXNativeTarget "VR-iOS-ExperimentTests" */ = {
452 | isa = XCConfigurationList;
453 | buildConfigurations = (
454 | 05ADC3E119DA200700B0EC7A /* Debug */,
455 | 05ADC3E219DA200700B0EC7A /* Release */,
456 | );
457 | defaultConfigurationIsVisible = 0;
458 | defaultConfigurationName = Release;
459 | };
460 | /* End XCConfigurationList section */
461 | };
462 | rootObject = 05ADC3B619DA200700B0EC7A /* Project object */;
463 | }
464 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // VR-iOS-Experiment
4 | //
5 | // Created by Steven Saunders on 30/09/2014.
6 | // Copyright (c) 2014 Steven Saunders. 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 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment/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 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment/FireParticles.scnp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stevenjs/VR-iOS-Experiment/72a0b16a545d5565fb7a4d890cf21274fa05d1b7/VR-iOS-Experiment/FireParticles.scnp
--------------------------------------------------------------------------------
/VR-iOS-Experiment/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 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/VR-iOS-Experiment/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 | UIStatusBarHidden
34 |
35 | UISupportedInterfaceOrientations
36 |
37 | UIInterfaceOrientationLandscapeLeft
38 | UIInterfaceOrientationLandscapeRight
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // VR-iOS-Experiment
4 | //
5 | // Created by Steven Saunders on 30/09/2014.
6 | // Copyright (c) 2014 Steven Saunders. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SceneKit
11 | import CoreMotion
12 |
13 | func degreesToRadians(_ degrees: Float) -> Float {
14 | return degrees * .pi / 180
15 | }
16 |
17 | func radiansToDegrees(_ radians: Float) -> Float {
18 | return 180 / .pi * radians
19 | }
20 |
21 | class ViewController: UIViewController, SCNSceneRendererDelegate {
22 |
23 | @IBOutlet var leftSceneView : SCNView?
24 | @IBOutlet var rightSceneView : SCNView?
25 |
26 | var motionManager : CMMotionManager?
27 | var cameraRollNode : SCNNode?
28 | var cameraPitchNode : SCNNode?
29 | var cameraYawNode : SCNNode?
30 |
31 | override func viewDidLoad() {
32 | super.viewDidLoad()
33 |
34 | leftSceneView?.backgroundColor = UIColor.black
35 | rightSceneView?.backgroundColor = UIColor.black
36 |
37 | // Create Scene
38 | let scene = SCNScene()
39 |
40 | leftSceneView?.scene = scene
41 | rightSceneView?.scene = scene
42 |
43 | // Create cameras
44 | let leftCamera = SCNCamera()
45 | let rightCamera = SCNCamera()
46 |
47 | let leftCameraNode = SCNNode()
48 | leftCameraNode.camera = leftCamera
49 | leftCameraNode.position = SCNVector3(x: -0.5, y: 0, z: 0)
50 |
51 | let rightCameraNode = SCNNode()
52 | rightCameraNode.camera = rightCamera
53 | rightCameraNode.position = SCNVector3(x: 0.5, y: 0, z: 0)
54 |
55 | let camerasNode = SCNNode()
56 | camerasNode.position = SCNVector3(x: 0, y: 0, z: -3)
57 | camerasNode.addChildNode(leftCameraNode)
58 | camerasNode.addChildNode(rightCameraNode)
59 |
60 | // The user will be holding their device up (i.e. 90 degrees roll from a flat orientation)
61 | // so roll the cameras by -90 degrees to orient the view correctly.
62 | camerasNode.eulerAngles = SCNVector3Make(degreesToRadians(-90), 0, 0)
63 |
64 | cameraRollNode = SCNNode()
65 | cameraRollNode!.addChildNode(camerasNode)
66 |
67 | cameraPitchNode = SCNNode()
68 | cameraPitchNode!.addChildNode(cameraRollNode!)
69 |
70 | cameraYawNode = SCNNode()
71 | cameraYawNode!.addChildNode(cameraPitchNode!)
72 |
73 | scene.rootNode.addChildNode(cameraYawNode!)
74 |
75 | leftSceneView?.pointOfView = leftCameraNode
76 | rightSceneView?.pointOfView = rightCameraNode
77 |
78 | // Ambient Light
79 | let ambientLight = SCNLight()
80 | ambientLight.type = .ambient
81 | ambientLight.color = UIColor(white: 0.1, alpha: 1)
82 | let ambientLightNode = SCNNode()
83 | ambientLightNode.light = ambientLight
84 | scene.rootNode.addChildNode(ambientLightNode)
85 |
86 | // Omni Light
87 | let diffuseLight = SCNLight()
88 | diffuseLight.type = .omni
89 | diffuseLight.color = UIColor(white: 1, alpha: 1)
90 | let diffuseLightNode = SCNNode()
91 | diffuseLightNode.light = diffuseLight
92 | diffuseLightNode.position = SCNVector3(x: -30, y: 30, z: 50)
93 | scene.rootNode.addChildNode(diffuseLightNode)
94 |
95 | // Create Floor
96 | let floor = SCNFloor()
97 | floor.reflectivity = 0.15
98 | let mat = SCNMaterial()
99 | let darkBlue = UIColor(red: 0, green: 0, blue: 0.5, alpha: 1)
100 | mat.diffuse.contents = darkBlue
101 | mat.specular.contents = darkBlue
102 | floor.materials = [mat]
103 | let floorNode = SCNNode(geometry: floor)
104 | floorNode.position = SCNVector3(x: 0, y: -1, z: 0)
105 | scene.rootNode.addChildNode(floorNode)
106 |
107 | // Create boing ball
108 | let boingBall = SCNSphere(radius: 1)
109 | let boingBallNode = SCNNode(geometry: boingBall)
110 | boingBallNode.position = SCNVector3(x: 0, y: 3, z: -7)
111 | scene.rootNode.addChildNode(boingBallNode)
112 |
113 | let material = SCNMaterial()
114 | material.diffuse.contents = UIImage(named: "checkerboard_pattern.png")
115 | material.specular.contents = UIColor.white
116 | material.shininess = 1.0
117 | boingBall.materials = [ material ]
118 |
119 | // Fire Particle System, attached to the boing ball
120 | if let fire = SCNParticleSystem(named: "FireParticles", inDirectory: nil) {
121 | fire.emitterShape = boingBall
122 | boingBallNode.addParticleSystem(fire)
123 | }
124 |
125 | // Make the ball bounce
126 | let animation = CABasicAnimation(keyPath: "position.y")
127 | animation.byValue = -3.05
128 | animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
129 | animation.autoreverses = true
130 | animation.repeatCount = Float.infinity
131 | animation.duration = 0.5
132 |
133 | boingBallNode.addAnimation(animation, forKey: "bounce")
134 |
135 | // Make the camera move back and forth
136 | let camera_anim = CABasicAnimation(keyPath: "position.y")
137 | camera_anim.byValue = 12.0
138 | camera_anim.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
139 | camera_anim.autoreverses = true
140 | camera_anim.repeatCount = Float.infinity
141 | camera_anim.duration = 2.0
142 |
143 | camerasNode.addAnimation(camera_anim, forKey: "camera_motion")
144 |
145 | // Respond to user head movement
146 | motionManager = CMMotionManager()
147 | motionManager?.deviceMotionUpdateInterval = 1.0 / 60.0
148 | motionManager?.startDeviceMotionUpdates(using: .xArbitraryZVertical)
149 |
150 | leftSceneView?.delegate = self
151 |
152 | leftSceneView?.isPlaying = true
153 | rightSceneView?.isPlaying = true
154 | }
155 |
156 | func renderer(_ aRenderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {
157 | let doCorrect = UIDevice.current.orientation == .landscapeLeft
158 | let rollPitchCorrect: Float = doCorrect ? -1 : 1
159 | let yawCorrect: Float = doCorrect ? .pi : 0
160 |
161 | if let mm = motionManager, let motion = mm.deviceMotion {
162 | let currentAttitude = motion.attitude
163 |
164 | cameraRollNode!.eulerAngles.x = Float(currentAttitude.roll) * rollPitchCorrect
165 | cameraPitchNode!.eulerAngles.z = Float(currentAttitude.pitch) * rollPitchCorrect
166 | cameraYawNode!.eulerAngles.y = Float(currentAttitude.yaw) - yawCorrect
167 | }
168 | }
169 |
170 | override func didReceiveMemoryWarning() {
171 | super.didReceiveMemoryWarning()
172 | // Dispose of any resources that can be recreated.
173 | }
174 |
175 | }
176 |
177 |
--------------------------------------------------------------------------------
/VR-iOS-Experiment/checkerboard_pattern.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stevenjs/VR-iOS-Experiment/72a0b16a545d5565fb7a4d890cf21274fa05d1b7/VR-iOS-Experiment/checkerboard_pattern.png
--------------------------------------------------------------------------------
/VR-iOS-Experiment/spark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stevenjs/VR-iOS-Experiment/72a0b16a545d5565fb7a4d890cf21274fa05d1b7/VR-iOS-Experiment/spark.png
--------------------------------------------------------------------------------
/VR-iOS-ExperimentTests/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 |
--------------------------------------------------------------------------------
/VR-iOS-ExperimentTests/VR_iOS_ExperimentTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // VR_iOS_ExperimentTests.swift
3 | // VR-iOS-ExperimentTests
4 | //
5 | // Created by Steven Saunders on 30/09/2014.
6 | // Copyright (c) 2014 Steven Saunders. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import XCTest
11 |
12 | class VR_iOS_ExperimentTests: 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 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/stevenjs/VR-iOS-Experiment/72a0b16a545d5565fb7a4d890cf21274fa05d1b7/screenshot.png
--------------------------------------------------------------------------------