Skip to content
Lunci edited this page Jul 21, 2022 · 2 revisions

Entire scene graph (SceneNode types only) can be built in separate thread. UI thread is still needed to attach the new scene onto the Viewport3DX. One simple example is following:

                Task.Run(() =>
                {
                    var sceneRoot = BuildSomeScene();
                    sceneRoot.Attach(EffectsManager); // Pre-Attach
                    return scene;
                }).ContinueWith((x) =>
                {
                    groupNode.AddChildNode(x.Result);
                }, TaskScheduler.FromCurrentSynchronizationContext());

where groupNode is an existing node being attached onto a viewport.

sceneRoot.Attach(EffectsManager); is being used to initialize all the graphics resources for the new scene in separate thread, so it won't cause any latency issue while being adding back to groupNode in UI thread. This feature is being introduced in v2.22.