Index: Half.cs =================================================================== --- Half.cs (revision 2632) +++ Half.cs (working copy) @@ -76,7 +76,7 @@ /// predictable results. /// [Serializable, StructLayout(LayoutKind.Sequential)] - public struct Half : ISerializable, IComparable, IFormattable, IEquatable + public struct Half : ISerializable, IComparable, IFormattable, IEquatable, ISized { #region Internal Field @@ -97,7 +97,7 @@ /// Returns true if the Half represents negative infinity. public bool IsNegativeInfinity { get { return (bits == 64512); } } - + #endregion Properties #region Constructors @@ -513,6 +513,13 @@ } #endregion IFormattable Members + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members #region String -> Half Index: ISized.cs =================================================================== --- ISized.cs (revision 0) +++ ISized.cs (revision 0) @@ -0,0 +1,70 @@ +#region --- License --- +/* +Copyright (c) 2006 - 2008 The Open Toolkit library. + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ +/* +The conversion functions are derived from OpenEXR's implementation and are +governed by the following license: + +Copyright (c) 2002, Industrial Light & Magic, a division of Lucas +Digital Ltd. LLC + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. +* Neither the name of Industrial Light & Magic nor the names of +its contributors may be used to endorse or promote products derived +from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#endregion --- License --- + +using System; + +namespace OpenTK +{ + /// + /// Description of ISized. + /// + public interface ISized + { + Int32 SizeBytes {get;} + } +} Index: Matrix3d.cs =================================================================== --- Matrix3d.cs (revision 2632) +++ Matrix3d.cs (working copy) @@ -32,7 +32,7 @@ #if false [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Matrix3d : IEquatable + public struct Matrix3d : IEquatable, ISized { #region Fields & Access @@ -791,6 +791,13 @@ ); #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members #region HashCode Index: Matrix4.cs =================================================================== --- Matrix4.cs (revision 2632) +++ Matrix4.cs (working copy) @@ -1219,5 +1219,6 @@ } #endregion + } } Index: Matrix4d.cs =================================================================== --- Matrix4d.cs (revision 2632) +++ Matrix4d.cs (working copy) @@ -32,7 +32,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Matrix4d : IEquatable + public struct Matrix4d : IEquatable, ISized { #region Fields @@ -1213,5 +1213,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return 4*Vector4d.SizeInBytes; } } + + #endregion ISized Members } } \ No newline at end of file Index: Quaternion.cs =================================================================== --- Quaternion.cs (revision 2632) +++ Quaternion.cs (working copy) @@ -34,7 +34,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Quaternion : IEquatable + public struct Quaternion : IEquatable, ISized { #region Fields @@ -695,5 +695,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return Vector4.SizeInBytes; } } + + #endregion ISized Members } } Index: Quaterniond.cs =================================================================== --- Quaterniond.cs (revision 2632) +++ Quaterniond.cs (working copy) @@ -34,7 +34,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Quaterniond : IEquatable + public struct Quaterniond : IEquatable, ISized { #region Fields @@ -1320,5 +1320,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return Vector4d.SizeInBytes; } } + + #endregion ISized Members } } \ No newline at end of file Index: Vector2.cs =================================================================== --- Vector2.cs (revision 2632) +++ Vector2.cs (working copy) @@ -32,7 +32,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Vector2 : IEquatable + public struct Vector2 : IEquatable, ISized { #region Fields @@ -1086,5 +1086,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } } Index: Vector2d.cs =================================================================== --- Vector2d.cs (revision 2632) +++ Vector2d.cs (working copy) @@ -30,7 +30,7 @@ /// Represents a 2D vector using two double-precision floating-point numbers. [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Vector2d : IEquatable + public struct Vector2d : IEquatable, ISized { #region Fields @@ -990,5 +990,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } } \ No newline at end of file Index: Vector2h.cs =================================================================== --- Vector2h.cs (revision 2632) +++ Vector2h.cs (working copy) @@ -32,7 +32,7 @@ /// 2-component Vector of the Half type. Occupies 4 Byte total. [Serializable, StructLayout(LayoutKind.Sequential)] - public struct Vector2h : ISerializable, IEquatable + public struct Vector2h : ISerializable, IEquatable, ISized { #region Fields @@ -289,6 +289,13 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members #region ToString() Index: Vector3.cs =================================================================== --- Vector3.cs (revision 2632) +++ Vector3.cs (working copy) @@ -35,7 +35,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Vector3 : IEquatable + public struct Vector3 : IEquatable, ISized { #region Fields @@ -1365,5 +1365,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } } Index: Vector3d.cs =================================================================== --- Vector3d.cs (revision 2632) +++ Vector3d.cs (working copy) @@ -33,7 +33,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Vector3d : IEquatable + public struct Vector3d : IEquatable, ISized { #region Fields @@ -1379,5 +1379,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } } \ No newline at end of file Index: Vector3h.cs =================================================================== --- Vector3h.cs (revision 2632) +++ Vector3h.cs (working copy) @@ -34,7 +34,7 @@ /// 3-component Vector of the Half type. Occupies 6 Byte total. /// [Serializable, StructLayout(LayoutKind.Sequential)] - public struct Vector3h : ISerializable, IEquatable + public struct Vector3h : ISerializable, IEquatable, ISized { #region Public Fields @@ -330,6 +330,13 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members #region ToString() Index: Vector4.cs =================================================================== --- Vector4.cs (revision 2632) +++ Vector4.cs (working copy) @@ -33,7 +33,7 @@ /// [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Vector4 : IEquatable + public struct Vector4 : IEquatable, ISized { #region Fields @@ -1195,5 +1195,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } } Index: Vector4d.cs =================================================================== --- Vector4d.cs (revision 2632) +++ Vector4d.cs (working copy) @@ -31,7 +31,7 @@ /// Represents a 4D vector using four double-precision floating-point numbers. [Serializable] [StructLayout(LayoutKind.Sequential)] - public struct Vector4d : IEquatable + public struct Vector4d : IEquatable, ISized { #region Fields @@ -1214,5 +1214,12 @@ } #endregion + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } } \ No newline at end of file Index: Vector4h.cs =================================================================== --- Vector4h.cs (revision 2632) +++ Vector4h.cs (working copy) @@ -34,7 +34,7 @@ /// 4-component Vector of the Half type. Occupies 8 Byte total. /// [Serializable, StructLayout(LayoutKind.Sequential)] - public struct Vector4h : ISerializable, IEquatable + public struct Vector4h : ISerializable, IEquatable, ISized { #region Public Fields @@ -410,5 +410,12 @@ } #endregion BitConverter + + #region ISized Members + + /// Returns the struct size in bytes. + Int32 ISized.SizeBytes { get { return SizeInBytes; } } + + #endregion ISized Members } }