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 MetalKit | |
struct ModelUVTextureRealityView: View { | |
@State var entity: ModelEntity? | |
@State var texture: LowLevelTexture? | |
let device: MTLDevice | |
let commandQueue: MTLCommandQueue | |
let textureComputePipeline: MTLComputePipelineState |
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 MetalKit | |
struct AdjustModelTextureRealityView: View { | |
@State var entity: ModelEntity? | |
@State var originalTexture: LowLevelTexture? | |
@State var fadedTexture: LowLevelTexture? | |
@State var fadeValue: Float = 0.0 | |
@State var timer: Timer? |
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 DownloadModelRealityView: View { | |
@State var rotationAngle: Float = 0 | |
@State var timer: Timer? | |
let url = URL(string: "https://matt54.github.io/Resources/StatueOfBuddha.usdz")! | |
var body: some View { | |
RealityView { content in |
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 ARKit | |
import RealityKit | |
import SwiftUI | |
struct OuterSpaceCeilingPortalView: View { | |
@State var detectionTimer: Timer? | |
@State var portalEntity: Entity? | |
@State var maxRadius: Float = 0 | |
@State var portalTransform: simd_float4x4? | |
@State var animationTimer: Timer? |
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 | |
#Preview("Window View") { | |
ImagePlaneView() | |
} | |
#Preview("RealityView") { | |
ImagePlaneRealityView() | |
} |
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 ImmersivePreviewExample: View { | |
var body: some View { | |
RealityView { content in | |
let meshResource = MeshResource.generatePlane(width: 2.0, height: 2.0) | |
let entity = Entity() | |
let modelComponent = ModelComponent(mesh: meshResource, materials: [SimpleMaterial(color: .yellow, roughness: 1.0, isMetallic: false)]) | |
entity.components.set(modelComponent) |
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 SphereMeshTextureComparisonView: View { | |
let latitudeBands = 128 | |
let longitudeBands = 80 | |
let radius: Float = 0.1 | |
// Metal-related properties | |
let device: MTLDevice |
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 AVFoundation | |
import SwiftUI | |
import RealityKit | |
#Preview { LightBeamSynthView() } | |
struct LightBeamSynthView: View { | |
@Environment(\.physicalMetrics) var physicalMetrics | |
@State var outerCylinderEntity: Entity? | |
@State var innerCylinderEntity: Entity? | |
@State var touchEntity: 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 SwiftUI | |
import RealityKit | |
struct CylinderWiggleMeshView: View { | |
let radialSegments = 16 | |
let heightSegments = 5 | |
let animationStepAmount: Float = 0.05 | |
let radius: Float = 0.005 | |
let height: Float = 0.15 | |
let displacementRange: Float = 0.005 |