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 IncrementallyUpdatingMultiPartData { | |
var settings: IncrementallyUpdatingMultiPartSettings | |
// Mesh buffer offsets (set once during initialization) | |
var vertexOffset: Int = 0 | |
var indexOffset: Int = 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 RealityKit | |
import SwiftUI | |
struct MultiPartMeshView: View { | |
let radius: Float = 0.25 | |
var body: some View { | |
RealityView { content in | |
if let mesh = try? createMesh(), | |
let resource = try? MeshResource(from: mesh) |
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 | |
struct BranchSegment { | |
var startPosition: SIMD3<Float> | |
var endPosition: SIMD3<Float> | |
var radius: Float | |
init(startPosition: SIMD3<Float>, endPosition: SIMD3<Float>, radius: Float) { | |
self.startPosition = startPosition | |
self.endPosition = endPosition |
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 MorphingSpherePlaneParams_h | |
#define MorphingSpherePlaneParams_h | |
struct MorphingSpherePlaneParams { | |
int latitudeBands; | |
int longitudeBands; | |
float radius; | |
float morphAmount; | |
}; |
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 MorphingSpherePlaneParams_h | |
#define MorphingSpherePlaneParams_h | |
struct MorphingSpherePlaneParams { | |
int latitudeBands; | |
int longitudeBands; | |
float radius; | |
float morphAmount; | |
}; |
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 | |
struct Branch { | |
var segments: [BranchSegment] = [] | |
var dynamicSegment: BranchSegment? // the end of the branch that's currently growing | |
var completedSegments: Int = 0 | |
var currentGrowthProgress: Float = 0.0 | |
var isActive: Bool = true | |
var branchId: UUID = UUID() | |
var parentBranchId: UUID? |
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? |
NewerOlder