worked on some ToDo's

some more work on GraphicsDevice
This commit is contained in:
Glatzemann 2011-11-07 11:26:19 +00:00
parent a89e52a428
commit 2844c8b1ac
6 changed files with 26 additions and 48 deletions

View File

@ -69,6 +69,8 @@ namespace ANX.Framework.Graphics
private DepthStencilState depthStencilState; private DepthStencilState depthStencilState;
private GraphicsAdapter currentAdapter; private GraphicsAdapter currentAdapter;
private PresentationParameters currentPresentationParameters; private PresentationParameters currentPresentationParameters;
private bool isDisposed;
private GraphicsProfile graphicsProfile;
#endregion // Private Members #endregion // Private Members
@ -85,6 +87,7 @@ namespace ANX.Framework.Graphics
public GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters) public GraphicsDevice(GraphicsAdapter adapter, GraphicsProfile graphicsProfile, PresentationParameters presentationParameters)
{ {
this.currentAdapter = adapter; this.currentAdapter = adapter;
this.graphicsProfile = graphicsProfile;
this.currentPresentationParameters = presentationParameters; this.currentPresentationParameters = presentationParameters;
this.viewport = new Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight); this.viewport = new Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight);
@ -162,13 +165,11 @@ namespace ANX.Framework.Graphics
public void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount) where T : struct, IVertexType public void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount) where T : struct, IVertexType
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//TODO: nativeDevice.DrawUserPrimitive(primitiveCount, vertexOffset);
} }
public void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct, IVertexType public void DrawUserPrimitives<T>(PrimitiveType primitiveType, T[] vertexData, int vertexOffset, int primitiveCount, VertexDeclaration vertexDeclaration) where T : struct, IVertexType
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//TODO: nativeDevice.DrawUserPrimitive(primitiveCount, vertexOffset);
} }
public void SetVertexBuffer(VertexBuffer vertexBuffer) public void SetVertexBuffer(VertexBuffer vertexBuffer)
@ -248,7 +249,7 @@ namespace ANX.Framework.Graphics
protected virtual void Dispose(Boolean disposeManaged) protected virtual void Dispose(Boolean disposeManaged)
{ {
throw new NotImplementedException(); //TODO: implement
} }
public INativeGraphicsDevice NativeDevice public INativeGraphicsDevice NativeDevice
@ -365,7 +366,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.isDisposed;
} }
} }
@ -401,7 +402,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.graphicsProfile;
} }
} }
@ -409,7 +410,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.currentAdapter;
} }
} }
@ -417,7 +418,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.currentPresentationParameters;
} }
} }
@ -425,11 +426,14 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return DepthStencilState.ReferenceStencil;
} }
set set
{ {
throw new NotImplementedException(); if (DepthStencilState.ReferenceStencil != value)
{
DepthStencilState.ReferenceStencil = value;
}
} }
} }
@ -437,11 +441,14 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return BlendState.MultiSampleMask;
} }
set set
{ {
throw new NotImplementedException(); if (BlendState.MultiSampleMask != value)
{
BlendState.MultiSampleMask = value;
}
} }
} }
@ -449,11 +456,14 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return BlendState.BlendFactor;
} }
set set
{ {
throw new NotImplementedException(); if (BlendState.BlendFactor != value)
{
BlendState.BlendFactor = value;
}
} }
} }

View File

@ -113,7 +113,6 @@ namespace ANX.RenderSystem.Windows.DX11_1
public void Clear(ref Color color) public void Clear(ref Color color)
{ {
//TODO: DIRTY -> Convert Color without divisions
throw new NotImplementedException(); throw new NotImplementedException();
//device.ClearRenderTargetView(renderView, new SharpDX.Color4(color.A / 255f, color.R / 255f, color.G / 255f, color.B / 255f)); //device.ClearRenderTargetView(renderView, new SharpDX.Color4(color.A / 255f, color.R / 255f, color.G / 255f, color.B / 255f));
} }

View File

