Merge branch 'develop' into glwidget-gtk3

This commit is contained in:
Jarl Gullberg 2017-06-13 20:29:58 +02:00
commit 993d1a60c9
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
5 changed files with 92 additions and 98 deletions

View file

@ -40,7 +40,7 @@ namespace OpenTK.Rewrite
if (definition == null) if (definition == null)
{ {
throw new ArgumentException("The definition argument cannot be null.", nameof(body)); throw new ArgumentException("The definition argument cannot be null.", nameof(definition));
} }
if (string.IsNullOrEmpty(name)) if (string.IsNullOrEmpty(name))
@ -53,4 +53,4 @@ namespace OpenTK.Rewrite
this.Name = name; this.Name = name;
} }
} }
} }

View file

@ -38,8 +38,15 @@ namespace OpenTK
{ {
#region Fields #region Fields
Vector3 xyz; /// <summary>
float w; /// The X, Y and Z components of this instance.
/// </summary>
public Vector3 Xyz;
/// <summary>
/// The W component of this instance.
/// </summary>
public float W;
#endregion #endregion
@ -52,8 +59,8 @@ namespace OpenTK
/// <param name="w">The w part</param> /// <param name="w">The w part</param>
public Quaternion(Vector3 v, float w) public Quaternion(Vector3 v, float w)
{ {
this.xyz = v; Xyz = v;
this.w = w; W = w;
} }
/// <summary> /// <summary>
@ -86,10 +93,10 @@ namespace OpenTK
float s2 = (float)Math.Sin(pitch); float s2 = (float)Math.Sin(pitch);
float s3 = (float)Math.Sin(roll); float s3 = (float)Math.Sin(roll);
this.w = c1 * c2 * c3 - s1 * s2 * s3; W = c1 * c2 * c3 - s1 * s2 * s3;
this.xyz.X = s1 * s2 * c3 + c1 * c2 * s3; Xyz.X = s1 * s2 * c3 + c1 * c2 * s3;
this.xyz.Y = s1 * c2 * c3 + c1 * s2 * s3; Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3;
this.xyz.Z = c1 * s2 * c3 - s1 * c2 * s3; Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3;
} }
/// <summary> /// <summary>
@ -117,36 +124,25 @@ namespace OpenTK
[CLSCompliant(false)] [CLSCompliant(false)]
public Vector3 XYZ { get { return Xyz; } set { Xyz = value; } } public Vector3 XYZ { get { return Xyz; } set { Xyz = value; } }
/// <summary>
/// Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance.
/// </summary>
[CLSCompliant(false)]
public Vector3 Xyz { get { return xyz; } set { xyz = value; } }
#pragma warning restore 3005 #pragma warning restore 3005
/// <summary> /// <summary>
/// Gets or sets the X component of this instance. /// Gets or sets the X component of this instance.
/// </summary> /// </summary>
[XmlIgnore] [XmlIgnore]
public float X { get { return xyz.X; } set { xyz.X = value; } } public float X { get { return Xyz.X; } set { Xyz.X = value; } }
/// <summary> /// <summary>
/// Gets or sets the Y component of this instance. /// Gets or sets the Y component of this instance.
/// </summary> /// </summary>
[XmlIgnore] [XmlIgnore]
public float Y { get { return xyz.Y; } set { xyz.Y = value; } } public float Y { get { return Xyz.Y; } set { Xyz.Y = value; } }
/// <summary> /// <summary>
/// Gets or sets the Z component of this instance. /// Gets or sets the Z component of this instance.
/// </summary> /// </summary>
[XmlIgnore] [XmlIgnore]
public float Z { get { return xyz.Z; } set { xyz.Z = value; } } public float Z { get { return Xyz.Z; } set { Xyz.Z = value; } }
/// <summary>
/// Gets or sets the W component of this instance.
/// </summary>
public float W { get { return w; } set { w = value; } }
#endregion #endregion
@ -583,10 +579,10 @@ namespace OpenTK
float s2 = (float)Math.Sin(eulerAngles.X * 0.5f); float s2 = (float)Math.Sin(eulerAngles.X * 0.5f);
float s3 = (float)Math.Sin(eulerAngles.Z * 0.5f); float s3 = (float)Math.Sin(eulerAngles.Z * 0.5f);
result.w = c1 * c2 * c3 - s1 * s2 * s3; result.W = c1 * c2 * c3 - s1 * s2 * s3;
result.xyz.X = s1 * s2 * c3 + c1 * c2 * s3; result.Xyz.X = s1 * s2 * c3 + c1 * c2 * s3;
result.xyz.Y = s1 * c2 * c3 + c1 * s2 * s3; result.Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3;
result.xyz.Z = c1 * s2 * c3 - s1 * c2 * s3; result.Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3;
} }
#endregion #endregion
@ -619,10 +615,10 @@ namespace OpenTK
float s = (float)Math.Sqrt(trace + 1) * 2; float s = (float)Math.Sqrt(trace + 1) * 2;
float invS = 1f / s; float invS = 1f / s;
result.w = s * 0.25f; result.W = s * 0.25f;
result.xyz.X = (matrix.Row2.Y - matrix.Row1.Z) * invS; result.Xyz.X = (matrix.Row2.Y - matrix.Row1.Z) * invS;
result.xyz.Y = (matrix.Row0.Z - matrix.Row2.X) * invS; result.Xyz.Y = (matrix.Row0.Z - matrix.Row2.X) * invS;
result.xyz.Z = (matrix.Row1.X - matrix.Row0.Y) * invS; result.Xyz.Z = (matrix.Row1.X - matrix.Row0.Y) * invS;
} }
else else
{ {
@ -633,30 +629,30 @@ namespace OpenTK
float s = (float)Math.Sqrt(1 + m00 - m11 - m22) * 2; float s = (float)Math.Sqrt(1 + m00 - m11 - m22) * 2;
float invS = 1f / s; float invS = 1f / s;
result.w = (matrix.Row2.Y - matrix.Row1.Z) * invS; result.W = (matrix.Row2.Y - matrix.Row1.Z) * invS;
result.xyz.X = s * 0.25f; result.Xyz.X = s * 0.25f;
result.xyz.Y = (matrix.Row0.Y + matrix.Row1.X) * invS; result.Xyz.Y = (matrix.Row0.Y + matrix.Row1.X) * invS;
result.xyz.Z = (matrix.Row0.Z + matrix.Row2.X) * invS; result.Xyz.Z = (matrix.Row0.Z + matrix.Row2.X) * invS;
} }
else if (m11 > m22) else if (m11 > m22)
{ {
float s = (float)Math.Sqrt(1 + m11 - m00 - m22) * 2; float s = (float)Math.Sqrt(1 + m11 - m00 - m22) * 2;
float invS = 1f / s; float invS = 1f / s;
result.w = (matrix.Row0.Z - matrix.Row2.X) * invS; result.W = (matrix.Row0.Z - matrix.Row2.X) * invS;
result.xyz.X = (matrix.Row0.Y + matrix.Row1.X) * invS; result.Xyz.X = (matrix.Row0.Y + matrix.Row1.X) * invS;
result.xyz.Y = s * 0.25f; result.Xyz.Y = s * 0.25f;
result.xyz.Z = (matrix.Row1.Z + matrix.Row2.Y) * invS; result.Xyz.Z = (matrix.Row1.Z + matrix.Row2.Y) * invS;
} }
else else
{ {
float s = (float)Math.Sqrt(1 + m22 - m00 - m11) * 2; float s = (float)Math.Sqrt(1 + m22 - m00 - m11) * 2;
float invS = 1f / s; float invS = 1f / s;
result.w = (matrix.Row1.X - matrix.Row0.Y) * invS; result.W = (matrix.Row1.X - matrix.Row0.Y) * invS;
result.xyz.X = (matrix.Row0.Z + matrix.Row2.X) * invS; result.Xyz.X = (matrix.Row0.Z + matrix.Row2.X) * invS;
result.xyz.Y = (matrix.Row1.Z + matrix.Row2.Y) * invS; result.Xyz.Y = (matrix.Row1.Z + matrix.Row2.Y) * invS;
result.xyz.Z = s * 0.25f; result.Xyz.Z = s * 0.25f;
} }
} }
} }
@ -859,7 +855,7 @@ namespace OpenTK
{ {
unchecked unchecked
{ {
return (this.xyz.GetHashCode() * 397) ^ this.w.GetHashCode(); return (this.Xyz.GetHashCode() * 397) ^ this.W.GetHashCode();
} }
} }

