mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-31 04:46:40 +00:00
More Performance
This commit is contained in:
@@ -112,17 +112,25 @@ public class IrisStructure extends IrisRegistrant
|
||||
|
||||
public boolean isWall(RNG rng, double x, double y, double z, StructureTileFace face)
|
||||
{
|
||||
if(face == StructureTileFace.DOWN && maxLayers == 1)
|
||||
if((face == StructureTileFace.DOWN || face == StructureTileFace.UP) && maxLayers == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return isWall(rng, x, y, z, (face.ordinal() + 12) * 3);
|
||||
}
|
||||
int gs = getGridSize() + 1;
|
||||
int gh = getGridHeight() + 1;
|
||||
int gx = getTileHorizon(x);
|
||||
int gy = getTileVertical(y);
|
||||
int gz = getTileHorizon(z);
|
||||
int hx = face.x();
|
||||
int hy = face.y();
|
||||
int hz = face.z();
|
||||
|
||||
private boolean isWall(RNG rng, double x, double y, double z, int side)
|
||||
{
|
||||
return getWallGenerator(rng).fitDoubleD(0, 1, (getTileHorizon(x) + side) / wallChanceZoom, (getTileVertical(y) + side) / wallChanceZoom, (getTileHorizon(z) - side) / wallChanceZoom) < getWallChance();
|
||||
int tx = (gx * 2) + (hx * gs);
|
||||
int ty = (gy * 2) + (hy * gh);
|
||||
int tz = (gz * 2) + (hz * gs);
|
||||
|
||||
return getWallGenerator(rng).fitDoubleD(0, 1, (tx) / wallChanceZoom, ty / wallChanceZoom, tz / wallChanceZoom) < getWallChance();
|
||||
}
|
||||
|
||||
public int getTileHorizon(double v)
|
||||
|
||||
@@ -55,19 +55,20 @@ public class IrisStructurePlacement
|
||||
int h;
|
||||
RNG rnp = rng.nextParallelRNG(cx - (cz * cz));
|
||||
int s = gridSize() - (getStructure().isMergeEdges() ? 1 : 0);
|
||||
int sh = gridHeight() - (getStructure().isMergeEdges() ? 1 : 0);
|
||||
|
||||
for(int i = cx << 4; i < (cx << 4) + 15; i += Math.max(s / 2, 1))
|
||||
{
|
||||
for(int j = cz << 4; j < (cz << 4) + 15; j += Math.max(s / 2, 1))
|
||||
{
|
||||
for(int k = 0; k < s * getStructure().getMaxLayers(); k += Math.max(s, 1))
|
||||
for(int k = 0; k < s * getStructure().getMaxLayers(); k += Math.max(sh, 1))
|
||||
{
|
||||
if(!hasStructure(rng, i, k, j))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
h = (height == -1 ? 0 : height) + (Math.floorDiv(k, s) * s);
|
||||
h = (height == -1 ? 0 : height) + (Math.floorDiv(k, sh) * sh);
|
||||
t = getStructure().getTile(rng, i / zoom, h / zoom, j / zoom);
|
||||
|
||||
if(t != null)
|
||||
@@ -106,6 +107,11 @@ public class IrisStructurePlacement
|
||||
return getStructure().getGridSize();
|
||||
}
|
||||
|
||||
public int gridHeight()
|
||||
{
|
||||
return getStructure().getGridHeight();
|
||||
}
|
||||
|
||||
public IrisStructure getStructure()
|
||||
{
|
||||
return structure.aquire(() -> Iris.data.getStructureLoader().load(getTileset()));
|
||||
|
||||
@@ -45,6 +45,16 @@ public class IrisStructureTile
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return (ceiling.required() ? "C" : "") +
|
||||
(floor.required() ? "F" : "") + "| "+
|
||||
(north.required() ? "X" : "-") +
|
||||
(south.required() ? "X" : "-") +
|
||||
(east.required() ? "X" : "-") +
|
||||
(west.required() ? "X" : "-") + " |";
|
||||
}
|
||||
|
||||
public boolean likeAGlove(boolean floor, boolean ceiling, KList<StructureTileFace> walls)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,21 @@ public enum StructureTileFace
|
||||
EAST,
|
||||
WEST;
|
||||
|
||||
public int x()
|
||||
{
|
||||
return this.equals(EAST) ? 1 : this.equals(WEST) ? -1 : 0;
|
||||
}
|
||||
|
||||
public int y()
|
||||
{
|
||||
return this.equals(UP) ? 1 : this.equals(DOWN) ? -1 : 0;
|
||||
}
|
||||
|
||||
public int z()
|
||||
{
|
||||
return this.equals(SOUTH) ? 1 : this.equals(NORTH) ? -1 : 0;
|
||||
}
|
||||
|
||||
public StructureTileFace rotate90CW()
|
||||
{
|
||||
switch(this)
|
||||
|
||||
Reference in New Issue
Block a user