Set CALayer as SCNMaterial's diffuse contents

不问归期 提交于 2019-12-03 06:27:45

New post on an old thread, but this day-in-age, it's possible to set the UIView itself as SCNMaterialProperty (diffuse) contents. Intention to support this feature is communicated directly from SceneKit engineering at Apple, though the documentation has not yet been updated to reflect it.

To tied back to the original post, do not set a UIView.layer as material property contents; instead set contents to the UIView itself.

The SceneKit docs pretty strongly suggest that, while there are cases where you can use animated CALayers as material content, that doesn't include UIView layers:

SceneKit cannot use a layer that is already being displayed elsewhere (for example, the backing layer of a UIView object).

That suggests that if you want to make animated content for your material, you're better off with either Core Animation used entirely on its own or SpriteKit.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!