From 9fd384420d0682a49ab5a0efc489309b31280b2c Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 6 Nov 2007 14:01:35 +0000 Subject: [PATCH] Removed (IntPtr) and (float*) cast operators. Added this indexer (Vector3[0], Vector3[0] etc) --- Source/OpenTK/Math/Vector3.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Source/OpenTK/Math/Vector3.cs b/Source/OpenTK/Math/Vector3.cs index 37048fa7..596fa0eb 100644 --- a/Source/OpenTK/Math/Vector3.cs +++ b/Source/OpenTK/Math/Vector3.cs @@ -254,18 +254,23 @@ namespace OpenTK.Math return vec; } - [CLSCompliant(false)] - unsafe public static explicit operator float*(Vector3 v) - { - return &v.X; - } - - public static explicit operator IntPtr(Vector3 v) + public float get(int index) { + 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 { - return (IntPtr)(&v.X); + fixed (float* ptr = &this.X) + return *(ptr + index); } + + */ } #endregion