Skip to content

Commit db52065

Browse files
committed
Make lighting work on MacOSX
1 parent ed5a118 commit db52065

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

ugs-fx/build-linux-x64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ -z ${PROJECT_VERSION} ]; then echo "Missing PROJECT_VERSION"; exit 1; fi
1313
if [ -z ${APP_VERSION} ]; then echo "Missing APP_VERSION"; exit 1; fi
1414

1515
# Download JVM
16-
JVM=zulu17.50.19-ca-fx-jdk17.0.11-linux_x64
16+
JVM=zulu21.42.19-ca-fx-jdk21.0.7-linux_x64
1717
set -e
1818
ZIP=$JVM.tar.gz
1919
export JAVA_HOME=.jdks/$JVM

ugs-fx/build-macosx-aarch64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ -z ${PROJECT_VERSION} ]; then echo "Missing PROJECT_VERSION"; exit 1; fi
1313
if [ -z ${APP_VERSION} ]; then echo "Missing APP_VERSION"; exit 1; fi
1414

1515
# Download JVM
16-
JVM=zulu17.58.21-ca-fx-jdk17.0.15-macosx_aarch64
16+
JVM=zulu21.42.19-ca-fx-jdk21.0.7-macosx_aarch64
1717
set -e
1818
ZIP=$JVM.tar.gz
1919
export JAVA_HOME=.jdks/$JVM

ugs-fx/build-macosx-x64.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if [ -z ${PROJECT_VERSION} ]; then echo "Missing PROJECT_VERSION"; exit 1; fi
1313
if [ -z ${APP_VERSION} ]; then echo "Missing APP_VERSION"; exit 1; fi
1414

1515
# Download JVM
16-
JVM=zulu17.58.21-ca-fx-jdk17.0.15-macosx_x64
16+
JVM=zulu21.42.19-ca-fx-jdk21.0.7-macosx_x64
1717
set -e
1818
ZIP=$JVM.tar.gz
1919
export JAVA_HOME=.jdks/$JVM

ugs-fx/build-windows-x64.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if "%APP_VERSION%"=="" (
1616
)
1717

1818
:: ----------- DOWNLOAD JVM ------------------------------------------------
19-
set JVM=zulu17.50.19-ca-fx-jdk17.0.11-win_x64
19+
set JVM=zulu21.42.19-ca-fx-jdk21.0.7-win_x64
2020
set ZIP=%JVM%.zip
2121
set JAVA_HOME=.jdks\%JVM%
2222

@@ -90,6 +90,6 @@ for %%s in ("msi" "exe") do call "%JAVA_HOME%\bin\jpackage" ^
9090
--license-file ..\COPYING ^
9191
--about-url https://universalgcodesender.com/
9292

93-
move "target\installer\Universal G-code Sender*.exe" "target\installer\ugs-%APP_VERSION%.exe"
94-
move "target\installer\Universal G-code Sender*.msi" "target\installer\ugs-%APP_VERSION%.msi"
93+
move "target\installer\Universal G-code Sender*.exe" "target\installer\ugs-%APP_VERSION%-x64.exe"
94+
move "target\installer\Universal G-code Sender*.msi" "target\installer\ugs-%APP_VERSION%-x64.msi"
9595
echo Done.

ugs-fx/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<url>https://github.com/winder/Universal-G-Code-Sender/tree/master/ugs-fx</url>
1717

1818
<properties>
19-
<javafx.version>17.0.13</javafx.version>
19+
<javafx.version>21.0.7</javafx.version>
2020
<exec.maven.plugin.version>3.5.0</exec.maven.plugin.version>
2121
</properties>
2222

ugs-fx/src/main/java/com/willwinder/universalgcodesender/fx/visualizer/Tool.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,13 @@ public MeshView createCone(float radius, float height, int divisions, Color colo
9292

9393
// Create MeshView and material
9494
MeshView cone = new MeshView(mesh);
95-
cone.setDrawMode(DrawMode.FILL); // or DrawMode.LINE for wireframe
95+
cone.setDrawMode(DrawMode.FILL);
9696
cone.setCullFace(CullFace.BACK);
9797

98-
PhongMaterial material = new PhongMaterial(color);
98+
PhongMaterial material = new PhongMaterial();
99+
material.setDiffuseColor(color);
100+
material.setSpecularColor(Color.WHITE);
101+
material.setSpecularPower(32);
99102
cone.setMaterial(material);
100103

101104
return cone;

ugs-fx/src/main/java/com/willwinder/universalgcodesender/fx/visualizer/Visualizer.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
package com.willwinder.universalgcodesender.fx.visualizer;
22

33
import javafx.application.Platform;
4+
import javafx.geometry.Point3D;
45
import javafx.scene.AmbientLight;
56
import javafx.scene.Camera;
7+
import javafx.scene.DirectionalLight;
68
import javafx.scene.Group;
79
import javafx.scene.ParallelCamera;
810
import javafx.scene.PerspectiveCamera;
9-
import javafx.scene.PointLight;
1011
import javafx.scene.SceneAntialiasing;
1112
import javafx.scene.SubScene;
1213
import javafx.scene.input.MouseButton;
@@ -36,15 +37,12 @@ public Visualizer() {
3637
rotateGroup.getTransforms().addAll(rotateX, rotateY, new Rotate(180, Rotate.Z_AXIS));
3738

3839
// Lighting
39-
PointLight light = new PointLight(Color.WHITE);
40-
light.setTranslateX(-200);
41-
light.setTranslateY(-100);
42-
light.setTranslateZ(-100);
40+
DirectionalLight light = new DirectionalLight(Color.WHITE);
41+
light.setDirection(new Point3D(1, -1, -1));
4342
light.getScope().addAll(tool);
4443

45-
4644
// Root group applies panning
47-
AmbientLight ambient = new AmbientLight(Color.rgb(210, 210, 210));
45+
AmbientLight ambient = new AmbientLight(Color.rgb(255, 255, 255));
4846
root3D = new Group(rotateGroup, ambient, light);
4947
root3D.getTransforms().add(translate);
5048

@@ -149,4 +147,4 @@ public void setCameraPosition(double x, double y, double z) {
149147
cameraTranslate.setY(y);
150148
cameraTranslate.setZ(z);
151149
}
152-
}
150+
}

0 commit comments

Comments
 (0)