resolved couple warnings. If it causes problems just revert it.

This commit is contained in:
cola98765
2022-01-17 14:18:12 +01:00
parent 57a6483aec
commit 4702aa7888
27 changed files with 142 additions and 181 deletions
@@ -76,8 +76,8 @@ public class ClientApi
}
private ConcurrentHashMap.KeySetView<Long,Boolean> generating = ConcurrentHashMap.newKeySet();
private ConcurrentHashMap.KeySetView<Long,Boolean> toBeLoaded = ConcurrentHashMap.newKeySet();
private final ConcurrentHashMap.KeySetView<Long,Boolean> generating = ConcurrentHashMap.newKeySet();
private final ConcurrentHashMap.KeySetView<Long,Boolean> toBeLoaded = ConcurrentHashMap.newKeySet();
public void clientChunkLoadEvent(IChunkWrapper chunk, IWorldWrapper world)
{
@@ -28,8 +28,6 @@ import com.seibel.lod.core.objects.opengl.LodBufferBuilder;
import com.seibel.lod.core.util.ColorUtil;
import com.seibel.lod.core.util.DataPointUtil;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import static com.seibel.lod.core.builders.lodBuilding.LodBuilder.MIN_WORLD_HEIGHT;
@@ -74,7 +72,7 @@ public class CubicLodTemplate
playerZ,
adjData,
color,
DataPointUtil.getLightSkyAlt(data),
DataPointUtil.getLightSky(data),
DataPointUtil.getLightBlock(data),
adjShadeDisabled);
@@ -85,8 +85,8 @@ public class LodBufferBuilderFactory
}
public static class Pos {
public int x;
public int y;
public final int x;
public final int y;
public Pos(int xx, int yy) {
x = xx;
@@ -357,12 +357,10 @@ public class LodBufferBuilderFactory
if (!future.get())
{
ClientApi.LOGGER.error("LodBufferBuilder ran into trouble and had to start over.");
continue;
}
} catch (Exception e) {
ClientApi.LOGGER.error("LodBufferBuilder ran into trouble: ");
e.printStackTrace();
continue;
}
}
@@ -665,8 +663,6 @@ public class LodBufferBuilderFactory
GpuUploadMethod uploadMethod = glProxy.getGpuUploadMethod();
// determine the upload timeout
int MBPerMS = CONFIG.client().advanced().buffers().getGpuUploadPerMegabyteInMilliseconds();
long BPerNS = MBPerMS; // MB -> B = 1/1,000,000. MS -> NS = 1,000,000. So, MBPerMS = BPerNS.
long remainingNS = 0; // We don't want to pause for like 0.1 ms... so we store those tiny MS.
long bytesUploaded = 0;
@@ -695,7 +691,7 @@ public class LodBufferBuilderFactory
// upload buffers over an extended period of time
// to hopefully prevent stuttering.
remainingNS += uploadBuffer.capacity()*BPerNS;
remainingNS += uploadBuffer.capacity()* (long) CONFIG.client().advanced().buffers().getGpuUploadPerMegabyteInMilliseconds();
bytesUploaded += uploadBuffer.capacity();
if (remainingNS >= TimeUnit.NANOSECONDS.convert(1000/60, TimeUnit.MILLISECONDS)) {
if (remainingNS > MAX_BUFFER_UPLOAD_TIMEOUT_NANOSECONDS) remainingNS = MAX_BUFFER_UPLOAD_TIMEOUT_NANOSECONDS;
@@ -22,17 +22,13 @@ package com.seibel.lod.core.builders.lodBuilding;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.enums.config.HorizontalResolution;
import com.seibel.lod.core.objects.lod.LodDimension;
import com.seibel.lod.core.objects.lod.LodRegion;
import com.seibel.lod.core.objects.lod.LodWorld;
import com.seibel.lod.core.util.ColorUtil;
import com.seibel.lod.core.util.DataPointUtil;
import com.seibel.lod.core.util.DetailDistanceUtil;
import com.seibel.lod.core.util.LevelPosUtil;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
@@ -107,7 +107,6 @@ public enum DistanceGenerationMode
case BIOME_ONLY:
return DistanceGenerationMode.NONE;
case NONE:
return null;
default:
return null;
}
@@ -116,8 +115,6 @@ public enum DistanceGenerationMode
// Note: return null if out of range
public static DistanceGenerationMode next(DistanceGenerationMode mode) {
switch (mode) {
case FULL:
return null;
case FEATURES:
return DistanceGenerationMode.FULL;
case SURFACE:
@@ -128,6 +125,7 @@ public enum DistanceGenerationMode
return DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
case NONE:
return DistanceGenerationMode.BIOME_ONLY;
case FULL:
default:
return null;
}
@@ -60,7 +60,6 @@ public enum VerticalQuality
case MEDIUM:
return VerticalQuality.LOW;
case LOW:
return null;
default:
return null;
}
@@ -69,12 +68,11 @@ public enum VerticalQuality
// Note: return null if out of range
public static VerticalQuality next(VerticalQuality mode) {
switch (mode) {
case HIGH:
return null;
case MEDIUM:
return VerticalQuality.HIGH;
case LOW:
return VerticalQuality.MEDIUM;
case HIGH:
default:
return null;
}
@@ -57,7 +57,7 @@ import com.seibel.lod.core.util.LodUtil;
public class LodDimensionFileHandler
{
/** This is the dimension that owns this file handler */
private LodDimension lodDimension;
private final LodDimension lodDimension;
private final File dimensionDataSaveFolder;
@@ -88,10 +88,10 @@ public class LodDimensionFileHandler
* Allow saving asynchronously, but never try to save multiple regions
* at a time
*/
private AtomicBoolean isFileWritingThreadRunning = new AtomicBoolean(false);
private final AtomicBoolean isFileWritingThreadRunning = new AtomicBoolean(false);
private ExecutorService fileWritingThreadPool = Executors.newSingleThreadExecutor(new LodThreadFactory(this.getClass().getSimpleName()));
private ConcurrentHashMap<RegionPos, LodRegion> regionToSave = new ConcurrentHashMap<RegionPos, LodRegion>();
private final ConcurrentHashMap<RegionPos, LodRegion> regionToSave = new ConcurrentHashMap<RegionPos, LodRegion>();
public LodDimensionFileHandler(File newSaveFolder, LodDimension newLodDimension)
@@ -173,7 +173,6 @@ public class LodDimensionFileHandler
+ ". File has been deleted.");
// This should not break, but be continue to see whether other detail levels can be loaded or updated
region.addLevelContainer(new VerticalLevelContainer(tempDetailLevel));
continue;
}
else if (fileVersion > LOD_SAVE_FILE_VERSION)
{
@@ -187,7 +186,6 @@ public class LodDimensionFileHandler
+ " this region will not be written to in order to protect the newer file.");
// This should not break, but be continue to see whether other detail levels can be loaded or updated
region.addLevelContainer(new VerticalLevelContainer(tempDetailLevel));
continue;
}
else if (fileVersion < LOD_SAVE_FILE_VERSION)
{
@@ -3,22 +3,21 @@ package com.seibel.lod.core.objects;
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper;
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
import java.util.HashMap;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class BlockBiomeCouple
{
public static ConcurrentMap<IBlockColorWrapper, BlockBiomeCouple> noBiomeIstanceCache = new ConcurrentHashMap<>();
public static ConcurrentMap<IBiomeWrapper, ConcurrentMap<IBlockColorWrapper, BlockBiomeCouple>> withBiomeIstanceCache = new ConcurrentHashMap<>();
public static final ConcurrentMap<IBlockColorWrapper, BlockBiomeCouple> noBiomeIstanceCache = new ConcurrentHashMap<>();
public static final ConcurrentMap<IBiomeWrapper, ConcurrentMap<IBlockColorWrapper, BlockBiomeCouple>> withBiomeIstanceCache = new ConcurrentHashMap<>();
String blockName;
String biomeName;
String coupleName;
final String blockName;
final String biomeName;
final String coupleName;
IBiomeWrapper biomeColor;
IBlockColorWrapper blockColor;
final IBiomeWrapper biomeColor;
final IBlockColorWrapper blockColor;
public static void addBlockBiomeToCache(IBlockColorWrapper blockColor){
}
@@ -30,7 +30,6 @@ import com.seibel.lod.core.util.ColorUtil;
import com.seibel.lod.core.util.DataPointUtil;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
@@ -329,7 +328,7 @@ public class VertexOptimizer
singleAdjDataPoint = adjData.get(LodDirection.DOWN)[0];
skipBot = DataPointUtil.doesItExist(singleAdjDataPoint) && DataPointUtil.getHeight(singleAdjDataPoint) == minY;// && DataPointUtil.getAlpha(singleAdjDataPoint) == 255;
if(DataPointUtil.doesItExist(singleAdjDataPoint))
skyLights.get(LodDirection.DOWN)[0] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint);
skyLights.get(LodDirection.DOWN)[0] = DataPointUtil.getLightSky(singleAdjDataPoint);
else
skyLights.get(LodDirection.DOWN)[0] = skyLights.get(LodDirection.UP)[0];
//other sided
@@ -379,12 +378,12 @@ public class VertexOptimizer
{
adjHeight.get(lodDirection)[0] = getMaxY();
adjDepth.get(lodDirection)[0] = getMinY();
skyLights.get(lodDirection)[0] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint); //skyLights.get(Direction.UP)[0];
skyLights.get(lodDirection)[0] = DataPointUtil.getLightSky(singleAdjDataPoint); //skyLights.get(Direction.UP)[0];
}
else
{
adjDepth.get(lodDirection)[faceToDraw] = getMinY();
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint);
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSky(singleAdjDataPoint);
}
faceToDraw++;
toFinish = false;
@@ -410,12 +409,12 @@ public class VertexOptimizer
{
adjHeight.get(lodDirection)[0] = getMaxY();
adjDepth.get(lodDirection)[0] = height;
skyLights.get(lodDirection)[0] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint); //skyLights.get(Direction.UP)[0];
skyLights.get(lodDirection)[0] = DataPointUtil.getLightSky(singleAdjDataPoint); //skyLights.get(Direction.UP)[0];
}
else
{
adjDepth.get(lodDirection)[faceToDraw] = height;
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint);
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSky(singleAdjDataPoint);
}
toFinish = false;
faceToDraw++;
@@ -443,7 +442,7 @@ public class VertexOptimizer
}
adjDepth.get(lodDirection)[faceToDraw] = height;
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint);
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSky(singleAdjDataPoint);
faceToDraw++;
adjHeight.get(lodDirection)[faceToDraw] = depth;
firstFace = false;
@@ -467,7 +466,7 @@ public class VertexOptimizer
{
singleAdjDataPoint = dataPoint[toFinishIndex];
if (DataPointUtil.doesItExist(singleAdjDataPoint))
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSkyAlt(singleAdjDataPoint);
skyLights.get(lodDirection)[faceToDraw] = DataPointUtil.getLightSky(singleAdjDataPoint);
else
skyLights.get(lodDirection)[faceToDraw] = skyLights.get(LodDirection.UP)[0];
}
@@ -21,7 +21,6 @@ package com.seibel.lod.core.objects.lod;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
/**
* A level container is a quad tree level
@@ -22,7 +22,6 @@ package com.seibel.lod.core.objects.lod;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -40,7 +39,6 @@ import com.seibel.lod.core.util.LevelPosUtil;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.IWrapperFactory;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
import com.seibel.lod.core.wrapperInterfaces.world.IDimensionTypeWrapper;
@@ -159,10 +157,8 @@ public class LodDimension
}
}
Arrays.sort(list, (a, b) -> {
RegionPos posA = (RegionPos)a;
RegionPos posB = (RegionPos)b;
double disSqrA = posA.x*posA.x+posA.z*posA.z;
double disSqrB = posB.x*posB.x+posB.z*posB.z;
double disSqrA = a.x* a.x+ a.z* a.z;
double disSqrB = b.x* b.x+ b.z* b.z;
return Double.compare(disSqrA, disSqrB);
});
iteratorList = list;
@@ -22,13 +22,9 @@ package com.seibel.lod.core.objects.lod;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.LongBuffer;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.dataFormat.*;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
import com.seibel.lod.core.util.*;
@@ -102,8 +98,8 @@ public class VerticalLevelContainer implements LevelContainer
} else {
if (compare<=0) return false;
}
for (int verticalIndex = 0; verticalIndex < verticalSize; verticalIndex++)
dataContainer[index + verticalIndex] = data[verticalIndex];
if (verticalSize >= 0)
System.arraycopy(data, 0, dataContainer, index, verticalSize);
return true;
}
@@ -421,12 +417,14 @@ public class VerticalLevelContainer implements LevelContainer
//STEP 1//
//We initially reset this position of the data container
positionDataContainer[posX * size + posZ] = PositionDataFormat.EMPTY_DATA;
final int k = posX * size + posZ;
positionDataContainer[k] = PositionDataFormat.EMPTY_DATA;
for (int verticalIndex = 0; verticalIndex < verticalSize; verticalIndex++)
{
verticalDataContainer[posX * size * verticalSize + posZ * verticalSize + verticalIndex] = VerticalDataFormat.EMPTY_LOD;
lightDataContainer[posX * size * verticalSize + posZ * verticalSize + verticalIndex] = 0;
colorDataContainer[posX * size * verticalSize + posZ * verticalSize + verticalIndex] = 0;
final int j = k * verticalSize + verticalIndex;
verticalDataContainer[j] = VerticalDataFormat.EMPTY_LOD;
lightDataContainer[j] = 0;
colorDataContainer[j] = 0;
}
@@ -760,12 +758,14 @@ public class VerticalLevelContainer implements LevelContainer
//SPLITTED VERSION OF THE MERGE AND ADD
private void resetPosition(int posX, int posZ)
{
positionDataContainer[posX * size + posZ] = PositionDataFormat.EMPTY_DATA;
final int i = posX * size + posZ;
positionDataContainer[i] = PositionDataFormat.EMPTY_DATA;
for (int verticalIndex = 0; verticalIndex < verticalSize; verticalIndex++)
{
verticalDataContainer[posX * size * verticalSize + posZ * verticalSize + verticalIndex] = VerticalDataFormat.EMPTY_LOD;
lightDataContainer[posX * size * verticalSize + posZ * verticalSize + verticalIndex] = 0;
colorDataContainer[posX * size * verticalSize + posZ * verticalSize + verticalIndex] = 0;
final int j = i * verticalSize + verticalIndex;
verticalDataContainer[j] = VerticalDataFormat.EMPTY_LOD;
lightDataContainer[j] = 0;
colorDataContainer[j] = 0;
}
}
@@ -21,7 +21,6 @@ package com.seibel.lod.core.objects.opengl;
import org.lwjgl.opengl.GL32;
import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.rendering.GLProxyContext;
import com.seibel.lod.core.render.GLProxy;
@@ -40,7 +40,6 @@ import com.seibel.lod.core.api.ClientApi;
import com.seibel.lod.core.enums.config.GpuUploadMethod;
import com.seibel.lod.core.enums.rendering.DebugMode;
import com.seibel.lod.core.enums.rendering.GLProxyContext;
import com.seibel.lod.core.util.LodThreadFactory;
import com.seibel.lod.core.util.SingletonHandler;
import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
@@ -105,54 +104,49 @@ public class GLProxy
private String getFailedVersionInfo(GLCapabilities c) {
StringBuilder str = new StringBuilder("Your supported OpenGL version:\n");
str.append("1.1: "+c.OpenGL11+"\n");
str.append("1.2: "+c.OpenGL12+"\n");
str.append("1.3: "+c.OpenGL13+"\n");
str.append("1.4: "+c.OpenGL14+"\n");
str.append("1.5: "+c.OpenGL15+"\n");
str.append("2.0: "+c.OpenGL20+"\n");
str.append("2.1: "+c.OpenGL21+"\n");
str.append("3.0: "+c.OpenGL30+"\n");
str.append("3.1: "+c.OpenGL31+"\n");
str.append("3.2: "+c.OpenGL32+" <- REQUIRED\n");
str.append("3.3: "+c.OpenGL33+"\n");
str.append("4.0: "+c.OpenGL40+"\n");
str.append("4.1: "+c.OpenGL41+"\n");
str.append("4.2: "+c.OpenGL42+"\n");
str.append("4.3: "+c.OpenGL43+" <- optional improvement\n");
str.append("4.4: "+c.OpenGL44+" <- optional improvement\n");
str.append("4.5: "+c.OpenGL45+"\n");
str.append("4.6: "+c.OpenGL46+"\n");
str.append("If you noticed that your computer supports higher OpenGL versions"
return "Your supported OpenGL version:\n" + "1.1: " + c.OpenGL11 + "\n" +
"1.2: " + c.OpenGL12 + "\n" +
"1.3: " + c.OpenGL13 + "\n" +
"1.4: " + c.OpenGL14 + "\n" +
"1.5: " + c.OpenGL15 + "\n" +
"2.0: " + c.OpenGL20 + "\n" +
"2.1: " + c.OpenGL21 + "\n" +
"3.0: " + c.OpenGL30 + "\n" +
"3.1: " + c.OpenGL31 + "\n" +
"3.2: " + c.OpenGL32 + " <- REQUIRED\n" +
"3.3: " + c.OpenGL33 + "\n" +
"4.0: " + c.OpenGL40 + "\n" +
"4.1: " + c.OpenGL41 + "\n" +
"4.2: " + c.OpenGL42 + "\n" +
"4.3: " + c.OpenGL43 + " <- optional improvement\n" +
"4.4: " + c.OpenGL44 + " <- optional improvement\n" +
"4.5: " + c.OpenGL45 + "\n" +
"4.6: " + c.OpenGL46 + "\n" +
"If you noticed that your computer supports higher OpenGL versions"
+ " but not the required version, try running the game in compatibility mode."
+ " (How you turn that on, I have no clue~)");
return str.toString();
+ " (How you turn that on, I have no clue~)";
}
private String getVersionInfo(GLCapabilities c) {
StringBuilder str = new StringBuilder("Your supported OpenGL version:\n");
str.append("1.1: "+c.OpenGL11+"\n");
str.append("1.2: "+c.OpenGL12+"\n");
str.append("1.3: "+c.OpenGL13+"\n");
str.append("1.4: "+c.OpenGL14+"\n");
str.append("1.5: "+c.OpenGL15+"\n");
str.append("2.0: "+c.OpenGL20+"\n");
str.append("2.1: "+c.OpenGL21+"\n");
str.append("3.0: "+c.OpenGL30+"\n");
str.append("3.1: "+c.OpenGL31+"\n");
str.append("3.2: "+c.OpenGL32+" <- REQUIRED\n");
str.append("3.3: "+c.OpenGL33+"\n");
str.append("4.0: "+c.OpenGL40+"\n");
str.append("4.1: "+c.OpenGL41+"\n");
str.append("4.2: "+c.OpenGL42+"\n");
str.append("4.3: "+c.OpenGL43+" <- optional improvement\n");
str.append("4.4: "+c.OpenGL44+" <- optional improvement\n");
str.append("4.5: "+c.OpenGL45+"\n");
str.append("4.6: "+c.OpenGL46+"\n");
return str.toString();
return "Your supported OpenGL version:\n" + "1.1: " + c.OpenGL11 + "\n" +
"1.2: " + c.OpenGL12 + "\n" +
"1.3: " + c.OpenGL13 + "\n" +
"1.4: " + c.OpenGL14 + "\n" +
"1.5: " + c.OpenGL15 + "\n" +
"2.0: " + c.OpenGL20 + "\n" +
"2.1: " + c.OpenGL21 + "\n" +
"3.0: " + c.OpenGL30 + "\n" +
"3.1: " + c.OpenGL31 + "\n" +
"3.2: " + c.OpenGL32 + " <- REQUIRED\n" +
"3.3: " + c.OpenGL33 + "\n" +
"4.0: " + c.OpenGL40 + "\n" +
"4.1: " + c.OpenGL41 + "\n" +
"4.2: " + c.OpenGL42 + "\n" +
"4.3: " + c.OpenGL43 + " <- optional improvement\n" +
"4.4: " + c.OpenGL44 + " <- optional improvement\n" +
"4.5: " + c.OpenGL45 + "\n" +
"4.6: " + c.OpenGL46 + "\n";
}
@@ -34,7 +34,7 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
public class LodFogConfig
{
public FogDrawMode fogDrawMode;
public FogDistance fogDistance;
public final FogDistance fogDistance;
public float nearFogStart = 0;
public float nearFogEnd = 0;
@@ -39,7 +39,6 @@ import com.seibel.lod.core.objects.math.Vec3f;
import com.seibel.lod.core.objects.opengl.LodVertexBuffer;
import com.seibel.lod.core.render.objects.LightmapTexture;
import com.seibel.lod.core.util.DetailDistanceUtil;
import com.seibel.lod.core.util.GridList;
import com.seibel.lod.core.util.LodUtil;
import com.seibel.lod.core.util.MovableGridList;
import com.seibel.lod.core.util.SingletonHandler;
@@ -405,10 +404,8 @@ public class LodRenderer
// accuracy vs the model view matrix, which only uses floats)
//int bufferPosX = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterX, LodUtil.BLOCK_DETAIL_LEVEL);
//int bufferPosZ = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterZ, LodUtil.BLOCK_DETAIL_LEVEL);
int bufferPosX = vbosCenterX;
int bufferPosZ = vbosCenterZ;
double xDiff = projectedView.x - bufferPosX;
double zDiff = projectedView.z - bufferPosZ;
double xDiff = projectedView.x - vbosCenterX;
double zDiff = projectedView.z - vbosCenterZ;
mcModelViewMatrix.multiplyTranslationMatrix(-xDiff, -projectedView.y, -zDiff);
return mcModelViewMatrix;
@@ -422,10 +419,8 @@ public class LodRenderer
{
//int worldCenterX = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterX, LodUtil.BLOCK_DETAIL_LEVEL);
//int worldCenterZ = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterZ, LodUtil.BLOCK_DETAIL_LEVEL);
int worldCenterX = vbosCenterX;
int worldCenterZ = vbosCenterZ;
Vec3d cameraPos = MC_RENDER.getCameraExactPosition();
return new Vec3f((float)cameraPos.x - worldCenterX, (float)cameraPos.y, (float)cameraPos.z - worldCenterZ);
return new Vec3f((float)cameraPos.x - vbosCenterX, (float)cameraPos.y, (float)cameraPos.z - vbosCenterZ);
}
/**
@@ -48,14 +48,16 @@ public final class VertexAttributePreGL43 extends VertexAttribute {
public void bindBufferToBindingPoint(int buffer, int bindingPoint) {
int[] toBind = bindingPointsToIndex[bindingPoint];
for (int i=0; i<toBind.length; i++)
GL32.glEnableVertexAttribArray(toBind[i]);
for (int j : toBind)
GL32.glEnableVertexAttribArray(j);
for (int i=0; i< toBind.length; i++) {
VertexPointer pointer = pointers[toBind[i]];
if (pointer==null) continue;
GL32.glVertexAttribPointer(toBind[i], pointer.elementCount, pointer.glType,
pointer.normalized, strideSize, pointersOffset[toBind[i]]);
for (int j : toBind)
{
VertexPointer pointer = pointers[j];
if (pointer == null)
continue;
GL32.glVertexAttribPointer(j, pointer.elementCount, pointer.glType,
pointer.normalized, strideSize, pointersOffset[j]);
}
}
@@ -71,8 +73,8 @@ public final class VertexAttributePreGL43 extends VertexAttribute {
public void unbindBuffersFromBindingPoint(int bindingPoint) {
int[] toBind = bindingPointsToIndex[bindingPoint];
for (int i=0; i<toBind.length; i++)
GL32.glDisableVertexAttribArray(toBind[i]);
for (int j : toBind)
GL32.glDisableVertexAttribArray(j);
}
@Override
@@ -71,15 +71,15 @@ public class BooleanMovableGridList {
return _swapDirect(x,y, t);
}
private final boolean _getDirect(int x, int y) {
private boolean _getDirect(int x, int y) {
assertIndex(x,y);
return b[x + y * gridSize];
}
private final void _setDirect(int x, int y, boolean t) {
private void _setDirect(int x, int y, boolean t) {
assertIndex(x,y);
b[x + y * gridSize] = t;
}
private final boolean _swapDirect(int x, int y, boolean t) {
private boolean _swapDirect(int x, int y, boolean t) {
assertIndex(x,y);
boolean r = b[x + y * gridSize];
b[x + y * gridSize] = t;
@@ -107,44 +107,41 @@ public class BooleanMovableGridList {
}
public void flipBorder(boolean valueToBeFlipped) {
boolean t = valueToBeFlipped;
BoolTransformer tran = (v, x, y) -> {
if (v!=t) return v;
if (v!= valueToBeFlipped) return v;
boolean r = false;
r |= (isInBound(x-1,y) ? get(x-1,y)==!t : false);
r |= (isInBound(x,y-1) ? get(x,y-1)==!t : false);
r |= (isInBound(x+1,y) ? get(x+1,y)==!t : false);
r |= (isInBound(x,y+1) ? get(x,y+1)==!t : false);
return r ? !t : t;
r |= (isInBound(x - 1, y) && get(x - 1, y) == !valueToBeFlipped);
r |= (isInBound(x, y - 1) && get(x, y - 1) == !valueToBeFlipped);
r |= (isInBound(x + 1, y) && get(x + 1, y) == !valueToBeFlipped);
r |= (isInBound(x, y + 1) && get(x, y + 1) == !valueToBeFlipped);
return r != valueToBeFlipped;
};
twoStageTransform(tran);
}
public void flipBorderCorner(boolean valueToBeFlipped) {
boolean t = valueToBeFlipped;
BoolTransformer tran = (v, x, y) -> {
if (v!=t) return v;
if (v!= valueToBeFlipped) return v;
boolean r = false;
r |= (isInBound(x-1,y) ? get(x-1,y)==!t : false);
r |= (isInBound(x,y-1) ? get(x,y-1)==!t : false);
r |= (isInBound(x+1,y) ? get(x+1,y)==!t : false);
r |= (isInBound(x,y+1) ? get(x,y+1)==!t : false);
r |= (isInBound(x-1,y-1) ? get(x-1,y-1)==!t : false);
r |= (isInBound(x+1,y-1) ? get(x+1,y-1)==!t : false);
r |= (isInBound(x+1,y+1) ? get(x+1,y+1)==!t : false);
r |= (isInBound(x-1,y+1) ? get(x-1,y+1)==!t : false);
return r ? !t : t;
r |= (isInBound(x - 1, y) && get(x - 1, y) == !valueToBeFlipped);
r |= (isInBound(x, y - 1) && get(x, y - 1) == !valueToBeFlipped);
r |= (isInBound(x + 1, y) && get(x + 1, y) == !valueToBeFlipped);
r |= (isInBound(x, y + 1) && get(x, y + 1) == !valueToBeFlipped);
r |= (isInBound(x - 1, y - 1) && get(x - 1, y - 1) == !valueToBeFlipped);
r |= (isInBound(x + 1, y - 1) && get(x + 1, y - 1) == !valueToBeFlipped);
r |= (isInBound(x + 1, y + 1) && get(x + 1, y + 1) == !valueToBeFlipped);
r |= (isInBound(x - 1, y + 1) && get(x - 1, y + 1) == !valueToBeFlipped);
return r != valueToBeFlipped;
};
twoStageTransform(tran);
}
public void flipBorderCorner(boolean valueToBeFlipped, int range) {
boolean t = valueToBeFlipped;
BoolTransformer tran = (v, x, y) -> {
if (v!=t) return v;
if (v!= valueToBeFlipped) return v;
boolean r = false;
for (int dx=-range;dx<=range;dx++)
for (int dy=-range;dy<=range;dy++)
r |= (isInBound(x+dx,y+dy) ? get(x+dx,y+dy)==!t : false);
return r ? !t : t;
r |= (isInBound(x + dx, y + dy) && get(x + dx, y + dy) == !valueToBeFlipped);
return r != valueToBeFlipped;
};
twoStageTransform(tran);
}
@@ -232,16 +229,17 @@ public class BooleanMovableGridList {
public String toDetailString() {
StringBuilder str = new StringBuilder("\n");
int i = 0;
str.append(toString());
str.append(this);
str.append("\n");
for (boolean t : b) {
str.append(t ? "#" : ".");
i++;
if (i % gridSize == 0) {
str.append("\n");
} else {
//str.append(", ");
}
//else {
// str.append(", ");
//}
}
return str.toString();
}
@@ -19,8 +19,6 @@
package com.seibel.lod.core.util;
import static com.seibel.lod.core.builders.bufferBuilding.LodBufferBuilderFactory.skyLightPlayer;
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
@@ -145,8 +143,8 @@ public class DataPointUtil
}
public static long shiftHeightAndDepth(long dataPoint, short offset) {
long height = (dataPoint + (offset << HEIGHT_SHIFT)) & HEIGHT_SHIFTED_MASK;
long depth = (dataPoint + (offset << DEPTH_SHIFT)) & DEPTH_SHIFTED_MASK;
long height = (dataPoint + ((long) offset << HEIGHT_SHIFT)) & HEIGHT_SHIFTED_MASK;
long depth = (dataPoint + ((long) offset << DEPTH_SHIFT)) & DEPTH_SHIFTED_MASK;
return dataPoint & ~(HEIGHT_SHIFTED_MASK | DEPTH_SHIFTED_MASK) | height | depth;
}
@@ -278,8 +276,8 @@ public class DataPointUtil
if (dataB!=0) dataB = Integer.MAX_VALUE;
return (int)(dataA-dataB);
}
int genA = (int)getGenerationMode(dataA);
int genB = (int)getGenerationMode(dataB);
int genA = getGenerationMode(dataA);
int genB = getGenerationMode(dataB);
return genA-genB;
}
@@ -6,8 +6,8 @@ import java.util.List;
public class GridList<T> extends ArrayList<T> implements List<T> {
public static class Pos {
public int x;
public int y;
public final int x;
public final int y;
public Pos(int xx, int yy) {
x = xx;
@@ -15,8 +15,8 @@ public class MovableGridList<T> extends ArrayList<T> implements List<T> {
private static final long serialVersionUID = 5366261085254591277L;
public static class Pos {
public int x;
public int y;
public final int x;
public final int y;
public Pos(int xx, int yy) {
x = xx;
@@ -94,16 +94,16 @@ public class MovableGridList<T> extends ArrayList<T> implements List<T> {
return (x>=0 && x<gridSize && y>=0 && y<gridSize);
}
private final T _getDirect(int x, int y) {
private T _getDirect(int x, int y) {
if (x<0 || x>=gridSize || y<0 || y>=gridSize) return null;
return super.get(x + y * gridSize);
}
private final boolean _setDirect(int x, int y, T t) {
private boolean _setDirect(int x, int y, T t) {
if (x<0 || x>=gridSize || y<0 || y>=gridSize) return false;
super.set(x + y * gridSize, t);
return true;
}
private final T _swapDirect(int x, int y, T t) {
private T _swapDirect(int x, int y, T t) {
if (x<0 || x>=gridSize || y<0 || y>=gridSize) return null;
return super.set(x + y * gridSize, t);
}
@@ -266,7 +266,7 @@ public class MovableGridList<T> extends ArrayList<T> implements List<T> {
public String toDetailString() {
StringBuilder str = new StringBuilder("\n");
int i = 0;
str.append(toString());
str.append(this);
str.append("\n");
for (T t : this) {
@@ -48,7 +48,7 @@ public interface IWrapperFactory
AbstractWorldGeneratorWrapper createWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper);
// Return null to signal that there is no AbstractWorldGenerator
public default AbstractExperimentalWorldGeneratorWrapper createExperimentalWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
default AbstractExperimentalWorldGeneratorWrapper createExperimentalWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
return null;
}
}
@@ -19,7 +19,6 @@
package com.seibel.lod.core.wrapperInterfaces.chunk;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.block.IBlockColorWrapper;
import com.seibel.lod.core.wrapperInterfaces.block.IBlockShapeWrapper;
import com.seibel.lod.core.wrapperInterfaces.world.IBiomeWrapper;
@@ -345,7 +345,7 @@ public interface ILodConfigWrapperSingleton
void setGenerationPriority(GenerationPriority newGenerationPriority);
DistanceGenerationMode DISTANCE_GENERATION_MODE_DEFAULT = DistanceGenerationMode.SURFACE;
public static String getDistanceGenerationModeDesc(IVersionConstants versionConstants)
static String getDistanceGenerationModeDesc(IVersionConstants versionConstants)
{
return ""
+ " How detailed should fake chunks be generated outside the vanilla render distance? \n"
@@ -437,7 +437,7 @@ public interface ILodConfigWrapperSingleton
static String multiOrSingleThreadText(IVersionConstants versionConstants, DistanceGenerationMode distanceGenerationMode)
{
return versionConstants.isWorldGeneratorSingleThreaded(distanceGenerationMode) ? "Singlethreaded" : "Multithreaded";
};
}
}
@@ -55,9 +55,9 @@ public interface IMinecraftRenderWrapper
Color getFogColor(float partialTicks);
public default Color getUnderWaterFogColor(float partialTicks) {return getFogColor(partialTicks);}
default Color getUnderWaterFogColor(float partialTicks) {return getFogColor(partialTicks);}
public default boolean isFogStateInUnderWater() {
default boolean isFogStateInUnderWater() {
return false;
}
@@ -77,7 +77,7 @@ public interface IMinecraftRenderWrapper
* <br>
* If not implemented this calls {@link #getMaximumRenderedChunks()}.
*/
public default HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
default HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
{
ISodiumAccessor sodium = ModAccessorApi.get(ISodiumAccessor.class);
return sodium==null ? getMaximumRenderedChunks() : sodium.getNormalRenderedChunks();
@@ -87,7 +87,7 @@ public interface IMinecraftRenderWrapper
* <strong>Doesn't need to be implemented.</strong> <br>
* Returns every chunk position within the vanilla render distance.
*/
public default HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
default HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
{
IMinecraftWrapper mcWrapper = SingletonHandler.get(IMinecraftWrapper.class);
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
@@ -119,9 +119,9 @@ public interface IMinecraftRenderWrapper
/** @returns -1 if there was an issue getting the lightmap */
int getLightmapTextureWidth();
/** @returns -1 if there was an issue getting the lightmap */
public int getLightmapGLFormat();
int getLightmapGLFormat();
// Try and disable vanilla fog. Return true if successful, or false if not able to.
public boolean tryDisableVanillaFog();
boolean tryDisableVanillaFog();
}
@@ -1,5 +1,5 @@
package com.seibel.lod.core.wrapperInterfaces.modAccessor;
public abstract interface IModAccessor {
public interface IModAccessor {
String getModName();
}
@@ -22,7 +22,6 @@ package com.seibel.lod.core.wrapperInterfaces.world;
import java.io.File;
import com.seibel.lod.core.enums.WorldType;
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.chunk.AbstractChunkPosWrapper;
import com.seibel.lod.core.wrapperInterfaces.chunk.IChunkWrapper;