mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 06:15:30 +00:00
Added index getters and settors for Vector and Matrix classes
This commit is contained in:
parent
0c7c1e8bd9
commit
1939bc789d
|
@ -114,6 +114,24 @@ namespace OpenTK
|
|||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at a specified row and column.
|
||||
/// </summary>
|
||||
public float this[int rowIndex, int columnIndex] { get{
|
||||
if(rowIndex == 0) return Row0[columnIndex];
|
||||
else if(rowIndex == 1) return Row1[columnIndex];
|
||||
else if(rowIndex == 2) return Row2[columnIndex];
|
||||
else if(rowIndex == 3) return Row3[columnIndex];
|
||||
throw new IndexOutOfRangeException("You tried to access this matrix at: (" + rowIndex + ", " + columnIndex + ")");
|
||||
} set{
|
||||
if(rowIndex == 0) Row0[columnIndex] = value;
|
||||
else if(rowIndex == 1) Row1[columnIndex] = value;
|
||||
else if(rowIndex == 2) Row2[columnIndex] = value;
|
||||
else if(rowIndex == 3) Row3[columnIndex] = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The determinant of this matrix
|
||||
/// </summary>
|
||||
|
|
|
@ -114,6 +114,24 @@ namespace OpenTK
|
|||
|
||||
#region Properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at a specified row and column.
|
||||
/// </summary>
|
||||
public double this[int rowIndex, int columnIndex] { get{
|
||||
if(rowIndex == 0) return Row0[columnIndex];
|
||||
else if(rowIndex == 1) return Row1[columnIndex];
|
||||
else if(rowIndex == 2) return Row2[columnIndex];
|
||||
else if(rowIndex == 3) return Row3[columnIndex];
|
||||
throw new IndexOutOfRangeException("You tried to access this matrix at: (" + rowIndex + ", " + columnIndex + ")");
|
||||
} set{
|
||||
if(rowIndex == 0) Row0[columnIndex] = value;
|
||||
else if(rowIndex == 1) Row1[columnIndex] = value;
|
||||
else if(rowIndex == 2) Row2[columnIndex] = value;
|
||||
else if(rowIndex == 3) Row3[columnIndex] = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The determinant of this matrix
|
||||
/// </summary>
|
||||
|
|
|
@ -108,6 +108,21 @@ namespace OpenTK
|
|||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at the index of the Vector.
|
||||
/// </summary>
|
||||
public float this[int index] {
|
||||
get{
|
||||
if(index == 0) return X;
|
||||
else if(index == 1) return Y;
|
||||
throw new IndexOutOfRangeException("You tried to access this vector at index: " + index);
|
||||
} set{
|
||||
if(index == 0) X = value;
|
||||
else if(index == 1) Y = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this vector at index: " + index);
|
||||
}
|
||||
}
|
||||
|
||||
#region Instance
|
||||
|
||||
#region public void Add()
|
||||
|
|
|
@ -92,6 +92,21 @@ namespace OpenTK
|
|||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at the index of the Vector.
|
||||
/// </summary>
|
||||
public double this[int index] {
|
||||
get{
|
||||
if(index == 0) return X;
|
||||
else if(index == 1) return Y;
|
||||
throw new IndexOutOfRangeException("You tried to access this vector at index: " + index);
|
||||
} set{
|
||||
if(index == 0) X = value;
|
||||
else if(index == 1) Y = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this vector at index: " + index);
|
||||
}
|
||||
}
|
||||
|
||||
#region Instance
|
||||
|
||||
#region public void Add()
|
||||
|
|
|
@ -119,6 +119,24 @@ namespace OpenTK
|
|||
|
||||
#region Public Members
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at the index of the Vector.
|
||||
/// </summary>
|
||||
public float this[int index] {
|
||||
get{
|
||||
if(index == 0) return X;
|
||||
else if(index == 1) return Y;
|
||||
else if(index == 2) return Z;
|
||||
throw new IndexOutOfRangeException("You tried to access this vector at index: " + index);
|
||||
} set{
|
||||
if(index == 0) X = value;
|
||||
else if(index == 1) Y = value;
|
||||
else if(index == 2) Z = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this vector at index: " + index);
|
||||
}
|
||||
}
|
||||
|
||||
#region Instance
|
||||
|
||||
#region public void Add()
|
||||
|
|
|
@ -118,6 +118,23 @@ namespace OpenTK
|
|||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at the index of the Vector.
|
||||
/// </summary>
|
||||
public double this[int index] {
|
||||
get{
|
||||
if(index == 0) return X;
|
||||
else if(index == 1) return Y;
|
||||
else if(index == 2) return Z;
|
||||
throw new IndexOutOfRangeException("You tried to access this vector at index: " + index);
|
||||
} set{
|
||||
if(index == 0) X = value;
|
||||
else if(index == 1) Y = value;
|
||||
else if(index == 2) Z = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this vector at index: " + index);
|
||||
}
|
||||
}
|
||||
|
||||
#region Instance
|
||||
|
||||
#region public void Add()
|
||||
|
|
|
@ -178,6 +178,25 @@ namespace OpenTK
|
|||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at the index of the Vector.
|
||||
/// </summary>
|
||||
public float this[int index] {
|
||||
get{
|
||||
if(index == 0) return X;
|
||||
else if(index == 1) return Y;
|
||||
else if(index == 2) return Z;
|
||||
else if(index == 3) return W;
|
||||
throw new IndexOutOfRangeException("You tried to access this vector at index: " + index);
|
||||
} set{
|
||||
if(index == 0) X = value;
|
||||
else if(index == 1) Y = value;
|
||||
else if(index == 2) Z = value;
|
||||
else if(index == 3) W = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this vector at index: " + index);
|
||||
}
|
||||
}
|
||||
|
||||
#region Instance
|
||||
|
||||
#region public void Add()
|
||||
|
|
|
@ -175,6 +175,25 @@ namespace OpenTK
|
|||
#endregion
|
||||
|
||||
#region Public Members
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value at the index of the Vector.
|
||||
/// </summary>
|
||||
public double this[int index] {
|
||||
get{
|
||||
if(index == 0) return X;
|
||||
else if(index == 1) return Y;
|
||||
else if(index == 2) return Z;
|
||||
else if(index == 3) return W;
|
||||
throw new IndexOutOfRangeException("You tried to access this vector at index: " + index);
|
||||
} set{
|
||||
if(index == 0) X = value;
|
||||
else if(index == 1) Y = value;
|
||||
else if(index == 2) Z = value;
|
||||
else if(index == 3) W = value;
|
||||
throw new IndexOutOfRangeException("You tried to set this vector at index: " + index);
|
||||
}
|
||||
}
|
||||
|
||||
#region Instance
|
||||
|
||||
|
|
Loading…
Reference in a new issue