+++ /dev/null
-/*
- * Sixth 3D engine. Author: Svjatoslav Agejenko.
- * This project is released under Creative Commons Zero (CC0) license.
- */
-package eu.svjatoslav.sixth.e3d.math;
-
-import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-
-public class TransformsPipeline {
-
-
- private Transform[] transforms = new Transform[100];
-
- /**
- * The number of transforms in the pipeline.
- */
- private int transformsCount = 0;
-
- /**
- * Adds a transform to the pipeline.
- *
- * @param transform
- * The transform to add.
- */
- public void addTransform(final Transform transform) {
- transforms[transformsCount] = transform;
- transformsCount++;
- }
-
- /**
- * Clears the pipeline.
- */
- public void clear() {
- transformsCount = 0;
- }
-
- /**
- * Drops the last transform from the pipeline.
- */
- public void dropTransform() {
- transformsCount--;
- }
-
- /**
- * Transforms a point.
- *
- * @param orinigalPoint
- * Original point to transform. Original point is not modified.
- * @param transformedPoint
- * Transformed point.
- */
- public void transform(final Point3D orinigalPoint, final Point3D transformedPoint) {
-
- transformedPoint.clone(orinigalPoint);
-
- // apply transforms in reverse order
- for (int i = transformsCount - 1; i >= 0; i--)
- transforms[i].transform(transformedPoint);
- }
-}