-
Notifications
You must be signed in to change notification settings - Fork 27
/
RotateQuaternion.cs
44 lines (40 loc) · 1.35 KB
/
RotateQuaternion.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using OpenTK;
using System.ComponentModel;
namespace Bonsai.Shaders
{
/// <summary>
/// Represents an operator that applies a rotation specified by a quaternion
/// to every transform in the sequence.
/// </summary>
[Description("Applies a rotation specified by a quaternion to every transform in the sequence.")]
public class RotateQuaternion : MatrixTransform
{
Quaternion rotation;
/// <summary>
/// Initializes a new instance of the <see cref="RotateQuaternion"/> class.
/// </summary>
public RotateQuaternion()
{
rotation = Quaternion.Identity;
}
/// <summary>
/// Gets or sets the quaternion representing the rotation transform.
/// </summary>
[TypeConverter(typeof(NumericRecordConverter))]
[Description("The quaternion representing the rotation transformation.")]
public Quaternion Rotation
{
get { return rotation; }
set { rotation = value; }
}
/// <summary>
/// Initializes a transform matrix for applying a rotation specified by
/// a quaternion.
/// </summary>
/// <inheritdoc/>
protected override void CreateTransform(out Matrix4 result)
{
Matrix4.CreateFromQuaternion(ref rotation, out result);
}
}
}