Javafx 8 3d Heightmap from TriangleMesh -
just made little app , wanted share ...
i took code several samples , adapted suit needs can source here: github source
here couple screenshots ya ...
if find interesting or useful or want improve it... feel free or so!
edit: ok, seems on images introduce lot of lag, tried implementing timeline push of processing gpu.. (i believe thats how works).. can think of better way create update thread ?
timeline defaulttimeline = new timeline(); defaulttimeline.getkeyframes().addall(new keyframe(new duration(14 - (system.currenttimemillis() % 14)), (actionevent t) -> { timeline everysecond = new timeline(); everysecond.setcyclecount(timeline.indefinite); everysecond.getkeyframes().addall(new keyframe(duration.valueof(14 + "ms"), (actionevent event) -> { update(); })); everysecond.play(); system.err.println("playing"); })); defaulttimeline.play();
and update method:
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())); } } }
at time asked unaware of invalidated() method of javafx properties, overriding method, , using preferred method of updating properties.
in doing so, platform performs should , issues have gone away.
Comments
Post a Comment