Skip to content

Commit e3b9509

Browse files
committed
Update to snapshot 13681046
1 parent 2ec422c commit e3b9509

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
val snapshotVersion : String? = "13663278"
1+
val snapshotVersion : String? = "13681046"
22

33
pluginManagement {
44
repositories {

xr/src/main/java/com/example/xr/scenecore/Environments.kt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,42 @@ private class Environments(val session: Session) {
4444
// [START androidxr_scenecore_environment_setEnvironmentPreference]
4545
val spatialEnvironmentPreference =
4646
SpatialEnvironment.SpatialEnvironmentPreference(lightingForSkybox, environmentGeometry)
47-
val preferenceResult =
48-
session.scene.spatialEnvironment.setSpatialEnvironmentPreference(spatialEnvironmentPreference)
49-
if (preferenceResult == SpatialEnvironment.SetSpatialEnvironmentPreferenceChangeApplied()) {
47+
session.scene.spatialEnvironment.preferredSpatialEnvironment = spatialEnvironmentPreference
48+
if (session.scene.spatialEnvironment.isPreferredSpatialEnvironmentActive) {
5049
// The environment was successfully updated and is now visible, and any listeners
5150
// specified using addOnSpatialEnvironmentChangedListener will be notified.
52-
} else if (preferenceResult == SpatialEnvironment.SetSpatialEnvironmentPreferenceChangePending()) {
53-
// The environment is in the process of being updated. Once visible, any listeners
54-
// specified using addOnSpatialEnvironmentChangedListener will be notified.
55-
}
51+
} else {
52+
// The passthrough opacity preference was successfully set, but not
53+
// immediately visible. The passthrough opacity change will be applied
54+
// when the activity has the SPATIAL_CAPABILITY_APP_ENVIRONMENT capability.
55+
// Then, any listeners specified using addOnSpatialEnvironmentChangedListener
56+
// will be notified.
57+
}
5658
// [END androidxr_scenecore_environment_setEnvironmentPreference]
5759
}
5860

5961
@Suppress("RestrictedApi") // b/416066566
6062
fun setPassthroughOpacityPreference() {
6163
// [START androidxr_scenecore_environment_setPassthroughOpacityPreference]
62-
val preferenceResult = session.scene.spatialEnvironment.setPassthroughOpacityPreference(1.0f)
63-
if (preferenceResult == SpatialEnvironment.SetPassthroughOpacityPreferenceChangeApplied()) {
64+
session.scene.spatialEnvironment.preferredPassthroughOpacity = 1.0f
65+
if (session.scene.spatialEnvironment.currentPassthroughOpacity == 1.0f) {
6466
// The passthrough opacity request succeeded and should be visible now, and any listeners
65-
// specified using addOnPassthroughOpacityChangedListener will be notified
66-
} else if (preferenceResult == SpatialEnvironment.SetPassthroughOpacityPreferenceChangePending()) {
67+
// specified using addOnPassthroughOpacityChangedListener will be notified.
68+
} else {
6769
// The passthrough opacity preference was successfully set, but not
6870
// immediately visible. The passthrough opacity change will be applied
6971
// when the activity has the
7072
// SpatialCapabilities.SPATIAL_CAPABILITY_PASSTHROUGH_CONTROL capability.
7173
// Then, any listeners specified using addOnPassthroughOpacityChangedListener
72-
// will be notified
74+
// will be notified.
7375
}
7476
// [END androidxr_scenecore_environment_setPassthroughOpacityPreference]
7577
}
7678

7779
@Suppress("RestrictedApi") // b/416066566
7880
fun getCurrentPassthroughOpacity() {
7981
// [START androidxr_scenecore_environment_getCurrentPassthroughOpacity]
80-
val currentPassthroughOpacity = session.scene.spatialEnvironment.getCurrentPassthroughOpacity()
82+
val currentPassthroughOpacity = session.scene.spatialEnvironment.currentPassthroughOpacity
8183
// [END androidxr_scenecore_environment_getCurrentPassthroughOpacity]
8284
}
8385
}

xr/src/main/java/com/example/xr/scenecore/SpatialCapabilities.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fun checkMultipleCapabilities(xrSession: Session) {
2828
SpatialCapabilities.SPATIAL_CAPABILITY_PASSTHROUGH_CONTROL
2929
)
3030
) {
31-
xrSession.scene.spatialEnvironment.setPassthroughOpacityPreference(0f)
31+
xrSession.scene.spatialEnvironment.preferredPassthroughOpacity = 1f
3232
}
3333
// Example 2: multiple capability flags can be checked simultaneously:
3434
if (xrSession.scene.spatialCapabilities.hasCapability(

0 commit comments

Comments
 (0)