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
private void updateRegionNodes() { | |
if (augmentedFace == null) { | |
return; | |
} | |
Pose centerPose = augmentedFace.getCenterPose(); | |
faceRegionNode.setWorldPosition(new Vector3(centerPose.tx(), centerPose.ty(), centerPose.tz())); | |
// Rotate the bones by 180 degrees because the .fbx template's coordinate system is |
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
IndirectLight buildIndirectLight() { | |
Preconditions.checkNotNull(irradianceData, "\"irradianceData\" was null."); | |
Preconditions.checkState( | |
irradianceData.length >= FLOATS_PER_VECTOR, | |
"\"irradianceData\" does not have enough components to store a vector"); | |
if (reflectCubemap == null) { | |
throw new IllegalStateException("reflectCubemap is null."); | |
} |
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
<uses-permission android:name="android.permission.CAMERA" /> | |
<application> | |
… | |
<meta-data android:name="com.google.ar.core" android:value="optional" /> | |
</application> |
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
<androidx.fragment.app.FragmentContainerView | |
android:id="@+id/arFragment" | |
android:name="com.google.ar.sceneform.ux.ArFragment" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" /> |
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
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
// Load model.glb from assets folder or http url | |
(supportFragmentManager.findFragmentById(R.id.arFragment) as ArFragment) | |
.setOnTapPlaneGlbModel("model.glb") | |
} |
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
dependencies { | |
implementation("com.gorisse.thomas.sceneform:sceneform:1.20.1") | |
} |
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
val View.lifecycleOwner: LifecycleOwner | |
get() = getTag(R.id.view_lifecycle_owner) as? LifecycleOwner ?: object : LifecycleOwner, | |
LifecycleEventObserver { | |
private val lifecycle = LifecycleRegistry(this) | |
init { | |
doOnAttach { | |
findViewTreeLifecycleOwner()?.lifecycle?.addObserver(this) | |
} | |
doOnDetach { |
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
val View.lifecycle get() = lifecycleOwner.lifecycle | |
val View.lifecycleScope get() = lifecycleOwner.lifecycleScope |
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
dependencies { | |
implementation "com.gorisse.thomas:android-view-lifecycle:1.0.1" | |
} |
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
view.lifecycle.addObserver(onResume = { | |
refreshData() | |
}) |
OlderNewer