Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8133343

PointLight not working if more than 3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 8u45
    • javafx
    • x86_64
    • linux

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux: 3.16.7-21-desktop x86_64bit
      OpenSuse 12.3 Gnome 3.14.2

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      processor:Intel Core2 Duo CPU E7300 @ 2.66GHz × 2
      GPU:Intel 945G



      A DESCRIPTION OF THE PROBLEM :
      I tried to add > 3 javafx.scene.PointLight into a scene but i could see only 3 lights. Cant we add more than 3 lights into single scene??

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      add more then 3 lights to scene


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      all javafx.scene.PointLight start working
      ACTUAL -
      only 3 javafx.scene.PointLight start working

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      import java.util.*;

      import javafx.event.*;
      import javafx.application.Application;
      import javafx.scene.*;
      import javafx.scene.input.*;
      import javafx.stage.Stage;
      import javafx.scene.layout.*;
      import javafx.geometry.*;
      import javafx.scene.transform.*;
      import javafx.animation.*;

      import javafx.scene.control.*;
      import javafx.scene.shape.*;
      import javafx.scene.paint.*;


      public class JFXMainCode extends Application {
      ArrayList<KeyCode> inputKeys = new ArrayList<KeyCode>();
      public static void main(String[] args) {
      Application.launch(args);
      }

      @Override
      public void start(Stage primaryStage) {
      Group root3DGroup = new Group();

      Box testBx = new Box(100, 100, 100);
      testBx.setMaterial(new PhongMaterial(Color.ORANGE));
      root3DGroup.getChildren().add(testBx);

      PointLight rightlight = new PointLight(Color.WHITE);
      rightlight.setTranslateX(150);
      root3DGroup.getChildren().add(rightlight);

      PointLight leftLight = new PointLight(Color.WHITE);
      leftLight.setTranslateX(-150);
      root3DGroup.getChildren().add(leftLight);

      PointLight frontLight = new PointLight(Color.WHITE);
      frontLight.setTranslateZ(-150);
      root3DGroup.getChildren().add(frontLight);

      PointLight backLight = new PointLight(Color.WHITE);
      backLight.setTranslateZ(150);
      root3DGroup.getChildren().add(backLight);

      PointLight upLight = new PointLight(Color.WHITE);
      upLight.setTranslateY(-150);
      root3DGroup.getChildren().add(upLight);

      PointLight downLight = new PointLight(Color.WHITE);
      downLight.setTranslateY(150);
      root3DGroup.getChildren().add(downLight);


      PerspectiveCamera camera = new PerspectiveCamera(true);
      camera.getTransforms().addAll(new Translate(150, -100, -200), new Rotate(-20, Rotate.X_AXIS), new Rotate(-30, Rotate.Y_AXIS));
      camera.setFarClip(2000);
      root3DGroup.getChildren().add(camera);

      Scene scene3D = new Scene(root3DGroup, 400, 400, true, SceneAntialiasing.BALANCED);
      scene3D.setFill(Color.BLACK);
      scene3D.setOnKeyPressed((KeyEvent e) -> {
      KeyCode code = e.getCode();
      if(!inputKeys.contains(code))
      inputKeys.add(code);
      });
      scene3D.setOnKeyReleased((KeyEvent e)-> {
      KeyCode code = e.getCode();
      inputKeys.remove(code);
      });
      scene3D.setCamera(camera);


      primaryStage.setScene(scene3D);
      primaryStage.sizeToScene();
      primaryStage.show();


      new AnimationTimer() {
      public void handle(long currentNanoTime)
      {
      double movSpeed = 7;
      if (inputKeys.contains(KeyCode.SHIFT))
      movSpeed = 2;

      if (inputKeys.contains(KeyCode.A))
      camera.setTranslateX(camera.getTranslateX() - movSpeed);
      else if (inputKeys.contains(KeyCode.D))
      camera.setTranslateX(camera.getTranslateX() + movSpeed);

      if (inputKeys.contains(KeyCode.W))
      camera.setTranslateZ(camera.getTranslateZ() + movSpeed);
      else if (inputKeys.contains(KeyCode.S))
      camera.setTranslateZ(camera.getTranslateZ() - movSpeed);


      if (inputKeys.contains(KeyCode.UP))
      camera.getTransforms().add(new Rotate(-(movSpeed/3.5), Rotate.X_AXIS));
      else if (inputKeys.contains(KeyCode.DOWN))
      camera.getTransforms().add(new Rotate(movSpeed/3.5, Rotate.X_AXIS));


      if (inputKeys.contains(KeyCode.RIGHT))
      camera.getTransforms().add(new Rotate(movSpeed/3.5, Rotate.Y_AXIS));
      else if (inputKeys.contains(KeyCode.LEFT))
      camera.getTransforms().add(new Rotate(-(movSpeed/3.5), Rotate.Y_AXIS));


      if (inputKeys.contains(KeyCode.ADD))
      camera.setTranslateY(camera.getTranslateY() - movSpeed);
      else if (inputKeys.contains(KeyCode.SUBTRACT))
      camera.setTranslateY(camera.getTranslateY() + movSpeed);
      }
      }.start();
      }
      }
      ---------- END SOURCE ----------

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: