[英]How Disable ARcore Sceneform Lighting?
Base on ARcore Develop Guide ( Lighting Estimation developer guide for Android ), I am trying disable the light in the Scenceform.基于 ARcore Develop Guide( Lighting Estimation developer guide for Android ),我正在尝试禁用 Scenceform 中的灯光。 But nothing happen.但什么也没有发生。
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);
}
The problem looks like I can not get the context session, science I got error " E/ARCore-AuthenticationManager: Exception during AuthenticationManager construction: com.google.android.gms.common.GoogleApiAvailability java.lang.ClassNotFoundException: com.google.android.gms.common.GoogleApiAvailability"问题看起来像我无法获得上下文会话,科学我得到错误“E/ARCore-AuthenticationManager:AuthenticationManager 构造期间的异常:com.google.android.gms.common.GoogleApiAvailability java.lang.ClassNotFoundException:com.google.android .gms.common.GoogleApiAvailability”
You should get your current session and change it instead, try this:您应该获取当前会话并进行更改,请尝试以下操作:
class AppArFragment : ArFragment() {
fun disableLight() {
arSceneView.session?.apply {
val changedConfig = config
changedConfig.lightEstimationMode = Config.LightEstimationMode.DISABLED
configure(changedConfig)
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.