mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Reach slope-tilted objects as far as a vertical rotation
A placement that turns towards the slope can tilt a tall object even when its configured rotation is disabled, so its reach counted only the horizontal footprint and the write and read windows cut it off at chunk seams. Count it like a vertical rotation: the tallest dimension as footprint and the full translation vector. Upstream:7aaf346ceb34e5e767
This commit is contained in:
1 parent
971cad0463
commit
867851366d
2 files changed
+19
-6
No files matched your search
@@ -111,21 +111,22 @@ final class PlacementReach {
|
||||
}
|
||||
|
||||
static int of(ObjectSize size, ObjectPlacement placement) {
|
||||
return of(size, placement.mode().placeMode(), placement.scale().maxScale(), placement.rotation(), placement.translate(),
|
||||
placement.warp() == null || placement.warp().isFlat() ? 0 : placement.warp().multiplier(),
|
||||
return of(size, placement.mode().placeMode(), placement.scale().maxScale(), placement.rotation(), placement.rotateTowardsSlope(),
|
||||
placement.translate(), placement.warp() == null || placement.warp().isFlat() ? 0 : placement.warp().multiplier(),
|
||||
placement.vacuumSettings().orElse(null));
|
||||
}
|
||||
|
||||
private static int of(ObjectSize size, PlaceMode mode, Double maxScale, ObjectRotation rotation, ObjectTranslate translate,
|
||||
Double warpMultiplier, VacuumSettings vacuum) {
|
||||
private static int of(ObjectSize size, PlaceMode mode, Double maxScale, ObjectRotation rotation, boolean rotatesTowardsSlope,
|
||||
ObjectTranslate translate, Double warpMultiplier, VacuumSettings vacuum) {
|
||||
double scale = maxScale == null ? 1D : Math.max(1D, maxScale);
|
||||
int width = scaledDimension(size.width(), scale);
|
||||
int height = scaledDimension(size.height(), scale);
|
||||
int depth = scaledDimension(size.depth(), scale);
|
||||
boolean rotateX = rotation != null && rotation.enabled() && rotation.xAxis() != null && rotation.xAxis().enabled();
|
||||
boolean rotateZ = rotation != null && rotation.enabled() && rotation.zAxis() != null && rotation.zAxis().enabled();
|
||||
int footprint = rotateX || rotateZ ? Math.max(width, Math.max(height, depth)) : Math.max(width, depth);
|
||||
int translation = translationReach(translate, rotation, rotateX || rotateZ);
|
||||
boolean tiltsVertically = rotatesTowardsSlope || rotateX || rotateZ;
|
||||
int footprint = tiltsVertically ? Math.max(width, Math.max(height, depth)) : Math.max(width, depth);
|
||||
int translation = translationReach(translate, rotation, tiltsVertically);
|
||||
int warp = warpMultiplier == null ? 0 : (int) Math.ceil(Math.abs(warpMultiplier) / 2D);
|
||||
int vacuumReach = mode.bendsTerrain() ? 2 * vacuumRadius(mode, vacuum) : 0;
|
||||
long reach = (long) footprint + translation + warp + vacuumReach;
|
||||
|
||||
Reference in new issue
Block a user