source: OniSplit/Dae/TransformCollection.cs@ 1114

Last change on this file since 1114 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.Collections.Generic;
2
3namespace Oni.Dae
4{
5 internal class TransformCollection : List<Transform>
6 {
7 public Matrix ToMatrix()
8 {
9 var matrix = Matrix.Identity;
10
11 foreach (var transform in Utils.Reverse(this))
12 matrix *= transform.ToMatrix();
13
14 return matrix;
15 }
16
17 public TransformScale Scale(string sid, Vector3 scale)
18 {
19 var transform = new TransformScale(sid, scale);
20 Add(transform);
21 return transform;
22 }
23
24 public TransformRotate Rotate(string sid, Vector3 axis, float angle)
25 {
26 var transform = new TransformRotate(sid, axis, angle);
27 Add(transform);
28 return transform;
29 }
30
31 public TransformTranslate Translate(string sid, Vector3 translate)
32 {
33 var transform = new TransformTranslate(sid, translate);
34 Add(transform);
35 return transform;
36 }
37 }
38}
Note: See TracBrowser for help on using the repository browser.