Changed license to Creative Commons Zero (CC0).
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / math / TransformPipe.java
1 /*
2  * Sixth 3D engine. Author: Svjatoslav Agejenko. 
3  * This project is released under Creative Commons Zero (CC0) license.
4  *
5 *
6  */
7
8 package eu.svjatoslav.sixth.e3d.math;
9
10 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
11
12 public class TransformPipe {
13
14     private Transform[] transforms = new Transform[100];
15
16     private int transformsCount = 0;
17
18     public void addTransform(final Transform transform) {
19         transforms[transformsCount] = transform;
20         transformsCount++;
21     }
22
23     public void clear() {
24         transformsCount = 0;
25     }
26
27     public void dropTransform() {
28         transformsCount--;
29     }
30
31     public void transform(final Point3D source, final Point3D destination) {
32
33         destination.clone(source);
34
35         for (int i = transformsCount - 1; i >= 0; i--)
36             transforms[i].transform(destination);
37     }
38 }