sceneview-android icon indicating copy to clipboard operation
sceneview-android copied to clipboard

Make ViewNode2 works

Open ThibaudM opened this issue 5 months ago • 0 comments

Hello,

Is it possible to have a working sample of the use of ViewNode2? It seems the code below almost works but it stops here because the texture stream is never updated.

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    val sceneView: SceneView = view.findViewById(R.id.sceneView)

    val windowManager = SceneView.createViewNodeManager(requireContext())
    sceneView.lifecycle = lifecycle
    sceneView.viewNodeWindowManager = windowManager

    val textView = TextView(context).apply {
        text = "Foobar"
        setTextColor(Color.BLACK)
        setBackgroundColor(Color.WHITE)
    }
    val node = ViewNode2(sceneView.engine, windowManager, sceneView.materialLoader, textView)
    sceneView.addChildNode(node)
    node.position = Float3(0f, 0f, -1f)
}

Screenshot_20241002-125338

ThibaudM avatar Oct 02 '24 11:10 ThibaudM