- implemented feature #1026 ("Implement EffectParameter.Semantic")
- fixed issue #583 ("BoundingFrustum corners wrong")
This commit is contained in:
parent
d4cce42aa8
commit
41061f8b12
@ -144,7 +144,7 @@ namespace ANX.Framework.TestCenter
|
|||||||
class AssertHelper
|
class AssertHelper
|
||||||
{
|
{
|
||||||
private const float epsilon = 0.0000001f;
|
private const float epsilon = 0.0000001f;
|
||||||
private const int complementBits = 5;
|
private const int complementBits = 8;
|
||||||
|
|
||||||
#region Compare
|
#region Compare
|
||||||
|
|
||||||
@ -253,6 +253,30 @@ namespace ANX.Framework.TestCenter
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ConvertEquals
|
#region ConvertEquals
|
||||||
|
public static void ConvertEquals(Microsoft.Xna.Framework.PlaneIntersectionType xna, ANX.Framework.PlaneIntersectionType anx, String test)
|
||||||
|
{
|
||||||
|
if ((int)xna == (int)anx)
|
||||||
|
{
|
||||||
|
Assert.Pass(test + " passed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.Fail(String.Format("{0} failed: xna: ({1}) anx: ({2})", test, xna.ToString(), anx.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ConvertEquals(Microsoft.Xna.Framework.ContainmentType xna, ANX.Framework.ContainmentType anx, String test)
|
||||||
|
{
|
||||||
|
if ((int)xna == (int)anx)
|
||||||
|
{
|
||||||
|
Assert.Pass(test + " passed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.Fail(String.Format("{0} failed: xna: ({1}) anx: ({2})", test, xna.ToString(), anx.ToString()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void ConvertEquals(float xna, float anx, String test)
|
public static void ConvertEquals(float xna, float anx, String test)
|
||||||
{
|
{
|
||||||
if (AssertHelper.AlmostEqual2sComplement(xna, anx, complementBits) ||
|
if (AssertHelper.AlmostEqual2sComplement(xna, anx, complementBits) ||
|
||||||
|
@ -95,10 +95,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum.Contains(xnaBox);
|
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum.Contains(xnaBox);
|
||||||
ANX.Framework.ContainmentType containsANX = anxFrustum.Contains(anxBox);
|
ANX.Framework.ContainmentType containsANX = anxFrustum.Contains(anxBox);
|
||||||
|
|
||||||
if ((int)containsXNA == (int)containsANX)
|
AssertHelper.ConvertEquals(containsXNA, containsANX, "ContainsBoundingBox");
|
||||||
Assert.Pass("ContainsBoundingBox passed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString());
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("ContainsBoundingBox failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -119,10 +116,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum1.Contains(xnaFrustum2);
|
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum1.Contains(xnaFrustum2);
|
||||||
ANX.Framework.ContainmentType containsANX = anxFrustum1.Contains(anxFrustum2);
|
ANX.Framework.ContainmentType containsANX = anxFrustum1.Contains(anxFrustum2);
|
||||||
|
|
||||||
if ((int)containsXNA == (int)containsANX)
|
AssertHelper.ConvertEquals(containsXNA, containsANX, "ContainsBoundingFrustum");
|
||||||
Assert.Pass("ContainsBoundingFrustum passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("ContainsBoundingFrustum failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -144,10 +138,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum.Contains(xnaSphere);
|
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum.Contains(xnaSphere);
|
||||||
ANX.Framework.ContainmentType containsANX = anxFrustum.Contains(anxSphere);
|
ANX.Framework.ContainmentType containsANX = anxFrustum.Contains(anxSphere);
|
||||||
|
|
||||||
if ((int)containsXNA == (int)containsANX)
|
AssertHelper.ConvertEquals(containsXNA, containsANX, "ContainsBoundingSphere");
|
||||||
Assert.Pass("ContainsBoundingSphere passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("ContainsBoundingSphere failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -167,10 +158,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum.Contains(xnaPoint);
|
Microsoft.Xna.Framework.ContainmentType containsXNA = xnaFrustum.Contains(xnaPoint);
|
||||||
ANX.Framework.ContainmentType containsANX = anxFrustum.Contains(anxPoint);
|
ANX.Framework.ContainmentType containsANX = anxFrustum.Contains(anxPoint);
|
||||||
|
|
||||||
if ((int)containsXNA == (int)containsANX)
|
AssertHelper.ConvertEquals(containsXNA, containsANX, "ContainsPoint");
|
||||||
Assert.Pass("ContainsPoint passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("ContainsPoint failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -231,49 +219,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
XNAVector3[] xna = xnaFrustum.GetCorners();
|
XNAVector3[] xna = xnaFrustum.GetCorners();
|
||||||
ANXVector3[] anx = anxFrustum.GetCorners();
|
ANXVector3[] anx = anxFrustum.GetCorners();
|
||||||
|
|
||||||
if (xna[0].X == anx[0].X &&
|
AssertHelper.ConvertEquals(xna, anx, "GetCorners");
|
||||||
xna[0].Y == anx[0].Y &&
|
|
||||||
xna[0].Z == anx[0].Z &&
|
|
||||||
xna[1].X == anx[1].X &&
|
|
||||||
xna[1].Y == anx[1].Y &&
|
|
||||||
xna[1].Z == anx[1].Z &&
|
|
||||||
xna[2].X == anx[2].X &&
|
|
||||||
xna[2].Y == anx[2].Y &&
|
|
||||||
xna[2].Z == anx[2].Z &&
|
|
||||||
xna[3].X == anx[3].X &&
|
|
||||||
xna[3].Y == anx[3].Y &&
|
|
||||||
xna[3].Z == anx[3].Z &&
|
|
||||||
xna[4].X == anx[4].X &&
|
|
||||||
xna[4].Y == anx[4].Y &&
|
|
||||||
xna[4].Z == anx[4].Z &&
|
|
||||||
xna[5].X == anx[5].X &&
|
|
||||||
xna[5].Y == anx[5].Y &&
|
|
||||||
xna[5].Z == anx[5].Z &&
|
|
||||||
xna[6].X == anx[6].X &&
|
|
||||||
xna[6].Y == anx[6].Y &&
|
|
||||||
xna[6].Z == anx[6].Z &&
|
|
||||||
xna[7].X == anx[7].X &&
|
|
||||||
xna[7].Y == anx[7].Y &&
|
|
||||||
xna[7].Z == anx[7].Z)
|
|
||||||
Assert.Pass("GetCorners passed");
|
|
||||||
else
|
|
||||||
Assert.Fail("GetCorners failed: xna(" +
|
|
||||||
xna[0].ToString() + " " +
|
|
||||||
xna[1].ToString() + " " +
|
|
||||||
xna[2].ToString() + " " +
|
|
||||||
xna[3].ToString() + " " +
|
|
||||||
xna[4].ToString() + " " +
|
|
||||||
xna[5].ToString() + " " +
|
|
||||||
xna[6].ToString() + " " +
|
|
||||||
xna[7].ToString() + ") anx(" +
|
|
||||||
anx[0].ToString() + " " +
|
|
||||||
anx[1].ToString() + " " +
|
|
||||||
anx[2].ToString() + " " +
|
|
||||||
anx[3].ToString() + " " +
|
|
||||||
anx[4].ToString() + " " +
|
|
||||||
anx[5].ToString() + " " +
|
|
||||||
anx[6].ToString() + " " +
|
|
||||||
anx[7].ToString() + ")");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -312,10 +258,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
bool containsXNA = xnaFrustum.Intersects(xnaBox);
|
bool containsXNA = xnaFrustum.Intersects(xnaBox);
|
||||||
bool containsANX = anxFrustum.Intersects(anxBox);
|
bool containsANX = anxFrustum.Intersects(anxBox);
|
||||||
|
|
||||||
if (containsXNA.Equals(containsANX))
|
AssertHelper.ConvertEquals(containsXNA, containsANX, "IntersectsBoundingBox");
|
||||||
Assert.Pass("IntersectsBoundingBox passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("IntersectsBoundingBox failed: xna({0}) anx({1})", containsXNA.ToString(), containsANX.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -336,10 +279,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
bool xna = xnaFrustum1.Intersects(xnaFrustum2);
|
bool xna = xnaFrustum1.Intersects(xnaFrustum2);
|
||||||
bool anx = anxFrustum1.Intersects(anxFrustum2);
|
bool anx = anxFrustum1.Intersects(anxFrustum2);
|
||||||
|
|
||||||
if (xna.Equals(anx))
|
AssertHelper.ConvertEquals(xna, anx, "IntersectsBoundingFrustum");
|
||||||
Assert.Pass("IntersectsBoundingFrustum passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("IntersectsBoundingFrustum failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -361,10 +301,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
bool xna = xnaFrustum.Intersects(xnaSphere);
|
bool xna = xnaFrustum.Intersects(xnaSphere);
|
||||||
bool anx = anxFrustum.Intersects(anxSphere);
|
bool anx = anxFrustum.Intersects(anxSphere);
|
||||||
|
|
||||||
if (xna.Equals(anx))
|
AssertHelper.ConvertEquals(xna, anx, "IntersectsBoundingSphere");
|
||||||
Assert.Pass("IntersectsBoundingSphere passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("IntersectsBoundingSphere failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -384,10 +321,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
Microsoft.Xna.Framework.PlaneIntersectionType xna = xnaFrustum.Intersects(xnaPlane);
|
Microsoft.Xna.Framework.PlaneIntersectionType xna = xnaFrustum.Intersects(xnaPlane);
|
||||||
ANX.Framework.PlaneIntersectionType anx = anxFrustum.Intersects(anxPlane);
|
ANX.Framework.PlaneIntersectionType anx = anxFrustum.Intersects(anxPlane);
|
||||||
|
|
||||||
if ((int)xna == (int)anx)
|
AssertHelper.ConvertEquals(xna, anx, "IntersectsPlane");
|
||||||
Assert.Pass("IntersectsPlane passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("IntersectsPlane failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -407,10 +341,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
float? xna = xnaFrustum.Intersects(xnaRay);
|
float? xna = xnaFrustum.Intersects(xnaRay);
|
||||||
float? anx = anxFrustum.Intersects(anxRay);
|
float? anx = anxFrustum.Intersects(anxRay);
|
||||||
|
|
||||||
if (xna.Equals(anx))
|
AssertHelper.ConvertEquals(xna, anx, "IntersectsRay");
|
||||||
Assert.Pass("IntersectsRay passed");
|
|
||||||
else
|
|
||||||
Assert.Fail(String.Format("IntersectsRay failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -537,14 +468,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
bool xna = xnaFrustum1 == xnaFrustum2;
|
bool xna = xnaFrustum1 == xnaFrustum2;
|
||||||
bool anx = anxFrustum1 == anxFrustum2;
|
bool anx = anxFrustum1 == anxFrustum2;
|
||||||
|
|
||||||
if (xna.Equals(anx))
|
AssertHelper.ConvertEquals(xna, anx, "EqualsOperator");
|
||||||
{
|
|
||||||
Assert.Pass("EqualsOperator passed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Fail(String.Format("EqualsOperator failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test, TestCaseSource("thirtytwofloats")]
|
[Test, TestCaseSource("thirtytwofloats")]
|
||||||
@ -565,14 +489,7 @@ namespace ANX.Framework.TestCenter.Strukturen
|
|||||||
bool xna = xnaFrustum1 != xnaFrustum2;
|
bool xna = xnaFrustum1 != xnaFrustum2;
|
||||||
bool anx = anxFrustum1 != anxFrustum2;
|
bool anx = anxFrustum1 != anxFrustum2;
|
||||||
|
|
||||||
if (xna.Equals(anx))
|
AssertHelper.ConvertEquals(xna, anx, "UnequalsOperator");
|
||||||
{
|
|
||||||
Assert.Pass("UnequalsOperator passed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert.Fail(String.Format("UnequalsOperator failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#region Using Statements
|
#region Using Statements
|
||||||
using System;
|
using System;
|
||||||
|
using ANX.Framework.NonXNA.Development;
|
||||||
|
|
||||||
|
|
||||||
#endregion // Using Statements
|
#endregion // Using Statements
|
||||||
@ -10,51 +11,35 @@ using System;
|
|||||||
|
|
||||||
namespace ANX.Framework
|
namespace ANX.Framework
|
||||||
{
|
{
|
||||||
|
[PercentageComplete(100)]
|
||||||
|
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||||
|
[Developer("???, Glatzemann")]
|
||||||
public class BoundingFrustum : IEquatable<BoundingFrustum>
|
public class BoundingFrustum : IEquatable<BoundingFrustum>
|
||||||
{
|
{
|
||||||
#region fields
|
#region fields
|
||||||
public const int CornerCount = 8;
|
public const int CornerCount = 8;
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region properties
|
|
||||||
private Vector3[] corners;
|
private Vector3[] corners;
|
||||||
|
private Plane[] planes = new Plane[6];
|
||||||
private Matrix matrix;
|
private Matrix matrix;
|
||||||
public Matrix Matrix
|
|
||||||
{
|
private enum PlanePosition : int
|
||||||
get { return this.matrix; }
|
{
|
||||||
set
|
Near = 0,
|
||||||
{
|
Far = 1,
|
||||||
this.matrix = value;
|
Left = 2,
|
||||||
this.CreatePlanes();
|
Right = 3,
|
||||||
this.CreateCorners();
|
Top = 4,
|
||||||
}
|
Bottom = 5,
|
||||||
}
|
}
|
||||||
|
|
||||||
private Plane near;
|
|
||||||
public Plane Near { get { return this.near; } }
|
|
||||||
|
|
||||||
private Plane far;
|
|
||||||
public Plane Far { get { return this.far; } }
|
|
||||||
|
|
||||||
private Plane top;
|
|
||||||
public Plane Top { get { return this.top; } }
|
|
||||||
|
|
||||||
private Plane bottom;
|
|
||||||
public Plane Bottom { get { return this.bottom; } }
|
|
||||||
|
|
||||||
private Plane right;
|
|
||||||
public Plane Right { get { return this.right; } }
|
|
||||||
|
|
||||||
private Plane left;
|
|
||||||
public Plane Left { get { return this.left; } }
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region constructors
|
#region constructors
|
||||||
public BoundingFrustum(Matrix value)
|
public BoundingFrustum(Matrix value)
|
||||||
{
|
{
|
||||||
corners = new Vector3[CornerCount];
|
|
||||||
this.matrix = value;
|
this.matrix = value;
|
||||||
|
|
||||||
CreatePlanes();
|
CreatePlanes();
|
||||||
CreateCorners();
|
CreateCorners();
|
||||||
}
|
}
|
||||||
@ -70,244 +55,54 @@ namespace ANX.Framework
|
|||||||
|
|
||||||
public void Contains(ref BoundingBox box, out ContainmentType result)
|
public void Contains(ref BoundingBox box, out ContainmentType result)
|
||||||
{
|
{
|
||||||
Vector3[] boxCorners = box.GetCorners();
|
bool flag = false;
|
||||||
|
Plane[] array = this.planes;
|
||||||
result = ContainmentType.Contains;
|
for (int i = 0; i < array.Length; i++)
|
||||||
|
|
||||||
Plane plane = Bottom;
|
|
||||||
Vector3 normal = plane.Normal;
|
|
||||||
//Vector3.Negate(ref normal, out normal);
|
|
||||||
float planeDistance = plane.D;
|
|
||||||
|
|
||||||
Vector3 pVertex = box.Min;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
pVertex.X = box.Max.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
pVertex.Y = box.Max.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
pVertex.Z = box.Max.Z;
|
|
||||||
|
|
||||||
float tempDistP;
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistP);
|
|
||||||
float distanceP = tempDistP - planeDistance;
|
|
||||||
|
|
||||||
Vector3 nVertex = box.Max;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
nVertex.X = box.Min.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
nVertex.Y = box.Min.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
nVertex.Z = box.Min.Z;
|
|
||||||
|
|
||||||
float tempDistN;
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistN);
|
|
||||||
float distanceN = tempDistN - planeDistance;
|
|
||||||
|
|
||||||
if (distanceN < 0 && distanceP < 0)
|
|
||||||
{
|
{
|
||||||
result = ContainmentType.Disjoint;
|
Plane plane = array[i];
|
||||||
return;
|
PlaneIntersectionType planeIntersectionType = box.Intersects(plane);
|
||||||
|
if (planeIntersectionType == PlaneIntersectionType.Front)
|
||||||
|
{
|
||||||
|
result = ContainmentType.Disjoint;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (planeIntersectionType == PlaneIntersectionType.Intersecting)
|
||||||
|
{
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (distanceN < 0 || distanceP < 0)
|
|
||||||
|
if (!flag)
|
||||||
{
|
{
|
||||||
result = ContainmentType.Intersects;
|
result = ContainmentType.Contains;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plane = Top;
|
|
||||||
normal = plane.Normal;
|
|
||||||
//Vector3.Negate(ref normal, out normal);
|
|
||||||
planeDistance = plane.D;
|
|
||||||
|
|
||||||
pVertex = box.Min;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
pVertex.X = box.Max.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
pVertex.Y = box.Max.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
pVertex.Z = box.Max.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistP);
|
|
||||||
distanceP = tempDistP - planeDistance;
|
|
||||||
|
|
||||||
nVertex = box.Max;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
nVertex.X = box.Min.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
nVertex.Y = box.Min.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
nVertex.Z = box.Min.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistN);
|
|
||||||
distanceN = tempDistN - planeDistance;
|
|
||||||
|
|
||||||
if (distanceN < 0 && distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Disjoint;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (distanceN < 0 || distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Intersects;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plane = Left;
|
result = ContainmentType.Intersects;
|
||||||
normal = plane.Normal;
|
|
||||||
//Vector3.Negate(ref normal, out normal);
|
|
||||||
planeDistance = plane.D;
|
|
||||||
|
|
||||||
pVertex = box.Min;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
pVertex.X = box.Max.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
pVertex.Y = box.Max.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
pVertex.Z = box.Max.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistP);
|
|
||||||
distanceP = tempDistP - planeDistance;
|
|
||||||
|
|
||||||
nVertex = box.Max;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
nVertex.X = box.Min.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
nVertex.Y = box.Min.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
nVertex.Z = box.Min.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistN);
|
|
||||||
distanceN = tempDistN - planeDistance;
|
|
||||||
|
|
||||||
if (distanceN < 0 && distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Disjoint;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (distanceN < 0 || distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Intersects;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plane = Right;
|
|
||||||
normal = plane.Normal;
|
|
||||||
//Vector3.Negate(ref normal, out normal);
|
|
||||||
planeDistance = plane.D;
|
|
||||||
|
|
||||||
pVertex = box.Min;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
pVertex.X = box.Max.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
pVertex.Y = box.Max.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
pVertex.Z = box.Max.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistP);
|
|
||||||
distanceP = tempDistP - planeDistance;
|
|
||||||
|
|
||||||
nVertex = box.Max;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
nVertex.X = box.Min.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
nVertex.Y = box.Min.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
nVertex.Z = box.Min.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistN);
|
|
||||||
distanceN = tempDistN - planeDistance;
|
|
||||||
|
|
||||||
if (distanceN < 0 && distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Disjoint;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (distanceN < 0 || distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Intersects;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plane = Near;
|
|
||||||
normal = plane.Normal;
|
|
||||||
//Vector3.Negate(ref normal, out normal);
|
|
||||||
planeDistance = plane.D;
|
|
||||||
|
|
||||||
pVertex = box.Min;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
pVertex.X = box.Max.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
pVertex.Y = box.Max.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
pVertex.Z = box.Max.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistP);
|
|
||||||
distanceP = tempDistP - planeDistance;
|
|
||||||
|
|
||||||
nVertex = box.Max;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
nVertex.X = box.Min.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
nVertex.Y = box.Min.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
nVertex.Z = box.Min.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistN);
|
|
||||||
distanceN = tempDistN - planeDistance;
|
|
||||||
|
|
||||||
if (distanceN < 0 && distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Disjoint;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (distanceN < 0 || distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Intersects;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
plane = Far;
|
|
||||||
normal = plane.Normal;
|
|
||||||
//Vector3.Negate(ref normal, out normal);
|
|
||||||
planeDistance = plane.D;
|
|
||||||
|
|
||||||
pVertex = box.Min;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
pVertex.X = box.Max.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
pVertex.Y = box.Max.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
pVertex.Z = box.Max.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistP);
|
|
||||||
distanceP = tempDistP - planeDistance;
|
|
||||||
|
|
||||||
nVertex = box.Max;
|
|
||||||
if (normal.X >= 0)
|
|
||||||
nVertex.X = box.Min.X;
|
|
||||||
if (normal.Y >= 0)
|
|
||||||
nVertex.Y = box.Min.Y;
|
|
||||||
if (normal.Z < 0)
|
|
||||||
nVertex.Z = box.Min.Z;
|
|
||||||
|
|
||||||
Vector3.Dot(ref normal, ref pVertex, out tempDistN);
|
|
||||||
distanceN = tempDistN - planeDistance;
|
|
||||||
|
|
||||||
if (distanceN < 0 && distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Disjoint;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (distanceN < 0 || distanceP < 0)
|
|
||||||
{
|
|
||||||
result = ContainmentType.Intersects;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainmentType Contains(BoundingFrustum frustum)
|
public ContainmentType Contains(BoundingFrustum frustum)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (frustum == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("frustum");
|
||||||
|
}
|
||||||
|
|
||||||
|
ContainmentType result = ContainmentType.Disjoint;
|
||||||
|
if (this.Intersects(frustum))
|
||||||
|
{
|
||||||
|
result = ContainmentType.Contains;
|
||||||
|
for (int i = 0; i < this.corners.Length; i++)
|
||||||
|
{
|
||||||
|
if (this.Contains(frustum.corners[i]) == ContainmentType.Disjoint)
|
||||||
|
{
|
||||||
|
result = ContainmentType.Intersects;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContainmentType Contains(BoundingSphere sphere)
|
public ContainmentType Contains(BoundingSphere sphere)
|
||||||
@ -522,10 +317,12 @@ namespace ANX.Framework
|
|||||||
{
|
{
|
||||||
throw new ArgumentNullException("corners");
|
throw new ArgumentNullException("corners");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (corners.Length < 8)
|
if (corners.Length < 8)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("corners", "The array to be filled with corner vertices needs at least have a length of 8 Vector3");
|
throw new ArgumentOutOfRangeException("corners", "The array to be filled with corner vertices needs at least have a length of 8 Vector3");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.corners.CopyTo(corners, 0);
|
this.corners.CopyTo(corners, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -773,27 +570,79 @@ namespace ANX.Framework
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
// This may look a bit more ugly, but String.Format should
|
// This may look a bit more ugly, but String.Format should
|
||||||
// be avoided cause of it's bad performance!
|
// be avoided cause of it's bad performance!
|
||||||
return "{Near:" + Near.ToString() +
|
return "{Near:" + Near.ToString() +
|
||||||
" Far:" + Far.ToString() +
|
" Far:" + Far.ToString() +
|
||||||
" Left:" + Left.ToString() +
|
" Left:" + Left.ToString() +
|
||||||
" Right:" + Right.ToString() +
|
" Right:" + Right.ToString() +
|
||||||
" Top:" + Top.ToString() +
|
" Top:" + Top.ToString() +
|
||||||
" Bottom:" + Bottom.ToString() + "}";
|
" Bottom:" + Bottom.ToString() + "}";
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
////source: monoxna
|
#region public properties
|
||||||
// var currentCulture = System.Globalization.CultureInfo.CurrentCulture;
|
public Matrix Matrix
|
||||||
// return string.Format(currentCulture, "{{Near:{0} Far:{1} Left:{2} Right:{3} Top:{4} Bottom:{5}}}", new object[]
|
{
|
||||||
//{
|
get
|
||||||
// this.Near.ToString(),
|
{
|
||||||
// this.Far.ToString(),
|
return this.matrix;
|
||||||
// this.Left.ToString(),
|
}
|
||||||
// this.Right.ToString(),
|
set
|
||||||
// this.Top.ToString(),
|
{
|
||||||
// this.Bottom.ToString()
|
this.matrix = value;
|
||||||
//});
|
this.CreatePlanes();
|
||||||
|
this.CreateCorners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plane Near
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.planes[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plane Far
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.planes[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plane Top
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.planes[4];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plane Bottom
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.planes[5];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plane Right
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.planes[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plane Left
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return this.planes[2];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -801,52 +650,68 @@ namespace ANX.Framework
|
|||||||
//algorithm based on but normals were pointing to outside instead of inside: http://crazyjoke.free.fr/doc/3D/plane%20extraction.pdf
|
//algorithm based on but normals were pointing to outside instead of inside: http://crazyjoke.free.fr/doc/3D/plane%20extraction.pdf
|
||||||
private void CreatePlanes()
|
private void CreatePlanes()
|
||||||
{
|
{
|
||||||
this.near.Normal.X = -this.matrix.M13;
|
int idx;
|
||||||
this.near.Normal.Y = -this.matrix.M23;
|
|
||||||
this.near.Normal.Z = -this.matrix.M33;
|
|
||||||
this.near.D = -this.matrix.M43;
|
|
||||||
|
|
||||||
this.far.Normal.X = this.matrix.M14 - this.matrix.M13;
|
idx = (int)PlanePosition.Near;
|
||||||
this.far.Normal.Y = this.matrix.M24 - this.matrix.M23;
|
this.planes[idx].Normal.X = -this.matrix.M13;
|
||||||
this.far.Normal.Z = this.matrix.M34 - this.matrix.M33;
|
this.planes[idx].Normal.Y = -this.matrix.M23;
|
||||||
this.far.D = this.matrix.M44 - this.matrix.M43;
|
this.planes[idx].Normal.Z = -this.matrix.M33;
|
||||||
|
this.planes[idx].D = -this.matrix.M43;
|
||||||
|
|
||||||
this.left.Normal.X = -this.matrix.M14 - this.matrix.M11;
|
idx = (int)PlanePosition.Far;
|
||||||
this.left.Normal.Y = -this.matrix.M24 - this.matrix.M21;
|
this.planes[idx].Normal.X = -this.matrix.M14 + this.matrix.M13;
|
||||||
this.left.Normal.Z = -this.matrix.M34 - this.matrix.M31;
|
this.planes[idx].Normal.Y = -this.matrix.M24 + this.matrix.M23;
|
||||||
this.left.D = -this.matrix.M44 - this.matrix.M41;
|
this.planes[idx].Normal.Z = -this.matrix.M34 + this.matrix.M33;
|
||||||
|
this.planes[idx].D = -this.matrix.M44 + this.matrix.M43;
|
||||||
|
|
||||||
this.right.Normal.X = -this.matrix.M14 + this.matrix.M11;
|
idx = (int)PlanePosition.Left;
|
||||||
this.right.Normal.Y = -this.matrix.M24 + this.matrix.M21;
|
this.planes[idx].Normal.X = -this.matrix.M14 - this.matrix.M11;
|
||||||
this.right.Normal.Z = -this.matrix.M34 + this.matrix.M31;
|
this.planes[idx].Normal.Y = -this.matrix.M24 - this.matrix.M21;
|
||||||
this.right.D = -this.matrix.M44 + this.matrix.M41;
|
this.planes[idx].Normal.Z = -this.matrix.M34 - this.matrix.M31;
|
||||||
|
this.planes[idx].D = -this.matrix.M44 - this.matrix.M41;
|
||||||
|
|
||||||
this.top.Normal.X = -this.matrix.M14 + this.matrix.M12;
|
idx = (int)PlanePosition.Right;
|
||||||
this.top.Normal.Y = -this.matrix.M24 + this.matrix.M22;
|
this.planes[idx].Normal.X = -this.matrix.M14 + this.matrix.M11;
|
||||||
this.top.Normal.Z = -this.matrix.M34 + this.matrix.M32;
|
this.planes[idx].Normal.Y = -this.matrix.M24 + this.matrix.M21;
|
||||||
this.top.D = -this.matrix.M44 + this.matrix.M42;
|
this.planes[idx].Normal.Z = -this.matrix.M34 + this.matrix.M31;
|
||||||
|
this.planes[idx].D = -this.matrix.M44 + this.matrix.M41;
|
||||||
|
|
||||||
this.bottom.Normal.X = -this.matrix.M14 - this.matrix.M12;
|
idx = (int)PlanePosition.Top;
|
||||||
this.bottom.Normal.Y = -this.matrix.M24 - this.matrix.M22;
|
this.planes[idx].Normal.X = -this.matrix.M14 + this.matrix.M12;
|
||||||
this.bottom.Normal.Z = -this.matrix.M34 - this.matrix.M32;
|
this.planes[idx].Normal.Y = -this.matrix.M24 + this.matrix.M22;
|
||||||
this.bottom.D = -this.matrix.M44 - this.matrix.M42;
|
this.planes[idx].Normal.Z = -this.matrix.M34 + this.matrix.M32;
|
||||||
|
this.planes[idx].D = -this.matrix.M44 + this.matrix.M42;
|
||||||
|
|
||||||
NormalizePlane(ref this.left);
|
idx = (int)PlanePosition.Bottom;
|
||||||
NormalizePlane(ref this.right);
|
this.planes[idx].Normal.X = -this.matrix.M14 - this.matrix.M12;
|
||||||
NormalizePlane(ref this.bottom);
|
this.planes[idx].Normal.Y = -this.matrix.M24 - this.matrix.M22;
|
||||||
NormalizePlane(ref this.top);
|
this.planes[idx].Normal.Z = -this.matrix.M34 - this.matrix.M32;
|
||||||
NormalizePlane(ref this.near);
|
this.planes[idx].D = -this.matrix.M44 - this.matrix.M42;
|
||||||
NormalizePlane(ref this.far);
|
|
||||||
|
for (int i = 0; i < this.planes.Length; i++)
|
||||||
|
{
|
||||||
|
this.planes[i].Normalize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//source: monoxna
|
private void CreateCorners()
|
||||||
private void NormalizePlane(ref Plane p)
|
|
||||||
{
|
{
|
||||||
float factor = 1f / p.Normal.Length();
|
Ray rnl = BoundingFrustum.EdgeIntersection(ref this.planes[(int)PlanePosition.Near], ref this.planes[(int)PlanePosition.Left]);
|
||||||
p.Normal.X *= factor;
|
Ray rrn = BoundingFrustum.EdgeIntersection(ref this.planes[(int)PlanePosition.Right], ref this.planes[(int)PlanePosition.Near]);
|
||||||
p.Normal.Y *= factor;
|
Ray rlf = BoundingFrustum.EdgeIntersection(ref this.planes[(int)PlanePosition.Left], ref this.planes[(int)PlanePosition.Far]);
|
||||||
p.Normal.Z *= factor;
|
Ray rfr = BoundingFrustum.EdgeIntersection(ref this.planes[(int)PlanePosition.Far], ref this.planes[(int)PlanePosition.Right]);
|
||||||
p.D *= factor;
|
|
||||||
|
this.corners = new[]
|
||||||
|
{
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Top], ref rnl),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Top], ref rrn),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Bottom], ref rrn),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Bottom], ref rnl),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Top], ref rlf),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Top], ref rfr),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Bottom], ref rfr),
|
||||||
|
BoundingFrustum.PointIntersection(ref this.planes[(int)PlanePosition.Bottom], ref rlf),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
//source: monoxna
|
//source: monoxna
|
||||||
@ -870,19 +735,21 @@ namespace ANX.Framework
|
|||||||
return vec / f;
|
return vec / f;
|
||||||
}
|
}
|
||||||
|
|
||||||
//source: monoxna
|
private static Ray EdgeIntersection(ref Plane p1, ref Plane p2)
|
||||||
private void CreateCorners()
|
|
||||||
{
|
{
|
||||||
this.corners = new Vector3[8];
|
Ray result = default(Ray);
|
||||||
this.corners[0] = IntersectionPoint(ref this.near, ref this.left, ref this.top);
|
result.Direction = Vector3.Cross(p1.Normal, p2.Normal);
|
||||||
this.corners[1] = IntersectionPoint(ref this.near, ref this.right, ref this.top);
|
float divider = result.Direction.LengthSquared();
|
||||||
this.corners[2] = IntersectionPoint(ref this.near, ref this.right, ref this.bottom);
|
result.Position = Vector3.Cross(-p1.D * p2.Normal + p2.D * p1.Normal, result.Direction) / divider;
|
||||||
this.corners[3] = IntersectionPoint(ref this.near, ref this.left, ref this.bottom);
|
return result;
|
||||||
this.corners[4] = IntersectionPoint(ref this.far, ref this.left, ref this.top);
|
|
||||||
this.corners[5] = IntersectionPoint(ref this.far, ref this.right, ref this.top);
|
|
||||||
this.corners[6] = IntersectionPoint(ref this.far, ref this.right, ref this.bottom);
|
|
||||||
this.corners[7] = IntersectionPoint(ref this.far, ref this.left, ref this.bottom);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Vector3 PointIntersection(ref Plane plane, ref Ray ray)
|
||||||
|
{
|
||||||
|
float scaleFactor = (-plane.D - Vector3.Dot(plane.Normal, ray.Position)) / Vector3.Dot(plane.Normal, ray.Direction);
|
||||||
|
return ray.Position + ray.Direction * scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IEquatable implementation
|
#region IEquatable implementation
|
||||||
@ -910,6 +777,7 @@ namespace ANX.Framework
|
|||||||
{
|
{
|
||||||
return object.Equals(a, b);
|
return object.Equals(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool operator !=(BoundingFrustum a, BoundingFrustum b)
|
public static bool operator !=(BoundingFrustum a, BoundingFrustum b)
|
||||||
{
|
{
|
||||||
return !object.Equals(a, b);
|
return !object.Equals(a, b);
|
||||||
|
@ -11,6 +11,7 @@ namespace ANX.Framework.Graphics
|
|||||||
{
|
{
|
||||||
[PercentageComplete(60)]
|
[PercentageComplete(60)]
|
||||||
[TestState(TestStateAttribute.TestState.Untested)]
|
[TestState(TestStateAttribute.TestState.Untested)]
|
||||||
|
[Developer("Glatzemann")]
|
||||||
public sealed class EffectParameter
|
public sealed class EffectParameter
|
||||||
{
|
{
|
||||||
#region Public (TODO)
|
#region Public (TODO)
|
||||||
@ -76,7 +77,7 @@ namespace ANX.Framework.Graphics
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
return this.NativeParameter.Semantic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#region Using Statements
|
#region Using Statements
|
||||||
using System;
|
using System;
|
||||||
using ANX.Framework.Graphics;
|
using ANX.Framework.Graphics;
|
||||||
|
using ANX.Framework.NonXNA.Development;
|
||||||
|
|
||||||
#endregion // Using Statements
|
#endregion // Using Statements
|
||||||
|
|
||||||
@ -10,58 +11,63 @@ using ANX.Framework.Graphics;
|
|||||||
|
|
||||||
namespace ANX.Framework.NonXNA
|
namespace ANX.Framework.NonXNA
|
||||||
{
|
{
|
||||||
|
[PercentageComplete(100)]
|
||||||
|
[TestState(TestStateAttribute.TestState.Untested)]
|
||||||
|
[Developer("Glatzemann")]
|
||||||
public interface INativeEffectParameter
|
public interface INativeEffectParameter
|
||||||
{
|
{
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
|
|
||||||
#region GetValue
|
string Semantic { get; }
|
||||||
bool GetValueBoolean();
|
|
||||||
|
|
||||||
bool[] GetValueBooleanArray(int count);
|
#region GetValue
|
||||||
|
bool GetValueBoolean();
|
||||||
|
|
||||||
int GetValueInt32();
|
bool[] GetValueBooleanArray(int count);
|
||||||
|
|
||||||
int[] GetValueInt32Array(int count);
|
int GetValueInt32();
|
||||||
|
|
||||||
Matrix GetValueMatrix();
|
int[] GetValueInt32Array(int count);
|
||||||
|
|
||||||
Matrix[] GetValueMatrixArray(int count);
|
Matrix GetValueMatrix();
|
||||||
|
|
||||||
Matrix GetValueMatrixTranspose();
|
Matrix[] GetValueMatrixArray(int count);
|
||||||
|
|
||||||
Matrix[] GetValueMatrixTransposeArray(int count);
|
Matrix GetValueMatrixTranspose();
|
||||||
|
|
||||||
Quaternion GetValueQuaternion();
|
Matrix[] GetValueMatrixTransposeArray(int count);
|
||||||
|
|
||||||
Quaternion[] GetValueQuaternionArray(int count);
|
Quaternion GetValueQuaternion();
|
||||||
|
|
||||||
float GetValueSingle();
|
Quaternion[] GetValueQuaternionArray(int count);
|
||||||
|
|
||||||
float[] GetValueSingleArray(int count);
|
float GetValueSingle();
|
||||||
|
|
||||||
string GetValueString();
|
float[] GetValueSingleArray(int count);
|
||||||
|
|
||||||
Texture2D GetValueTexture2D();
|
string GetValueString();
|
||||||
|
|
||||||
Texture3D GetValueTexture3D();
|
Texture2D GetValueTexture2D();
|
||||||
|
|
||||||
TextureCube GetValueTextureCube();
|
Texture3D GetValueTexture3D();
|
||||||
|
|
||||||
Vector2 GetValueVector2();
|
TextureCube GetValueTextureCube();
|
||||||
|
|
||||||
Vector2[] GetValueVector2Array(int count);
|
Vector2 GetValueVector2();
|
||||||
|
|
||||||
Vector3 GetValueVector3();
|
Vector2[] GetValueVector2Array(int count);
|
||||||
|
|
||||||
Vector3[] GetValueVector3Array(int count);
|
Vector3 GetValueVector3();
|
||||||
|
|
||||||
Vector4 GetValueVector4();
|
Vector3[] GetValueVector3Array(int count);
|
||||||
|
|
||||||
Vector4[] GetValueVector4Array(int count);
|
Vector4 GetValueVector4();
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SetValue
|
Vector4[] GetValueVector4Array(int count);
|
||||||
void SetValue(bool value);
|
#endregion
|
||||||
|
|
||||||
|
#region SetValue
|
||||||
|
void SetValue(bool value);
|
||||||
|
|
||||||
void SetValue(bool[] value);
|
void SetValue(bool[] value);
|
||||||
|
|
||||||
@ -69,7 +75,7 @@ namespace ANX.Framework.NonXNA
|
|||||||
|
|
||||||
void SetValue(int[] value);
|
void SetValue(int[] value);
|
||||||
|
|
||||||
void SetValue(Matrix value, bool transpose);
|
void SetValue(Matrix value, bool transpose);
|
||||||
|
|
||||||
void SetValue(Matrix[] value, bool transpose);
|
void SetValue(Matrix[] value, bool transpose);
|
||||||
|
|
||||||
@ -91,11 +97,11 @@ namespace ANX.Framework.NonXNA
|
|||||||
|
|
||||||
void SetValue(Vector4 value);
|
void SetValue(Vector4 value);
|
||||||
|
|
||||||
void SetValue(Vector4[] value);
|
void SetValue(Vector4[] value);
|
||||||
|
|
||||||
void SetValue(string value);
|
void SetValue(string value);
|
||||||
|
|
||||||
void SetValue(Texture value);
|
void SetValue(Texture value);
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,14 @@ namespace ANX.RenderSystem.GL3
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Semantic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The index of the uniform.
|
/// The index of the uniform.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.5.13.*")]
|
[assembly: AssemblyVersion("0.5.14.*")]
|
||||||
[assembly: AssemblyFileVersion("0.5.13.0")]
|
[assembly: AssemblyFileVersion("0.5.14.0")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
||||||
|
@ -3,6 +3,7 @@ using ANX.Framework;
|
|||||||
using ANX.Framework.Graphics;
|
using ANX.Framework.Graphics;
|
||||||
using ANX.Framework.NonXNA;
|
using ANX.Framework.NonXNA;
|
||||||
using Dx10 = SharpDX.Direct3D10;
|
using Dx10 = SharpDX.Direct3D10;
|
||||||
|
using ANX.Framework.NonXNA.Development;
|
||||||
|
|
||||||
// This file is part of the ANX.Framework created by the
|
// This file is part of the ANX.Framework created by the
|
||||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||||
@ -10,7 +11,10 @@ using Dx10 = SharpDX.Direct3D10;
|
|||||||
|
|
||||||
namespace ANX.RenderSystem.Windows.DX10
|
namespace ANX.RenderSystem.Windows.DX10
|
||||||
{
|
{
|
||||||
public class EffectParameter_DX10 : INativeEffectParameter
|
[PercentageComplete(70)]
|
||||||
|
[TestState(TestStateAttribute.TestState.Untested)]
|
||||||
|
[Developer("Glatzemann")]
|
||||||
|
public class EffectParameter_DX10 : INativeEffectParameter
|
||||||
{
|
{
|
||||||
#region Public
|
#region Public
|
||||||
public Dx10.EffectVariable NativeParameter
|
public Dx10.EffectVariable NativeParameter
|
||||||
@ -26,6 +30,14 @@ namespace ANX.RenderSystem.Windows.DX10
|
|||||||
return NativeParameter.Description.Name;
|
return NativeParameter.Description.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Semantic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return NativeParameter.Description.Semantic;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region SetValue (bool)
|
#region SetValue (bool)
|
||||||
|
@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
|
|||||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||||
// übernehmen, indem Sie "*" eingeben:
|
// übernehmen, indem Sie "*" eingeben:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.7.23.*")]
|
[assembly: AssemblyVersion("0.7.24.*")]
|
||||||
[assembly: AssemblyFileVersion("0.7.23.0")]
|
[assembly: AssemblyFileVersion("0.7.24.0")]
|
||||||
|
|
||||||
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
|
||||||
|
@ -3,6 +3,7 @@ using ANX.Framework;
|
|||||||
using ANX.Framework.Graphics;
|
using ANX.Framework.Graphics;
|
||||||
using ANX.Framework.NonXNA;
|
using ANX.Framework.NonXNA;
|
||||||
using Dx11 = SharpDX.Direct3D11;
|
using Dx11 = SharpDX.Direct3D11;
|
||||||
|
using ANX.Framework.NonXNA.Development;
|
||||||
|
|
||||||
// This file is part of the ANX.Framework created by the
|
// This file is part of the ANX.Framework created by the
|
||||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||||
@ -10,7 +11,10 @@ using Dx11 = SharpDX.Direct3D11;
|
|||||||
|
|
||||||
namespace ANX.RenderSystem.Windows.DX11
|
namespace ANX.RenderSystem.Windows.DX11
|
||||||
{
|
{
|
||||||
public class EffectParameter_DX11 : INativeEffectParameter
|
[PercentageComplete(60)]
|
||||||
|
[TestState(TestStateAttribute.TestState.Untested)]
|
||||||
|
[Developer("Glatzemann")]
|
||||||
|
public class EffectParameter_DX11 : INativeEffectParameter
|
||||||
{
|
{
|
||||||
#region Public
|
#region Public
|
||||||
public Dx11.EffectVariable NativeParameter
|
public Dx11.EffectVariable NativeParameter
|
||||||
@ -26,6 +30,14 @@ namespace ANX.RenderSystem.Windows.DX11
|
|||||||
return NativeParameter.Description.Name;
|
return NativeParameter.Description.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Semantic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return NativeParameter.Description.Semantic;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region SetValue (bool)
|
#region SetValue (bool)
|
||||||
|
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
|||||||
// Buildnummer
|
// Buildnummer
|
||||||
// Revision
|
// Revision
|
||||||
//
|
//
|
||||||
[assembly: AssemblyVersion("0.7.15.*")]
|
[assembly: AssemblyVersion("0.7.16.*")]
|
||||||
[assembly: AssemblyFileVersion("0.7.15.0")]
|
[assembly: AssemblyFileVersion("0.7.16.0")]
|
||||||
|
@ -25,6 +25,14 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
return nativeParameter.Name;
|
return nativeParameter.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Semantic
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return nativeParameter.Semantic;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
|
@ -24,6 +24,6 @@ using System.Runtime.InteropServices;
|
|||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("0.2.7.*")]
|
[assembly: AssemblyVersion("0.2.8.*")]
|
||||||
[assembly: AssemblyFileVersion("0.2.7.0")]
|
[assembly: AssemblyFileVersion("0.2.8.0")]
|
||||||
[assembly: GuidAttribute("855A261E-DB66-4CB2-97F3-34BC9DA4DAA1")]
|
[assembly: GuidAttribute("855A261E-DB66-4CB2-97F3-34BC9DA4DAA1")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user