This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you're using SwiftLint, add this to your swiftlint.yml to make Xcode | |
# generate warnings when you create new Swift files and Xcode inserts the | |
# filename where the package name should be. | |
custom_rules: | |
# This calls out an Xcode 13 bug where the header comments of newly created | |
# files include the file name where the package name should be. | |
xcode_13_header_comment_bug: | |
regex: ' *\/\/ *([A-Za-z0-9_]*?).swift *\n *\/\/ *\1 *\n' | |
message: "Incorrect header comment package name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIColor { | |
/// Creates a dynamic color from the receiver blended with another color. | |
/// | |
/// If `weight` is 0, the color of `self` is returned. If `weight` is 1, the color | |
/// of `otherColor` is returned. | |
/// | |
/// This method works correctly with light and dark mode. A dynamic color is |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIColor { | |
/// Creates a dynamic color from the receiver with attenuated brightness. | |
/// | |
/// This method works correctly with light and dark mode. A dynamic color is | |
/// returned, so if the user switches to dark mode, the attenuated dark mode version of `self` | |
/// will be displayed. | |
func attenuated(by attenuation: CGFloat) -> UIColor { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Entity+EnumerateHierarchy.swift | |
// | |
// Created by Drew Olbrich on 7/18/23. | |
// | |
import RealityKit | |
extension Entity { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Entity+LoadFileAsync.swift | |
// | |
// Created by Drew Olbrich on 8/4/23. | |
// | |
import Foundation | |
import RealityKit | |
import Combine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Entity+GenerateGroundingShadowComponents.swift | |
// | |
// Created by Drew Olbrich on 10/18/23. | |
// Copyright © 2023 Lunar Skydiving LLC. All rights reserved. | |
// | |
// MIT License | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Important: You may want to use this newer `Entity` extension instead: https://gist.github.com/drewolbrich/1e9d3da074c8a1d5ca93721124b97596 | |
import Foundation | |
import RealityKit | |
extension Entity { | |
/// The opacity value applied to the entity and its descendants. | |
/// | |
/// `OpacityComponent` is assigned to the entity if it doesn't already exist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Entity+Opacity.swift | |
// | |
// Created by Drew Olbrich on 10/25/23. | |
// Copyright © 2023 Lunar Skydiving LLC. All rights reserved. | |
// | |
// MIT License | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import simd | |
/// Creates a 4x4 matrix that orients the +Z axis in the direction of `at`, and the | |
/// +Y axis toward `up`. | |
func simd_look(at: SIMD3<Float>, up: SIMD3<Float> = SIMD3<Float>(0, 1, 0)) -> simd_float4x4 { | |
let zAxis = normalize(at) | |
let xAxis = normalize(cross(up, zAxis)) | |
let yAxis = normalize(cross(zAxis, xAxis)) | |
return simd_float4x4( |
OlderNewer