source: OniSplit/Dae/TransformTranslate.cs

Last change on this file 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.0 KB
Line 
1using System;
2
3namespace Oni.Dae
4{
5 internal class TransformTranslate : Transform
6 {
7 private static readonly string[] valueNames = new[] { "X", "Y", "Z" };
8
9 public TransformTranslate()
10 : base(3)
11 {
12 }
13
14 public TransformTranslate(Vector3 translation)
15 : base(3)
16 {
17 Translation = translation;
18 }
19
20 public TransformTranslate(string sid, Vector3 translation)
21 : base(sid, 3)
22 {
23 Translation = translation;
24 }
25
26 public Vector3 Translation
27 {
28 get { return new Vector3(Values); }
29 set { value.CopyTo(Values); }
30 }
31
32 public override Matrix ToMatrix() => Matrix.CreateTranslation(Translation);
33
34 public override int ValueNameToValueIndex(string name) => Array.FindIndex(valueNames, x => string.Equals(x, name, StringComparison.OrdinalIgnoreCase));
35 public override string ValueIndexToValueName(int index) => valueNames[index];
36 }
37}
Note: See TracBrowser for help on using the repository browser.