Removed (IntPtr) and (float*) cast operators. Added this indexer (Vector3[0], Vector3[0] etc)

This commit is contained in:
the_fiddler 2007-11-06 14:01:35 +00:00
parent e2b08d0bd6
commit 9fd384420d

View file

@ -254,18 +254,23 @@ namespace OpenTK.Math
return vec; return vec;
} }
[CLSCompliant(false)] public float get(int index)
unsafe public static explicit operator float*(Vector3 v)
{
return &v.X;
}
public static explicit operator IntPtr(Vector3 v)
{ {
switch (index)
{
case 0: return X;
case 1: return Y;
case 2: return Z;
default: throw new ArgumentOutOfRangeException("index", index, "Should be 0, 1 or 2.");
}
/*
unsafe unsafe
{ {
return (IntPtr)(&v.X); fixed (float* ptr = &this.X)
return *(ptr + index);
} }
*/
} }
#endregion #endregion