This file contains hidden or 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 CenterExtrudedTextView: View { | |
let entity: Entity = try! getEntity() | |
var body: some View { | |
RealityView { content in | |
content.add(entity) | |
} |
This file contains hidden or 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 PancakeEffectView: View { | |
@State var entity: ModelEntity? | |
@State var lowLevelMesh: LowLevelMesh? | |
@State var originalVerticesBuffer: MTLBuffer? | |
@State var timer: Timer? | |
@State var isForward: Bool = true |
This file contains hidden or 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
#ifndef HeightMapParams_h | |
#define HeightMapParams_h | |
struct HeightMapParams { | |
simd_float2 size; | |
simd_uint2 dimensions; | |
}; | |
#endif /* HeightMapParams_h */ |
This file contains hidden or 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 MorphModelToSphereView: View { | |
@State var entity: ModelEntity? | |
@State var lowLevelMesh: LowLevelMesh? | |
@State var originalVertices: [VertexData] = [] | |
@State var originalTexture: LowLevelTexture? | |
@State var processedTexture: LowLevelTexture? |
This file contains hidden or 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 | |
@main | |
struct CombineAndSplitViewExampleApp: App { | |
@State var viewStateManager = ViewStateManager() | |
var body: some Scene { | |
// Main Window allows us to launch first CombineAndSplitView Window with appropriate ViewWindowID value | |
// (if we just had CombineAndSplitView open initially, it would be associated with nil) | |
// There's probably a way to handle the nil case too, but this already covers my needs |
This file contains hidden or 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 | |
#Preview { | |
@Previewable @State var value: Double = 0.0 | |
VStack { | |
Text("Value: \(value)") | |
CenterSliderWithIcons(value: $value) | |
} | |
.foregroundStyle(.black) | |
.padding() |
This file contains hidden or 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 | |
struct ContentView: View { | |
@State var sliderValue: Double = 0.5 | |
var body: some View { | |
CustomSlider(value: $sliderValue) | |
} | |
} | |
struct CustomSlider<V: BinaryFloatingPoint>: View where V.Stride: BinaryFloatingPoint { |
This file contains hidden or 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 hidden or 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 hidden or 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 | |
// See: https://developer.apple.com/documentation/realitykit/creating-a-plane-with-low-level-mesh | |
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) { |
NewerOlder