Skip to content

Commit

Permalink
Merge pull request #3918 from kwvanderlinde/feature/3817-optional-alp…
Browse files Browse the repository at this point in the history
…ha-compositing
  • Loading branch information
cwisniew committed Apr 13, 2023
2 parents abcaefd + b466f80 commit 349517b
Show file tree
Hide file tree
Showing 11 changed files with 401 additions and 253 deletions.
16 changes: 14 additions & 2 deletions src/main/java/net/rptools/maptool/client/AppPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,20 @@ public class AppPreferences {
private static final String KEY_AURA_OVERLAY_OPACITY = "auraOverlayOpacity";
private static final int DEFAULT_AURA_OVERLAY_OPACITY = 60;

private static final String KEY_LIGHT_OVERLAY_OPACITY = "lightOverlayOpacity";
private static final int DEFAULT_LIGHT_OVERLAY_OPACITY = 60;

private static final String KEY_LUMENS_OVERLAY_OPACITY = "lumensOverlayOpacity";
private static final int DEFAULT_LUMENS_OVERLAY_OPACITY = 120;

private static final String KEY_LUMENS_OVERLAY_BORDER_THICKNESS = "lumensOverlayBorderThickness";
private static final int DEFAULT_LUMENS_OVERLAY_BORDER_THICKNESS = 5;

private static final String KEY_LUMENS_OVERLAY_SHOW_BY_DEFAULT = "lumensOverlayShowByDefault";
private static final boolean DEFAULT_LUMENS_OVERLAY_SHOW_BY_DEFAULT = true;
private static final boolean DEFAULT_LUMENS_OVERLAY_SHOW_BY_DEFAULT = false;

private static final String KEY_LIGHTS_SHOW_BY_DEFAULT = "lightsShowByDefault";
private static final boolean DEFAULT_LIGHTS_SHOW_BY_DEFAULT = false;
private static final boolean DEFAULT_LIGHTS_SHOW_BY_DEFAULT = true;

private static final String KEY_FOG_OVERLAY_OPACITY = "fogOverlayOpacity";
private static final int DEFAULT_FOG_OVERLAY_OPACITY = 100;
Expand Down Expand Up @@ -347,6 +350,15 @@ public static int getAuraOverlayOpacity() {
return range0to255(value);
}

public static void setLightOverlayOpacity(int size) {
prefs.putInt(KEY_LIGHT_OVERLAY_OPACITY, range0to255(size));
}

public static int getLightOverlayOpacity() {
int value = prefs.getInt(KEY_LIGHT_OVERLAY_OPACITY, DEFAULT_LIGHT_OVERLAY_OPACITY);
return range0to255(value);
}

public static void setLumensOverlayOpacity(int size) {
prefs.putInt(KEY_LUMENS_OVERLAY_OPACITY, range0to255(size));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ private void initialize() {
initPixelsPerCellTextField();
initDefaultVisionTextField();
initVisionTypeCombo();
initLightingStyleCombo();
initAStarRoundingOptionsComboBox();

initIsometricRadio();
Expand Down Expand Up @@ -268,6 +269,10 @@ public JComboBox getVisionTypeCombo() {
return formPanel.getComboBox("visionType");
}

public JComboBox<Zone.LightingStyle> getLightingStyleCombo() {
return formPanel.getComboBox("lightingStyle");
}

public JComboBox getAStarRoundingOptionsComboBox() {
return formPanel.getComboBox("aStarRoundingOptionsComboBox");
}
Expand All @@ -290,6 +295,7 @@ private void copyZoneToUI() {
getSquareRadio().setSelected(zone.getGrid() instanceof SquareGrid);
getNoGridRadio().setSelected(zone.getGrid() instanceof GridlessGrid);
getVisionTypeCombo().setSelectedItem(zone.getVisionType());
getLightingStyleCombo().setSelectedItem(zone.getLightingStyle());
getAStarRoundingOptionsComboBox().setSelectedItem(zone.getAStarRounding());

gridOffsetX = zone.getGrid().getOffsetX();
Expand All @@ -311,6 +317,7 @@ private void copyUIToZone() {
getDefaultVisionTextField().getText(), zone.getTokenVisionDistance()));

zone.setVisionType((Zone.VisionType) getVisionTypeCombo().getSelectedItem());
zone.setLightingStyle((Zone.LightingStyle) getLightingStyleCombo().getSelectedItem());
zone.setAStarRounding(
(Zone.AStarRoundingOptions) getAStarRoundingOptionsComboBox().getSelectedItem());

Expand Down Expand Up @@ -527,6 +534,15 @@ private void initAStarRoundingOptionsComboBox() {
.setModel(new DefaultComboBoxModel<>(Zone.AStarRoundingOptions.values()));
}

private void initLightingStyleCombo() {
DefaultComboBoxModel<Zone.LightingStyle> model = new DefaultComboBoxModel<>();
for (Zone.LightingStyle vt : Zone.LightingStyle.values()) {
model.addElement(vt);
}
model.setSelectedItem(Zone.LightingStyle.OVERTOP);
getLightingStyleCombo().setModel(model);
}

public String getZoneName() {
return getNameTextField().getText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<grid id="775b6" binding="mainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="5" right="5"/>
<constraints>
<xy x="10" y="10" width="625" height="366"/>
<xy x="10" y="10" width="813" height="401"/>
</constraints>
<properties>
<name value="root"/>
</properties>
<border type="none"/>
<children>
<grid id="aa2a3" layout-manager="GridLayoutManager" row-count="9" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="aa2a3" layout-manager="GridLayoutManager" row-count="10" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
Expand Down Expand Up @@ -91,6 +91,15 @@
<toolTipText resource-bundle="net/rptools/maptool/language/i18n" key="MapPropertiesDialog.label.lights.tooltip"/>
</properties>
</component>
<component id="5b2db" class="javax.swing.JLabel">
<constraints>
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text resource-bundle="net/rptools/maptool/language/i18n" key="MapPropertiesDialog.label.lightingStyle"/>
<toolTipText resource-bundle="net/rptools/maptool/language/i18n" key="MapPropertiesDialog.label.lightingStyle.tooltip"/>
</properties>
</component>
<grid id="b63a7" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="0" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
Expand Down Expand Up @@ -321,9 +330,19 @@
<name value="visionType"/>
</properties>
</component>
<component id="22476" class="javax.swing.JComboBox">
<constraints>
<grid row="8" column="1" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<actionCommand value="comboBoxChanged"/>
<model/>
<name value="lightingStyle"/>
</properties>
</component>
<vspacer id="fe121">
<constraints>
<grid row="8" column="5" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<grid row="9" column="5" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
Expand Down
Loading

0 comments on commit 349517b

Please sign in to comment.