Skip to content

Commit

Permalink
Add an option to force opengl
Browse files Browse the repository at this point in the history
  • Loading branch information
Retera committed Aug 21, 2022
1 parent 5ee84cb commit ff45edc
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 93 deletions.
15 changes: 15 additions & 0 deletions craft3data/src/com/hiveworkshop/wc3/gui/ProgramPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ProgramPreferences implements Serializable {
private Boolean renderParticles = true;
private Boolean renderStaticPoseParticles = true;
private Boolean autoPopulateMdlTextEditor = false;
private Boolean disableDirectXToSolveVisualArtifacts = false;
Color activeRColor1 = new Color(200, 255, 200);
Color activeRColor2 = new Color(60, 170, 0);
Color activeColor1 = new Color(255, 200, 200);
Expand Down Expand Up @@ -79,6 +80,9 @@ public void reload() {
if (autoPopulateMdlTextEditor == null) {
autoPopulateMdlTextEditor = false;
}
if (disableDirectXToSolveVisualArtifacts == null) {
disableDirectXToSolveVisualArtifacts = false;
}
if (vertexColor == null || normalsColor == null || pivotPointsColor == null) {
vertexColor = new Color(0, 0, 255);// new Color(0, 0, 0)
triangleColor = new Color(255, 255, 255);// new Color(190, 190, 190)
Expand Down Expand Up @@ -164,6 +168,7 @@ public void loadFrom(final ProgramPreferences other) {
this.renderParticles = other.renderParticles;
this.renderStaticPoseParticles = other.renderStaticPoseParticles;
this.autoPopulateMdlTextEditor = other.autoPopulateMdlTextEditor;
this.disableDirectXToSolveVisualArtifacts = other.disableDirectXToSolveVisualArtifacts;
SaveProfile.save();
firePrefsChanged();

Expand Down Expand Up @@ -536,6 +541,10 @@ public Boolean getAutoPopulateMdlTextEditor() {
return autoPopulateMdlTextEditor;
}

public Boolean getDisableDirectXToSolveVisualArtifacts() {
return disableDirectXToSolveVisualArtifacts;
}

public void setAllowLoadingNonBlpTextures(final Boolean allowLoadingNonBlpTextures) {
this.allowLoadingNonBlpTextures = allowLoadingNonBlpTextures;
SaveProfile.save();
Expand All @@ -560,6 +569,12 @@ public void setAutoPopulateMdlTextEditor(final Boolean autoPopulateMdlTextEditor
firePrefsChanged();
}

public void setDisableDirectXToSolveVisualArtifacts(final Boolean disableDirectXToSolveVisualArtifacts) {
this.disableDirectXToSolveVisualArtifacts = disableDirectXToSolveVisualArtifacts;
SaveProfile.save();
firePrefsChanged();
}

public Color getLightsColor() {
return lightsColor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,27 +43,31 @@ public ProgramPreferencesPanel(final ProgramPreferences programPreferences,
final JCheckBox allowLoadingNonBlpTextures = new JCheckBox();
final JCheckBox renderParticles = new JCheckBox();
final JCheckBox autoPopulateMdlTextEditor = new JCheckBox();
if ((programPreferences.isInvertedDisplay() != null) && programPreferences.isInvertedDisplay()) {
final JCheckBox disableDirectXToPreventArtifacts = new JCheckBox();
if (programPreferences.isInvertedDisplay() != null && programPreferences.isInvertedDisplay()) {
invertedDisplay.setSelected(true);
}
if ((programPreferences.getUseBoxesForPivotPoints() != null)
&& programPreferences.getUseBoxesForPivotPoints()) {
if (programPreferences.getUseBoxesForPivotPoints() != null && programPreferences.getUseBoxesForPivotPoints()) {
useBoxesForNodes.setSelected(true);
}
if ((programPreferences.getQuickBrowse() != null) && programPreferences.getQuickBrowse()) {
if (programPreferences.getQuickBrowse() != null && programPreferences.getQuickBrowse()) {
quickBrowse.setSelected(true);
}
if ((programPreferences.getAllowLoadingNonBlpTextures() != null)
if (programPreferences.getAllowLoadingNonBlpTextures() != null
&& programPreferences.getAllowLoadingNonBlpTextures()) {
allowLoadingNonBlpTextures.setSelected(true);
}
if ((programPreferences.getRenderParticles() == null) || programPreferences.getRenderParticles()) {
if (programPreferences.getRenderParticles() == null || programPreferences.getRenderParticles()) {
renderParticles.setSelected(true);
}
if ((programPreferences.getAutoPopulateMdlTextEditor() == null)
if (programPreferences.getAutoPopulateMdlTextEditor() == null
|| programPreferences.getAutoPopulateMdlTextEditor()) {
autoPopulateMdlTextEditor.setSelected(true);
}
if (programPreferences.getDisableDirectXToSolveVisualArtifacts() == null
|| programPreferences.getDisableDirectXToSolveVisualArtifacts()) {
disableDirectXToPreventArtifacts.setSelected(true);
}
final ActionListener viewModeUpdater = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Expand Down Expand Up @@ -97,6 +101,8 @@ public void actionPerformed(final ActionEvent e) {
generalPrefsPanel.add(renderParticles, "cell 1 7");
generalPrefsPanel.add(new JLabel("Auto Refresh MDL Text (enabled=more lag):"), "cell 0 8");
generalPrefsPanel.add(autoPopulateMdlTextEditor, "cell 1 8");
generalPrefsPanel.add(new JLabel("Force Use OpenGL (may fix Windows UI bugs):"), "cell 0 9");
generalPrefsPanel.add(disableDirectXToPreventArtifacts, "cell 1 9");
// final BoxLayout boxLayout = new BoxLayout(generalPrefsPanel,
// BoxLayout.PAGE_AXIS);

Expand Down Expand Up @@ -131,6 +137,13 @@ public void actionPerformed(final ActionEvent e) {
programPreferences.setAutoPopulateMdlTextEditor(autoPopulateMdlTextEditor.isSelected());
}
});
disableDirectXToPreventArtifacts.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
programPreferences
.setDisableDirectXToSolveVisualArtifacts(disableDirectXToPreventArtifacts.isSelected());
}
});
useBoxesForNodes.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
Expand Down
Loading

0 comments on commit ff45edc

Please sign in to comment.