Exemplo n.º 1
0
        private ProjectionGraph BuildProjectionGraph()
        {
            var graph = new ProjectionGraph();

            foreach (IView view in Views)
            {
                if (view.Camera == null)
                {
                    continue;
                }

                var viewVertex = new ViewVertex(view);
                graph.AddViewVertex(view, viewVertex);

                ISceneNode viewSceneRoot = view.GetSceneNode().RootNode();
                if (viewSceneRoot != null)
                {
                    SceneVertex viewSceneVertex = graph.GetSceneVertex(viewSceneRoot);
                    if (viewSceneVertex == null)
                    {
                        viewSceneVertex = new SceneVertex(viewSceneRoot);
                        graph.AddSceneVertex(viewSceneRoot, viewSceneVertex);
                    }

                    new SceneToViewEdge().Link(viewSceneVertex, viewVertex);
                }

                ISceneNode  cameraSceneRoot   = view.Camera.GetSceneNode().RootNode();
                SceneVertex cameraSceneVertex = graph.GetSceneVertex(cameraSceneRoot);
                if (cameraSceneVertex == null)
                {
                    cameraSceneVertex = new SceneVertex(cameraSceneRoot);
                    graph.AddSceneVertex(cameraSceneRoot, cameraSceneVertex);
                }

                new ViewToSceneEdge().Link(viewVertex, cameraSceneVertex);
            }

            return(graph);
        }
Exemplo n.º 2
0
 public void AddViewVertex(IView view, ViewVertex vertex) => _viewVertices[view] = vertex;