Formatting update
[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 package eu.svjatoslav.sixth.e3d.math;
6
7 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
8
9 public class TransformPipe {
10
11     private Transform[] transforms = new Transform[100];
12
13     private int transformsCount = 0;
14
15     public void addTransform(final Transform transform) {
16         transforms[transformsCount] = transform;
17         transformsCount++;
18     }
19
20     public void clear() {
21         transformsCount = 0;
22     }
23
24     public void dropTransform() {
25         transformsCount--;
26     }
27
28     public void transform(final Point3D source, final Point3D destination) {
29
30         destination.clone(source);
31
32         for (int i = transformsCount - 1; i >= 0; i--)
33             transforms[i].transform(destination);
34     }
35 }