diff --git a/docs/scarpet/api/Auxiliary.md b/docs/scarpet/api/Auxiliary.md index 78f61be4..3a0bbc30 100644 --- a/docs/scarpet/api/Auxiliary.md +++ b/docs/scarpet/api/Auxiliary.md @@ -114,7 +114,7 @@ Available shapes: * `align` - text alignment with regards to `pos`. Default is `center` (displayed text is centered with respect to `pos`), `left` (`pos` indicates beginning of text), and `right` (`pos` indicates the end of text). - * `tilt` - additional rotation of the text on the canvas + * `tilt`, `lean`, `turn` - additional rotations of the text on the canvas along all three axis * `indent`, `height`, `raise` - offsets for text rendering on X (`indent`), Y (`height`), and Z axis (`raise`) with regards to the plane of the text. One unit of these corresponds to 1 line spacing, which can be used to display multiple lines of text bound to the same `pos` diff --git a/src/main/java/carpet/script/utils/ShapeDispatcher.java b/src/main/java/carpet/script/utils/ShapeDispatcher.java index 87a153f2..404b2753 100644 --- a/src/main/java/carpet/script/utils/ShapeDispatcher.java +++ b/src/main/java/carpet/script/utils/ShapeDispatcher.java @@ -418,6 +418,8 @@ public class ShapeDispatcher put("facing", new StringValue("player")). put("raise", new NumericValue(0)). put("tilt", new NumericValue(0)). + put("lean", new NumericValue(0)). + put("turn", new NumericValue(0)). put("indent", new NumericValue(0)). put("height", new NumericValue(0)). put("align", new StringValue("center")). @@ -439,6 +441,8 @@ public class ShapeDispatcher Direction facing; float raise; float tilt; + float lean; + float turn; float size; float indent; int align; @@ -487,6 +491,8 @@ public class ShapeDispatcher raise = NumericValue.asNumber(options.getOrDefault("raise", optional.get("raise"))).getFloat(); tilt = NumericValue.asNumber(options.getOrDefault("tilt", optional.get("tilt"))).getFloat(); + lean = NumericValue.asNumber(options.getOrDefault("lean", optional.get("lean"))).getFloat(); + turn = NumericValue.asNumber(options.getOrDefault("turn", optional.get("turn"))).getFloat(); indent = NumericValue.asNumber(options.getOrDefault("indent", optional.get("indent"))).getFloat(); height = NumericValue.asNumber(options.getOrDefault("height", optional.get("height"))).getFloat(); @@ -519,6 +525,8 @@ public class ShapeDispatcher if (facing!= null) hash ^= facing.hashCode(); hash *= 1099511628211L; hash ^= Float.hashCode(raise); hash *= 1099511628211L; hash ^= Float.hashCode(tilt); hash *= 1099511628211L; + hash ^= Float.hashCode(lean); hash *= 1099511628211L; + hash ^= Float.hashCode(turn); hash *= 1099511628211L; hash ^= Float.hashCode(indent); hash *= 1099511628211L; hash ^= Float.hashCode(height); hash *= 1099511628211L; hash ^= Float.hashCode(size); hash *= 1099511628211L; diff --git a/src/main/java/carpet/script/utils/ShapesRenderer.java b/src/main/java/carpet/script/utils/ShapesRenderer.java index 8be35a77..436d8632 100644 --- a/src/main/java/carpet/script/utils/ShapesRenderer.java +++ b/src/main/java/carpet/script/utils/ShapesRenderer.java @@ -278,6 +278,14 @@ public class ShapesRenderer { RenderSystem.rotatef(shape.tilt, 0.0f, 0.0f, 1.0f); } + if (shape.lean!=0.0f) + { + RenderSystem.rotatef(shape.lean, 1.0f, 0.0f, 0.0f); + } + if (shape.turn!=0.0f) + { + RenderSystem.rotatef(shape.turn, 0.0f, 1.0f, 0.0f); + } RenderSystem.translatef(-10*shape.indent, -10*shape.height-9, (float) (-10*renderEpsilon)-10*shape.raise); //if (visibleThroughWalls) RenderSystem.disableDepthTest(); RenderSystem.scalef(-1.0F, 1.0F, 1.0F);