source: OniSplit/Dae/TransformScale.cs@ 1162

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