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 | |
#Preview("TileFloorSinglePlaneRealityView") { | |
TileFloorSinglePlaneRealityView() | |
} | |
struct TileFloorSinglePlaneRealityView: View { | |
var body: some View { | |
let gridSize = 1 |
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 | |
// Volume example | |
struct TileFloorRealityView: View { | |
let gridSize = 8 | |
var body: some View { | |
GeometryReader3D { proxy in | |
RealityView { content in |
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 PhysicallyBasedMaterialPickerView2: View { | |
@State var entity: ModelEntity? | |
@State var baseColorTextureResource: TextureResource? | |
@State var materialParameters: PhysicallyBasedMaterialParameters = PhysicallyBasedMaterialParameters() | |
var body: some View { | |
RealityView { content in |
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 PhysicallyBasedMaterialPickerView: View { | |
@State var entity: ModelEntity? | |
@State var materialParameters: PhysicallyBasedMaterialParameters = PhysicallyBasedMaterialParameters() | |
func generateEntity() -> ModelEntity { | |
let meshResource = MeshResource.generateSphere(radius: 0.2) | |
return ModelEntity(mesh: meshResource, materials: [getMaterial()]) |
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 LowLevelMeshRevealView: View { | |
@State var entity: ModelEntity? | |
@State var lowLevelMesh: LowLevelMesh? | |
@State var originalVertices: [VertexData] = [] | |
@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
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 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 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 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 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 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 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 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 | |
#Preview("Window View") { | |
ImagePlaneView() | |
} | |
#Preview("RealityView") { | |
ImagePlaneRealityView() | |
} |