Last change
on this file since 1115 was 1114, checked in by iritscen, 5 years ago |
Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.
|
File size:
1.4 KB
|
Line | |
---|
1 | using System;
|
---|
2 |
|
---|
3 | namespace Oni.Dae
|
---|
4 | {
|
---|
5 | internal class TransformRotate : Transform
|
---|
6 | {
|
---|
7 | private static readonly string[] valueNames = new[] { "X", "Y", "Z", "ANGLE" };
|
---|
8 |
|
---|
9 | public TransformRotate()
|
---|
10 | : base(4)
|
---|
11 | {
|
---|
12 | }
|
---|
13 |
|
---|
14 | public TransformRotate(Vector3 axis, float angle)
|
---|
15 | : base(4)
|
---|
16 | {
|
---|
17 | Axis = axis;
|
---|
18 | Angle = angle;
|
---|
19 | }
|
---|
20 |
|
---|
21 | public TransformRotate(string sid, Vector3 axis, float angle)
|
---|
22 | : base(sid, 4)
|
---|
23 | {
|
---|
24 | Axis = axis;
|
---|
25 | Angle = angle;
|
---|
26 | }
|
---|
27 |
|
---|
28 | public Vector3 Axis
|
---|
29 | {
|
---|
30 | get { return new Vector3(Values); }
|
---|
31 | set { value.CopyTo(Values); }
|
---|
32 | }
|
---|
33 |
|
---|
34 | public float Angle
|
---|
35 | {
|
---|
36 | get { return Values[3]; }
|
---|
37 | set { Values[3] = value; }
|
---|
38 | }
|
---|
39 |
|
---|
40 | public Sampler AngleAnimation => GetAnimation(3);
|
---|
41 |
|
---|
42 | public override Matrix ToMatrix() => Matrix.CreateFromAxisAngle(Axis, MathHelper.ToRadians(Angle));
|
---|
43 | public Quaternion ToQuaternion() => Quaternion.CreateFromAxisAngle(Axis, MathHelper.ToRadians(Angle));
|
---|
44 |
|
---|
45 | public override int ValueNameToValueIndex(string name) => Array.FindIndex(valueNames, x => string.Equals(x, name, StringComparison.OrdinalIgnoreCase));
|
---|
46 | public override string ValueIndexToValueName(int index) => valueNames[index];
|
---|
47 | }
|
---|
48 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.