Model outliner (#735)
* Model outliner * Partial revert * Reformat code * Object indicators overhaul -> Hull/Clickbox/Outline (with different outline styles) * Implement config tweak for comboboxes (unhideValue/hideValue/enabledByValue/disabledByValue) * Reformat modeloutliner
This commit is contained in:
@@ -51,16 +51,24 @@ public @interface ConfigItem
|
||||
|
||||
String unhide() default "";
|
||||
|
||||
String unhideValue() default "";
|
||||
|
||||
String hide() default "";
|
||||
|
||||
String hideValue() default "";
|
||||
|
||||
String parent() default "";
|
||||
|
||||
String enabledBy() default "";
|
||||
|
||||
String enabledByValue() default "";
|
||||
|
||||
String disabledBy() default "";
|
||||
|
||||
String disabledByValue() default "";
|
||||
|
||||
boolean parse() default false;
|
||||
|
||||
Class<?> clazz() default void.class;
|
||||
String method() default "";
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,18 @@ import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.ItemLayer;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCDefinition;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.WallObject;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.client.task.Schedule;
|
||||
|
||||
@@ -278,8 +284,7 @@ public class ModelOutlineRenderer
|
||||
* @param x1 The starting x position
|
||||
* @param x2 The ending x position
|
||||
*/
|
||||
private void simulateHorizontalLineRasterizationForOutline(
|
||||
int pixelPos, int x1, int x2)
|
||||
private void simulateHorizontalLineRasterizationForOutline(int pixelPos, int x1, int x2)
|
||||
{
|
||||
if (x2 > clipX2)
|
||||
{
|
||||
@@ -337,8 +342,7 @@ public class ModelOutlineRenderer
|
||||
* @param x3 The starting x position of the second line
|
||||
* @param x4 The ending x position of the second line
|
||||
*/
|
||||
private void outlineAroundHorizontalLine(
|
||||
int pixelPos, int x1, int x2, int x3, int x4)
|
||||
private void outlineAroundHorizontalLine(int pixelPos, int x1, int x2, int x3, int x4)
|
||||
{
|
||||
if (x1 < clipX1)
|
||||
{
|
||||
@@ -420,8 +424,7 @@ public class ModelOutlineRenderer
|
||||
* @param x3 The x position of the third vertex in the triangle
|
||||
* @param y3 The y position of the third vertex in the triangle
|
||||
*/
|
||||
private void simulateTriangleRasterizationForOutline(
|
||||
int x1, int y1, int x2, int y2, int x3, int y3)
|
||||
private void simulateTriangleRasterizationForOutline(int x1, int y1, int x2, int y2, int x3, int y3)
|
||||
{
|
||||
// Swap vertices so y1 <= y2 <= y3 using bubble sort
|
||||
if (y1 > y2)
|
||||
@@ -615,8 +618,7 @@ public class ModelOutlineRenderer
|
||||
* @param vertexOrientation The orientation of the vertices
|
||||
* @return Returns true if any of them are inside the clip area, otherwise false
|
||||
*/
|
||||
private boolean projectVertices(Model model,
|
||||
final int localX, final int localY, final int localZ, final int vertexOrientation)
|
||||
private boolean projectVertices(Model model, final int localX, final int localY, final int localZ, final int vertexOrientation)
|
||||
{
|
||||
final int cameraX = client.getCameraX();
|
||||
final int cameraY = client.getCameraY();
|
||||
@@ -742,8 +744,7 @@ public class ModelOutlineRenderer
|
||||
* @param innerColor The color of the pixels of the outline closest to the model
|
||||
* @param outerColor The color of the pixels of the outline furthest away from the model
|
||||
*/
|
||||
private void renderOutline(BufferedImage image, int outlineWidth,
|
||||
Color innerColor, Color outerColor)
|
||||
private void renderOutline(BufferedImage image, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
int[] imageData = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
|
||||
List<PixelDistanceAlpha> ps = getPriorityList(outlineWidth);
|
||||
@@ -886,9 +887,7 @@ public class ModelOutlineRenderer
|
||||
* @param innerColor The color of the pixels of the outline closest to the model
|
||||
* @param outerColor The color of the pixels of the outline furthest away from the model
|
||||
*/
|
||||
private void drawModelOutline(Model model,
|
||||
int localX, int localY, int localZ, int orientation,
|
||||
int outlineWidth, Color innerColor, Color outerColor)
|
||||
private void drawModelOutline(Model model, int localX, int localY, int localZ, int orientation, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
if (outlineWidth <= 0)
|
||||
{
|
||||
@@ -930,8 +929,7 @@ public class ModelOutlineRenderer
|
||||
drawOutline(npc, outlineWidth, color, color);
|
||||
}
|
||||
|
||||
public void drawOutline(NPC npc, int outlineWidth,
|
||||
Color innerColor, Color outerColor)
|
||||
public void drawOutline(NPC npc, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition composition = npc.getTransformedDefinition();
|
||||
@@ -959,8 +957,7 @@ public class ModelOutlineRenderer
|
||||
drawOutline(player, outlineWidth, color, color);
|
||||
}
|
||||
|
||||
public void drawOutline(Player player, int outlineWidth,
|
||||
Color innerColor, Color outerColor)
|
||||
public void drawOutline(Player player, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
LocalPoint lp = player.getLocalLocation();
|
||||
if (lp != null)
|
||||
@@ -970,4 +967,136 @@ public class ModelOutlineRenderer
|
||||
player.getOrientation(), outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawOutline(GameObject gameObject, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
LocalPoint lp = gameObject.getLocalLocation();
|
||||
if (lp != null)
|
||||
{
|
||||
drawModelOutline(gameObject.getModel(), lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, gameObject.getPlane()),
|
||||
gameObject.getRsOrientation(), outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawOutline(GroundObject groundObject, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
LocalPoint lp = groundObject.getLocalLocation();
|
||||
if (lp != null)
|
||||
{
|
||||
drawModelOutline(groundObject.getModel(), lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, client.getPlane()),
|
||||
0, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawOutline(ItemLayer itemLayer, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
LocalPoint lp = itemLayer.getLocalLocation();
|
||||
if (lp != null)
|
||||
{
|
||||
Model model = itemLayer.getModelBottom();
|
||||
if (model != null)
|
||||
{
|
||||
drawModelOutline(model, lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, itemLayer.getPlane()),
|
||||
0, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
|
||||
model = itemLayer.getModelMiddle();
|
||||
if (model != null)
|
||||
{
|
||||
drawModelOutline(model, lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, itemLayer.getPlane()),
|
||||
0, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
|
||||
model = itemLayer.getModelTop();
|
||||
if (model != null)
|
||||
{
|
||||
drawModelOutline(model, lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, itemLayer.getPlane()),
|
||||
0, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawOutline(DecorativeObject decorativeObject, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
LocalPoint lp = decorativeObject.getLocalLocation();
|
||||
if (lp != null)
|
||||
{
|
||||
Model model = decorativeObject.getModel1();
|
||||
if (model != null)
|
||||
{
|
||||
drawModelOutline(model,
|
||||
lp.getX() + decorativeObject.getXOffset(),
|
||||
lp.getY() + decorativeObject.getYOffset(),
|
||||
Perspective.getTileHeight(client, lp, decorativeObject.getPlane()),
|
||||
decorativeObject.getOrientation(), outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
|
||||
model = decorativeObject.getModel2();
|
||||
if (model != null)
|
||||
{
|
||||
// Offset is not used for the second model
|
||||
drawModelOutline(model, lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, decorativeObject.getPlane()),
|
||||
decorativeObject.getOrientation(), outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawOutline(WallObject wallObject, int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
LocalPoint lp = wallObject.getLocalLocation();
|
||||
if (lp != null)
|
||||
{
|
||||
Model model = wallObject.getModelA();
|
||||
if (model != null)
|
||||
{
|
||||
drawModelOutline(model, lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, wallObject.getPlane()),
|
||||
wallObject.getOrientationA(), outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
|
||||
model = wallObject.getModelB();
|
||||
if (model != null)
|
||||
{
|
||||
drawModelOutline(model, lp.getX(), lp.getY(),
|
||||
Perspective.getTileHeight(client, lp, wallObject.getPlane()),
|
||||
wallObject.getOrientationB(), outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawOutline(TileObject tileObject, int outlineWidth, Color color)
|
||||
{
|
||||
drawOutline(tileObject, outlineWidth, color, color);
|
||||
}
|
||||
|
||||
public void drawOutline(TileObject tileObject,
|
||||
int outlineWidth, Color innerColor, Color outerColor)
|
||||
{
|
||||
if (tileObject instanceof GameObject)
|
||||
{
|
||||
drawOutline((GameObject) tileObject, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
else if (tileObject instanceof GroundObject)
|
||||
{
|
||||
drawOutline((GroundObject) tileObject, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
else if (tileObject instanceof ItemLayer)
|
||||
{
|
||||
drawOutline((ItemLayer) tileObject, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
else if (tileObject instanceof DecorativeObject)
|
||||
{
|
||||
drawOutline((DecorativeObject) tileObject, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
else if (tileObject instanceof WallObject)
|
||||
{
|
||||
drawOutline((WallObject) tileObject, outlineWidth, innerColor, outerColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -633,6 +633,26 @@ public class ConfigPanel extends PluginPanel
|
||||
{
|
||||
show = Boolean.parseBoolean(configManager.getConfiguration(cd.getGroup().value(), cid2.getItem().keyName()));
|
||||
}
|
||||
else if (cid2.getType().isEnum())
|
||||
{
|
||||
Class<? extends Enum> type = (Class<? extends Enum>) cid2.getType();
|
||||
try
|
||||
{
|
||||
Enum selectedItem = Enum.valueOf(type, configManager.getConfiguration(cd.getGroup().value(), cid2.getItem().keyName()));
|
||||
if (!cid.getItem().unhideValue().equals(""))
|
||||
{
|
||||
show = selectedItem.toString().equals(cid.getItem().unhideValue());
|
||||
}
|
||||
else if (!cid.getItem().hideValue().equals(""))
|
||||
{
|
||||
show = !selectedItem.toString().equals(cid.getItem().hideValue());
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
log.info("So bad, so sad: {}", ex.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (show)
|
||||
@@ -817,7 +837,7 @@ public class ConfigPanel extends PluginPanel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (cid.getItem().parse())
|
||||
{
|
||||
JLabel parsingLabel = new JLabel();
|
||||
@@ -1067,8 +1087,8 @@ public class ConfigPanel extends PluginPanel
|
||||
.splitToList(String.format("%s || %s", cid2.getItem().unhide(), cid2.getItem().hide()));
|
||||
|
||||
if (itemHide.contains(cid.getItem().keyName()))
|
||||
{ // If another options visibility changes depending on the value of this checkbox, then render the entire menu again
|
||||
|
||||
{
|
||||
// If another options visibility changes depending on the value of this checkbox, then render the entire menu again
|
||||
reloadPluginlist(listItem, config, cd);
|
||||
}
|
||||
}
|
||||
@@ -1107,6 +1127,36 @@ public class ConfigPanel extends PluginPanel
|
||||
{
|
||||
JComboBox jComboBox = (JComboBox) component;
|
||||
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), ((Enum) jComboBox.getSelectedItem()).name());
|
||||
|
||||
for (ConfigItemDescriptor cid2 : cd.getItems())
|
||||
{
|
||||
if (cid2.getItem().hidden() || !cid2.getItem().hide().isEmpty())
|
||||
{
|
||||
List<String> itemHide = Splitter
|
||||
.onPattern("\\|\\|")
|
||||
.trimResults()
|
||||
.omitEmptyStrings()
|
||||
.splitToList(String.format("%s || %s", cid2.getItem().unhide(), cid2.getItem().hide()));
|
||||
|
||||
if (itemHide.contains(cid.getItem().keyName()))
|
||||
{
|
||||
reloadPluginlist(listItem, config, cd);
|
||||
}
|
||||
|
||||
String changedVal = ((Enum) jComboBox.getSelectedItem()).name();
|
||||
|
||||
if (cid2.getItem().enabledBy().contains(cid.getItem().keyName()) && cid2.getItem().enabledByValue().equals(changedVal))
|
||||
{
|
||||
configManager.setConfiguration(cd.getGroup().value(), cid2.getItem().keyName(), "true");
|
||||
reloadPluginlist(listItem, config, cd);
|
||||
}
|
||||
else if (cid2.getItem().disabledBy().contains(cid.getItem().keyName()) && cid2.getItem().disabledByValue().equals(changedVal))
|
||||
{
|
||||
configManager.setConfiguration(cd.getGroup().value(), cid2.getItem().keyName(), "false");
|
||||
reloadPluginlist(listItem, config, cd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (component instanceof HotkeyButton)
|
||||
{
|
||||
@@ -1223,4 +1273,4 @@ public class ConfigPanel extends PluginPanel
|
||||
{
|
||||
openGroupConfigPanel(listItem, config, cd, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Owain van Brakel <https://github.com/Owain94>
|
||||
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -30,48 +31,85 @@ import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Range;
|
||||
import net.runelite.client.config.Stub;
|
||||
|
||||
@ConfigGroup("objectindicators")
|
||||
public interface ObjectIndicatorsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "overlayStub",
|
||||
name = "Overlay Style",
|
||||
description = "",
|
||||
position = 0
|
||||
)
|
||||
default Stub overlayStub()
|
||||
{
|
||||
return new Stub();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "objectMarkerRenderStyle",
|
||||
name = "Highlight Style",
|
||||
description = "Highlight setting",
|
||||
parent = "overlayStub"
|
||||
)
|
||||
default RenderStyle objectMarkerRenderStyle()
|
||||
{
|
||||
return RenderStyle.OUTLINE;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "objectMarkerOutlineRenderStyle",
|
||||
name = "Outline Style",
|
||||
description = "Highlight outline setting",
|
||||
parent = "overlayStub",
|
||||
hidden = true,
|
||||
unhide = "objectMarkerRenderStyle",
|
||||
unhideValue = "OUTLINE"
|
||||
)
|
||||
default OutlineRenderStyle objectMarkerOutlineRenderStyle()
|
||||
{
|
||||
return OutlineRenderStyle.NORMAL_OUTLINE;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "colorStub",
|
||||
name = "Colors",
|
||||
description = "",
|
||||
position = 3
|
||||
)
|
||||
default Stub colorStub()
|
||||
{
|
||||
return new Stub();
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "markerColor",
|
||||
name = "Marker color",
|
||||
description = "Configures the color of object marker"
|
||||
description = "Configures the outer color of object marker",
|
||||
parent = "colorStub"
|
||||
)
|
||||
default Color markerColor()
|
||||
default Color objectMarkerColor()
|
||||
{
|
||||
return Color.YELLOW;
|
||||
}
|
||||
|
||||
@Range(
|
||||
min = 0,
|
||||
max = 10
|
||||
max = 100
|
||||
)
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "stroke",
|
||||
name = "Stroke Size",
|
||||
description = "Configures the stroke size of object marker"
|
||||
)
|
||||
default int stroke()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Range(
|
||||
min = 0,
|
||||
max = 255
|
||||
)
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "alpha",
|
||||
position = 5,
|
||||
keyName = "objectMarkerAlpha",
|
||||
name = "Alpha",
|
||||
description = "Configures the opacity/alpha of object marker"
|
||||
description = "Configures the opacity/alpha of object marker",
|
||||
parent = "colorStub"
|
||||
)
|
||||
default int alpha()
|
||||
default int objectMarkerAlpha()
|
||||
{
|
||||
return 20;
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Owain van Brakel <https://github.com/Owain94>
|
||||
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -24,33 +25,40 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.objectindicators;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.geom.Area;
|
||||
import static java.lang.Math.floor;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.client.graphics.ModelOutlineRenderer;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
class ObjectIndicatorsOverlay extends Overlay
|
||||
{
|
||||
private static final Color TRANSPARENT = new Color(0, 0, 0, 0);
|
||||
|
||||
private final Client client;
|
||||
private final ObjectIndicatorsConfig config;
|
||||
private final ObjectIndicatorsPlugin plugin;
|
||||
private final ModelOutlineRenderer modelOutliner;
|
||||
|
||||
@Inject
|
||||
private ObjectIndicatorsOverlay(Client client, ObjectIndicatorsConfig config, ObjectIndicatorsPlugin plugin)
|
||||
private ObjectIndicatorsOverlay(Client client, ObjectIndicatorsConfig config, ObjectIndicatorsPlugin plugin, ModelOutlineRenderer modelOutliner)
|
||||
{
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.modelOutliner = modelOutliner;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
@@ -66,46 +74,70 @@ class ObjectIndicatorsOverlay extends Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
final Polygon polygon;
|
||||
Polygon polygon2 = null;
|
||||
Color color = config.objectMarkerColor();
|
||||
int opacity = (int) floor(config.objectMarkerAlpha() * 2.55);
|
||||
Color objectColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), opacity);
|
||||
|
||||
if (object instanceof GameObject)
|
||||
switch (config.objectMarkerRenderStyle())
|
||||
{
|
||||
polygon = ((GameObject) object).getConvexHull();
|
||||
}
|
||||
else if (object instanceof DecorativeObject)
|
||||
{
|
||||
polygon = ((DecorativeObject) object).getConvexHull();
|
||||
polygon2 = ((DecorativeObject) object).getConvexHull2();
|
||||
}
|
||||
else
|
||||
{
|
||||
polygon = object.getCanvasTilePoly();
|
||||
}
|
||||
case OUTLINE:
|
||||
switch (config.objectMarkerOutlineRenderStyle())
|
||||
{
|
||||
case THIN_OUTLINE:
|
||||
modelOutliner.drawOutline(object, 1, objectColor);
|
||||
break;
|
||||
|
||||
if (polygon != null)
|
||||
{
|
||||
renderPoly(graphics, polygon, config.markerColor(), config.stroke(), config.alpha());
|
||||
}
|
||||
case NORMAL_OUTLINE:
|
||||
modelOutliner.drawOutline(object, 2, objectColor);
|
||||
break;
|
||||
|
||||
if (polygon2 != null)
|
||||
{
|
||||
renderPoly(graphics, polygon2, config.markerColor(), config.stroke(), config.alpha());
|
||||
case THIN_GLOW:
|
||||
modelOutliner.drawOutline(object, 4, objectColor, TRANSPARENT);
|
||||
break;
|
||||
|
||||
case GLOW:
|
||||
modelOutliner.drawOutline(object, 8, objectColor, TRANSPARENT);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HULL:
|
||||
final Polygon polygon;
|
||||
Polygon polygon2 = null;
|
||||
|
||||
if (object instanceof GameObject)
|
||||
{
|
||||
polygon = ((GameObject) object).getConvexHull();
|
||||
}
|
||||
else if (object instanceof DecorativeObject)
|
||||
{
|
||||
polygon = ((DecorativeObject) object).getConvexHull();
|
||||
polygon2 = ((DecorativeObject) object).getConvexHull2();
|
||||
}
|
||||
else
|
||||
{
|
||||
polygon = object.getCanvasTilePoly();
|
||||
}
|
||||
|
||||
if (polygon != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, polygon, objectColor);
|
||||
}
|
||||
|
||||
if (polygon2 != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, polygon2, objectColor);
|
||||
}
|
||||
break;
|
||||
case CLICKBOX:
|
||||
Area clickbox = object.getClickbox();
|
||||
if (clickbox != null)
|
||||
{
|
||||
OverlayUtil.renderHoverableArea(graphics, object.getClickbox(), client.getMouseCanvasPosition(), TRANSPARENT, objectColor, objectColor.darker());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Polygon polygon, Color color, int stroke, int alpha)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 255));
|
||||
graphics.setStroke(new BasicStroke(stroke));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), alpha));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.objectindicators;
|
||||
|
||||
public enum OutlineRenderStyle
|
||||
{
|
||||
THIN_OUTLINE,
|
||||
NORMAL_OUTLINE,
|
||||
THIN_GLOW,
|
||||
GLOW
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.objectindicators;
|
||||
|
||||
public enum RenderStyle
|
||||
{
|
||||
CLICKBOX,
|
||||
HULL,
|
||||
OUTLINE
|
||||
}
|
||||
Reference in New Issue
Block a user