commit 1b4a17dc20f1e52965e4a5ba9b28d469b45ccd04 Author: Eryn Wells Date: Sun Sep 16 22:04:00 2018 -0700 Initial Commit diff --git a/Waveform.xcodeproj/project.pbxproj b/Waveform.xcodeproj/project.pbxproj new file mode 100644 index 0000000..e750d89 --- /dev/null +++ b/Waveform.xcodeproj/project.pbxproj @@ -0,0 +1,334 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + C024BEBC214F6D3D00983E1C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C024BEBB214F6D3D00983E1C /* AppDelegate.swift */; }; + C024BEBE214F6D3D00983E1C /* GameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C024BEBD214F6D3D00983E1C /* GameViewController.swift */; }; + C024BEC0214F6D3D00983E1C /* art.scnassets in Resources */ = {isa = PBXBuildFile; fileRef = C024BEBF214F6D3D00983E1C /* art.scnassets */; }; + C024BEC2214F6D3E00983E1C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C024BEC1214F6D3E00983E1C /* Assets.xcassets */; }; + C024BEC5214F6D3E00983E1C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C024BEC3214F6D3E00983E1C /* Main.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + C024BEB8214F6D3D00983E1C /* Waveform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Waveform.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C024BEBB214F6D3D00983E1C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + C024BEBD214F6D3D00983E1C /* GameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameViewController.swift; sourceTree = ""; }; + C024BEBF214F6D3D00983E1C /* art.scnassets */ = {isa = PBXFileReference; lastKnownFileType = wrapper.scnassets; path = art.scnassets; sourceTree = ""; }; + C024BEC1214F6D3E00983E1C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + C024BEC4214F6D3E00983E1C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + C024BEC6214F6D3E00983E1C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C024BEC7214F6D3E00983E1C /* Waveform.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Waveform.entitlements; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C024BEB5214F6D3D00983E1C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + C024BEAF214F6D3D00983E1C = { + isa = PBXGroup; + children = ( + C024BEBA214F6D3D00983E1C /* Waveform */, + C024BEB9214F6D3D00983E1C /* Products */, + ); + sourceTree = ""; + }; + C024BEB9214F6D3D00983E1C /* Products */ = { + isa = PBXGroup; + children = ( + C024BEB8214F6D3D00983E1C /* Waveform.app */, + ); + name = Products; + sourceTree = ""; + }; + C024BEBA214F6D3D00983E1C /* Waveform */ = { + isa = PBXGroup; + children = ( + C024BEBB214F6D3D00983E1C /* AppDelegate.swift */, + C024BEBD214F6D3D00983E1C /* GameViewController.swift */, + C024BEBF214F6D3D00983E1C /* art.scnassets */, + C024BEC1214F6D3E00983E1C /* Assets.xcassets */, + C024BEC3214F6D3E00983E1C /* Main.storyboard */, + C024BEC6214F6D3E00983E1C /* Info.plist */, + C024BEC7214F6D3E00983E1C /* Waveform.entitlements */, + ); + path = Waveform; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C024BEB7214F6D3D00983E1C /* Waveform */ = { + isa = PBXNativeTarget; + buildConfigurationList = C024BECA214F6D3E00983E1C /* Build configuration list for PBXNativeTarget "Waveform" */; + buildPhases = ( + C024BEB4214F6D3D00983E1C /* Sources */, + C024BEB5214F6D3D00983E1C /* Frameworks */, + C024BEB6214F6D3D00983E1C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Waveform; + productName = Waveform; + productReference = C024BEB8214F6D3D00983E1C /* Waveform.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C024BEB0214F6D3D00983E1C /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0940; + LastUpgradeCheck = 0940; + ORGANIZATIONNAME = "Eryn Wells"; + TargetAttributes = { + C024BEB7214F6D3D00983E1C = { + CreatedOnToolsVersion = 9.4.1; + }; + }; + }; + buildConfigurationList = C024BEB3214F6D3D00983E1C /* Build configuration list for PBXProject "Waveform" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = C024BEAF214F6D3D00983E1C; + productRefGroup = C024BEB9214F6D3D00983E1C /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C024BEB7214F6D3D00983E1C /* Waveform */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C024BEB6214F6D3D00983E1C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C024BEC5214F6D3E00983E1C /* Main.storyboard in Resources */, + C024BEC2214F6D3E00983E1C /* Assets.xcassets in Resources */, + C024BEC0214F6D3D00983E1C /* art.scnassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C024BEB4214F6D3D00983E1C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C024BEBE214F6D3D00983E1C /* GameViewController.swift in Sources */, + C024BEBC214F6D3D00983E1C /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + C024BEC3214F6D3E00983E1C /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C024BEC4214F6D3E00983E1C /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C024BEC8214F6D3E00983E1C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + C024BEC9214F6D3E00983E1C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "Mac Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.13; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + C024BECB214F6D3E00983E1C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Waveform/Waveform.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 78372RE6B4; + INFOPLIST_FILE = Waveform/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = me.erynwells.Waveform; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + }; + name = Debug; + }; + C024BECC214F6D3E00983E1C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_ENTITLEMENTS = Waveform/Waveform.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + DEVELOPMENT_TEAM = 78372RE6B4; + INFOPLIST_FILE = Waveform/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = me.erynwells.Waveform; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 4.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C024BEB3214F6D3D00983E1C /* Build configuration list for PBXProject "Waveform" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C024BEC8214F6D3E00983E1C /* Debug */, + C024BEC9214F6D3E00983E1C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C024BECA214F6D3E00983E1C /* Build configuration list for PBXNativeTarget "Waveform" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C024BECB214F6D3E00983E1C /* Debug */, + C024BECC214F6D3E00983E1C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C024BEB0214F6D3D00983E1C /* Project object */; +} diff --git a/Waveform.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Waveform.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..c010c56 --- /dev/null +++ b/Waveform.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Waveform.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Waveform.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Waveform.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Waveform/AppDelegate.swift b/Waveform/AppDelegate.swift new file mode 100644 index 0000000..881d4aa --- /dev/null +++ b/Waveform/AppDelegate.swift @@ -0,0 +1,18 @@ +// +// AppDelegate.swift +// Waveform +// +// Created by Eryn Wells on 9/16/18. +// Copyright © 2018 Eryn Wells. All rights reserved. +// + +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + + func applicationDidFinishLaunching(_ aNotification: Notification) { + // Insert code here to initialize your application + } + +} diff --git a/Waveform/Assets.xcassets/AppIcon.appiconset/Contents.json b/Waveform/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..2db2b1c --- /dev/null +++ b/Waveform/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,58 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Waveform/Assets.xcassets/Contents.json b/Waveform/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Waveform/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Waveform/Base.lproj/Main.storyboard b/Waveform/Base.lproj/Main.storyboard new file mode 100644 index 0000000..5d0b8f6 --- /dev/null +++ b/Waveform/Base.lproj/Main.storyboard @@ -0,0 +1,719 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + Default + + + + + + + Left to Right + + + + + + + Right to Left + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Waveform/GameViewController.swift b/Waveform/GameViewController.swift new file mode 100644 index 0000000..97e0624 --- /dev/null +++ b/Waveform/GameViewController.swift @@ -0,0 +1,105 @@ +// +// GameViewController.swift +// Waveform +// +// Created by Eryn Wells on 9/16/18. +// Copyright © 2018 Eryn Wells. All rights reserved. +// + +import SceneKit +import QuartzCore + +class GameViewController: NSViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + // create a new scene + let scene = SCNScene(named: "art.scnassets/ship.scn")! + + // create and add a camera to the scene + let cameraNode = SCNNode() + cameraNode.camera = SCNCamera() + scene.rootNode.addChildNode(cameraNode) + + // place the camera + cameraNode.position = SCNVector3(x: 0, y: 0, z: 15) + + // create and add a light to the scene + let lightNode = SCNNode() + lightNode.light = SCNLight() + lightNode.light!.type = .omni + lightNode.position = SCNVector3(x: 0, y: 10, z: 10) + scene.rootNode.addChildNode(lightNode) + + // create and add an ambient light to the scene + let ambientLightNode = SCNNode() + ambientLightNode.light = SCNLight() + ambientLightNode.light!.type = .ambient + ambientLightNode.light!.color = NSColor.darkGray + scene.rootNode.addChildNode(ambientLightNode) + + // retrieve the ship node + let ship = scene.rootNode.childNode(withName: "ship", recursively: true)! + + // animate the 3d object + ship.runAction(SCNAction.repeatForever(SCNAction.rotateBy(x: 0, y: 2, z: 0, duration: 1))) + + // retrieve the SCNView + let scnView = self.view as! SCNView + + // set the scene to the view + scnView.scene = scene + + // allows the user to manipulate the camera + scnView.allowsCameraControl = true + + // show statistics such as fps and timing information + scnView.showsStatistics = true + + // configure the view + scnView.backgroundColor = NSColor.black + + // Add a click gesture recognizer + let clickGesture = NSClickGestureRecognizer(target: self, action: #selector(handleClick(_:))) + var gestureRecognizers = scnView.gestureRecognizers + gestureRecognizers.insert(clickGesture, at: 0) + scnView.gestureRecognizers = gestureRecognizers + } + + @objc + func handleClick(_ gestureRecognizer: NSGestureRecognizer) { + // retrieve the SCNView + let scnView = self.view as! SCNView + + // check what nodes are clicked + let p = gestureRecognizer.location(in: scnView) + let hitResults = scnView.hitTest(p, options: [:]) + // check that we clicked on at least one object + if hitResults.count > 0 { + // retrieved the first clicked object + let result = hitResults[0] + + // get its material + let material = result.node.geometry!.firstMaterial! + + // highlight it + SCNTransaction.begin() + SCNTransaction.animationDuration = 0.5 + + // on completion - unhighlight + SCNTransaction.completionBlock = { + SCNTransaction.begin() + SCNTransaction.animationDuration = 0.5 + + material.emission.contents = NSColor.black + + SCNTransaction.commit() + } + + material.emission.contents = NSColor.red + + SCNTransaction.commit() + } + } +} diff --git a/Waveform/Info.plist b/Waveform/Info.plist new file mode 100644 index 0000000..eca6f87 --- /dev/null +++ b/Waveform/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2018 Eryn Wells. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/Waveform/Waveform.entitlements b/Waveform/Waveform.entitlements new file mode 100644 index 0000000..f2ef3ae --- /dev/null +++ b/Waveform/Waveform.entitlements @@ -0,0 +1,10 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + + diff --git a/Waveform/art.scnassets/ship.scn b/Waveform/art.scnassets/ship.scn new file mode 100644 index 0000000..8d166d0 Binary files /dev/null and b/Waveform/art.scnassets/ship.scn differ diff --git a/Waveform/art.scnassets/texture.png b/Waveform/art.scnassets/texture.png new file mode 100644 index 0000000..ba39258 Binary files /dev/null and b/Waveform/art.scnassets/texture.png differ