Add depthTest option to ShapeMarkers and add a helper-funktion

This commit is contained in:
Blue (Lukas Rieger) 2020-04-23 18:06:42 +02:00
parent 4a84f62372
commit 161fc1c968
3 changed files with 37 additions and 3 deletions

View File

@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
apiVersion=1.0.1
apiVersion=1.1.0

View File

@ -27,6 +27,7 @@
import java.util.Collection;
import java.util.Optional;
import com.flowpowered.math.vector.Vector2d;
import com.flowpowered.math.vector.Vector3d;
import de.bluecolored.bluemap.api.BlueMapMap;
@ -136,11 +137,13 @@ default POIMarker createPOIMarker(String id, BlueMapMap map, double posX, double
* Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
* If a {@link Marker} with that id already exists, it will be replaced by the new {@link ShapeMarker}!
*
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
*
* @param id the id of the new marker
* @param map the {@link BlueMapMap} of the new marker
* @param position the position of the new marker
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height (y-position on the map) of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @return the created {@link ShapeMarker}
*/
ShapeMarker createShapeMarker(String id, BlueMapMap map, Vector3d position, Shape shape, float height);
@ -149,19 +152,38 @@ default POIMarker createPOIMarker(String id, BlueMapMap map, double posX, double
* Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
* If a Marker with that id already exists, it will be replaced by the new {@link ShapeMarker}!
*
* <p><i>(Since the shape has its own positions, the position is only used to determine e.g. the distance to the camera)</i></p>
*
* @param id the id of the new marker
* @param map the {@link BlueMapMap} of the new marker
* @param posX the x-position of the new marker
* @param posY the y-position of the new marker
* @param posZ the z-position of the new marker
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height (y-position on the map) of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @return the created {@link ShapeMarker}
*/
default ShapeMarker createShapeMarker(String id, BlueMapMap map, double posX, double posY, double posZ, Shape shape, float height) {
return createShapeMarker(id, map, new Vector3d(posX, posY, posZ), shape, height);
}
/**
* Creates a {@link ShapeMarker} with the given id and adds it to this {@link MarkerSet}.<br>
* If a Marker with that id already exists, it will be replaced by the new {@link ShapeMarker}!
*
* <p><i>(The position of the marker will be the center of the shape (it's bounding box))</i></p>
*
* @param id the id of the new marker
* @param map the {@link BlueMapMap} of the new marker
* @param shape the Shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @param height the height of shape of the marker (See: {@link ShapeMarker#setShape(Shape, float)})
* @return the created {@link ShapeMarker}
*/
default ShapeMarker createShapeMarker(String id, BlueMapMap map, Shape shape, float height) {
Vector2d center = shape.getMin().add(shape.getMax()).div(2);
return createShapeMarker(id, map, new Vector3d(center.getX(), height, center.getY()), shape, height);
}
/**
* Removes the given Marker from this {@link MarkerSet}.<br>
* This is equivalent to calling <code>removeMarker(marker.getId())</code>.

View File

@ -48,6 +48,18 @@ public interface ShapeMarker extends Marker {
* @param height the new height of the shape on the map
*/
void setShape(Shape shape, float height);
/**
* If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the border of the marker when it is - for example - under the ground.
* @return <code>true</code> if the depthTest is enabled
*/
boolean isDepthTestEnabled();
/**
* If the depth-test is disabled, you can see the marker fully through all objects on the map. If it is enabled, you'll only see the border of the marker when it is - for example - under the ground.
* @param enabled if the depth-test should be enabled for this {@link ShapeMarker}
*/
void setDepthTestEnabled(boolean enabled);
/**
* Getter for the {@link Color} of the border of the shape.