@ -85,8 +85,6 @@ namespace WindowsGame1
/// </summary> /// </summary>
protected override void Initialize() protected override void Initialize()
{ {
// TODO: Add your initialization logic here
base.Initialize(); base.Initialize();
} }
@ -125,8 +123,6 @@ namespace WindowsGame1
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit(); this.Exit();
// TODO: Add your update logic here
for (int i = 0; i < y.Length; i++) for (int i = 0; i < y.Length; i++)
{ {
y[i] += this.r.Next(100) * (float)gameTime.ElapsedGameTime.TotalSeconds; y[i] += this.r.Next(100) * (float)gameTime.ElapsedGameTime.TotalSeconds;

View File

@ -72,14 +72,11 @@ namespace TextRendering
protected override void Initialize() protected override void Initialize()
{ {
// TODO: Fügen Sie Ihre Initialisierungslogik hier hinzu
base.Initialize(); base.Initialize();
} }
protected override void LoadContent() protected override void LoadContent()
{ {
// Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann.
spriteBatch = new SpriteBatch(GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice);
this.debugFont = Content.Load<SpriteFont>(@"Fonts/Debug"); this.debugFont = Content.Load<SpriteFont>(@"Fonts/Debug");
@ -87,12 +84,9 @@ namespace TextRendering
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
{ {
// Ermöglicht ein Beenden des Spiels
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit(); this.Exit();
// TODO: Fügen Sie Ihre Aktualisierungslogik hier hinzu
base.Update(gameTime); base.Update(gameTime);
} }

View File

@ -75,14 +75,11 @@ namespace VertexIndexBuffer
protected override void Initialize() protected override void Initialize()
{ {
// TODO: Fügen Sie Ihre Initialisierungslogik hier hinzu
base.Initialize(); base.Initialize();
} }
protected override void LoadContent() protected override void LoadContent()
{ {
// Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann.
spriteBatch = new SpriteBatch(GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice);
miniTriEffect = Content.Load<Effect>(@"Effects/MiniTri"); miniTriEffect = Content.Load<Effect>(@"Effects/MiniTri");
@ -112,26 +109,14 @@ namespace VertexIndexBuffer
ib.SetData<int>(indices); ib.SetData<int>(indices);
} }
protected override void UnloadContent()
{
// TODO: Entladen Sie jeglichen Nicht-ContentManager-Inhalt hier
}
protected override void Update(GameTime gameTime) protected override void Update(GameTime gameTime)
{ {
// Ermöglicht ein Beenden des Spiels
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit(); this.Exit();
// TODO: Fügen Sie Ihre Aktualisierungslogik hier hinzu
base.Update(gameTime); base.Update(gameTime);
} }
/// <summary>
/// Dies wird aufgerufen, wenn das Spiel selbst zeichnen soll.
/// </summary>
/// <param name="gameTime">Bietet einen Schnappschuss der Timing-Werte.</param>
protected override void Draw(GameTime gameTime) protected override void Draw(GameTime gameTime)
{ {
GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.Clear(Color.CornflowerBlue);

View File

@ -79,8 +79,6 @@ namespace WindowsGame1
/// </summary> /// </summary>
protected override void Initialize() protected override void Initialize()
{ {
// TODO: Add your initialization logic here
base.Initialize(); base.Initialize();
} }
@ -91,7 +89,7 @@ namespace WindowsGame1
protected override void LoadContent() protected override void LoadContent()
{ {
// Create a new SpriteBatch, which can be used to draw textures. // Create a new SpriteBatch, which can be used to draw textures.
//spriteBatch = new SpriteBatch(GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice);
} }
/// <summary> /// <summary>
@ -100,8 +98,8 @@ namespace WindowsGame1
/// </summary> /// </summary>
protected override void UnloadContent() protected override void UnloadContent()
{ {
// TODO: Unload any non ContentManager content here
} }
/// <summary> /// <summary>
/// Allows the game to run logic such as updating the world, /// Allows the game to run logic such as updating the world,
@ -116,8 +114,6 @@ namespace WindowsGame1
this.Exit(); this.Exit();
} }
// TODO: Add your update logic here
base.Update(gameTime); base.Update(gameTime);
} }
@ -129,8 +125,6 @@ namespace WindowsGame1
{ {
GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.Clear(Color.CornflowerBlue);
// TODO: Add your draw logic here
base.Draw(gameTime); base.Draw(gameTime);
} }
} }