Skip to content

Instantly share code, notes, and snippets.

#! /usr/bin/swift
//
// - This is just some AppKit boilerplate to launch a window.
//
import AppKit
@available(OSX 10.15, *)
class AppDelegate: NSObject, NSApplicationDelegate {
let window = NSWindow()
let windowDelegate = WindowDelegate()
@heckj
heckj / Capsule.swift
Created April 21, 2019 15:22
A Reusable SCNNode SubClass With An SCNCapsule Geometry
//
// Capsule.swift
//
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit
@heckj
heckj / Cone.swift
Created April 20, 2019 22:29
A Reusable SCNNode SubClass With An SCNCone Geometry
//
// Cone.swift
//
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit
@heckj
heckj / Torus.swift
Created April 20, 2019 22:29
A Reusable SCNNode SubClass With An SCNTorus Geometry
//
// Torus.swift
//
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit
@heckj
heckj / Sphere.swift
Created April 20, 2019 22:28
A Reusable SCNNode SubClass With An SCNSphere Geometry
//
// Sphere.swift
//
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit
@heckj
heckj / Pyramid.swift
Created April 20, 2019 22:28
A Reusable SCNNode SubClass With An SCNPyramid Geometry
//
// Pyramid.swift
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit
@heckj
heckj / SCNText+Typewriter.swift
Created April 20, 2019 22:28
An Example Of Animating SCNText With A Typewriter Like Effect
//1. Timer To Animate Our Text
var animationTimer: Timer?
//2. Variable To Store The Current Time
var time:Int = 0
/// Animates The Presentation Of SCNText To Give An Appearance Of A Typing Effect
///
/// - Parameters:
/// - textGeometry: SCNText
@heckj
heckj / SCNTube.swift
Created April 20, 2019 22:28
A Reusable SCNNode SubClass With An SCNTube Geometry
//
// Tube.swift
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit
@heckj
heckj / MetalWireFrameShader.metal
Created April 20, 2019 22:28
Wireframe Shader For An SCNBox Geometry
/*
Copyright © 2018 Apple Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@heckj
heckj / Cylinder.swift
Created April 20, 2019 22:24
A Reusable SCNNode SubClass With An SCNCylinder Geometry
//
// Cylinder.swift
//
//
// Created by Josh Robbins on 24/02/2018.
// Copyright © 2018 BlackMirror. All rights reserved.
//
import Foundation
import SceneKit