- Fixed the Curve class Oscillate mode and all Curve tests are now passing!
- Added the missing Serializable attribute to the Curve class - Added some more Development attributes
This commit is contained in:
parent
4fdad340d3
commit
646c2e5b79
@ -32,8 +32,6 @@ namespace ANX.Framework.TestCenter.Strukturen
|
||||
[TestFixture]
|
||||
public class CurveKeyTest
|
||||
{
|
||||
|
||||
|
||||
#region Testdata
|
||||
static object[] sixteenfloats =
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,9 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct BoundingBox : IEquatable<BoundingBox>
|
||||
{
|
||||
#region public fields
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -11,6 +12,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct BoundingSphere : IEquatable<BoundingSphere>
|
||||
{
|
||||
#region fields
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using ANX.Framework.Graphics.PackedVector;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -7,6 +8,9 @@ using ANX.Framework.Graphics.PackedVector;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Color : IPackedVector<uint>, IPackedVector, IEquatable<Color>
|
||||
{
|
||||
#region Private Members
|
||||
|
@ -7,6 +7,7 @@
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum ContainmentType
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -6,64 +7,45 @@ using System;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
#if !WINDOWSMETRO // TODO: find replacement for Win8!
|
||||
[Serializable]
|
||||
#endif
|
||||
[PercentageComplete(100)]
|
||||
[Developer("floAr")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public class Curve
|
||||
{
|
||||
private CurveKeyCollection keys;
|
||||
private CurveLoopType preLoop;
|
||||
private CurveLoopType postLoop;
|
||||
public CurveLoopType PreLoop { get; set; }
|
||||
public CurveLoopType PostLoop { get; set; }
|
||||
public CurveKeyCollection Keys { get; private set; }
|
||||
|
||||
public CurveLoopType PreLoop
|
||||
public bool IsConstant
|
||||
{
|
||||
get { return preLoop; }
|
||||
set { preLoop = value; }
|
||||
}
|
||||
public CurveLoopType PostLoop
|
||||
{
|
||||
get { return postLoop; }
|
||||
set { postLoop = value; }
|
||||
get { return Keys.Count <= 1; }
|
||||
}
|
||||
|
||||
public CurveKeyCollection Keys
|
||||
public Curve()
|
||||
{
|
||||
get
|
||||
{
|
||||
return keys;
|
||||
}
|
||||
}
|
||||
|
||||
public Boolean IsConstant
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.keys.Count <= 1;
|
||||
}
|
||||
Keys = new CurveKeyCollection();
|
||||
}
|
||||
|
||||
public Curve Clone()
|
||||
{
|
||||
Curve result = new Curve();
|
||||
result.keys = this.keys.Clone();
|
||||
result.preLoop = this.preLoop;
|
||||
result.postLoop = this.postLoop;
|
||||
return result;
|
||||
}
|
||||
public Curve()
|
||||
{
|
||||
this.keys = new CurveKeyCollection();
|
||||
return new Curve { Keys = Keys.Clone(), PreLoop = PreLoop, PostLoop = PostLoop };
|
||||
}
|
||||
|
||||
#region tangent calculation
|
||||
#region ComputeTangent
|
||||
//formulas from: http://msdn.microsoft.com/de-de/library/microsoft.xna.framework.curvetangent%28v=xnagamestudio.40%29.aspx
|
||||
public void ComputeTangent(Int32 index, CurveTangent tangentInOutType)
|
||||
public void ComputeTangent(int index, CurveTangent tangentInOutType)
|
||||
{
|
||||
if (index < 0 || index >= keys.Count)
|
||||
if (index < 0 || index >= Keys.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
CurveKey prev = index > 0 ? this.keys[index - 1] : this.keys[index];
|
||||
CurveKey current = this.keys[index];
|
||||
CurveKey prev = index > 0 ? this.Keys[index - 1] : this.Keys[index];
|
||||
CurveKey current = this.Keys[index];
|
||||
current.TangentIn = 0;
|
||||
CurveKey next = index < this.keys.Count - 1 ? this.keys[index + 1] : this.keys[index];
|
||||
CurveKey next = index < this.Keys.Count - 1 ? this.Keys[index + 1] : this.Keys[index];
|
||||
|
||||
|
||||
switch (tangentInOutType)
|
||||
@ -82,17 +64,18 @@ namespace ANX.Framework
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void ComputeTangent(Int32 index, CurveTangent tangentInType, CurveTangent tangentOutType)
|
||||
|
||||
public void ComputeTangent(int index, CurveTangent tangentInType, CurveTangent tangentOutType)
|
||||
{
|
||||
if (index < 0 || index >= keys.Count)
|
||||
if (index < 0 || index >= Keys.Count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
CurveKey prev = index > 0 ? this.keys[index - 1] : this.keys[index];
|
||||
CurveKey current = this.keys[index];
|
||||
CurveKey prev = index > 0 ? this.Keys[index - 1] : this.Keys[index];
|
||||
CurveKey current = this.Keys[index];
|
||||
current.TangentIn = 0;
|
||||
CurveKey next = index < this.keys.Count - 1 ? this.keys[index + 1] : this.keys[index];
|
||||
CurveKey next = index < this.Keys.Count - 1 ? this.Keys[index + 1] : this.Keys[index];
|
||||
|
||||
|
||||
switch (tangentInType)
|
||||
@ -121,165 +104,169 @@ namespace ANX.Framework
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ComputeTangents(CurveTangent tangentInOutType)
|
||||
{
|
||||
for (int i = 0; i < this.keys.Count; ++i)
|
||||
for (int i = 0; i < this.Keys.Count; ++i)
|
||||
{
|
||||
this.ComputeTangent(i, tangentInOutType);
|
||||
}
|
||||
}
|
||||
|
||||
public void ComputeTangents(CurveTangent tangentInType, CurveTangent tangentOutType)
|
||||
{
|
||||
for (int i = 0; i < this.keys.Count; ++i)
|
||||
for (int i = 0; i < this.Keys.Count; ++i)
|
||||
{
|
||||
this.ComputeTangent(i, tangentInType, tangentOutType);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public Single Evaluate(Single position)
|
||||
public float Evaluate(float position)
|
||||
{
|
||||
if (Keys.Count == 0)
|
||||
return 0f;
|
||||
|
||||
if (Keys.Count == 1)
|
||||
return Keys[0].Value;
|
||||
|
||||
CurveKey firstPointOfCurve = Keys[0];
|
||||
CurveKey lastPointOfCurve = Keys[Keys.Count - 1];
|
||||
|
||||
if (position < firstPointOfCurve.Position)
|
||||
return EvalualtePreLoop(firstPointOfCurve, lastPointOfCurve, position);
|
||||
|
||||
if (position > lastPointOfCurve.Position)
|
||||
return EvalualtePostLoop(firstPointOfCurve, lastPointOfCurve, position);
|
||||
|
||||
return Interpolate(position);
|
||||
}
|
||||
|
||||
#region EvalualtePreLoop
|
||||
private float EvalualtePreLoop(CurveKey first, CurveKey last, float position)
|
||||
{
|
||||
int wraps;
|
||||
float firstPosition = first.Position;
|
||||
float lastPosition = last.Position;
|
||||
// tspan is min 1 to avoid deadlock at constant curves
|
||||
float timeSpan = Math.Max(1, lastPosition - firstPosition);
|
||||
|
||||
// Description from : http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.curvelooptype.aspx
|
||||
switch (PreLoop)
|
||||
{
|
||||
case CurveLoopType.Constant:
|
||||
// The Curve will evaluate to its first key for positions before the first point in the Curve and to
|
||||
// the last key for positions after the last point.
|
||||
return first.Value;
|
||||
|
||||
case CurveLoopType.Linear:
|
||||
// Linear interpolation will be performed to determine the value.
|
||||
return first.Value - first.TangentIn * (first.Position - position);
|
||||
|
||||
case CurveLoopType.Cycle:
|
||||
// Positions specified past the ends of the curve will wrap around to the opposite side of the Curve.
|
||||
position -= timeSpan * CountWraps(position);
|
||||
return Interpolate(position);
|
||||
|
||||
case CurveLoopType.CycleOffset:
|
||||
// Positions specified past the ends of the curv will wrap around to the opposite side of the Curve.
|
||||
// The value will be offset by the difference between the values of the first and last CurveKey
|
||||
// multiplied by the number of times the position wraps around. If the position is before the first
|
||||
// point in the Curve, the difference will be subtracted from its value; otherwise, the difference
|
||||
// will be added
|
||||
wraps = CountWraps(position);
|
||||
float difference = (last.Value - first.Value) * wraps;
|
||||
position -= timeSpan * CountWraps(position);
|
||||
return Interpolate(position) + difference;
|
||||
|
||||
case CurveLoopType.Oscillate:
|
||||
// Positions specified past the ends of the Curve act as an offset from the same side of the Curve
|
||||
// toward the opposite side.
|
||||
wraps = CountWraps(position);
|
||||
float offset = position - (first.Position + wraps * timeSpan);
|
||||
float wrappedPosition = (wraps & 1) != 0 ? (last.Position - offset) : (first.Position + offset);
|
||||
return Interpolate(wrappedPosition);
|
||||
}
|
||||
|
||||
return Interpolate(position);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region EvalualtePostLoop
|
||||
private float EvalualtePostLoop(CurveKey first, CurveKey last, float position)
|
||||
{
|
||||
int wraps;
|
||||
//Get first and last Point
|
||||
CurveKey first = keys[0];
|
||||
float firstPosition = first.Position;
|
||||
CurveKey last = keys[keys.Count - 1];
|
||||
float lastPosition = last.Position;
|
||||
//tspan is min 1 to avoid deadlock at constant curves
|
||||
float timeSpan = Math.Max(1, lastPosition - firstPosition);
|
||||
//wanted point before first point
|
||||
if (position < first.Position)
|
||||
|
||||
switch (PostLoop)
|
||||
{
|
||||
// Description from : http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.curvelooptype.aspx
|
||||
switch (this.PreLoop)
|
||||
{
|
||||
case CurveLoopType.Constant:
|
||||
//The Curve will evaluate to its first key for positions before the first point in the Curve and to the last key for positions after the last point.
|
||||
return first.Value;
|
||||
case CurveLoopType.Constant:
|
||||
// The Curve will evaluate to its first key for positions before the first point in the Curve and to
|
||||
// the last key for positions after the last point.
|
||||
return last.Value;
|
||||
|
||||
case CurveLoopType.Linear:
|
||||
// Linear interpolation will be performed to determine the value.
|
||||
return first.Value - first.TangentIn * (first.Position - position);
|
||||
case CurveLoopType.Linear:
|
||||
// Linear interpolation will be performed to determine the value.
|
||||
return last.Value - last.TangentOut * (last.Position - position);
|
||||
|
||||
case CurveLoopType.Cycle:
|
||||
// Positions specified past the ends of the curve will wrap around to the opposite side of the Curve.
|
||||
case CurveLoopType.Cycle:
|
||||
// Positions specified past the ends of the curve will wrap around to the opposite side of the Curve.
|
||||
position -= timeSpan * CountWraps(position);
|
||||
return Interpolate(position);
|
||||
|
||||
case CurveLoopType.CycleOffset:
|
||||
// Positions specified past the ends of the curve will wrap around to the opposite side of the Curve.
|
||||
// The value will be offset by the difference between the values of the first and last CurveKey
|
||||
// multiplied by the number of times the position wraps around. If the position is before the first
|
||||
// point in the Curve, the difference will be subtracted from its value; otherwise, the difference
|
||||
// will be added.
|
||||
wraps = CountWraps(position);
|
||||
float difference = (last.Value - first.Value) * wraps;
|
||||
position -= timeSpan * CountWraps(position);
|
||||
return Interpolate(position) + difference;
|
||||
|
||||
position -= timeSpan * countWraps(position);
|
||||
|
||||
return this.interpolate((position));
|
||||
|
||||
|
||||
|
||||
case CurveLoopType.CycleOffset:
|
||||
//Positions specified past the ends of the curv will wrap around to the opposite side of the Curve.
|
||||
//The value will be offset by the difference between the values of the first and last CurveKey
|
||||
//multiplied by the number of times the position wraps around. If the position is before the first
|
||||
//point in the Curve, the difference will be subtracted from its value; otherwise, the difference
|
||||
//will be added
|
||||
wraps = countWraps(position);
|
||||
float difference = (this.keys[this.keys.Count - 1].Value - this.keys[0].Value) * wraps;
|
||||
|
||||
position -= timeSpan * countWraps(position);
|
||||
|
||||
return this.interpolate(position) + difference;
|
||||
|
||||
case CurveLoopType.Oscillate:
|
||||
//Positions specified past the ends of the Curve act as an offset from the same side of the Curve
|
||||
//toward the opposite side.
|
||||
wraps = -countWraps(position);
|
||||
|
||||
if (wraps % 2 == 1)
|
||||
{
|
||||
return this.interpolate(lastPosition - position + firstPosition - (wraps * timeSpan));
|
||||
}
|
||||
return this.interpolate(position + (wraps * timeSpan));
|
||||
}
|
||||
}
|
||||
//wanted point behind last point
|
||||
else if (position > last.Position)
|
||||
{
|
||||
switch (this.PostLoop)
|
||||
{
|
||||
case CurveLoopType.Constant:
|
||||
//The Curve will evaluate to its first key for positions before the first point in the Curve and to
|
||||
//the last key for positions after the last point.
|
||||
return last.Value;
|
||||
|
||||
case CurveLoopType.Linear:
|
||||
//Linear interpolation will be performed to determine the value.
|
||||
return last.Value + last.TangentOut * (position - last.Position);
|
||||
|
||||
case CurveLoopType.Cycle:
|
||||
// Positions specified past the ends of the curve will wrap around to the opposite side of the Curve.
|
||||
position -= timeSpan * countWraps(position);
|
||||
|
||||
return this.interpolate((position));
|
||||
|
||||
|
||||
|
||||
case CurveLoopType.CycleOffset:
|
||||
//Positions specified past the ends of the curve will wrap around to the opposite side of the Curve.
|
||||
//The value will be offset by the difference between the values of the first and last CurveKey
|
||||
//multiplied by the number of times the position wraps around. If the position is before the first
|
||||
//point in the Curve, the difference will be subtracted from its value; otherwise, the difference
|
||||
//will be added.
|
||||
wraps = countWraps(position);
|
||||
float difference = (this.keys[this.keys.Count - 1].Value - this.keys[0].Value) * wraps;
|
||||
|
||||
position -= timeSpan * countWraps(position);
|
||||
|
||||
return this.interpolate(position) + difference;
|
||||
|
||||
case CurveLoopType.Oscillate:
|
||||
//Positions specified past the ends of the Curve act as an offset from the same side of the Curve
|
||||
//toward the opposite side.
|
||||
wraps = -countWraps(position);
|
||||
position += timeSpan * wraps;
|
||||
if (wraps % 2 == 1)
|
||||
{
|
||||
return this.interpolate(lastPosition - position + firstPosition - (wraps * timeSpan));
|
||||
}
|
||||
return this.interpolate(position + (wraps * timeSpan));
|
||||
}
|
||||
case CurveLoopType.Oscillate:
|
||||
// Positions specified past the ends of the Curve act as an offset from the same side of the Curve
|
||||
// toward the opposite side.
|
||||
wraps = CountWraps(position);
|
||||
float offset = position - (first.Position + wraps * timeSpan);
|
||||
float wrappedPosition = (wraps & 1) != 0 ? (last.Position - offset) : (first.Position + offset);
|
||||
return Interpolate(wrappedPosition);
|
||||
}
|
||||
|
||||
//in curve
|
||||
return interpolate(position);
|
||||
|
||||
return Interpolate(position);
|
||||
}
|
||||
private int countWraps(float position)
|
||||
#endregion
|
||||
|
||||
private int CountWraps(float position)
|
||||
{
|
||||
float wraps = (position - keys[0].Position) / (keys[keys.Count - 1].Position - keys[0].Position);
|
||||
if (wraps < 0) wraps--;
|
||||
float timeRange = Keys[Keys.Count - 1].Position - Keys[0].Position;
|
||||
float wraps = (position - Keys[0].Position) / timeRange;
|
||||
if (wraps < 0)
|
||||
wraps--;
|
||||
|
||||
return (int)wraps;
|
||||
}
|
||||
|
||||
private float interpolate(float position)
|
||||
private float Interpolate(float position)
|
||||
{
|
||||
//interpolate inside the curve with cubic hermite:
|
||||
http://forums.create.msdn.com/forums/p/53392/323814.aspx
|
||||
|
||||
//interpolate inside the curve with cubic hermite: http://forums.create.msdn.com/forums/p/53392/323814.aspx
|
||||
|
||||
//assume position is inside curve
|
||||
CurveKey a = this.keys[0];
|
||||
CurveKey a = Keys[0];
|
||||
CurveKey b;
|
||||
for (int i = 1; i < this.keys.Count; ++i)
|
||||
for (int nextKeyIndex = 1; nextKeyIndex < Keys.Count; nextKeyIndex++)
|
||||
{
|
||||
b = this.Keys[i];
|
||||
b = Keys[nextKeyIndex];
|
||||
if (b.Position >= position)
|
||||
{
|
||||
//stepping
|
||||
if (a.Continuity == CurveContinuity.Step)
|
||||
{
|
||||
if (position == b.Position)
|
||||
{
|
||||
return b.Position;
|
||||
}
|
||||
return a.Value;
|
||||
return position == b.Position ? b.Value : a.Value;
|
||||
|
||||
}
|
||||
//smooth
|
||||
//get the location between a and b in [0,1]
|
||||
float moment = (position - a.Position) / (b.Position - a.Position);
|
||||
@ -291,6 +278,5 @@ namespace ANX.Framework
|
||||
}
|
||||
return 0f;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -8,8 +9,10 @@ using System.Collections.Generic;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
public class CurveKeyCollection : ICollection<CurveKey>,
|
||||
IEnumerable<CurveKey>, IEnumerable
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public class CurveKeyCollection : ICollection<CurveKey>, IEnumerable<CurveKey>, IEnumerable
|
||||
{
|
||||
#region Private
|
||||
private List<CurveKey> keys;
|
||||
|
@ -11,6 +11,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public abstract class GameHost
|
||||
{
|
||||
internal event EventHandler<EventArgs> Activated;
|
||||
|
@ -11,6 +11,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public abstract class GameWindow
|
||||
{
|
||||
#region Private
|
||||
|
@ -15,6 +15,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public class GraphicsDeviceManager : IGraphicsDeviceManager, IDisposable, IGraphicsDeviceService
|
||||
{
|
||||
#region Constants
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using ANX.Framework.NonXNA;
|
||||
using ANX.Framework.Graphics;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -13,7 +14,9 @@ using ANX.Framework.Graphics;
|
||||
|
||||
namespace ANX.Framework.Input.MotionSensing
|
||||
{
|
||||
public class MotionSensingDevice
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public static class MotionSensingDevice
|
||||
{
|
||||
private static readonly IMotionSensingDevice motionSensingDevice;
|
||||
|
||||
@ -30,7 +33,8 @@ namespace ANX.Framework.Input.MotionSensing
|
||||
|
||||
static MotionSensingDevice()
|
||||
{
|
||||
motionSensingDevice = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>().MotionSensingDevice;
|
||||
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IInputSystemCreator>();
|
||||
motionSensingDevice = creator.MotionSensingDevice;
|
||||
}
|
||||
|
||||
public static MotionSensingDeviceState GetState()
|
||||
|
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using ANX.Framework.Graphics;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -11,41 +12,40 @@ using ANX.Framework.Graphics;
|
||||
#if XNAEXT
|
||||
namespace ANX.Framework.Input.MotionSensing
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
public struct MotionSensingDeviceState
|
||||
{
|
||||
private bool connected;
|
||||
private readonly bool connected;
|
||||
|
||||
private Texture2D pRGB;
|
||||
private Texture2D pDepth;
|
||||
private readonly Texture2D pRGB;
|
||||
private readonly Texture2D pDepth;
|
||||
|
||||
private Vector3 pHipCenter;
|
||||
private Vector3 pSpine;
|
||||
private Vector3 pShoulderCenter;
|
||||
private Vector3 pHead;
|
||||
private Vector3 pShoulderLeft;
|
||||
private Vector3 pElbowLeft;
|
||||
private Vector3 pWristLeft;
|
||||
private Vector3 pHandLeft;
|
||||
private Vector3 pShoulderRight;
|
||||
private Vector3 pElbowRight;
|
||||
private Vector3 pWristRight;
|
||||
private Vector3 pHandRight;
|
||||
private Vector3 pHipLeft;
|
||||
private Vector3 pKneeLeft;
|
||||
private Vector3 pAnkleLeft;
|
||||
private Vector3 pFootLeft;
|
||||
private Vector3 pHipRight;
|
||||
private Vector3 pKneeRight;
|
||||
private Vector3 pAnkleRight;
|
||||
private Vector3 pFootRight;
|
||||
private Vector3 pCount;
|
||||
private readonly Vector3 pHipCenter;
|
||||
private readonly Vector3 pSpine;
|
||||
private readonly Vector3 pShoulderCenter;
|
||||
private readonly Vector3 pHead;
|
||||
private readonly Vector3 pShoulderLeft;
|
||||
private readonly Vector3 pElbowLeft;
|
||||
private readonly Vector3 pWristLeft;
|
||||
private readonly Vector3 pHandLeft;
|
||||
private readonly Vector3 pShoulderRight;
|
||||
private readonly Vector3 pElbowRight;
|
||||
private readonly Vector3 pWristRight;
|
||||
private readonly Vector3 pHandRight;
|
||||
private readonly Vector3 pHipLeft;
|
||||
private readonly Vector3 pKneeLeft;
|
||||
private readonly Vector3 pAnkleLeft;
|
||||
private readonly Vector3 pFootLeft;
|
||||
private readonly Vector3 pHipRight;
|
||||
private readonly Vector3 pKneeRight;
|
||||
private readonly Vector3 pAnkleRight;
|
||||
private readonly Vector3 pFootRight;
|
||||
private readonly Vector3 pCount;
|
||||
|
||||
public bool Connected
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.connected;
|
||||
}
|
||||
get { return this.connected; }
|
||||
}
|
||||
|
||||
public Texture2D RGB { get { return this.pRGB; } }
|
||||
@ -73,37 +73,39 @@ namespace ANX.Framework.Input.MotionSensing
|
||||
public Vector3 FootRight { get { return this.pFootRight; } }
|
||||
public Vector3 Count { get { return this.pCount; } }
|
||||
|
||||
public MotionSensingDeviceState(bool connected, Texture2D _RGB, Texture2D _Depth, Vector3 _HipCenter, Vector3 _Spine, Vector3 _ShoulderCenter, Vector3 _Head, Vector3 _ShoulderLeft,
|
||||
Vector3 _ElbowLeft, Vector3 _WristLeft, Vector3 _HandLeft, Vector3 _ShoulderRight, Vector3 _ElbowRight, Vector3 _WristRight, Vector3 _HandRight, Vector3 _HipLeft, Vector3 _KneeLeft, Vector3 _AnkleLeft, Vector3 _FootLeft, Vector3 _HipRight, Vector3 _KneeRight, Vector3 _AnkleRight, Vector3 _FootRight, Vector3 _Count)
|
||||
public MotionSensingDeviceState(bool connected, Texture2D rgbTexture, Texture2D depthTe, Vector3 hipCenter,
|
||||
Vector3 spine, Vector3 shoulderCenter, Vector3 head, Vector3 shoulderLeft, Vector3 elbowLeft, Vector3 wristLeft,
|
||||
Vector3 handLeft, Vector3 shoulderRight, Vector3 elbowRight, Vector3 wristRight, Vector3 handRight,
|
||||
Vector3 hipLeft, Vector3 kneeLeft, Vector3 ankleLeft, Vector3 footLeft, Vector3 hipRight, Vector3 kneeRight,
|
||||
Vector3 ankleRight, Vector3 footRight, Vector3 count)
|
||||
{
|
||||
this.connected = connected;
|
||||
|
||||
pRGB = _RGB;
|
||||
pDepth = _Depth;
|
||||
pRGB = rgbTexture;
|
||||
pDepth = depthTe;
|
||||
|
||||
pHipCenter = _HipCenter;
|
||||
pSpine = _Spine;
|
||||
pShoulderCenter = _ShoulderCenter;
|
||||
pHead = _Head;
|
||||
pShoulderLeft = _ShoulderLeft;
|
||||
pElbowLeft=_ElbowLeft;
|
||||
pWristLeft=_WristLeft;
|
||||
pHandLeft=_HandLeft;
|
||||
pShoulderRight=_ShoulderRight;
|
||||
pElbowRight=_ElbowRight;
|
||||
pWristRight=_WristRight;
|
||||
pHandRight=_HandRight;
|
||||
pHipLeft=_HipLeft;
|
||||
pKneeLeft=_KneeLeft;
|
||||
pAnkleLeft=_AnkleLeft;
|
||||
pFootLeft=_FootLeft;
|
||||
pHipRight=_HipRight;
|
||||
pKneeRight=_KneeRight;
|
||||
pAnkleRight=_AnkleRight;
|
||||
pFootRight=_FootRight;
|
||||
pCount=_Count;
|
||||
pHipCenter = hipCenter;
|
||||
pSpine = spine;
|
||||
pShoulderCenter = shoulderCenter;
|
||||
pHead = head;
|
||||
pShoulderLeft = shoulderLeft;
|
||||
pElbowLeft = elbowLeft;
|
||||
pWristLeft = wristLeft;
|
||||
pHandLeft = handLeft;
|
||||
pShoulderRight = shoulderRight;
|
||||
pElbowRight = elbowRight;
|
||||
pWristRight = wristRight;
|
||||
pHandRight = handRight;
|
||||
pHipLeft = hipLeft;
|
||||
pKneeLeft = kneeLeft;
|
||||
pAnkleLeft = ankleLeft;
|
||||
pFootLeft = footLeft;
|
||||
pHipRight = hipRight;
|
||||
pKneeRight = kneeRight;
|
||||
pAnkleRight = ankleRight;
|
||||
pFootRight = footRight;
|
||||
pCount = count;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// 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
|
||||
@ -5,6 +7,8 @@
|
||||
#if XNAEXT
|
||||
namespace ANX.Framework.Input.MotionSensing
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum MotionSensingDeviceType
|
||||
{
|
||||
Kinect,
|
||||
|
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(70)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Matrix : IEquatable<Matrix>
|
||||
{
|
||||
#region Public Fields
|
||||
|
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Plane : IEquatable<Plane>
|
||||
{
|
||||
#region fields
|
||||
@ -17,7 +21,6 @@ namespace ANX.Framework
|
||||
public Vector3 Normal;
|
||||
#endregion
|
||||
|
||||
|
||||
#region constructors
|
||||
public Plane(float a, float b, float c, float d)
|
||||
{
|
||||
@ -43,7 +46,6 @@ namespace ANX.Framework
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region public methods
|
||||
public float Dot(Vector4 value)
|
||||
{
|
||||
@ -343,7 +345,6 @@ namespace ANX.Framework
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region IEquatable implementation
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
@ -356,7 +357,6 @@ namespace ANX.Framework
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region operator overloading
|
||||
public static bool operator ==(Plane lhs, Plane rhs)
|
||||
{
|
||||
|
@ -8,9 +8,9 @@ using ANX.Framework.NonXNA.Development;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Point : IEquatable<Point>
|
||||
{
|
||||
#region Constants
|
||||
|
@ -1,6 +1,8 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
@ -9,6 +11,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Quaternion : IEquatable<Quaternion>
|
||||
{
|
||||
#region fields
|
||||
@ -418,7 +423,7 @@ namespace ANX.Framework
|
||||
#region IEquatable implementation
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
return (obj is Quaternion) ? this.Equals((Quaternion)obj) : false;
|
||||
return (obj is Quaternion) && this.Equals((Quaternion)obj);
|
||||
}
|
||||
public bool Equals(Quaternion other)
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -6,6 +7,9 @@ using System;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Ray : IEquatable<Ray>
|
||||
{
|
||||
#region fields
|
||||
@ -20,7 +24,6 @@ namespace ANX.Framework
|
||||
public Vector3 Position;
|
||||
#endregion
|
||||
|
||||
|
||||
#region constructors
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Ray"/> struct.
|
||||
@ -34,7 +37,6 @@ namespace ANX.Framework
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region public methods
|
||||
/// <summary>
|
||||
/// Returns a hash code for this instance.
|
||||
@ -179,7 +181,6 @@ namespace ANX.Framework
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region operator overloading
|
||||
/// <summary>
|
||||
/// Implements the operator ==.
|
||||
@ -207,7 +208,6 @@ namespace ANX.Framework
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region IEquatable implementation
|
||||
/// <summary>
|
||||
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -7,6 +8,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Rectangle : IEquatable<Rectangle>
|
||||
{
|
||||
#region fields
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -7,6 +8,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Vector2 : IEquatable<Vector2>
|
||||
{
|
||||
#region fields
|
||||
|
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Vector3 : IEquatable<Vector3>
|
||||
{
|
||||
#region Private Static Fields
|
||||
|
@ -1,6 +1,7 @@
|
||||
#region Using Statements
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
@ -10,6 +11,9 @@ using System.Globalization;
|
||||
|
||||
namespace ANX.Framework
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("???")]
|
||||
[TestState(TestStateAttribute.TestState.InProgress)]
|
||||
public struct Vector4 : IEquatable<Vector4>
|
||||
{
|
||||
#region Fields
|
||||
@ -625,7 +629,7 @@ namespace ANX.Framework
|
||||
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
return (obj is Vector4) ? this.Equals((Vector4)obj) : false;
|
||||
return (obj is Vector4) && this.Equals((Vector4)obj);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user