gpt4 book ai didi

java - 如何禁用 ARcore Sceneform Lighting?

转载 作者:行者123 更新时间:2023-11-30 04:56:28 26 4
gpt4 key购买 nike

基于 ARcore 开发指南 ( Lighting Estimation developer guide for Android ),我正在尝试禁用 Scenceform 中的灯光。但什么也没发生。

 arFragment.setOnTapArPlaneListener(
(HitResult hitResult, Plane plane, MotionEvent motionEvent) -> {
if (objectRenderable == null) return;
// Create the Anchor.
Anchor anchor = hitResult.createAnchor();
AnchorNode anchorNode = new AnchorNode(anchor);
anchorNode.setParent(arFragment.getArSceneView().getScene());
anchorNode.setSmoothed(true);
objectRenderable.setShadowReceiver(false);
objectRenderable.setShadowCaster(false);
updateLight();
TransformableNode transformableNode = new TransformableNode(arFragment.getTransformationSystem());
transformableNode.getScaleController().setMaxScale(15.0f);
transformableNode.getScaleController().setMinScale(1.0f);
transformableNode.setParent(anchorNode);
transformableNode.setRenderable(objectRenderable);
transformableNode.select();
});

private void updateLight() {
Session session = new Session(this);
// Configure the session with the Lighting Estimation API turned off.
Config config = session.getConfig();
config.setLightEstimationMode(Config.LightEstimationMode.DISABLED);
session.configure(config);
}

问题看起来我无法获得上下文 session ,科学我得到错误“E/ARCore-AuthenticationManager:AuthenticationManager 构造期间的异常:com.google.android.gms.common.GoogleApiAvailability java.lang.ClassNotFoundException: com.google.android.gms.common.GoogleApiAvailability"

最佳答案

您应该获取当前 session 并更改它,试试这个:

class AppArFragment : ArFragment() {
fun disableLight() {
arSceneView.session?.apply {
val changedConfig = config
changedConfig.lightEstimationMode = Config.LightEstimationMode.DISABLED
configure(changedConfig)
}
}
}

关于java - 如何禁用 ARcore Sceneform Lighting?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59057352/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com