我正在关注关于在 SceneView 中将 Light 添加到节点的 google 开发人员指南:
https://developers.google.com/sceneform/develop/build-scene
Light spotLightYellow =
Light.builder(this, Light.Type.FOCUSED_SPOTLIGHT)
.setColor(new Color(android.graphics.Color.YELLOW))
.setShadowCastingEnabled(true)
.build();
但是,它似乎对我的渲染模型没有任何作用。
还有什么我想念的吗?
ModelRenderable.builder()
.setSource(
this,
Uri.parse(card)
)
.build()
.thenAccept(
modelRenderable -> {
node.setParent(scene);
node.setLocalPosition(vector3);
node.setLocalScale(new Vector3(1.4f, 1.4f, 1.4f));
node.setName("Test");
Light light =
Light.builder(Light.Type.FOCUSED_SPOTLIGHT)
.setColor(new Color(android.graphics.Color.YELLOW))
.setShadowCastingEnabled(true)
.build();
node.setLight(light);
node.setRenderable(modelRenderable);
})
.exceptionally(
throwable -> {
Toast toast =
Toast.makeText(this, "Unable to load Fox renderable" + throwable, Toast.LENGTH_LONG);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
return null;
});