Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: javafx
    • Labels:

      Description

      ¿Is there any method to get Box's face to set an image difirent in all of them?, i'll try it on this text, buy i only can set a unique image in all.

      Test.java
      ----------------------------

      import javafx.application.Application;
      import javafx.event.EventHandler;
      import javafx.scene.Group;
      import javafx.scene.PerspectiveCamera;
      import javafx.scene.PointLight;
      import javafx.scene.Scene;
      import javafx.scene.image.Image;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.paint.Color;
      import javafx.scene.paint.PhongMaterial;
      import javafx.scene.shape.Box;
      import javafx.scene.shape.CullFace;
      import javafx.scene.transform.Rotate;
      import javafx.stage.Stage;

      public class imageCube extends Application {
      double anchorX, anchorY, anchorAngle;
      private PerspectiveCamera addCamera(Scene scene) {
      PerspectiveCamera perspectiveCamera = new PerspectiveCamera(false);
      scene.setCamera(perspectiveCamera);
      return perspectiveCamera; }
      /** * @param args the command line arguments */
      public static void main(String[] args) {
      launch(args);
      }
      @Override
      public void start(Stage primaryStage) {
      primaryStage.setTitle("Box");
      Image bumpMap = new Image("2.png");
      final PhongMaterial redMaterial = new PhongMaterial();
      redMaterial.setBumpMap(bumpMap);
      redMaterial.setSpecularColor(Color.WHITE);
      final Box red = new Box(400, 400, 400);
      red.setMaterial(redMaterial);
      red.setTranslateX(250);
      red.setTranslateY(250);
      red.setTranslateZ(450);
      final Group parent = new Group(red);
      parent.setTranslateZ(500);
      parent.setRotationAxis(Rotate.Y_AXIS);
      final Group root = new Group(parent);
      final Scene scene = new Scene(root, 500, 500, true);
      scene.setOnMousePressed(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
      anchorX = event.getSceneX();
      anchorY = event.getSceneY();
      anchorAngle = parent.getRotate();
      }
      });
      scene.setOnMouseDragged(new EventHandler<MouseEvent>() {
      @Override
      public void handle(MouseEvent event) {
      parent.setRotate(anchorAngle + anchorX - event.getSceneX());
      }
      });
      PointLight pointLight = new PointLight(Color.ANTIQUEWHITE);
      pointLight.setTranslateX(15);
      pointLight.setTranslateY(-10);
      pointLight.setTranslateZ(-100);
      root.getChildren().add(pointLight);
      addCamera(scene);
      primaryStage.setScene(scene);
      primaryStage.show();
      }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kcr Kevin Rushforth
                Reporter:
                drollonjfx David Garcia Rollon (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: