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 SwiftUI | |
import RealityKit | |
import Metal | |
struct CubeSphereState { | |
var size: SIMD3<Float> = [0.3, 0.3, 0.3] | |
var planeResolution: SIMD2<UInt32> = [16, 16] | |
var cubeSphereInterpolationRatio: Float = 0.0 | |
} |
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 Foundation | |
import RealityKit | |
import SwiftUI | |
struct CubeMeshExample: View { | |
@State private var rotationAngles: SIMD3<Float> = [0, 0, 0] | |
@State private var lastRotationUpdateTime = CACurrentMediaTime() | |
@State private var time: Double = 0.0 | |
@State private var rootEntity: 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
import Foundation | |
import RealityKit | |
import SwiftUI | |
struct ApplePlaneExample: View { | |
var body: some View { | |
RealityView { content in | |
// Create a plane mesh. | |
if let planeMesh = try? PlaneMesh(size: [0.2, 0.2], dimensions: [16, 16]), let mesh = try? MeshResource(from: planeMesh.mesh) { | |
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 SwiftUI | |
import RealityKit | |
struct TurkeyClonesAnimationView: View { | |
let scale: Float = 0.02 | |
let horizontalCount: Int = 4 | |
let horizontalSpacing: Float = 0.0375 | |
let verticalCount: Int = 2 | |
let verticalSpacing: Float = 0.05 |
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
// Don't forget to include this bridging header | |
#ifndef GaussianBlurParams_h | |
#define GaussianBlurParams_h | |
struct GaussianBlurParams { | |
int32_t kernelSize; | |
float intensity; | |
}; |
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 RealityKit | |
import SwiftUI | |
struct BreathingLeavesView: View { | |
let rootEntity = Entity() | |
@State var children = [EntityPositionPair]() | |
@State private var rotationAngles: SIMD3<Float> = [0, 0, 0] | |
@State private var modulationTimer: Timer? | |
@State private var time: Double = 0.0 | |
@State private var lastRotationUpdateTime = CACurrentMediaTime() |
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 SwiftUI | |
import RealityKit | |
struct FlamesTextAnimationView: View { | |
var textLines: [String] = ["WELCOME", "TO", "APP NAME"] | |
let commandQueue: MTLCommandQueue | |
let computePipeline: MTLComputePipelineState | |
@State private var texture: LowLevelTexture? | |
let timer = Timer.publish(every: 1.0 / 120.0, on: .main, in: .common).autoconnect() | |
@State private var time: Float = 0 |
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 RealityKit | |
import SwiftUI | |
struct LowLevelTextureTextView: View { | |
let commandQueue: MTLCommandQueue | |
let computePipeline: MTLComputePipelineState | |
@State private var texture: LowLevelTexture? | |
let timer = Timer.publish(every: 1.0 / 120.0, on: .main, in: .common).autoconnect() | |
@State private var time: Float = 0 | |
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 GameKit | |
import SwiftUI | |
struct GameTestView: View { | |
@StateObject private var gameKitManager = GameKitManager() | |
@State private var timer: Timer? | |
var body: some View { | |
VStack { | |
Text("Score: \(gameKitManager.score)") |
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 SwiftUI | |
import RealityKit | |
import ARKit | |
import HandVector | |
struct TargetPracticeView: View { | |
@State var jointPositions: [HandSkeleton.JointName: SIMD3<Float>] = [:] | |
@State var targets: [Target] = [] | |
@State var laserBeamEntity: ModelEntity? |
NewerOlder