Example #1
0
        public ParticleSystemView(DiagnosticViewContext context, FXParticleSystemTemplate particleSystemTemplate)
            : base(context)
        {
            var game = context.Game;

            var particleSystem = AddDisposable(new ParticleSystem(
                                                   particleSystemTemplate,
                                                   game.AssetStore.LoadContext,
                                                   () => ref WorldIdentity));

            void OnUpdating(object sender, GameUpdatingEventArgs e)
            {
                particleSystem.Update(e.GameTime);
            }

            game.Updating += OnUpdating;

            AddDisposeAction(() => game.Updating -= OnUpdating);

            particleSystem.Activate();

            _renderedView = AddDisposable(new RenderedView(context));

            void onBuildingRenderList(object sender, BuildingRenderListEventArgs e)
            {
                particleSystem.BuildRenderList(e.RenderList);
            }

            _renderedView.RenderPipeline.BuildingRenderList += onBuildingRenderList;

            AddDisposeAction(() => _renderedView.RenderPipeline.BuildingRenderList -= onBuildingRenderList);
        }
Example #2
0
        public ModelView(DiagnosticViewContext context, Model model)
            : base(context)
        {
            _modelInstance = AddDisposable(model.CreateInstance(context.Game.AssetStore.LoadContext));
            _modelInstance.Update(TimeInterval.Zero);

            var enclosingBoundingBox = GetEnclosingBoundingBox(_modelInstance);

            _renderedView = AddDisposable(new RenderedView(
                                              context,
                                              enclosingBoundingBox.GetCenter(),
                                              Vector3.Distance(enclosingBoundingBox.Min, enclosingBoundingBox.Max)));

            void OnBuildingRenderList(object sender, BuildingRenderListEventArgs e)
            {
                _modelInstance.SetWorldMatrix(Matrix4x4.Identity);
                _modelInstance.BuildRenderList(
                    e.RenderList,
                    e.Camera,
                    true,
                    new MeshShaderResources.RenderItemConstantsPS
                {
                    HouseColor = Vector3.One,
                    Opacity    = 1.0f
                });
            }

            _renderedView.RenderPipeline.BuildingRenderList += OnBuildingRenderList;
            AddDisposeAction(() => _renderedView.RenderPipeline.BuildingRenderList -= OnBuildingRenderList);
        }
Example #3
0
        public MappedImageView(DiagnosticViewContext context, MappedImage mappedImageAsset)
            : base(context)
        {
            _texture = MappedImageUtility.CreateTexture(context.Game.GraphicsLoadContext, mappedImageAsset);
            var textureViewDescription = new TextureViewDescription(_texture, 0, 1, 0, 1);

            _textureView = AddDisposable(Context.Game.GraphicsDevice.ResourceFactory.CreateTextureView(ref textureViewDescription));
        }
Example #4
0
        public FXListView(DiagnosticViewContext context, FXList fxList)
            : base(context)
        {
            _renderedView = AddDisposable(new RenderedView(context));

            fxList.Execute(
                new FXListExecutionContext(
                    Quaternion.Identity,
                    Vector3.Zero,
                    _renderedView.Scene.GameContext));
        }
Example #5
0
        public static AssetView CreateAssetView(DiagnosticViewContext context, object asset)
        {
            switch (asset)
            {
            case Model m: return(new ModelView(context, m));

            case Texture t: return(new TextureView(context, t));

            default: return(null);
            }
        }
Example #6
0
        public GameObjectView(DiagnosticViewContext context, ObjectDefinition objectDefinition)
            : base(context)
        {
            _renderedView = AddDisposable(new RenderedView(context,
                                                           createGameObjects: gameObjects =>
            {
                _gameObject = gameObjects.Add(objectDefinition, context.Game.CivilianPlayer);
            }));

            _modelConditionStates = _gameObject.ModelConditionStates.ToList();
            _selectedIndex        = 0;
        }
Example #7
0
        public GameObjectView(DiagnosticViewContext context, ObjectDefinition objectDefinition)
            : base(context)
        {
            _renderedView = AddDisposable(new RenderedView(context,
                                                           createGameObjects: gameObjects =>
            {
                _gameObject = gameObjects.Add(objectDefinition);
                gameObjects.InsertCreated();
            }));

            _modelConditionStates = _gameObject.Drawable.ModelConditionStates.ToList();
            _selectedIndex        = 0;
        }
Example #8
0
        public ParticleSystemView(DiagnosticViewContext context, FXParticleSystemTemplate particleSystemTemplate)
            : base(context)
        {
            var game = context.Game;

            var particleSystem = AddDisposable(new ParticleSystem(
                                                   game.ContentManager,
                                                   particleSystemTemplate,
                                                   () => ref WorldIdentity));

            _renderedView = AddDisposable(new RenderedView(context));

            void onBuildingRenderList(object sender, BuildingRenderListEventArgs e)
            {
                particleSystem.BuildRenderList(e.RenderList, e.GameTime);
            }

            _renderedView.RenderPipeline.BuildingRenderList += onBuildingRenderList;

            AddDisposeAction(() => _renderedView.RenderPipeline.BuildingRenderList -= onBuildingRenderList);
        }
Example #9
0
        public ModelView(DiagnosticViewContext context, Model model)
            : base(context)
        {
            _modelInstance = AddDisposable(model.CreateInstance(context.Game.ContentManager));
            _modelInstance.Update(TimeInterval.Zero);

            var enclosingBoundingBox = GetEnclosingBoundingBox(_modelInstance);

            _renderedView = AddDisposable(new RenderedView(
                                              context,
                                              enclosingBoundingBox.GetCenter(),
                                              Vector3.Distance(enclosingBoundingBox.Min, enclosingBoundingBox.Max)));

            void OnBuildingRenderList(object sender, BuildingRenderListEventArgs e)
            {
                _modelInstance.SetWorldMatrix(Matrix4x4.Identity);
                _modelInstance.BuildRenderList(e.RenderList, e.Camera, true, context.Game.CivilianPlayer);
            }

            _renderedView.RenderPipeline.BuildingRenderList += OnBuildingRenderList;
            AddDisposeAction(() => _renderedView.RenderPipeline.BuildingRenderList -= OnBuildingRenderList);
        }
Example #10
0
 public SoundView(DiagnosticViewContext context, string filePath)
     : base(context)
 {
     _source = AddDisposable(context.Game.Audio.GetStream(filePath));
 }
Example #11
0
 public SoundView(DiagnosticViewContext context, AudioFile audioFile)
     : base(context)
 {
     _source = AddDisposable(context.Game.Audio.GetStream(audioFile.Entry));
 }
Example #12
0
 protected AssetView(DiagnosticViewContext context)
 {
     Context = context;
 }
Example #13
0
 public TextureView(DiagnosticViewContext context, TextureAsset textureAsset)
     : base(context)
 {
     _texture      = textureAsset;
     _textureViews = new Dictionary <TextureViewDescription, Veldrid.TextureView>();
 }
Example #14
0
 public DefaultAssetView(DiagnosticViewContext context, BaseAsset asset)
     : base(context)
 {
     _asset = asset;
 }