From 2844c8b1ace6e738387b1d9bb3817b1ce049030f Mon Sep 17 00:00:00 2001 From: Glatzemann Date: Mon, 7 Nov 2011 11:26:19 +0000 Subject: [PATCH] worked on some ToDo's some more work on GraphicsDevice --- ANX.Framework/Graphics/GraphicsDevice.cs | 36 ++++++++++++------- .../GraphicsDeviceWindowsDX11_1.cs | 1 - Samples/SimpleSprite/Game1.cs | 4 --- Samples/TextRendering/Game1.cs | 6 ---- Samples/VertexIndexBuffer/Game1.cs | 15 -------- Samples/WindowsGame/Game1.cs | 12 ++----- 6 files changed, 26 insertions(+), 48 deletions(-) diff --git a/ANX.Framework/Graphics/GraphicsDevice.cs b/ANX.Framework/Graphics/GraphicsDevice.cs index c55e120c..ae28eae9 100644 --- a/ANX.Framework/Graphics/GraphicsDevice.cs +++ b/ANX.Framework/Graphics/GraphicsDevice.cs @@ -69,6 +69,8 @@ namespace ANX.Framework.Graphics private DepthStencilState depthStencilState; private GraphicsAdapter currentAdapter; private PresentationParameters currentPresentationParameters; + private bool isDisposed; + private GraphicsProfile graphicsProfile; #endregion // Private Members @@ -85,6 +87,7 @@ namespace ANX.Framework.Graphics public GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters) { this.currentAdapter = adapter; + this.graphicsProfile = graphicsProfile; this.currentPresentationParameters = presentationParameters; this.viewport = new Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight); @@ -162,13 +165,11 @@ namespace ANX.Framework.Graphics public void DrawUserPrimitives(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount) where T : struct, IVertexType { throw new NotImplementedException(); - //TODO: nativeDevice.DrawUserPrimitive(primitiveCount, vertexOffset); } public void DrawUserPrimitives(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct, IVertexType { throw new NotImplementedException(); - //TODO: nativeDevice.DrawUserPrimitive(primitiveCount, vertexOffset); } public void SetVertexBuffer(VertexBuffer vertexBuffer) @@ -248,7 +249,7 @@ namespace ANX.Framework.Graphics protected virtual void Dispose(Boolean disposeManaged) { - throw new NotImplementedException(); + //TODO: implement } public INativeGraphicsDevice NativeDevice @@ -365,7 +366,7 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.isDisposed; } } @@ -401,7 +402,7 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.graphicsProfile; } } @@ -409,7 +410,7 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.currentAdapter; } } @@ -417,7 +418,7 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.currentPresentationParameters; } } @@ -425,11 +426,14 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return DepthStencilState.ReferenceStencil; } set { - throw new NotImplementedException(); + if (DepthStencilState.ReferenceStencil != value) + { + DepthStencilState.ReferenceStencil = value; + } } } @@ -437,11 +441,14 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return BlendState.MultiSampleMask; } set { - throw new NotImplementedException(); + if (BlendState.MultiSampleMask != value) + { + BlendState.MultiSampleMask = value; + } } } @@ -449,11 +456,14 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return BlendState.BlendFactor; } set { - throw new NotImplementedException(); + if (BlendState.BlendFactor != value) + { + BlendState.BlendFactor = value; + } } } diff --git a/ANX.RenderSystem.Windows.DX11.1/GraphicsDeviceWindowsDX11_1.cs b/ANX.RenderSystem.Windows.DX11.1/GraphicsDeviceWindowsDX11_1.cs index b4376f05..63783d43 100644 --- a/ANX.RenderSystem.Windows.DX11.1/GraphicsDeviceWindowsDX11_1.cs +++ b/ANX.RenderSystem.Windows.DX11.1/GraphicsDeviceWindowsDX11_1.cs @@ -113,7 +113,6 @@ namespace ANX.RenderSystem.Windows.DX11_1 public void Clear(ref Color color) { - //TODO: DIRTY -> Convert Color without divisions throw new NotImplementedException(); //device.ClearRenderTargetView(renderView, new SharpDX.Color4(color.A / 255f, color.R / 255f, color.G / 255f, color.B / 255f)); } diff --git a/Samples/SimpleSprite/Game1.cs b/Samples/SimpleSprite/Game1.cs index 812380b9..5ccb4450 100644 --- a/Samples/SimpleSprite/Game1.cs +++ b/Samples/SimpleSprite/Game1.cs @@ -85,8 +85,6 @@ namespace WindowsGame1 /// protected override void Initialize() { - // TODO: Add your initialization logic here - base.Initialize(); } @@ -125,8 +123,6 @@ namespace WindowsGame1 if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); - // TODO: Add your update logic here - for (int i = 0; i < y.Length; i++) { y[i] += this.r.Next(100) * (float)gameTime.ElapsedGameTime.TotalSeconds; diff --git a/Samples/TextRendering/Game1.cs b/Samples/TextRendering/Game1.cs index f8420b62..e9db78f2 100644 --- a/Samples/TextRendering/Game1.cs +++ b/Samples/TextRendering/Game1.cs @@ -72,14 +72,11 @@ namespace TextRendering protected override void Initialize() { - // TODO: Fügen Sie Ihre Initialisierungslogik hier hinzu - base.Initialize(); } protected override void LoadContent() { - // Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann. spriteBatch = new SpriteBatch(GraphicsDevice); this.debugFont = Content.Load(@"Fonts/Debug"); @@ -87,12 +84,9 @@ namespace TextRendering protected override void Update(GameTime gameTime) { - // Ermöglicht ein Beenden des Spiels if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); - // TODO: Fügen Sie Ihre Aktualisierungslogik hier hinzu - base.Update(gameTime); } diff --git a/Samples/VertexIndexBuffer/Game1.cs b/Samples/VertexIndexBuffer/Game1.cs index f3bbd389..d05cf6f5 100644 --- a/Samples/VertexIndexBuffer/Game1.cs +++ b/Samples/VertexIndexBuffer/Game1.cs @@ -75,14 +75,11 @@ namespace VertexIndexBuffer protected override void Initialize() { - // TODO: Fügen Sie Ihre Initialisierungslogik hier hinzu - base.Initialize(); } protected override void LoadContent() { - // Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann. spriteBatch = new SpriteBatch(GraphicsDevice); miniTriEffect = Content.Load(@"Effects/MiniTri"); @@ -112,26 +109,14 @@ namespace VertexIndexBuffer ib.SetData(indices); } - protected override void UnloadContent() - { - // TODO: Entladen Sie jeglichen Nicht-ContentManager-Inhalt hier - } - protected override void Update(GameTime gameTime) { - // Ermöglicht ein Beenden des Spiels if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); - // TODO: Fügen Sie Ihre Aktualisierungslogik hier hinzu - base.Update(gameTime); } - /// - /// Dies wird aufgerufen, wenn das Spiel selbst zeichnen soll. - /// - /// Bietet einen Schnappschuss der Timing-Werte. protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); diff --git a/Samples/WindowsGame/Game1.cs b/Samples/WindowsGame/Game1.cs index e7c6555e..37a51f1b 100644 --- a/Samples/WindowsGame/Game1.cs +++ b/Samples/WindowsGame/Game1.cs @@ -79,8 +79,6 @@ namespace WindowsGame1 /// protected override void Initialize() { - // TODO: Add your initialization logic here - base.Initialize(); } @@ -91,7 +89,7 @@ namespace WindowsGame1 protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. - //spriteBatch = new SpriteBatch(GraphicsDevice); + spriteBatch = new SpriteBatch(GraphicsDevice); } /// @@ -100,8 +98,8 @@ namespace WindowsGame1 /// protected override void UnloadContent() { - // TODO: Unload any non ContentManager content here - } + + } /// /// Allows the game to run logic such as updating the world, @@ -116,8 +114,6 @@ namespace WindowsGame1 this.Exit(); } - // TODO: Add your update logic here - base.Update(gameTime); } @@ -129,8 +125,6 @@ namespace WindowsGame1 { GraphicsDevice.Clear(Color.CornflowerBlue); - // TODO: Add your draw logic here - base.Draw(gameTime); } }