Fixed the DisplayMode class which was way too accessible!
Added Tests for: - DisplayMode - VertexElement - VertexPositionColor (GetHashCode still fails) - VertexPositionColorTexture (GetHashCode still fails) - VertexPositionTexture - VertexPositionNormalTexture
This commit is contained in:
parent
994e894b24
commit
be01038e1f
@ -69,7 +69,13 @@
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\DisplayModeTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionNormalTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexElementTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\ViewportTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />
|
||||
|
@ -69,7 +69,13 @@
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\DisplayModeTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionNormalTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexElementTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\ViewportTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />
|
||||
|
@ -70,7 +70,13 @@
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\DisplayModeTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionNormalTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexElementTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\ViewportTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />
|
||||
|
@ -71,7 +71,13 @@
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\DisplayModeTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionNormalTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionTextureTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexElementTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\VertexPositionColorTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\ViewportTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadButtonsTest.cs" />
|
||||
<Compile Include="Strukturen\Input\GamePadDPadTest.cs" />
|
||||
|
@ -157,6 +157,15 @@ namespace ANX.Framework.TestCenter
|
||||
return intDiff <= (1 << maxDeltaBits);
|
||||
}
|
||||
|
||||
public static bool Compare(Microsoft.Xna.Framework.Graphics.VertexElement xna,
|
||||
ANX.Framework.Graphics.VertexElement anx)
|
||||
{
|
||||
return (xna.Offset == anx.Offset &&
|
||||
xna.UsageIndex == anx.UsageIndex &&
|
||||
(int)xna.VertexElementFormat == (int)anx.VertexElementFormat &&
|
||||
(int)xna.VertexElementUsage == (int)anx.VertexElementUsage);
|
||||
}
|
||||
|
||||
private static bool Compare(XNACurve xna, ANXCurve anx)
|
||||
{
|
||||
return (xna.IsConstant == anx.IsConstant) && (Compare(xna.Keys, anx.Keys)) && (Compare(xna.PreLoop, anx.PreLoop)) && (Compare(xna.PostLoop, anx.PostLoop));
|
||||
|
@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
|
||||
using XNADisplayMode = Microsoft.Xna.Framework.Graphics.DisplayMode;
|
||||
using XNASurfaceFormat = Microsoft.Xna.Framework.Graphics.SurfaceFormat;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics
|
||||
{
|
||||
class DisplayModeTest
|
||||
{
|
||||
[Test]
|
||||
public void Values()
|
||||
{
|
||||
var xnaParameters = new object[] { 800, 600, XNASurfaceFormat.Color };
|
||||
var xna = (XNADisplayMode)Activator.CreateInstance(typeof(XNADisplayMode),
|
||||
BindingFlags.NonPublic | BindingFlags.Instance, null, xnaParameters, CultureInfo.InvariantCulture);
|
||||
var anxParameters = new object[] { 800, 600, SurfaceFormat.Color };
|
||||
var anx = (DisplayMode)Activator.CreateInstance(typeof(DisplayMode),
|
||||
BindingFlags.NonPublic | BindingFlags.Instance, null, anxParameters, CultureInfo.InvariantCulture);
|
||||
|
||||
Assert.AreEqual(xna.AspectRatio, anx.AspectRatio);
|
||||
AssertHelper.ConvertEquals(xna.TitleSafeArea, anx.TitleSafeArea, "Values");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString()
|
||||
{
|
||||
var xnaParameters = new object[] { 800, 600, XNASurfaceFormat.Color };
|
||||
var xna = (XNADisplayMode)Activator.CreateInstance(typeof(XNADisplayMode),
|
||||
BindingFlags.NonPublic | BindingFlags.Instance, null, xnaParameters, CultureInfo.InvariantCulture);
|
||||
var anxParameters = new object[] { 800, 600, SurfaceFormat.Color };
|
||||
var anx = (DisplayMode)Activator.CreateInstance(typeof(DisplayMode),
|
||||
BindingFlags.NonPublic | BindingFlags.Instance, null, anxParameters, CultureInfo.InvariantCulture);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
using XNAVertexElement = Microsoft.Xna.Framework.Graphics.VertexElement;
|
||||
using ANXVertexElement = ANX.Framework.Graphics.VertexElement;
|
||||
|
||||
using XNAVertexElementFormat = Microsoft.Xna.Framework.Graphics.VertexElementFormat;
|
||||
using XNAVertexElementUsage = Microsoft.Xna.Framework.Graphics.VertexElementUsage;
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics
|
||||
{
|
||||
class VertexElementTest
|
||||
{
|
||||
[Test]
|
||||
public void ToString0()
|
||||
{
|
||||
var xna = new XNAVertexElement();
|
||||
var anx = new ANXVertexElement();
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString1()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetHashCode()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals0()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals1()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals2()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna == xna, anx == anx, "Equals2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals3()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var xna2 = new XNAVertexElement(3, XNAVertexElementFormat.Color, XNAVertexElementUsage.Color, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
var anx2 = new ANXVertexElement(3, VertexElementFormat.Color, VertexElementUsage.Color, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna != xna2, anx != anx2, "Equals3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals4()
|
||||
{
|
||||
var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0);
|
||||
var xna2 = new XNAVertexElement(3, XNAVertexElementFormat.Color, XNAVertexElementUsage.Color, 0);
|
||||
var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0);
|
||||
var anx2 = new ANXVertexElement(3, VertexElementFormat.Color, VertexElementUsage.Color, 0);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
|
||||
using XNAVertexPositionColor = Microsoft.Xna.Framework.Graphics.VertexPositionColor;
|
||||
using XNAVector3 = Microsoft.Xna.Framework.Vector3;
|
||||
using XNAColor = Microsoft.Xna.Framework.Color;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics
|
||||
{
|
||||
class VertexPositionColorTest
|
||||
{
|
||||
[Test]
|
||||
public void VertexDeclaration()
|
||||
{
|
||||
var xna = XNAVertexPositionColor.VertexDeclaration;
|
||||
var anx = VertexPositionColor.VertexDeclaration;
|
||||
|
||||
Assert.AreEqual(xna.VertexStride, anx.VertexStride);
|
||||
Assert.AreEqual(xna.Name, anx.Name);
|
||||
|
||||
var xnaElements = xna.GetVertexElements();
|
||||
var anxElements = anx.GetVertexElements();
|
||||
Assert.AreEqual(xnaElements.Length, anxElements.Length);
|
||||
for (int index = 0; index < xnaElements.Length; index++)
|
||||
AssertHelper.Compare(xnaElements[index], anxElements[index]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetHashCode()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals0()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals1()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals2()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
|
||||
AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals3()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var xna2 = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.Red);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
var anx2 = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.Red);
|
||||
|
||||
AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals4()
|
||||
{
|
||||
var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue);
|
||||
var xna2 = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.Red);
|
||||
var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue);
|
||||
var anx2 = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.Red);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
|
||||
using XNAVertexPositionColorTexture = Microsoft.Xna.Framework.Graphics.VertexPositionColorTexture;
|
||||
using XNAVector3 = Microsoft.Xna.Framework.Vector3;
|
||||
using XNAVector2 = Microsoft.Xna.Framework.Vector2;
|
||||
using XNAColor = Microsoft.Xna.Framework.Color;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics
|
||||
{
|
||||
class VertexPositionColorTextureTest
|
||||
{
|
||||
[Test]
|
||||
public void VertexDeclaration()
|
||||
{
|
||||
var xna = XNAVertexPositionColorTexture.VertexDeclaration;
|
||||
var anx = VertexPositionColorTexture.VertexDeclaration;
|
||||
|
||||
Assert.AreEqual(xna.VertexStride, anx.VertexStride);
|
||||
Assert.AreEqual(xna.Name, anx.Name);
|
||||
|
||||
var xnaElements = xna.GetVertexElements();
|
||||
var anxElements = anx.GetVertexElements();
|
||||
Assert.AreEqual(xnaElements.Length, anxElements.Length);
|
||||
for (int index = 0; index < xnaElements.Length; index++)
|
||||
AssertHelper.Compare(xnaElements[index], anxElements[index]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetHashCode()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals0()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals1()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals2()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals3()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var xna2 = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.Red,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
var anx2 = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.Red, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals4()
|
||||
{
|
||||
var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var xna2 = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.Red,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f));
|
||||
var anx2 = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.Red, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
|
||||
using XNAVertexPositionNormalTexture = Microsoft.Xna.Framework.Graphics.VertexPositionNormalTexture;
|
||||
using XNAVector3 = Microsoft.Xna.Framework.Vector3;
|
||||
using XNAVector2 = Microsoft.Xna.Framework.Vector2;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics
|
||||
{
|
||||
class VertexPositionNormalTextureTest
|
||||
{
|
||||
[Test]
|
||||
public void VertexDeclaration()
|
||||
{
|
||||
var xna = XNAVertexPositionNormalTexture.VertexDeclaration;
|
||||
var anx = VertexPositionNormalTexture.VertexDeclaration;
|
||||
|
||||
Assert.AreEqual(xna.VertexStride, anx.VertexStride);
|
||||
Assert.AreEqual(xna.Name, anx.Name);
|
||||
|
||||
var xnaElements = xna.GetVertexElements();
|
||||
var anxElements = anx.GetVertexElements();
|
||||
Assert.AreEqual(xnaElements.Length, anxElements.Length);
|
||||
for (int index = 0; index < xnaElements.Length; index++)
|
||||
AssertHelper.Compare(xnaElements[index], anxElements[index]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetHashCode()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals0()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals1()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals2()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals3()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var xna2 = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), XNAVector3.Zero,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
var anx2 = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), Vector3.Zero, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals4()
|
||||
{
|
||||
var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f),
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var xna2 = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), XNAVector3.Zero,
|
||||
new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f),
|
||||
new Vector2(0.5f, 0.5f));
|
||||
var anx2 = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), Vector3.Zero, new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
|
||||
using XNAVertexPositionTexture = Microsoft.Xna.Framework.Graphics.VertexPositionTexture;
|
||||
using XNAVector3 = Microsoft.Xna.Framework.Vector3;
|
||||
using XNAVector2 = Microsoft.Xna.Framework.Vector2;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen.Graphics
|
||||
{
|
||||
class VertexPositionTextureTest
|
||||
{
|
||||
[Test]
|
||||
public void VertexDeclaration()
|
||||
{
|
||||
var xna = XNAVertexPositionTexture.VertexDeclaration;
|
||||
var anx = VertexPositionTexture.VertexDeclaration;
|
||||
|
||||
Assert.AreEqual(xna.VertexStride, anx.VertexStride);
|
||||
Assert.AreEqual(xna.Name, anx.Name);
|
||||
|
||||
var xnaElements = xna.GetVertexElements();
|
||||
var anxElements = anx.GetVertexElements();
|
||||
Assert.AreEqual(xnaElements.Length, anxElements.Length);
|
||||
for (int index = 0; index < xnaElements.Length; index++)
|
||||
AssertHelper.Compare(xnaElements[index], anxElements[index]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetHashCode()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ToString()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals0()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals1()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals2()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
|
||||
AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals3()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var xna2 = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), XNAVector2.One);
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
var anx2 = new VertexPositionTexture(new Vector3(1f, 2f, 3f), Vector2.One);
|
||||
|
||||
AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Equals4()
|
||||
{
|
||||
var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f));
|
||||
var xna2 = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), XNAVector2.One);
|
||||
var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f));
|
||||
var anx2 = new VertexPositionTexture(new Vector3(1f, 2f, 3f), Vector2.One);
|
||||
|
||||
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,10 @@
|
||||
#region Using Statements
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
using XNAViewport = Microsoft.Xna.Framework.Graphics.Viewport;
|
||||
using ANXViewport = ANX.Framework.Graphics.Viewport;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
|
@ -14,10 +14,10 @@ namespace ANX.Framework
|
||||
public struct Color : IPackedVector<uint>, IPackedVector, IEquatable<Color>
|
||||
{
|
||||
#region Private Members
|
||||
/// <summary>
|
||||
/// Marcel NOTE: I made this internal and befriend the ANX.Framework
|
||||
/// with the OGL Module so the datatype conversion can be made faster.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Marcel NOTE: I made this internal and befriend the ANX.Framework
|
||||
/// with the OGL Module so the datatype conversion can be made faster.
|
||||
/// </summary>
|
||||
internal uint packedValue;
|
||||
|
||||
#endregion // Private Members
|
||||
|
@ -9,15 +9,24 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("AstrorEnales")]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public class DisplayMode
|
||||
{
|
||||
public float AspectRatio { get; set; }
|
||||
public SurfaceFormat Format { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
public Rectangle TitleSafeArea { get; set; }
|
||||
public SurfaceFormat Format { get; private set; }
|
||||
public int Height { get; private set; }
|
||||
public int Width { get; private set; }
|
||||
public float AspectRatio { get; private set; }
|
||||
public Rectangle TitleSafeArea { get; private set; }
|
||||
|
||||
internal DisplayMode(int width, int height, SurfaceFormat format)
|
||||
{
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
this.Format = format;
|
||||
AspectRatio = (height == 0 || width == 0) ? 0f : (float)width / height;
|
||||
TitleSafeArea = new Rectangle(0, 0, width, height);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
|
@ -16,39 +16,33 @@ namespace ANX.Framework.Graphics
|
||||
public struct VertexBufferBinding
|
||||
{
|
||||
#region Private
|
||||
private VertexBuffer vertexBuffer;
|
||||
private int instanceFrequency;
|
||||
private int vertexOffset;
|
||||
private readonly VertexBuffer vertexBuffer;
|
||||
private readonly int instanceFrequency;
|
||||
private readonly int vertexOffset;
|
||||
#endregion
|
||||
|
||||
#region Public
|
||||
public VertexBuffer VertexBuffer
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vertexBuffer;
|
||||
}
|
||||
}
|
||||
public VertexBuffer VertexBuffer
|
||||
{
|
||||
get { return this.vertexBuffer; }
|
||||
}
|
||||
|
||||
public int InstanceFrequency
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.instanceFrequency;
|
||||
}
|
||||
}
|
||||
public int InstanceFrequency
|
||||
{
|
||||
get { return this.instanceFrequency; }
|
||||
}
|
||||
|
||||
public int VertexOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vertexOffset;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public int VertexOffset
|
||||
{
|
||||
get { return this.vertexOffset; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public VertexBufferBinding(VertexBuffer vertexBuffer)
|
||||
{
|
||||
if (vertexBuffer == null)
|
||||
throw new ArgumentNullException("vertexBuffer");
|
||||
|
||||
this.vertexBuffer = vertexBuffer;
|
||||
this.vertexOffset = 0;
|
||||
this.instanceFrequency = 0;
|
||||
@ -56,6 +50,12 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
public VertexBufferBinding(VertexBuffer vertexBuffer, int vertexOffset)
|
||||
{
|
||||
if (vertexBuffer == null)
|
||||
throw new ArgumentNullException("vertexBuffer");
|
||||
|
||||
if (vertexOffset < 0 || vertexOffset >= vertexBuffer.VertexCount)
|
||||
throw new ArgumentOutOfRangeException("vertexOffset");
|
||||
|
||||
this.vertexBuffer = vertexBuffer;
|
||||
this.vertexOffset = vertexOffset;
|
||||
this.instanceFrequency = 0;
|
||||
@ -63,6 +63,15 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
public VertexBufferBinding(VertexBuffer vertexBuffer, int vertexOffset, int instanceFrequency)
|
||||
{
|
||||
if (vertexBuffer == null)
|
||||
throw new ArgumentNullException("vertexBuffer");
|
||||
|
||||
if (vertexOffset < 0 || vertexOffset >= vertexBuffer.VertexCount)
|
||||
throw new ArgumentOutOfRangeException("vertexOffset");
|
||||
|
||||
if (instanceFrequency < 0)
|
||||
throw new ArgumentOutOfRangeException("instanceFrequency");
|
||||
|
||||
this.vertexBuffer = vertexBuffer;
|
||||
this.vertexOffset = vertexOffset;
|
||||
this.instanceFrequency = instanceFrequency;
|
||||
|
@ -16,33 +16,33 @@ namespace ANX.Framework.Graphics
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public class VertexDeclaration : GraphicsResource
|
||||
{
|
||||
private VertexElement[] elements;
|
||||
private readonly VertexElement[] elements;
|
||||
|
||||
public int VertexStride
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
public int VertexStride { get; private set; }
|
||||
|
||||
public VertexDeclaration(params VertexElement[] elements)
|
||||
public VertexDeclaration(params VertexElement[] elements)
|
||||
{
|
||||
if (elements == null || elements.Length == 0)
|
||||
throw new ArgumentNullException("elements");
|
||||
|
||||
this.elements = elements;
|
||||
|
||||
for (int i = 0; i < this.elements.Length; i++)
|
||||
{
|
||||
VertexStride += GetElementStride(this.elements[i].VertexElementFormat);
|
||||
}
|
||||
}
|
||||
|
||||
public VertexDeclaration(int vertexStride, params VertexElement[] elements)
|
||||
{
|
||||
{
|
||||
if (elements == null || elements.Length == 0)
|
||||
throw new ArgumentNullException("elements");
|
||||
|
||||
this.elements = elements;
|
||||
VertexStride = vertexStride;
|
||||
}
|
||||
|
||||
public VertexElement[] GetVertexElements()
|
||||
{
|
||||
return (elements != null) ? (elements.Clone() as VertexElement[]) : null;
|
||||
return elements != null ? (elements.Clone() as VertexElement[]) : null;
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
|
@ -13,7 +13,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct VertexElement
|
||||
{
|
||||
#region Private
|
||||
@ -24,54 +24,30 @@ namespace ANX.Framework.Graphics
|
||||
#endregion
|
||||
|
||||
#region Public
|
||||
public int Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.offset;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.offset = value;
|
||||
}
|
||||
}
|
||||
public int Offset
|
||||
{
|
||||
get { return this.offset; }
|
||||
set { this.offset = value; }
|
||||
}
|
||||
|
||||
public VertexElementFormat VertexElementFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.elementFormat;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.elementFormat = value;
|
||||
}
|
||||
}
|
||||
public VertexElementFormat VertexElementFormat
|
||||
{
|
||||
get { return this.elementFormat; }
|
||||
set { this.elementFormat = value; }
|
||||
}
|
||||
|
||||
public VertexElementUsage VertexElementUsage
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.elementUsage;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.elementUsage = value;
|
||||
}
|
||||
}
|
||||
public VertexElementUsage VertexElementUsage
|
||||
{
|
||||
get { return this.elementUsage; }
|
||||
set { this.elementUsage = value; }
|
||||
}
|
||||
|
||||
public int UsageIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.usageIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.usageIndex = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
public int UsageIndex
|
||||
{
|
||||
get { return this.usageIndex; }
|
||||
set { this.usageIndex = value; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
public VertexElement(int offset, VertexElementFormat elementFormat, VertexElementUsage elementUsage, int usageIndex)
|
||||
{
|
||||
|
@ -11,9 +11,12 @@ using ANX.Framework.NonXNA;
|
||||
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
#if !WINDOWSMETRO //TODO: search replacement for Win8
|
||||
[Serializable]
|
||||
#endif
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct VertexPositionColor : IVertexType
|
||||
{
|
||||
public Vector3 Position;
|
||||
@ -40,8 +43,10 @@ namespace ANX.Framework.Graphics
|
||||
new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0),
|
||||
};
|
||||
|
||||
VertexDeclaration = new VertexDeclaration(16, elements);
|
||||
VertexDeclaration.Name = "VertexPositionColor.VertexDeclaration";
|
||||
VertexDeclaration = new VertexDeclaration(16, elements)
|
||||
{
|
||||
Name = "VertexPositionColor.VertexDeclaration"
|
||||
};
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@ -56,13 +61,10 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj != null && obj is VertexPositionColor)
|
||||
return this == (VertexPositionColor)obj;
|
||||
|
||||
return false;
|
||||
return obj is VertexPositionColor && this == (VertexPositionColor)obj;
|
||||
}
|
||||
|
||||
public static bool operator ==(VertexPositionColor lhs, VertexPositionColor rhs)
|
||||
public static bool operator ==(VertexPositionColor lhs, VertexPositionColor rhs)
|
||||
{
|
||||
return lhs.Color.Equals(rhs.Color) && lhs.Position.Equals(rhs.Position);
|
||||
}
|
||||
|
@ -11,18 +11,18 @@ using ANX.Framework.NonXNA;
|
||||
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
#if !WINDOWSMETRO //TODO: search replacement for Win8
|
||||
[Serializable]
|
||||
#endif
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct VertexPositionColorTexture : IVertexType
|
||||
{
|
||||
#region Private Members
|
||||
public Vector3 Position;
|
||||
public Color Color;
|
||||
public Vector2 TextureCoordinate;
|
||||
|
||||
#endregion
|
||||
|
||||
public static readonly VertexDeclaration VertexDeclaration;
|
||||
|
||||
VertexDeclaration IVertexType.VertexDeclaration
|
||||
@ -49,8 +49,10 @@ namespace ANX.Framework.Graphics
|
||||
new VertexElement(16, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
|
||||
};
|
||||
|
||||
VertexDeclaration = new VertexDeclaration(24, elements);
|
||||
VertexDeclaration.Name = "VertexPositionColorTexture.VertexDeclaration";
|
||||
VertexDeclaration = new VertexDeclaration(24, elements)
|
||||
{
|
||||
Name = "VertexPositionColorTexture.VertexDeclaration"
|
||||
};
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@ -65,15 +67,10 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj != null && obj is VertexPositionColorTexture)
|
||||
{
|
||||
return this == (VertexPositionColorTexture)obj;
|
||||
}
|
||||
|
||||
return false;
|
||||
return obj is VertexPositionColorTexture && this == (VertexPositionColorTexture)obj;
|
||||
}
|
||||
|
||||
public static bool operator ==(VertexPositionColorTexture lhs, VertexPositionColorTexture rhs)
|
||||
public static bool operator ==(VertexPositionColorTexture lhs, VertexPositionColorTexture rhs)
|
||||
{
|
||||
return lhs.Color.Equals(rhs.Color) &&
|
||||
lhs.Position.Equals(rhs.Position) &&
|
||||
|
@ -11,9 +11,12 @@ using ANX.Framework.NonXNA;
|
||||
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
#if !WINDOWSMETRO //TODO: search replacement for Win8
|
||||
[Serializable]
|
||||
#endif
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct VertexPositionNormalTexture : IVertexType
|
||||
{
|
||||
public Vector3 Position;
|
||||
@ -36,14 +39,16 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
static VertexPositionNormalTexture()
|
||||
{
|
||||
VertexElement[] elements = new VertexElement[]
|
||||
VertexElement[] elements =
|
||||
{
|
||||
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
|
||||
new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
|
||||
new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
|
||||
};
|
||||
VertexDeclaration = new VertexDeclaration(32, elements);
|
||||
VertexDeclaration.Name = "VertexPositionNormalTexture.VertexDeclaration";
|
||||
VertexDeclaration = new VertexDeclaration(32, elements)
|
||||
{
|
||||
Name = "VertexPositionNormalTexture.VertexDeclaration"
|
||||
};
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@ -58,10 +63,7 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj != null && obj is VertexPositionNormalTexture)
|
||||
return this == (VertexPositionNormalTexture)obj;
|
||||
|
||||
return false;
|
||||
return obj is VertexPositionNormalTexture && this == (VertexPositionNormalTexture)obj;
|
||||
}
|
||||
|
||||
public static bool operator ==(VertexPositionNormalTexture lhs, VertexPositionNormalTexture rhs)
|
||||
|
@ -11,9 +11,12 @@ using ANX.Framework.NonXNA;
|
||||
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
#if !WINDOWSMETRO //TODO: search replacement for Win8
|
||||
[Serializable]
|
||||
#endif
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct VertexPositionTexture : IVertexType
|
||||
{
|
||||
public Vector3 Position;
|
||||
@ -34,13 +37,15 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
static VertexPositionTexture()
|
||||
{
|
||||
VertexElement[] elements = new VertexElement[]
|
||||
VertexElement[] elements =
|
||||
{
|
||||
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
|
||||
new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
|
||||
};
|
||||
VertexDeclaration = new VertexDeclaration(20, elements);
|
||||
VertexDeclaration.Name = "VertexPositionTexture.VertexDeclaration";
|
||||
VertexDeclaration = new VertexDeclaration(20, elements)
|
||||
{
|
||||
Name = "VertexPositionTexture.VertexDeclaration"
|
||||
};
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
@ -55,13 +60,10 @@ namespace ANX.Framework.Graphics
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj != null && obj is VertexPositionTexture)
|
||||
return this == (VertexPositionTexture)obj;
|
||||
|
||||
return false;
|
||||
return obj is VertexPositionTexture && this == (VertexPositionTexture)obj;
|
||||
}
|
||||
|
||||
public static bool operator ==(VertexPositionTexture lhs, VertexPositionTexture rhs)
|
||||
public static bool operator ==(VertexPositionTexture lhs, VertexPositionTexture rhs)
|
||||
{
|
||||
return lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) && lhs.Position.Equals(rhs.Position);
|
||||
}
|
||||
|
@ -8,19 +8,17 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Input.Touch
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public struct GestureSample
|
||||
{
|
||||
#region Private
|
||||
private GestureType gestureType;
|
||||
private TimeSpan timestamp;
|
||||
private Vector2 position;
|
||||
private Vector2 position2;
|
||||
private Vector2 delta;
|
||||
private Vector2 delta2;
|
||||
#endregion
|
||||
private readonly GestureType gestureType;
|
||||
private readonly TimeSpan timestamp;
|
||||
private readonly Vector2 position;
|
||||
private readonly Vector2 position2;
|
||||
private readonly Vector2 delta;
|
||||
private readonly Vector2 delta2;
|
||||
|
||||
#region Public
|
||||
public Vector2 Delta
|
||||
{
|
||||
get { return this.delta; }
|
||||
@ -50,10 +48,8 @@ namespace ANX.Framework.Input.Touch
|
||||
{
|
||||
get { return this.timestamp; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
public GestureSample(GestureType gestureType, TimeSpan timestamp, Vector2 position, Vector2 position2,
|
||||
public GestureSample(GestureType gestureType, TimeSpan timestamp, Vector2 position, Vector2 position2,
|
||||
Vector2 delta, Vector2 delta2)
|
||||
{
|
||||
this.gestureType = gestureType;
|
||||
@ -63,6 +59,5 @@ namespace ANX.Framework.Input.Touch
|
||||
this.delta = delta;
|
||||
this.delta2 = delta2;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -268,17 +268,7 @@ namespace ANX.RenderSystem.GL3
|
||||
}
|
||||
|
||||
foreach (DisplayResolution res in device.AvailableResolutions)
|
||||
{
|
||||
float aspect = (float)res.Width / (float)res.Height;
|
||||
resultingModes.Add(new DisplayMode
|
||||
{
|
||||
AspectRatio = aspect,
|
||||
Width = res.Width,
|
||||
Height = res.Height,
|
||||
TitleSafeArea = new Rectangle(0, 0, res.Width, res.Height),
|
||||
Format = surfaceFormat,
|
||||
});
|
||||
}
|
||||
resultingModes.Add(new DisplayMode(res.Width, res.Height, surfaceFormat));
|
||||
}
|
||||
|
||||
var newAdapter = new GraphicsAdapter
|
||||
|
@ -200,15 +200,8 @@ namespace ANX.RenderSystem.Windows.DX10
|
||||
DisplayModeEnumerationFlags.Interlaced);
|
||||
foreach (ModeDescription modeDescription in modeList)
|
||||
{
|
||||
DisplayMode displayMode = new DisplayMode()
|
||||
{
|
||||
Format = DxFormatConverter.Translate(modeDescription.Format),
|
||||
Width = modeDescription.Width,
|
||||
Height = modeDescription.Height,
|
||||
AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height,
|
||||
TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real
|
||||
};
|
||||
|
||||
var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height,
|
||||
DxFormatConverter.Translate(modeDescription.Format));
|
||||
resultingModes.Add(displayMode);
|
||||
}
|
||||
}
|
||||
|
@ -189,17 +189,11 @@ namespace ANX.RenderSystem.Windows.DX11
|
||||
|
||||
foreach (Output adapterOutput in adapter.Outputs)
|
||||
{
|
||||
foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced))
|
||||
foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm,
|
||||
DisplayModeEnumerationFlags.Interlaced))
|
||||
{
|
||||
var displayMode = new DisplayMode
|
||||
{
|
||||
Format = DxFormatConverter.Translate(modeDescription.Format),
|
||||
Width = modeDescription.Width,
|
||||
Height = modeDescription.Height,
|
||||
AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height,
|
||||
TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real
|
||||
};
|
||||
|
||||
var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height,
|
||||
DxFormatConverter.Translate(modeDescription.Format));
|
||||
resultingModes.Add(displayMode);
|
||||
}
|
||||
|
||||
|
@ -184,56 +184,49 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
IsDefaultAdapter = true
|
||||
}
|
||||
});
|
||||
/*
|
||||
SharpDX.DXGI.Factory factory = new Factory();
|
||||
/*
|
||||
SharpDX.DXGI.Factory factory = new Factory();
|
||||
|
||||
List<GraphicsAdapter> adapterList = new List<GraphicsAdapter>();
|
||||
DisplayModeCollection displayModeCollection = new DisplayModeCollection();
|
||||
List<GraphicsAdapter> adapterList = new List<GraphicsAdapter>();
|
||||
DisplayModeCollection displayModeCollection = new DisplayModeCollection();
|
||||
|
||||
for (int i = 0; i < factory.GetAdapterCount(); i++)
|
||||
{
|
||||
using (Adapter adapter = factory.GetAdapter(i))
|
||||
{
|
||||
GraphicsAdapter ga = new GraphicsAdapter();
|
||||
//ga.CurrentDisplayMode = ;
|
||||
//ga.Description = ;
|
||||
ga.DeviceId = adapter.Description.DeviceId;
|
||||
ga.DeviceName = adapter.Description.Description;
|
||||
ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter?
|
||||
//ga.IsWideScreen = ;
|
||||
//ga.MonitorHandle = ;
|
||||
ga.Revision = adapter.Description.Revision;
|
||||
ga.SubSystemId = adapter.Description.SubsystemId;
|
||||
//ga.SupportedDisplayModes = ;
|
||||
ga.VendorId = adapter.Description.VendorId;
|
||||
for (int i = 0; i < factory.GetAdapterCount(); i++)
|
||||
{
|
||||
using (Adapter adapter = factory.GetAdapter(i))
|
||||
{
|
||||
GraphicsAdapter ga = new GraphicsAdapter();
|
||||
//ga.CurrentDisplayMode = ;
|
||||
//ga.Description = ;
|
||||
ga.DeviceId = adapter.Description.DeviceId;
|
||||
ga.DeviceName = adapter.Description.Description;
|
||||
ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter?
|
||||
//ga.IsWideScreen = ;
|
||||
//ga.MonitorHandle = ;
|
||||
ga.Revision = adapter.Description.Revision;
|
||||
ga.SubSystemId = adapter.Description.SubsystemId;
|
||||
//ga.SupportedDisplayModes = ;
|
||||
ga.VendorId = adapter.Description.VendorId;
|
||||
|
||||
using (Output adapterOutput = adapter.GetOutput(0))
|
||||
{
|
||||
foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced))
|
||||
{
|
||||
DisplayMode displayMode = new DisplayMode()
|
||||
{
|
||||
Format = FormatConverter.Translate(modeDescription.Format),
|
||||
Width = modeDescription.Width,
|
||||
Height = modeDescription.Height,
|
||||
AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height,
|
||||
TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real
|
||||
};
|
||||
using (Output adapterOutput = adapter.GetOutput(0))
|
||||
{
|
||||
foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced))
|
||||
{
|
||||
var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height,
|
||||
DxFormatConverter.Translate(modeDescription.Format));
|
||||
displayModeCollection[displayMode.Format] = new DisplayMode[] { displayMode };
|
||||
}
|
||||
}
|
||||
|
||||
displayModeCollection[displayMode.Format] = new DisplayMode[] { displayMode };
|
||||
}
|
||||
}
|
||||
ga.SupportedDisplayModes = displayModeCollection;
|
||||
|
||||
ga.SupportedDisplayModes = displayModeCollection;
|
||||
adapterList.Add(ga);
|
||||
}
|
||||
}
|
||||
|
||||
adapterList.Add(ga);
|
||||
}
|
||||
}
|
||||
factory.Dispose();
|
||||
|
||||
factory.Dispose();
|
||||
|
||||
return new System.Collections.ObjectModel.ReadOnlyCollection<GraphicsAdapter>(adapterList);*/
|
||||
}
|
||||
return new System.Collections.ObjectModel.ReadOnlyCollection<GraphicsAdapter>(adapterList);*/
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CreateRenderTarget
|
||||
|
@ -30,6 +30,8 @@ namespace OnlineStatusGenerator
|
||||
|
||||
var sortedKeys = new List<string>(namespaces.Keys);
|
||||
sortedKeys.Sort();
|
||||
foreach (string space in sortedKeys)
|
||||
namespaces[space].Sort((o1, o2) => String.Compare(o1.Name, o2.Name, StringComparison.Ordinal));
|
||||
|
||||
string result = "<table border=1 cellspacing=0>";
|
||||
foreach (string space in sortedKeys)
|
||||
|
Loading…
x
Reference in New Issue
Block a user