View file

@ -38,8 +38,15 @@ namespace OpenTK
{ {
#region Fields #region Fields
Vector3d xyz; /// <summary>
double w; /// The X, Y and Z components of this instance.
/// </summary>
public Vector3d Xyz;
/// <summary>
/// The W component of this instance.
/// </summary>
public double W;
#endregion #endregion
@ -52,8 +59,8 @@ namespace OpenTK
/// <param name="w">The w part</param> /// <param name="w">The w part</param>
public Quaterniond(Vector3d v, double w) public Quaterniond(Vector3d v, double w)
{ {
this.xyz = v; Xyz = v;
this.w = w; W = w;
} }
/// <summary> /// <summary>
@ -86,10 +93,10 @@ namespace OpenTK
double s2 = Math.Sin(pitch); double s2 = Math.Sin(pitch);
double s3 = Math.Sin(roll); double s3 = Math.Sin(roll);
this.w = c1 * c2 * c3 - s1 * s2 * s3; W = c1 * c2 * c3 - s1 * s2 * s3;
this.xyz.X = s1 * s2 * c3 + c1 * c2 * s3; Xyz.X = s1 * s2 * c3 + c1 * c2 * s3;
this.xyz.Y = s1 * c2 * c3 + c1 * s2 * s3; Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3;
this.xyz.Z = c1 * s2 * c3 - s1 * c2 * s3; Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3;
} }
/// <summary> /// <summary>
@ -117,35 +124,25 @@ namespace OpenTK
[XmlIgnore] [XmlIgnore]
public Vector3d XYZ { get { return Xyz; } set { Xyz = value; } } public Vector3d XYZ { get { return Xyz; } set { Xyz = value; } }
/// <summary>
/// Gets or sets an OpenTK.Vector3d with the X, Y and Z components of this instance.
/// </summary>
public Vector3d Xyz { get { return xyz; } set { xyz = value; } }
#pragma warning restore 3005 #pragma warning restore 3005
/// <summary> /// <summary>
/// Gets or sets the X component of this instance. /// Gets or sets the X component of this instance.
/// </summary> /// </summary>
[XmlIgnore] [XmlIgnore]
public double X { get { return xyz.X; } set { xyz.X = value; } } public double X { get { return Xyz.X; } set { Xyz.X = value; } }
/// <summary> /// <summary>
/// Gets or sets the Y component of this instance. /// Gets or sets the Y component of this instance.
/// </summary> /// </summary>
[XmlIgnore] [XmlIgnore]
public double Y { get { return xyz.Y; } set { xyz.Y = value; } } public double Y { get { return Xyz.Y; } set { Xyz.Y = value; } }
/// <summary> /// <summary>
/// Gets or sets the Z component of this instance. /// Gets or sets the Z component of this instance.
/// </summary> /// </summary>
[XmlIgnore] [XmlIgnore]
public double Z { get { return xyz.Z; } set { xyz.Z = value; } } public double Z { get { return Xyz.Z; } set { Xyz.Z = value; } }
/// <summary>
/// Gets or sets the W component of this instance.
/// </summary>
public double W { get { return w; } set { w = value; } }
#endregion #endregion
@ -582,10 +579,10 @@ namespace OpenTK
double s2 = Math.Sin(eulerAngles.X * 0.5); double s2 = Math.Sin(eulerAngles.X * 0.5);
double s3 = Math.Sin(eulerAngles.Z * 0.5); double s3 = Math.Sin(eulerAngles.Z * 0.5);
result.w = c1 * c2 * c3 - s1 * s2 * s3; result.W = c1 * c2 * c3 - s1 * s2 * s3;
result.xyz.X = s1 * s2 * c3 + c1 * c2 * s3; result.Xyz.X = s1 * s2 * c3 + c1 * c2 * s3;
result.xyz.Y = s1 * c2 * c3 + c1 * s2 * s3; result.Xyz.Y = s1 * c2 * c3 + c1 * s2 * s3;
result.xyz.Z = c1 * s2 * c3 - s1 * c2 * s3; result.Xyz.Z = c1 * s2 * c3 - s1 * c2 * s3;
} }
#endregion #endregion
@ -618,10 +615,10 @@ namespace OpenTK
double s = Math.Sqrt(trace + 1) * 2; double s = Math.Sqrt(trace + 1) * 2;
double invS = 1.0 / s; double invS = 1.0 / s;
result.w = s * 0.25; result.W = s * 0.25;
result.xyz.X = (matrix.Row2.Y - matrix.Row1.Z) * invS; result.Xyz.X = (matrix.Row2.Y - matrix.Row1.Z) * invS;
result.xyz.Y = (matrix.Row0.Z - matrix.Row2.X) * invS; result.Xyz.Y = (matrix.Row0.Z - matrix.Row2.X) * invS;
result.xyz.Z = (matrix.Row1.X - matrix.Row0.Y) * invS; result.Xyz.Z = (matrix.Row1.X - matrix.Row0.Y) * invS;
} }
else else
{ {
@ -632,30 +629,30 @@ namespace OpenTK
double s = Math.Sqrt(1 + m00 - m11 - m22) * 2; double s = Math.Sqrt(1 + m00 - m11 - m22) * 2;
double invS = 1.0 / s; double invS = 1.0 / s;
result.w = (matrix.Row2.Y - matrix.Row1.Z) * invS; result.W = (matrix.Row2.Y - matrix.Row1.Z) * invS;
result.xyz.X = s * 0.25; result.Xyz.X = s * 0.25;
result.xyz.Y = (matrix.Row0.Y + matrix.Row1.X) * invS; result.Xyz.Y = (matrix.Row0.Y + matrix.Row1.X) * invS;
result.xyz.Z = (matrix.Row0.Z + matrix.Row2.X) * invS; result.Xyz.Z = (matrix.Row0.Z + matrix.Row2.X) * invS;
} }
else if (m11 > m22) else if (m11 > m22)
{ {
double s = Math.Sqrt(1 + m11 - m00 - m22) * 2; double s = Math.Sqrt(1 + m11 - m00 - m22) * 2;
double invS = 1.0 / s; double invS = 1.0 / s;
result.w = (matrix.Row0.Z - matrix.Row2.X) * invS; result.W = (matrix.Row0.Z - matrix.Row2.X) * invS;
result.xyz.X = (matrix.Row0.Y + matrix.Row1.X) * invS; result.Xyz.X = (matrix.Row0.Y + matrix.Row1.X) * invS;
result.xyz.Y = s * 0.25; result.Xyz.Y = s * 0.25;
result.xyz.Z = (matrix.Row1.Z + matrix.Row2.Y) * invS; result.Xyz.Z = (matrix.Row1.Z + matrix.Row2.Y) * invS;
} }
else else
{ {
double s = Math.Sqrt(1 + m22 - m00 - m11) * 2; double s = Math.Sqrt(1 + m22 - m00 - m11) * 2;
double invS = 1.0 / s; double invS = 1.0 / s;
result.w = (matrix.Row1.X - matrix.Row0.Y) * invS; result.W = (matrix.Row1.X - matrix.Row0.Y) * invS;
result.xyz.X = (matrix.Row0.Z + matrix.Row2.X) * invS; result.Xyz.X = (matrix.Row0.Z + matrix.Row2.X) * invS;
result.xyz.Y = (matrix.Row1.Z + matrix.Row2.Y) * invS; result.Xyz.Y = (matrix.Row1.Z + matrix.Row2.Y) * invS;
result.xyz.Z = s * 0.25; result.Xyz.Z = s * 0.25;
} }
} }
} }
@ -859,7 +856,7 @@ namespace OpenTK
{ {
unchecked unchecked
{ {
return (this.xyz.GetHashCode() * 397) ^ this.w.GetHashCode(); return (this.Xyz.GetHashCode() * 397) ^ this.W.GetHashCode();
} }
} }

