Exemplo n.º 1
0
        private void AddRenderable(Entity entity, MetaModel renderableEntity)
        {
            if (!IsVisible(renderableEntity, Renderer.Settings))
            {
                return;
            }

            var model = Scene.View.Content.Acquire <Model9>(renderableEntity);

            renderableEntity.MetaModelChanged += new EventHandler(SortedTestSceneRendererConnector_MetaModelChanged);

            metaModelIdToEntity.Add(renderableEntity.InstanceID, entity);

            resources[entity].Add(renderableEntity.InstanceID,
                                  new Common.Tuple <Model9, MetaResource <Model9, Model10> >(
                                      model, (MetaResource <Model9, Model10>)renderableEntity.Clone()));

            Graphics.Renderer.Renderer.EntityAnimation ea = null;
            if (model.SkinnedMesh != null)
            {
                ea = Scene.View.Content.Acquire <Graphics.Renderer.Renderer.EntityAnimation>(entity.MetaEntityAnimation);
                ea.Update(model, 0.01f, ((MetaModel)renderableEntity).GetWorldMatrix(Scene.Camera, entity));
                EntityAnimations.Add(entity, ea);
                ((MetaModel)renderableEntity).StoredFrameMatrices = ea.StoredFrameMatrices;
            }

            Renderer.Add(entity, renderableEntity, model, renderableEntity.InstanceID);
        }
Exemplo n.º 2
0
        public static MetaModel MergeMeta(DescModel desc, MetaModel meta, bool replace = false)
        {
            if (desc == null)
            {
                throw new ApplicationException("File .desc was not specified.");
            }
            if (meta == null)
            {
                throw new ApplicationException("File .nmeta was not specified.");
            }
            if (desc.Default == null)
            {
                throw new ApplicationException("Default was not specified within the file .desc.");
            }

            desc.Default.CheckReadSuccess();

            MetaModel mMeta = replace ? meta : (MetaModel)meta.Clone();

            if (string.IsNullOrEmpty(mMeta.Core.Is64BitInstruction))
            {
                mMeta.Core.Is64BitInstruction = desc.Default.Is64BitInstruction;
            }
            if (string.IsNullOrEmpty(mMeta.Core.ProcessAddressSpace))
            {
                mMeta.Core.ProcessAddressSpace = desc.Default.ProcessAddressSpace;
            }
            if (string.IsNullOrEmpty(mMeta.Core.MainThreadPriority))
            {
                mMeta.Core.MainThreadPriority = desc.Default.MainThreadPriority;
            }
            if (string.IsNullOrEmpty(mMeta.Core.MainThreadCoreNumber))
            {
                mMeta.Core.MainThreadCoreNumber = desc.Default.MainThreadCoreNumber;
            }
            if (string.IsNullOrEmpty(mMeta.Core.MainThreadStackSize))
            {
                mMeta.Core.MainThreadStackSize = desc.Default.MainThreadStackSize;
            }
            if (string.IsNullOrEmpty(mMeta.Core.SystemResourceSize))
            {
                mMeta.Core.SystemResourceSize = "0x0";
            }
            if (string.IsNullOrEmpty(mMeta.Core.Version))
            {
                mMeta.Core.Version = "0";
            }
            if (string.IsNullOrEmpty(mMeta.Core.Name))
            {
                mMeta.Core.Name = "Application";
            }
            //if (string.IsNullOrEmpty(meta.Core.ProductCode)) meta.Core.ProductCode = string.Empty;

            return(mMeta);
        }
        private void AddRenderable(Entity entity, MetaModel renderableEntity)
        {
            if (!IsVisible(renderableEntity, Renderer.Settings)) return;

            var model = Scene.View.Content.Acquire<Model9>(renderableEntity);
            renderableEntity.MetaModelChanged += new EventHandler(SortedTestSceneRendererConnector_MetaModelChanged);

            metaModelIdToEntity.Add(renderableEntity.InstanceID, entity);

            resources[entity].Add(renderableEntity.InstanceID,
                new Common.Tuple<Model9, MetaResource<Model9, Model10>>(
                    model, (MetaResource<Model9, Model10>)renderableEntity.Clone()));

            Graphics.Renderer.Renderer.EntityAnimation ea = null;
            if (model.SkinnedMesh != null)
            {
                ea = Scene.View.Content.Acquire<Graphics.Renderer.Renderer.EntityAnimation>(entity.MetaEntityAnimation);
                ea.Update(model, 0.01f, ((MetaModel)renderableEntity).GetWorldMatrix(Scene.Camera, entity));
                EntityAnimations.Add(entity, ea);
                ((MetaModel)renderableEntity).StoredFrameMatrices = ea.StoredFrameMatrices;
            }

            Renderer.Add(entity, renderableEntity, model, renderableEntity.InstanceID);
        }