title: Javafx 8 3d Heightmap from TriangleMesh
body: <p>just made this little app and wanted to share ...</p>
  
  <p>I took code from several samples and adapted it to suit my needs
   you can get the source here: <a href="https://github.com/jdub1581/MapGenerator" rel="nofollow noreferrer">gitHub source</a></p>
  
  <p>Here are a couple screenshots for ya ... 
  <img src="https://i.stack.imgur.com/PlMIy.jpg" alt="screenShot 1"></p>
  
  <p><img src="https://i.stack.imgur.com/8Zm2v.jpg" alt="enter image description here"></p>
  
  <p>If you find it interesting or useful or want to help improve it... feel free to do or say so!</p>
  
  <p><strong>EDIT:</strong> OK, It seems that on some Images introduce a lot of lag, I tried implementing a Timeline to hopefully push some of the processing to the GPU.. (I believe thats how it works).. Can anyone think of a better way to create the update thread ? </p>
  
  <pre><code>Timeline defaultTimeline = new Timeline();
      defaultTimeline.getKeyFrames().addAll(new KeyFrame(new Duration(14 - (System.currentTimeMillis() % 14)), (ActionEvent t) -&gt; {
  
          Timeline everySecond = new Timeline();
          everySecond.setCycleCount(Timeline.INDEFINITE);
          everySecond.getKeyFrames().addAll(new KeyFrame(Duration.valueOf(14 + "ms"), (ActionEvent event) -&gt; {
              update();                  
          }));
          everySecond.play();
          System.err.println("Playing");
      }));
      defaultTimeline.play();
  </code></pre>
  
  <p>and the update method:</p>
  
  <pre><code> private void update() {
      if(pixelSkipSlider.isValueChanging()){
          if(meshView.getMesh() != null){
              meshView.setMesh(MeshUtils.createHeightMap(meshImageView.getImage(), (int)pixelSkipSlider.getValue() , (float)maxHeightSlider.getValue(), (float)scaleSlider.getValue()));
          }
      }
      if(maxHeightSlider.isValueChanging()){
          if(meshView.getMesh() != null){
              meshView.setMesh(MeshUtils.createHeightMap(meshImageView.getImage(), (int)pixelSkipSlider.getValue() , (float)maxHeightSlider.getValue(), (float)scaleSlider.getValue()));
          }
      }
      if(scaleSlider.isValueChanging()){
          if(meshView.getMesh() != null){
              meshView.setMesh(MeshUtils.createHeightMap(meshImageView.getImage(), (int)pixelSkipSlider.getValue() , (float)maxHeightSlider.getValue(), (float)scaleSlider.getValue()));
          }
      }
  }    
  </code></pre>