mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-25 10:09:14 +00:00
Slope rotation (unfinished)
This commit is contained in:
@@ -503,6 +503,34 @@ public class IrisObject extends IrisRegistrant {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Rotation calculation
|
||||
double slopeRotationY = 0;
|
||||
ProceduralStream<Double> heightStream = rdata.getEngine().getComplex().getHeightStream();
|
||||
if (config.isRotateTowardsSlope()) {
|
||||
// TODO: Make this respect object rotation (I have no idea how. So just make sure your objects are sort of square and you'll be fine)
|
||||
// Whichever side of the rectangle that bounds the object is lowest is the 'direction' of the slope (simply said).
|
||||
double hNorth = heightStream.get(x, z + ((float)h) / 2);
|
||||
double hEast = heightStream.get(x + ((float)w) / 2, z);
|
||||
double hSouth = heightStream.get(x, z - ((float)h) / 2);
|
||||
double hWest = heightStream.get(x - ((float)w) / 2, z);
|
||||
double min = Math.min(Math.min(hNorth, hEast), Math.min(hSouth, hWest));
|
||||
if (min == hNorth) {
|
||||
slopeRotationY = 0;
|
||||
} else if (min == hEast) {
|
||||
slopeRotationY = 90;
|
||||
} else if (min == hSouth) {
|
||||
slopeRotationY = 180;
|
||||
} else if (min == hWest) {
|
||||
slopeRotationY = 270;
|
||||
}
|
||||
} else if (config.isRotateTowardsSlopePrecise()) {
|
||||
// I take three points which together make a plane that decently represents the slope beneath the object
|
||||
double hNorth = heightStream.get(x, z + ((float)h) / 2);
|
||||
double hEast = heightStream.get(x + ((float)w) / 2, z);
|
||||
double hSouthWest = heightStream.get(x - ((float)w) / 2, z - ((float)h) / 2);
|
||||
// TODO: Complex math
|
||||
}
|
||||
|
||||
if (config.isSmartBore()) {
|
||||
ensureSmartBored(placer.isDebugSmartBore());
|
||||
}
|
||||
|
||||
@@ -64,6 +64,12 @@ public class IrisObjectPlacement {
|
||||
private boolean isDolphinTarget = false;
|
||||
@Desc("The slope at which this object can be placed. Range from 0 to 10 by default. Calculated from the corners of the object.")
|
||||
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
|
||||
@Desc("Set to true to add the rotation of the direction of the slope of the terrain (wherever the slope is going down) to the y-axis rotation of the object. See also rotateTowardsSlopePrecise.")
|
||||
private boolean rotateTowardsSlope = false;
|
||||
@Desc("By default the 'rotateTowardsSlope' function simply calculates which direction" +
|
||||
" (North East South or West) is the lowest, resulting in a 0, 90, 180 or 270 degree rotations. " +
|
||||
"Setting this to true does a precise calculation, which may give unwanted side-effects due to non-90 degree rotations.")
|
||||
private boolean rotateTowardsSlopePrecise = false;
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
|
||||
|
||||
Reference in New Issue
Block a user