Skip to content

Commit

Permalink
first round of beta fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvongerlach committed Sep 4, 2023
1 parent 2eaf64a commit f83ccad
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 43 deletions.
71 changes: 36 additions & 35 deletions GenerativeWallArt/ImmersiveView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,45 +102,46 @@ struct ImmersiveView: View {
}
update: { _, _ in
} attachments: {
VStack {
Text(inputText)
.frame(maxWidth: 600, alignment: .leading)
.font(.extraLargeTitle2)
.fontWeight(.regular)
.padding(40)
.glassBackgroundEffect()
if showAttachmentButtons {
HStack(spacing: 20) {
Button(action: {
tapSubject.send()
}) {
Text("Yes, let's go!")
.font(.largeTitle)
.fontWeight(.regular)
.padding()
.cornerRadius(8)
Attachment(id: "red_e") {
VStack {
Text(inputText)
.frame(maxWidth: 600, alignment: .leading)
.font(.extraLargeTitle2)
.fontWeight(.regular)
.padding(40)
.glassBackgroundEffect()
if showAttachmentButtons {
HStack(spacing: 20) {
Button(action: {
tapSubject.send()
}) {
Text("Yes, let's go!")
.font(.largeTitle)
.fontWeight(.regular)
.padding()
.cornerRadius(8)
}
.padding()
.buttonStyle(.bordered)

Button(action: {
// Action for No button
}) {
Text("No")
.font(.largeTitle)
.fontWeight(.regular)
.padding()
.cornerRadius(8)
}
.padding()
.buttonStyle(.bordered)
}
.padding()
.buttonStyle(.bordered)

Button(action: {
// Action for No button
}) {
Text("No")
.font(.largeTitle)
.fontWeight(.regular)
.padding()
.cornerRadius(8)
}
.padding()
.buttonStyle(.bordered)
.glassBackgroundEffect()
.opacity(showAttachmentButtons ? 1 : 0)
}
.glassBackgroundEffect()
.opacity(showAttachmentButtons ? 1 : 0)
}
.opacity(showTextField ? 1 : 0)
}
.tag("red_e")
.opacity(showTextField ? 1 : 0)
}
.gesture(SpatialTapGesture().targetedToAnyEntity().onEnded {
_ in
Expand Down
4 changes: 2 additions & 2 deletions GenerativeWallArt/ImpactParticleSystem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ struct ImpactParticleSystem: System {

func update(context: SceneUpdateContext) {
// get projectile
var iter = context.entities(matching: Self.projectileQuery, when: .rendering).makeIterator()
var iter = context.entities(matching: Self.projectileQuery, updatingSystemWhen: .rendering).makeIterator()
guard let projectile = iter.next() else { return }
guard var projectileComponent = projectile.components[ProjectileComponent.self] else { return }

// if it's time for a burst
if !projectileComponent.bursted && projectileComponent.canBurst {
// look for impact particles using the particle query
for p in context.entities(matching: Self.particleQuery, when: .rendering) {
for p in context.entities(matching: Self.particleQuery, updatingSystemWhen: .rendering) {
if p.name == "ImpactParticle" {
p.components[ParticleEmitterComponent.self]?.burst()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public struct BillboardSystem: System {
let entities = context.scene.performQuery(Self.query).map({ $0 })

guard !entities.isEmpty,
let pose = worldTrackingProvider.queryPose(atTimestamp: CACurrentMediaTime()) else { return }
let pose = worldTrackingProvider.queryDeviceAnchor(atTimestamp: CACurrentMediaTime()) else { return }

let cameraTransform = Transform(matrix: pose.originFromDeviceTransform)
let cameraTransform = Transform(matrix: pose.originFromAnchorTransform)
for entity in entities {

let translation = entity.transform.translation
Expand Down Expand Up @@ -67,10 +67,11 @@ public struct BillboardSystem: System {
content.add(entity)
}
} attachments: {
Text("Preview")
.font(.system(size: 100))
.background(.pink)
.tag("previewTag")
Attachment(id: "previewTag") {
Text("Preview")
.font(.system(size: 100))
.background(.pink)
}
}
.previewLayout(.sizeThatFits)
}

0 comments on commit f83ccad

Please sign in to comment.