Search in sources :

Example 26 with Translate

use of javafx.scene.transform.Translate in project FXyzLib by Birdasaur.

the class TexturedMesh method updateTransforms.

protected void updateTransforms() {
    getTransforms().removeAll(rotateX, rotateY, rotateZ, scale);
    Bounds bounds = getBoundsInLocal();
    javafx.geometry.Point3D p = new javafx.geometry.Point3D((bounds.getMaxX() + bounds.getMinX()) / 2d, (bounds.getMaxY() + bounds.getMinY()) / 2d, (bounds.getMaxZ() + bounds.getMinZ()) / 2d);
    translate = new Translate(0, 0, 0);
    rotateX = new Rotate(0, p.getX(), p.getY(), p.getZ(), Rotate.X_AXIS);
    rotateY = new Rotate(0, p.getX(), p.getY(), p.getZ(), Rotate.Y_AXIS);
    rotateZ = new Rotate(0, p.getX(), p.getY(), p.getZ(), Rotate.Z_AXIS);
    scale = new Scale(1, 1, 1, p.getX(), p.getY(), p.getZ());
    getTransforms().addAll(translate, rotateZ, rotateY, rotateX, scale);
}
Also used : Rotate(javafx.scene.transform.Rotate) Point3D(org.fxyz.geometry.Point3D) Bounds(javafx.geometry.Bounds) Scale(javafx.scene.transform.Scale) Translate(javafx.scene.transform.Translate)

Aggregations

Translate (javafx.scene.transform.Translate)26 Rotate (javafx.scene.transform.Rotate)18 Group (javafx.scene.Group)14 Scene (javafx.scene.Scene)12 Color (javafx.scene.paint.Color)11 Point3D (org.fxyz.geometry.Point3D)11 Random (java.util.Random)10 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)10 PerspectiveCamera (javafx.scene.PerspectiveCamera)10 KeyCode (javafx.scene.input.KeyCode)10 PointLight (javafx.scene.PointLight)9 MouseEvent (javafx.scene.input.MouseEvent)9 Sphere (javafx.scene.shape.Sphere)7 List (java.util.List)5 Collectors (java.util.stream.Collectors)5 IntStream (java.util.stream.IntStream)5 DoubleProperty (javafx.beans.property.DoubleProperty)5 IntegerProperty (javafx.beans.property.IntegerProperty)5 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)5 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)5