View file

@ -23,3 +23,4 @@ description
OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling. OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling.
files files
OpenTK.dll.config => content/ OpenTK.dll.config => content/
../../bin/OpenTK/OpenTK.pdb => lib/net20/

View file

@ -747,43 +747,43 @@ namespace OpenTK.Platform.Windows
case WindowMessage.MOUSEWHEEL: case WindowMessage.MOUSEWHEEL:
HandleMouseWheel(handle, message, wParam, lParam); HandleMouseWheel(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.MOUSEHWHEEL: case WindowMessage.MOUSEHWHEEL:
HandleMouseHWheel(handle, message, wParam, lParam); HandleMouseHWheel(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.LBUTTONDOWN: case WindowMessage.LBUTTONDOWN:
HandleLButtonDown(handle, message, wParam, lParam); HandleLButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.MBUTTONDOWN: case WindowMessage.MBUTTONDOWN:
HandleMButtonDown(handle, message, wParam, lParam); HandleMButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.RBUTTONDOWN: case WindowMessage.RBUTTONDOWN:
HandleRButtonDown(handle, message, wParam, lParam); HandleRButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.XBUTTONDOWN: case WindowMessage.XBUTTONDOWN:
HandleXButtonDown(handle, message, wParam, lParam); HandleXButtonDown(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.LBUTTONUP: case WindowMessage.LBUTTONUP:
HandleLButtonUp(handle, message, wParam, lParam); HandleLButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.MBUTTONUP: case WindowMessage.MBUTTONUP:
HandleMButtonUp(handle, message, wParam, lParam); HandleMButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.RBUTTONUP: case WindowMessage.RBUTTONUP:
HandleRButtonUp(handle, message, wParam, lParam); HandleRButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
case WindowMessage.XBUTTONUP: case WindowMessage.XBUTTONUP:
HandleXButtonUp(handle, message, wParam, lParam); HandleXButtonUp(handle, message, wParam, lParam);
break; return IntPtr.Zero;
// Keyboard events: // Keyboard events:
case WindowMessage.KEYDOWN: case WindowMessage.KEYDOWN:
@ -833,7 +833,7 @@ namespace OpenTK.Platform.Windows
{ {
if (mouse_capture_count == 0) if (mouse_capture_count == 0)
{ {
Functions.SetCapture(window.Handle); Functions.SetCapture(child_window.Handle);
} }
mouse_capture_count++; mouse_capture_count++;
} }