Skip to content

Commit

Permalink
Enable NEWT rendering engine by default
Browse files Browse the repository at this point in the history
  • Loading branch information
breiler committed Nov 27, 2024
1 parent 9a0ef7a commit fa2a929
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
8 changes: 4 additions & 4 deletions ugs-core/src/resources/MessagesBundle_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,10 @@ platform.window.visualizer.tooltip = 3D view of the current operation.
platform.window.fileBrowser = File Browser
platform.window.fileBrowser.tooltip = Load a folder to view and work with files.
platform.visualizer.edit.options.title = Visualizer options
platform.visualizer.newt = Use NEWT rendering engine
platform.visualizer.newt.desc = Use the new NEWT rendering engine for better performance
platform.visualizer.newt.samples = NEWT antialiasing samples
platform.visualizer.newt.samples.desc = How many antialiasing samples to make
platform.visualizer.legacy = Use legacy rendering engine
platform.visualizer.legacy.desc = Use the old legacy rendering engine in case of compatibility issues
platform.visualizer.newt.samples = Antialiasing samples
platform.visualizer.newt.samples.desc = How many antialiasing samples to make (will not be used with legacy rendering engine)
platform.visualizer.color.background = Background Color
platform.visualizer.tool = Show tool location
platform.visualizer.color.tool = Tool color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.universalgcodesender.model.events.FileStateEvent;
import com.willwinder.universalgcodesender.utils.Settings;
import com.willwinder.universalgcodesender.utils.Settings.FileStats;
import org.apache.commons.lang3.SystemUtils;

import javax.swing.SwingUtilities;
import java.awt.GraphicsConfiguration;
Expand Down Expand Up @@ -101,9 +100,6 @@ public RendererInputHandler(GcodeRenderer gr, AnimatorBase a, BackendAPI backend
* @return a screen pixel coordinate
*/
private static Point getScreenPoint(int x, int y) {
if (!SystemUtils.IS_OS_WINDOWS) {
return new Point(x, y);
}
GraphicsConfiguration graphicsConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
AffineTransform defaultTransform = graphicsConfiguration.getDefaultTransform();
return new Point((int) Math.round(x * defaultTransform.getScaleX()), (int) Math.round(y * defaultTransform.getScaleY()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.ugs.nbm.visualizer.jogl.VisualizationPanel;
import com.willwinder.ugs.nbm.visualizer.options.VisualizerOptions;
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import static com.willwinder.ugs.nbp.lib.services.LocalizingService.lang;
import com.willwinder.ugs.nbp.lib.services.TopComponentLocalizer;
import com.willwinder.universalgcodesender.i18n.Localization;
import org.apache.commons.lang3.StringUtils;
Expand All @@ -38,6 +37,8 @@ This file is part of Universal Gcode Sender (UGS).
import java.awt.BorderLayout;
import java.awt.Color;

import static com.willwinder.ugs.nbp.lib.services.LocalizingService.lang;

/**
* Setup JOGL canvas, GcodeRenderer and RendererInputHandler.
*/
Expand Down Expand Up @@ -89,10 +90,10 @@ protected void componentOpened() {
JPanel borderedPanel = new JPanel();
borderedPanel.setLayout(new BorderLayout());
borderedPanel.setBorder(BorderFactory.createLineBorder(Color.DARK_GRAY, 1));
if (VisualizerOptions.getBooleanOption(VisualizerOptions.VISUALIZER_OPTION_NEWT, false)) {
borderedPanel.add(new NewtVisualizationPanel(), BorderLayout.CENTER);
} else {
if (VisualizerOptions.getBooleanOption(VisualizerOptions.VISUALIZER_OPTION_LEGACY, false)) {
borderedPanel.add(new VisualizationPanel(), BorderLayout.CENTER);
} else {
borderedPanel.add(new NewtVisualizationPanel(), BorderLayout.CENTER);
}
add(borderedPanel, BorderLayout.CENTER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ This file is part of Universal Gcode Sender (UGS).
*/
public class VisualizerOptions extends ArrayList<Option<?>> {

public static String VISUALIZER_OPTION_NEWT = "platform.visualizer.newt";
public static String VISUALIZER_OPTION_NEWT_DESC = "platform.visualizer.newt.desc";
public static String VISUALIZER_OPTION_LEGACY = "platform.visualizer.legacy";
public static String VISUALIZER_OPTION_LEGACY_DESC = "platform.visualizer.legacy.desc";
public static String VISUALIZER_OPTION_NEWT_SAMPLES = "platform.visualizer.newt.samples";
public static String VISUALIZER_OPTION_NEWT_SAMPLES_DESC = "platform.visualizer.newt.samples.desc";

Expand Down Expand Up @@ -115,7 +115,7 @@ public class VisualizerOptions extends ArrayList<Option<?>> {
public static String VISUALIZER_OPTION_BOUNDARY_INVERT_DESC = "platform.visualizer.boundary.invert.desc";

public VisualizerOptions() {
add(getOption(VISUALIZER_OPTION_NEWT, Localization.getString(VISUALIZER_OPTION_NEWT_DESC), false));
add(getOption(VISUALIZER_OPTION_LEGACY, Localization.getString(VISUALIZER_OPTION_LEGACY_DESC), false));
add(getOption(VISUALIZER_OPTION_NEWT_SAMPLES, Localization.getString(VISUALIZER_OPTION_NEWT_SAMPLES_DESC), 4));

// GcodeRenderer clear color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] args) throws Exception {
private void start() throws Exception {
setPreferredSize(new Dimension(1024, 768));
setLayout(new BorderLayout());
VisualizerOptions.setBooleanOption(VisualizerOptions.VISUALIZER_OPTION_NEWT, true);
VisualizerOptions.setBooleanOption(VisualizerOptions.VISUALIZER_OPTION_LEGACY, false);
Visualizer2TopComponent visualizer = new Visualizer2TopComponent();
add(visualizer, BorderLayout.CENTER);
visualizer.componentOpened();
Expand Down

0 comments on commit fa2a929

Please sign in to comment.