Пример #1
0
 public void AddRenderItemToView(SceneActor renderItem)
 {
     if (VisualFactory == null)
     {
         string viewPortName = "NAMENOTDEFINED";
         if (viewport.Name != null && viewport.Name != string.Empty)
         {
             viewPortName = viewport.Name;
         }
         Aegir.Util.DebugUtil.LogWithLocation($"No visual factory provided for viewport {viewPortName}");
     }
     else
     {
         Visual3D visual = VisualFactory.GetVisual(RenderMode, renderItem);
         AddVisual(visual, renderItem.Transform);
     }
 }
Пример #2
0
        private void RenderMeshBehaviour(MeshBehaviour renderBehaviour, LibTransform transform)
        {
            if (renderBehaviour == null)
            {
                throw new ArgumentNullException($"Could not render Mesh {nameof(renderBehaviour)} was null");
            }
            if (transform == null)
            {
                throw new ArgumentNullException($"Could not render Mesh {nameof(transform)} was null");
            }
            DebugUtil.LogWithLocation($"Rendering MeshBehaviour: {transform.Parent.Name}");
            MeshGeometry3D geometry = meshFactory.GetGeometry(renderBehaviour.Mesh.Data);
            SceneActor     actor    = new SceneActor(geometry, transform);

            for (int i = 0, l = viewports.Count; i < l; i++)
            {
                viewports[i].RenderActor(actor);
            }
        }
Пример #3
0
        private void RenderEntity(EntityViewModel entity)
        {
            foreach (EntityViewModel child in entity.Children)
            {
                RenderEntity(child);
            }
            DebugUtil.LogWithLocation($"Rendering entity: {entity.Name}");
            LibTransform  transformBehaviour = entity.GetEntityComponent <LibTransform>();
            MeshBehaviour renderBehaviour    = entity.GetEntityComponent <MeshBehaviour>();

            if (renderBehaviour != null)
            {
                renderBehaviours.Add(renderBehaviour);
                renderBehaviour.MeshChanged += RenderBehaviour_MeshChanged;
                if (renderBehaviour?.Mesh?.Data != null)
                {
                    RenderMeshBehaviour(renderBehaviour, transformBehaviour);
                }
                else
                {
                    SceneActor actor = new SceneActor(null, transformBehaviour);
                    for (int i = 0, l = viewports.Count; i < l; i++)
                    {
                        viewports[i].RenderActor(actor);
                    }
                }
            }
            else
            {
                DebugUtil.LogWithLocation($"No meshdata present for:{entity.Name} ");
                //No meshdata, lets show a dummy
                SceneActor actor = new SceneActor(null, transformBehaviour);
                for (int i = 0, l = viewports.Count; i < l; i++)
                {
                    viewports[i].RenderActor(actor);
                }
            }
        }