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); }
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); }
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)); }
public FXListView(DiagnosticViewContext context, FXList fxList) : base(context) { _renderedView = AddDisposable(new RenderedView(context)); fxList.Execute( new FXListExecutionContext( Quaternion.Identity, Vector3.Zero, _renderedView.Scene.GameContext)); }
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); } }
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; }
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; }
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); }
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); }
public SoundView(DiagnosticViewContext context, string filePath) : base(context) { _source = AddDisposable(context.Game.Audio.GetStream(filePath)); }
public SoundView(DiagnosticViewContext context, AudioFile audioFile) : base(context) { _source = AddDisposable(context.Game.Audio.GetStream(audioFile.Entry)); }
protected AssetView(DiagnosticViewContext context) { Context = context; }
public TextureView(DiagnosticViewContext context, TextureAsset textureAsset) : base(context) { _texture = textureAsset; _textureViews = new Dictionary <TextureViewDescription, Veldrid.TextureView>(); }
public DefaultAssetView(DiagnosticViewContext context, BaseAsset asset) : base(context) { _asset = asset; }