예제 #1
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);
                }
            }
        }
예제 #2
0
 internal void CameraFollow(EntityViewModel selectedItem)
 {
     AegirLib.Behaviour.World.Transform transform = selectedItem.GetEntityComponent <AegirLib.Behaviour.World.Transform>();
     //viewports[1].FollowTransform = transform;
 }