Compare commits
19 Commits
2.2.0a
...
1.6.4a_dev
| Author | SHA1 | Date | |
|---|---|---|---|
| c8b8817909 | |||
| 8a70545439 | |||
| d8e5cbda0a | |||
| 6f4b0a54e9 | |||
| 61ea29a6fd | |||
| 7d6c4fa1f9 | |||
| 108b4c7470 | |||
| 63fff244eb | |||
| 5e86aa1275 | |||
| db72d1cdc2 | |||
| 5e99efe093 | |||
| 9557912101 | |||
| ca2b09c2c8 | |||
| e1b2c62854 | |||
| c3bb079b42 | |||
| 9670cbbb74 | |||
| 3ca0757358 | |||
| 4f2076b48e | |||
| e91bcb7964 |
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
package com.seibel.lod.core;
|
package com.seibel.lod.core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This file is similar to mcmod.info
|
* This file is similar to mcmod.info
|
||||||
* <br>
|
* <br>
|
||||||
@@ -41,5 +40,5 @@ public final class ModInfo
|
|||||||
/** Human readable version of NAME */
|
/** Human readable version of NAME */
|
||||||
public static final String READABLE_NAME = "Distant Horizons";
|
public static final String READABLE_NAME = "Distant Horizons";
|
||||||
public static final String API = "LodAPI";
|
public static final String API = "LodAPI";
|
||||||
public static final String VERSION = "1.6.3a";
|
public static final String VERSION = "1.6.7a-dev";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,12 @@ import java.lang.annotation.Target;
|
|||||||
* Where the annotations for the config are defined
|
* Where the annotations for the config are defined
|
||||||
* If there is no annotation then the config will not touch it
|
* If there is no annotation then the config will not touch it
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* REMOVED IN a1.7
|
||||||
|
*
|
||||||
|
* @author coolGi
|
||||||
* @version 02-07-2022
|
* @version 02-07-2022
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class ConfigAnnotations {
|
public class ConfigAnnotations {
|
||||||
/** A textField, button, etc. that can be interacted with */
|
/** A textField, button, etc. that can be interacted with */
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public enum VerticalQuality
|
|||||||
),
|
),
|
||||||
|
|
||||||
ULTRA(
|
ULTRA(
|
||||||
new int[] { 16, 8, 4, 2, 2, 2, 2, 1, 1, 1, 1 },
|
new int[] { 16, 16, 8, 8, 4, 4, 4, 1, 1, 1, 1 },
|
||||||
12
|
12
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -532,7 +533,7 @@ public class LodDimensionFinder
|
|||||||
newDimension.mkdirs();
|
newDimension.mkdirs();
|
||||||
|
|
||||||
File oldDataNewPath = new File(newDimension.getPath() + File.separatorChar + folder.getName());
|
File oldDataNewPath = new File(newDimension.getPath() + File.separatorChar + folder.getName());
|
||||||
Files.move(folder.toPath(), oldDataNewPath.toPath());
|
Files.move(folder.toPath(), oldDataNewPath.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -107,11 +107,17 @@ public class PlayerData
|
|||||||
/** Writes everything from this object to the file given. */
|
/** Writes everything from this object to the file given. */
|
||||||
public void toTomlFile(CommentedFileConfig toml)
|
public void toTomlFile(CommentedFileConfig toml)
|
||||||
{
|
{
|
||||||
|
if (playerBlockPos == null)
|
||||||
|
{
|
||||||
|
toml.remove(PLAYER_BLOCK_POS_X_PATH);
|
||||||
|
toml.remove(PLAYER_BLOCK_POS_Y_PATH);
|
||||||
|
toml.remove(PLAYER_BLOCK_POS_Z_PATH);
|
||||||
|
} else {
|
||||||
// player block pos
|
// player block pos
|
||||||
toml.add(PLAYER_BLOCK_POS_X_PATH, playerBlockPos.getX());
|
toml.add(PLAYER_BLOCK_POS_X_PATH, playerBlockPos.getX());
|
||||||
toml.add(PLAYER_BLOCK_POS_Y_PATH, playerBlockPos.getY());
|
toml.add(PLAYER_BLOCK_POS_Y_PATH, playerBlockPos.getY());
|
||||||
toml.add(PLAYER_BLOCK_POS_Z_PATH, playerBlockPos.getZ());
|
toml.add(PLAYER_BLOCK_POS_Z_PATH, playerBlockPos.getZ());
|
||||||
|
}
|
||||||
toml.save();
|
toml.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,13 +38,20 @@ public class LodBox
|
|||||||
short maxY = (short) (y + ySize);
|
short maxY = (short) (y + ySize);
|
||||||
short maxZ = (short) (z + zSize);
|
short maxZ = (short) (z + zSize);
|
||||||
byte skyLightTop = skyLight;
|
byte skyLightTop = skyLight;
|
||||||
|
boolean isTransparent = ColorUtil.getAlpha(color)<255;
|
||||||
|
boolean isTopTransparent = DataPointUtil.isTransparent(topData);
|
||||||
|
boolean isBotTransparent = DataPointUtil.isTransparent(botData);
|
||||||
byte skyLightBot = DataPointUtil.doesItExist(botData) ? DataPointUtil.getLightSky(botData) : 0;
|
byte skyLightBot = DataPointUtil.doesItExist(botData) ? DataPointUtil.getLightSky(botData) : 0;
|
||||||
|
|
||||||
// Up direction case
|
// Up direction case
|
||||||
boolean skipTop = DataPointUtil.doesItExist(topData) && DataPointUtil.getDepth(topData) == maxY;// &&
|
boolean skipTop = DataPointUtil.doesItExist(topData) && (
|
||||||
|
(isTransparent && (DataPointUtil.getDepth(topData) == maxY)) ||
|
||||||
|
(!isTransparent && (DataPointUtil.getDepth(topData) == maxY) && !isTopTransparent));
|
||||||
|
boolean skipBot = DataPointUtil.doesItExist(botData) && (
|
||||||
|
(isTransparent && (DataPointUtil.getDepth(botData) == maxY)) ||
|
||||||
|
(!isTransparent && (DataPointUtil.getDepth(botData) == maxY) && !isBotTransparent));
|
||||||
// DataPointUtil.getAlpha(singleAdjDataPoint)
|
// DataPointUtil.getAlpha(singleAdjDataPoint)
|
||||||
// == 255;
|
// == 255;
|
||||||
boolean skipBot = DataPointUtil.doesItExist(botData) && DataPointUtil.getHeight(botData) == y;// &&
|
//boolean skipBot = DataPointUtil.doesItExist(botData) && DataPointUtil.getHeight(botData) == y;// &&
|
||||||
// DataPointUtil.getAlpha(singleAdjDataPoint)
|
// DataPointUtil.getAlpha(singleAdjDataPoint)
|
||||||
// == 255;
|
// == 255;
|
||||||
|
|
||||||
@@ -148,6 +155,8 @@ public class LodBox
|
|||||||
private static void makeAdjQuads(LodQuadBuilder builder, long[] adjData, LodDirection direction, short x, short y,
|
private static void makeAdjQuads(LodQuadBuilder builder, long[] adjData, LodDirection direction, short x, short y,
|
||||||
short z, short w0, short wy, int color, int overlapColor, byte upSkyLight, byte blockLight)
|
short z, short w0, short wy, int color, int overlapColor, byte upSkyLight, byte blockLight)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
boolean isTransparent = ColorUtil.getAlpha(color)<255;
|
||||||
color = ColorUtil.applyShade(color, MC.getShade(direction));
|
color = ColorUtil.applyShade(color, MC.getShade(direction));
|
||||||
long[] dataPoint = adjData;
|
long[] dataPoint = adjData;
|
||||||
if (dataPoint == null || DataPointUtil.isVoid(dataPoint[0]))
|
if (dataPoint == null || DataPointUtil.isVoid(dataPoint[0]))
|
||||||
@@ -164,14 +173,13 @@ public class LodBox
|
|||||||
|
|
||||||
// TODO transparency ocean floor fix
|
// TODO transparency ocean floor fix
|
||||||
// boolean isOpaque = ((colorMap[0] >> 24) & 0xFF) == 255;
|
// boolean isOpaque = ((colorMap[0] >> 24) & 0xFF) == 255;
|
||||||
for (i = 0; i < dataPoint.length && DataPointUtil.doesItExist(adjData[i])
|
for (i = 0; i < dataPoint.length && DataPointUtil.doesItExist(adjData[i]) && !DataPointUtil.isVoid(adjData[i]); i++)
|
||||||
&& !DataPointUtil.isVoid(adjData[i]); i++)
|
|
||||||
{
|
{
|
||||||
long adjPoint = adjData[i];
|
long adjPoint = adjData[i];
|
||||||
|
boolean isAdjTransparent = DataPointUtil.isTransparent(adjPoint);
|
||||||
// TODO transparency ocean floor fix
|
// TODO transparency ocean floor fix
|
||||||
// if (isOpaque && DataPointUtil.getAlpha(singleAdjDataPoint) != 255)
|
if (!isTransparent && isAdjTransparent)
|
||||||
// continue;
|
continue;
|
||||||
|
|
||||||
short height = DataPointUtil.getHeight(adjPoint);
|
short height = DataPointUtil.getHeight(adjPoint);
|
||||||
short depth = DataPointUtil.getDepth(adjPoint);
|
short depth = DataPointUtil.getDepth(adjPoint);
|
||||||
|
|||||||
@@ -175,6 +175,15 @@ public class RenderRegion implements AutoCloseable
|
|||||||
for (LodDirection dir : LodDirection.ADJ_DIRECTIONS) {
|
for (LodDirection dir : LodDirection.ADJ_DIRECTIONS) {
|
||||||
adjRegions[dir.ordinal() - 2] = lodDim.getRegion(regionPos.x+dir.getNormal().x, regionPos.z+dir.getNormal().z);
|
adjRegions[dir.ordinal() - 2] = lodDim.getRegion(regionPos.x+dir.getNormal().x, regionPos.z+dir.getNormal().z);
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException | ArrayIndexOutOfBoundsException e) { // HOTFIX: Error ignoring for a concurrency caused issue
|
||||||
|
setNeedRegen();
|
||||||
|
if (!backState.compareAndSet(BackState.Building, BackState.Unused)) {
|
||||||
|
EVENT_LOGGER.error("\"Lod Builder Starter\""
|
||||||
|
+ " encountered error on catching exceptions and fallback on starting build task: ",
|
||||||
|
new ConcurrentModificationException("RenderRegion Illegal State"));
|
||||||
|
}
|
||||||
|
EVENT_LOGGER.info("\"Lod Builder Starter\" failed due to possible known concurrency issue: ", e);
|
||||||
|
return CompletableFuture.completedFuture(null);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
setNeedRegen();
|
setNeedRegen();
|
||||||
if (!backState.compareAndSet(BackState.Building, BackState.Unused)) {
|
if (!backState.compareAndSet(BackState.Building, BackState.Unused)) {
|
||||||
@@ -200,6 +209,9 @@ public class RenderRegion implements AutoCloseable
|
|||||||
buildRun.run();
|
buildRun.run();
|
||||||
EVENT_LOGGER.trace("RenderRegion end QuadBuild @ {}", regionPos);
|
EVENT_LOGGER.trace("RenderRegion end QuadBuild @ {}", regionPos);
|
||||||
return builder;
|
return builder;
|
||||||
|
} catch (NullPointerException | ArrayIndexOutOfBoundsException e) {
|
||||||
|
EVENT_LOGGER.info("\"LodNodeBufferBuilder\" failed due to possible known concurrency issue: ", e);
|
||||||
|
throw e; // HOTFIX: Error ignoring for a concurrency caused issue
|
||||||
} catch (Throwable e3) {
|
} catch (Throwable e3) {
|
||||||
EVENT_LOGGER.error("\"LodNodeBufferBuilder\" was unable to build quads: ", e3);
|
EVENT_LOGGER.error("\"LodNodeBufferBuilder\" was unable to build quads: ", e3);
|
||||||
throw e3;
|
throw e3;
|
||||||
@@ -318,6 +330,10 @@ public class RenderRegion implements AutoCloseable
|
|||||||
// We avoid cases where the adjPosition is in player chunk while the position is
|
// We avoid cases where the adjPosition is in player chunk while the position is
|
||||||
// not
|
// not
|
||||||
// to always have a wall underwater
|
// to always have a wall underwater
|
||||||
|
|
||||||
|
/**TODO REMOVE THIS UGLY TRANSPARENCY THING AND MAKE IT MORE SIMPLE*/
|
||||||
|
for (int transparency = 0; transparency <= 1; transparency++)
|
||||||
|
{
|
||||||
for (LodDirection lodDirection : LodDirection.ADJ_DIRECTIONS) {
|
for (LodDirection lodDirection : LodDirection.ADJ_DIRECTIONS) {
|
||||||
try {
|
try {
|
||||||
int xAdj = posX + lodDirection.getNormal().x;
|
int xAdj = posX + lodDirection.getNormal().x;
|
||||||
@@ -382,6 +398,8 @@ public class RenderRegion implements AutoCloseable
|
|||||||
// We only stop when we find a block that is void or non-existing block
|
// We only stop when we find a block that is void or non-existing block
|
||||||
for (int i = 0; i < posData.length; i++) {
|
for (int i = 0; i < posData.length; i++) {
|
||||||
long data = posData[i];
|
long data = posData[i];
|
||||||
|
if (DataPointUtil.isTransparent(data) == (transparency == 1))
|
||||||
|
continue;
|
||||||
// If the data is not renderable (Void or non-existing) we stop since there is
|
// If the data is not renderable (Void or non-existing) we stop since there is
|
||||||
// no data left in this position
|
// no data left in this position
|
||||||
if (DataPointUtil.isVoid(data) || !DataPointUtil.doesItExist(data))
|
if (DataPointUtil.isVoid(data) || !DataPointUtil.doesItExist(data))
|
||||||
@@ -395,7 +413,7 @@ public class RenderRegion implements AutoCloseable
|
|||||||
LevelPosUtil.getRegionModule(detailLevel, posX),
|
LevelPosUtil.getRegionModule(detailLevel, posX),
|
||||||
LevelPosUtil.getRegionModule(detailLevel, posZ), quadBuilder, debugMode);
|
LevelPosUtil.getRegionModule(detailLevel, posZ), quadBuilder, debugMode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}// for pos to in list to render
|
}// for pos to in list to render
|
||||||
// the thread executed successfully
|
// the thread executed successfully
|
||||||
// Merge all quads
|
// Merge all quads
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.seibel.lod.core.render;
|
||||||
|
|
||||||
|
import com.seibel.lod.core.ModInfo;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class F3Screen {
|
||||||
|
public static List<String> f3List = Arrays.asList(
|
||||||
|
"",
|
||||||
|
ModInfo.READABLE_NAME + " version: " + ModInfo.VERSION
|
||||||
|
);
|
||||||
|
public static boolean renderCustomF3 = false;
|
||||||
|
}
|
||||||
@@ -64,7 +64,7 @@ import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
|||||||
*/
|
*/
|
||||||
public class GLProxy
|
public class GLProxy
|
||||||
{
|
{
|
||||||
public static final boolean OVERWIDE_VANILLA_GL_LOGGER = true;
|
public static final boolean OVERWIDE_VANILLA_GL_LOGGER = false;
|
||||||
|
|
||||||
private static final IMinecraftClientWrapper MC = SingletonHandler.get(IMinecraftClientWrapper.class);
|
private static final IMinecraftClientWrapper MC = SingletonHandler.get(IMinecraftClientWrapper.class);
|
||||||
|
|
||||||
|
|||||||
@@ -267,9 +267,10 @@ public class LodRenderer
|
|||||||
drawEnableDepth.end("drawEnableDepth");
|
drawEnableDepth.end("drawEnableDepth");
|
||||||
drawGLSetup.end("drawGLSetup");
|
drawGLSetup.end("drawGLSetup");
|
||||||
// enable transparent rendering
|
// enable transparent rendering
|
||||||
// GL32.glBlendFunc(GL32.GL_SRC_ALPHA, GL32.GL_ONE_MINUS_SRC_ALPHA);
|
GL32.glBlendFunc(GL32.GL_SRC_ALPHA, GL32.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
// GL32.glEnable(GL32.GL_BLEND);
|
GL32.glEnable(GL32.GL_BLEND);
|
||||||
GL32.glDisable(GL32.GL_BLEND);
|
|
||||||
|
//GL32.glDisable(GL32.GL_BLEND);
|
||||||
GL32.glClear(GL32.GL_DEPTH_BUFFER_BIT);
|
GL32.glClear(GL32.GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
||||||
/*---------Bind required objects--------*/
|
/*---------Bind required objects--------*/
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
package com.seibel.lod.core.util;
|
package com.seibel.lod.core.util;
|
||||||
|
|
||||||
|
import com.seibel.lod.core.handlers.dependencyInjection.SingletonHandler;
|
||||||
import com.seibel.lod.core.logging.SpamReducedLogger;
|
import com.seibel.lod.core.logging.SpamReducedLogger;
|
||||||
|
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftClientWrapper;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
@@ -246,6 +248,10 @@ public class DataPointUtil
|
|||||||
return (int) (((dataPoint >>> COLOR_SHIFT) & COLOR_MASK) | (alpha << (ALPHA_SHIFT-COLOR_SHIFT)));
|
return (int) (((dataPoint >>> COLOR_SHIFT) & COLOR_MASK) | (alpha << (ALPHA_SHIFT-COLOR_SHIFT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isTransparent(long dataPoint){
|
||||||
|
return getAlpha(dataPoint) < 255;
|
||||||
|
}
|
||||||
|
|
||||||
/** This is used to convert a dataPoint to string (useful for the print function) */
|
/** This is used to convert a dataPoint to string (useful for the print function) */
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static String toString(long dataPoint)
|
public static String toString(long dataPoint)
|
||||||
@@ -388,6 +394,17 @@ public class DataPointUtil
|
|||||||
{
|
{
|
||||||
int size = dataToMerge.length / inputVerticalData;
|
int size = dataToMerge.length / inputVerticalData;
|
||||||
|
|
||||||
|
int[] indeces = new int[size];
|
||||||
|
Arrays.fill(indeces,0);
|
||||||
|
boolean[] increaseIndex = new boolean[size];
|
||||||
|
boolean[] indexHandled = new boolean[size];
|
||||||
|
byte genMode = getGenerationMode(dataToMerge[0]);
|
||||||
|
if (genMode == 0) genMode = 1; // FIXME: Hack to make the version 10 genMode never be 0.
|
||||||
|
boolean limited = false;
|
||||||
|
boolean allDefault;
|
||||||
|
long singleData;
|
||||||
|
|
||||||
|
|
||||||
// We initialize the arrays that are going to be used
|
// We initialize the arrays that are going to be used
|
||||||
int heightAndDepthLength = (MAX_WORLD_Y_SIZE / 2 + 16) * 2;
|
int heightAndDepthLength = (MAX_WORLD_Y_SIZE / 2 + 16) * 2;
|
||||||
short[] heightAndDepth = tLocalHeightAndDepth.get();
|
short[] heightAndDepth = tLocalHeightAndDepth.get();
|
||||||
@@ -402,158 +419,17 @@ public class DataPointUtil
|
|||||||
tMaxVerticalData.set(dataPoint);
|
tMaxVerticalData.set(dataPoint);
|
||||||
} else Arrays.fill(dataPoint, 0);
|
} else Arrays.fill(dataPoint, 0);
|
||||||
|
|
||||||
byte genMode = getGenerationMode(dataToMerge[0]);
|
|
||||||
if (genMode == 0) genMode = 1; // FIXME: Hack to make the version 10 genMode never be 0.
|
//First we check if it's all void or all empty
|
||||||
boolean allEmpty = true;
|
boolean allEmpty = true;
|
||||||
boolean allVoid = true;
|
boolean allVoid = true;
|
||||||
boolean limited = false;
|
long tempData;
|
||||||
boolean allDefault;
|
|
||||||
long singleData;
|
|
||||||
|
|
||||||
|
|
||||||
short depth;
|
|
||||||
short height;
|
|
||||||
int count = 0;
|
|
||||||
int i;
|
|
||||||
int ii;
|
|
||||||
int dataIndex;
|
|
||||||
//We collect the indexes of the data, ordered by the depth
|
|
||||||
for (int index = 0; index < size; index++)
|
for (int index = 0; index < size; index++)
|
||||||
{
|
{
|
||||||
if (index == 0)
|
tempData = dataToMerge[index * inputVerticalData];
|
||||||
{
|
allVoid = allVoid && DataPointUtil.isVoid(tempData);
|
||||||
for (dataIndex = 0; dataIndex < inputVerticalData; dataIndex++)
|
allEmpty = allEmpty && !DataPointUtil.doesItExist(tempData);
|
||||||
{
|
|
||||||
singleData = dataToMerge[dataIndex];
|
|
||||||
if (doesItExist(singleData))
|
|
||||||
{
|
|
||||||
//genMode = Math.min(genMode, getGenerationMode(singleData));
|
|
||||||
allEmpty = false;
|
|
||||||
if (!isVoid(singleData))
|
|
||||||
{
|
|
||||||
allVoid = false;
|
|
||||||
count++;
|
|
||||||
heightAndDepth[dataIndex * 2] = getHeight(singleData);
|
|
||||||
heightAndDepth[dataIndex * 2 +1] = getDepth(singleData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (dataIndex = 0; dataIndex < inputVerticalData; dataIndex++)
|
|
||||||
{
|
|
||||||
singleData = dataToMerge[index * inputVerticalData + dataIndex];
|
|
||||||
if (doesItExist(singleData))
|
|
||||||
{
|
|
||||||
//genMode = Math.min(genMode, getGenerationMode(singleData));
|
|
||||||
allEmpty = false;
|
|
||||||
if (!isVoid(singleData))
|
|
||||||
{
|
|
||||||
allVoid = false;
|
|
||||||
depth = getDepth(singleData);
|
|
||||||
height = getHeight(singleData);
|
|
||||||
|
|
||||||
int botPos = -1;
|
|
||||||
int topPos = -1;
|
|
||||||
//values fall in between and possibly require extension of array
|
|
||||||
boolean botExtend = false;
|
|
||||||
boolean topExtend = false;
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
if (depth < heightAndDepth[i * 2] && depth >= heightAndDepth[i * 2 + 1])
|
|
||||||
{
|
|
||||||
botPos = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (depth < heightAndDepth[i * 2 + 1] && ((i + 1 < count && depth >= heightAndDepth[(i + 1) * 2]) || i + 1 == count))
|
|
||||||
{
|
|
||||||
botPos = i;
|
|
||||||
botExtend = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
if (height <= heightAndDepth[i * 2] && height > heightAndDepth[i * 2 + 1])
|
|
||||||
{
|
|
||||||
topPos = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (height <= heightAndDepth[i * 2 + 1] && ((i + 1 < count && height > heightAndDepth[(i + 1) * 2]) || i + 1 == count))
|
|
||||||
{
|
|
||||||
topPos = i;
|
|
||||||
topExtend = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (topPos == -1)
|
|
||||||
{
|
|
||||||
if (botPos == -1)
|
|
||||||
{
|
|
||||||
//whole block falls above
|
|
||||||
extendArray(heightAndDepth, 2, 0, 1, count);
|
|
||||||
heightAndDepth[0] = height;
|
|
||||||
heightAndDepth[1] = depth;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
else if (!botExtend)
|
|
||||||
{
|
|
||||||
//only top falls above extending it there, while bottom is inside existing
|
|
||||||
shrinkArray(heightAndDepth, 2, 0, botPos, count);
|
|
||||||
heightAndDepth[0] = height;
|
|
||||||
count -= botPos;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//top falls between some blocks, extending those as well
|
|
||||||
shrinkArray(heightAndDepth, 2, 0, botPos, count);
|
|
||||||
heightAndDepth[0] = height;
|
|
||||||
heightAndDepth[1] = depth;
|
|
||||||
count -= botPos;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (!topExtend)
|
|
||||||
{
|
|
||||||
if (!botExtend)
|
|
||||||
//both top and bottom are within some exiting blocks, possibly merging them
|
|
||||||
heightAndDepth[topPos * 2 + 1] = heightAndDepth[botPos * 2 + 1];
|
|
||||||
else
|
|
||||||
//top falls between some blocks, extending it there
|
|
||||||
heightAndDepth[topPos * 2 + 1] = depth;
|
|
||||||
shrinkArray(heightAndDepth, 2, topPos + 1, botPos - topPos, count);
|
|
||||||
count -= botPos - topPos;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (!botExtend)
|
|
||||||
{
|
|
||||||
//only top is within some exiting block, extending it
|
|
||||||
topPos++; //to make it easier
|
|
||||||
heightAndDepth[topPos * 2] = height;
|
|
||||||
heightAndDepth[topPos * 2 + 1] = heightAndDepth[botPos * 2 + 1];
|
|
||||||
shrinkArray(heightAndDepth, 2, topPos + 1, botPos - topPos, count);
|
|
||||||
count -= botPos - topPos;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//both top and bottom are outside existing blocks
|
|
||||||
shrinkArray(heightAndDepth, 2, topPos + 1, botPos - topPos, count);
|
|
||||||
count -= botPos - topPos;
|
|
||||||
extendArray(heightAndDepth, 2, topPos + 1, 1, count);
|
|
||||||
count++;
|
|
||||||
heightAndDepth[topPos * 2 + 2] = height;
|
|
||||||
heightAndDepth[topPos * 2 + 3] = depth;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//We check if there is any data that's not empty or void
|
//We check if there is any data that's not empty or void
|
||||||
@@ -565,6 +441,126 @@ public class DataPointUtil
|
|||||||
return dataPoint;
|
return dataPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
short depth;
|
||||||
|
short height;
|
||||||
|
int count = 0;
|
||||||
|
int i;
|
||||||
|
int ii;
|
||||||
|
int dataIndex;
|
||||||
|
//We collect the indexes of the data, ordered by the depth
|
||||||
|
|
||||||
|
//this check is used only to see if we have checked all the values in the array
|
||||||
|
boolean stillHasDataToCheck = true;
|
||||||
|
short prevHeight;
|
||||||
|
short prevDepth;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
while(stillHasDataToCheck)
|
||||||
|
{
|
||||||
|
Arrays.fill(indexHandled, false);
|
||||||
|
boolean connected = true;
|
||||||
|
int newHeight = -10000;
|
||||||
|
int newDepth = -10000;
|
||||||
|
int tempHeight;
|
||||||
|
int tempDepth;
|
||||||
|
while(connected)
|
||||||
|
{
|
||||||
|
Arrays.fill(increaseIndex, false);
|
||||||
|
for (int index = 0; index < size; index++)
|
||||||
|
{
|
||||||
|
if(indeces[index] < inputVerticalData)
|
||||||
|
{
|
||||||
|
tempData = dataToMerge[index * inputVerticalData + indeces[index]];
|
||||||
|
if(!DataPointUtil.isVoid(tempData) && DataPointUtil.doesItExist(tempData)) {
|
||||||
|
tempHeight = DataPointUtil.getHeight(tempData);
|
||||||
|
tempDepth = DataPointUtil.getDepth(tempData);
|
||||||
|
if(tempDepth >= newHeight) {
|
||||||
|
//First case
|
||||||
|
//the column we are checking is higher than the current column
|
||||||
|
newDepth = tempDepth;
|
||||||
|
newHeight = tempHeight;
|
||||||
|
Arrays.fill(increaseIndex, false);
|
||||||
|
Arrays.fill(indexHandled, false);
|
||||||
|
increaseIndex[index] = true;
|
||||||
|
indexHandled[index] = true;
|
||||||
|
}else if((tempDepth >= newDepth) && (tempHeight <= newHeight)){
|
||||||
|
//the column we are checking is contained in the current column
|
||||||
|
//we simply increase this index
|
||||||
|
increaseIndex[index] = true;
|
||||||
|
indexHandled[index] = true;
|
||||||
|
}else if(tempHeight > newHeight && tempDepth <= newDepth){
|
||||||
|
newDepth = tempDepth;
|
||||||
|
newHeight = tempHeight;
|
||||||
|
increaseIndex[index] = true;
|
||||||
|
indexHandled[index] = true;
|
||||||
|
}else if(tempHeight > newDepth && tempHeight <= newHeight){
|
||||||
|
//the column we are checking touches the current column from the bottom
|
||||||
|
//for this reason we extend what's below
|
||||||
|
|
||||||
|
//We want to avoid to expend this column if it has already been expanded by
|
||||||
|
//this index
|
||||||
|
if(!indexHandled[index]) {
|
||||||
|
newDepth = tempDepth;
|
||||||
|
increaseIndex[index] = true;
|
||||||
|
indexHandled[index] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(tempDepth < newHeight && tempDepth > newDepth){
|
||||||
|
//the column we are checking touches the current column from the top
|
||||||
|
//for this reason we extend the top
|
||||||
|
newHeight = tempHeight;
|
||||||
|
increaseIndex[index] = true;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
indexHandled[index] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if we added any new data there is a chance that we could add more
|
||||||
|
//for this reason we would continue
|
||||||
|
//if no data is added than the column hasn't changed.
|
||||||
|
//for this reason we can start working on a new column
|
||||||
|
connected = false;
|
||||||
|
for (int index = 0; index < size; index++)
|
||||||
|
{
|
||||||
|
if(increaseIndex[index])
|
||||||
|
{
|
||||||
|
connected = true;
|
||||||
|
indeces[index]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Now we add the height and depth data we extracted to the heightAndDepth array
|
||||||
|
if(newDepth != newHeight)
|
||||||
|
{
|
||||||
|
if(count != 0)
|
||||||
|
{
|
||||||
|
prevDepth = heightAndDepth[(count-1)*2+1];
|
||||||
|
if(newHeight > prevDepth) {
|
||||||
|
newHeight = (short) Math.min(newHeight, prevDepth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
heightAndDepth[count*2] = (short) newHeight;
|
||||||
|
heightAndDepth[count*2+1] = (short) newDepth;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Here we check the condition that makes the loop continue
|
||||||
|
//We stop the loop only if there is no more data to check
|
||||||
|
stillHasDataToCheck = false;
|
||||||
|
for (int index = 0; index < size; index++)
|
||||||
|
{
|
||||||
|
if(indeces[index] < inputVerticalData)
|
||||||
|
{
|
||||||
|
tempData = dataToMerge[index * inputVerticalData + indeces[index]];
|
||||||
|
stillHasDataToCheck |= !DataPointUtil.isVoid(tempData) && DataPointUtil.doesItExist(tempData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//we limit the vertical portion to maxVerticalData
|
//we limit the vertical portion to maxVerticalData
|
||||||
int j = 0;
|
int j = 0;
|
||||||
while (count > maxVerticalData)
|
while (count > maxVerticalData)
|
||||||
@@ -655,14 +651,6 @@ public class DataPointUtil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allEmpty)
|
|
||||||
//no child has been initialized
|
|
||||||
dataPoint[j] = EMPTY_DATA;
|
|
||||||
else if (allVoid)
|
|
||||||
//all the children are void
|
|
||||||
dataPoint[j] = createVoidDataPoint(genMode);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//we have at least 1 child
|
//we have at least 1 child
|
||||||
if (size != 1)
|
if (size != 1)
|
||||||
{
|
{
|
||||||
@@ -677,8 +665,8 @@ public class DataPointUtil
|
|||||||
//{
|
//{
|
||||||
// add simplification at the end due to color
|
// add simplification at the end due to color
|
||||||
//}
|
//}
|
||||||
dataPoint[j] = createDataPoint((int) Math.sqrt(tempAlpha), (int) Math.sqrt(tempRed), (int) Math.sqrt(tempGreen), (int) Math.sqrt(tempBlue), height, depth, tempLightSky, tempLightBlock, genMode);
|
dataPoint[j] = createDataPoint(tempAlpha, (int) Math.sqrt(tempRed), (int) Math.sqrt(tempGreen), (int) Math.sqrt(tempBlue), height, depth, tempLightSky, tempLightBlock, genMode);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return dataPoint;
|
return dataPoint;
|
||||||
|
|||||||
@@ -391,9 +391,8 @@ public class LodUtil
|
|||||||
numb = Float.intBitsToFloat(i);
|
numb = Float.intBitsToFloat(i);
|
||||||
return numb * (1.5F - half * numb * numb);
|
return numb * (1.5F - half * numb * numb);
|
||||||
}
|
}
|
||||||
public static float pow2(float x) {return x*x;}
|
|
||||||
public static double pow2(double x) {return x*x;}
|
public static double pow2(double x) {return x*x;}
|
||||||
public static int pow2(int x) {return x*x;}
|
public static long pow2(long x) {return x*x;}
|
||||||
|
|
||||||
|
|
||||||
// True if the requested threshold pass, or false otherwise
|
// True if the requested threshold pass, or false otherwise
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import com.seibel.lod.core.handlers.dependencyInjection.IBindable;
|
|||||||
/**
|
/**
|
||||||
* Checks if a mod is loaded
|
* Checks if a mod is loaded
|
||||||
*
|
*
|
||||||
* @author coolGi2007
|
* @author coolGi
|
||||||
* @version 3-5-2022
|
* @version 3-5-2022
|
||||||
*/
|
*/
|
||||||
public interface IModChecker extends IBindable {
|
public interface IModChecker extends IBindable {
|
||||||
|
|||||||
@@ -0,0 +1,165 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
||||||
@@ -70,7 +70,7 @@ void main()
|
|||||||
|
|
||||||
}
|
}
|
||||||
//fragColor = vec4(0.7,0.6,0.5,1.0);
|
//fragColor = vec4(0.7,0.6,0.5,1.0);
|
||||||
fragColor = vec4(returnColor.rgb,1.0);
|
fragColor = returnColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
float linearFog(float x, float fogStart, float fogLength, float fogMin, float fogRange) {
|
float linearFog(float x, float fogStart, float fogLength, float fogMin, float fogRange) {
|
||||||
|
|||||||
Reference in New Issue
Block a user