Change Box to VertexOptimizer and added the DataFormat folder with empty classes
This commit is contained in:
+15
-15
@@ -30,6 +30,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL30;
|
||||
@@ -41,7 +42,6 @@ import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.enums.config.GpuUploadMethod;
|
||||
import com.seibel.lod.core.enums.config.VanillaOverdraw;
|
||||
import com.seibel.lod.core.enums.rendering.GLProxyContext;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.PosToRenderContainer;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import com.seibel.lod.core.objects.lod.LodDimension;
|
||||
@@ -143,7 +143,7 @@ public class LodBufferBuilderFactory
|
||||
/** this is used to prevent multiple threads creating, destroying, or using the buffers at the same time */
|
||||
private final ReentrantLock bufferLock = new ReentrantLock();
|
||||
|
||||
private volatile Box[][] boxCache;
|
||||
private volatile VertexOptimizer[][] vertexOptimizerCache;
|
||||
private volatile PosToRenderContainer[][] setsToRender;
|
||||
private volatile RegionPos center;
|
||||
|
||||
@@ -229,11 +229,11 @@ public class LodBufferBuilderFactory
|
||||
if (setsToRender.length != lodDim.getWidth())
|
||||
setsToRender = new PosToRenderContainer[lodDim.getWidth()][lodDim.getWidth()];
|
||||
|
||||
if (boxCache == null)
|
||||
boxCache = new Box[lodDim.getWidth()][lodDim.getWidth()];
|
||||
if (vertexOptimizerCache == null)
|
||||
vertexOptimizerCache = new VertexOptimizer[lodDim.getWidth()][lodDim.getWidth()];
|
||||
|
||||
if (boxCache.length != lodDim.getWidth())
|
||||
boxCache = new Box[lodDim.getWidth()][lodDim.getWidth()];
|
||||
if (vertexOptimizerCache.length != lodDim.getWidth())
|
||||
vertexOptimizerCache = new VertexOptimizer[lodDim.getWidth()][lodDim.getWidth()];
|
||||
|
||||
// this will be the center of the VBOs once they have been built
|
||||
buildableCenterChunkPos = playerChunkPos;
|
||||
@@ -288,7 +288,7 @@ public class LodBufferBuilderFactory
|
||||
int bufferIndex;
|
||||
boolean posNotInPlayerChunk;
|
||||
boolean adjPosInPlayerChunk;
|
||||
Box box = ThreadMapUtil.getBox();
|
||||
VertexOptimizer vertexOptimizer = ThreadMapUtil.getBox();
|
||||
boolean[] adjShadeDisabled = ThreadMapUtil.getAdjShadeDisabledArray();
|
||||
|
||||
// determine how many LODs we can stack vertically
|
||||
@@ -352,11 +352,11 @@ public class LodBufferBuilderFactory
|
||||
Arrays.fill(adjShadeDisabled, false);
|
||||
|
||||
//We check every adj block in each direction
|
||||
for (LodDirection lodDirection : Box.ADJ_DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.ADJ_DIRECTIONS)
|
||||
{
|
||||
|
||||
xAdj = posX + Box.DIRECTION_NORMAL_MAP.get(lodDirection).x;
|
||||
zAdj = posZ + Box.DIRECTION_NORMAL_MAP.get(lodDirection).z;
|
||||
xAdj = posX + VertexOptimizer.DIRECTION_NORMAL_MAP.get(lodDirection).x;
|
||||
zAdj = posZ + VertexOptimizer.DIRECTION_NORMAL_MAP.get(lodDirection).z;
|
||||
int color;
|
||||
int data;
|
||||
byte flags;
|
||||
@@ -377,7 +377,7 @@ public class LodBufferBuilderFactory
|
||||
{
|
||||
data = lodDim.getData(detailLevel, xAdj, zAdj, verticalIndex);
|
||||
flags = lodDim.getFlags(detailLevel, xAdj, zAdj, verticalIndex);
|
||||
adjShadeDisabled[Box.DIRECTION_INDEX.get(lodDirection)] = false;
|
||||
adjShadeDisabled[VertexOptimizer.DIRECTION_INDEX.get(lodDirection)] = false;
|
||||
adjData.get(lodDirection)[verticalIndex] = data;
|
||||
adjFlags.get(lodDirection)[verticalIndex] = flags;
|
||||
}
|
||||
@@ -394,7 +394,7 @@ public class LodBufferBuilderFactory
|
||||
if ((isThisPositionGoingToBeRendered(detailLevel, xAdj, zAdj, playerChunkPos, vanillaRenderedChunks, gameChunkRenderDistance) || (posNotInPlayerChunk && adjPosInPlayerChunk))
|
||||
&& DataPointUtil.doesItExist(flags) && !DataPointUtil.isVoid(flags))
|
||||
{
|
||||
adjShadeDisabled[Box.DIRECTION_INDEX.get(lodDirection)] = DataPointUtil.getAlpha(data) < 255;
|
||||
adjShadeDisabled[VertexOptimizer.DIRECTION_INDEX.get(lodDirection)] = DataPointUtil.getAlpha(data) < 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -443,7 +443,7 @@ public class LodBufferBuilderFactory
|
||||
|
||||
//We send the call to create the vertices
|
||||
CONFIG.client().graphics().advancedGraphics().getLodTemplate().template.addLodToBuffer(currentBuffers[bufferIndex], playerBlockPosRounded, color, data, flags, adjData, adjFlags,
|
||||
detailLevel, posX, posZ, box, renderer.previousDebugMode, adjShadeDisabled);
|
||||
detailLevel, posX, posZ, vertexOptimizer, renderer.previousDebugMode, adjShadeDisabled);
|
||||
}
|
||||
|
||||
} // for pos to in list to render
|
||||
@@ -585,7 +585,7 @@ public class LodBufferBuilderFactory
|
||||
{
|
||||
regionMemoryRequired = DEFAULT_MEMORY_ALLOCATION;
|
||||
|
||||
// if the memory required is greater than the max buffer
|
||||
// if the memory required is greater than the max buffer
|
||||
// capacity, divide the memory across multiple buffers
|
||||
if (regionMemoryRequired > LodUtil.MAX_ALLOCATABLE_DIRECT_MEMORY)
|
||||
{
|
||||
@@ -650,7 +650,7 @@ public class LodBufferBuilderFactory
|
||||
drawableStorageBufferIds[x][z][i] = GL15.glGenBuffers();
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, drawableStorageBufferIds[x][z][i]);
|
||||
GL45.glBufferStorage(GL15.GL_ARRAY_BUFFER, regionMemoryRequired, 0);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
|
||||
import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.enums.rendering.DebugMode;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import com.seibel.lod.core.objects.opengl.LodBufferBuilder;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
@@ -37,9 +37,8 @@ import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
public abstract class AbstractLodTemplate
|
||||
{
|
||||
/** Uploads the given LOD to the buffer. */
|
||||
public abstract void addLodToBuffer(LodBufferBuilder buffer, AbstractBlockPosWrapper bufferCenterBlockPos, int color, int data, byte flags,
|
||||
Map<LodDirection, int[]> adjData, Map<LodDirection, byte[]> adjFlags,
|
||||
byte detailLevel, int posX, int posZ, Box box, DebugMode debugging, boolean[] adjShadeDisabled);
|
||||
public abstract void addLodToBuffer(LodBufferBuilder buffer, AbstractBlockPosWrapper bufferCenterBlockPos, int color, int data, byte flags, Map<LodDirection, Map<LodDirection, int[]> adjData, Map<LodDirection, byte[]> adjFlags,
|
||||
byte detailLevel, int posX, int posZ, VertexOptimizer vertexOptimizer, DebugMode debugging, boolean[] adjShadeDisabled);
|
||||
|
||||
/** add the given position and color to the buffer */
|
||||
protected void addPosAndColor(LodBufferBuilder buffer,
|
||||
|
||||
+23
-23
@@ -23,7 +23,7 @@ import java.util.Map;
|
||||
|
||||
import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.enums.rendering.DebugMode;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import com.seibel.lod.core.objects.opengl.LodBufferBuilder;
|
||||
import com.seibel.lod.core.util.ColorUtil;
|
||||
import com.seibel.lod.core.util.DataPointUtil;
|
||||
@@ -47,9 +47,9 @@ public class CubicLodTemplate extends AbstractLodTemplate
|
||||
public void addLodToBuffer(LodBufferBuilder buffer, AbstractBlockPosWrapper bufferCenterBlockPos,
|
||||
int color, int data, byte flags,
|
||||
Map<LodDirection, int[]> adjData, Map<LodDirection, byte[]> adjFlags,
|
||||
byte detailLevel, int posX, int posZ, Box box, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
byte detailLevel, int posX, int posZ, VertexOptimizer vertexOptimizer, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
{
|
||||
if (box == null)
|
||||
if (vertexOptimizer == null)
|
||||
return;
|
||||
|
||||
// equivalent to 2^detailLevel
|
||||
@@ -59,7 +59,7 @@ public class CubicLodTemplate extends AbstractLodTemplate
|
||||
color = LodUtil.DEBUG_DETAIL_LEVEL_COLORS[detailLevel].getRGB();
|
||||
|
||||
generateBoundingBox(
|
||||
box,
|
||||
vertexOptimizer,
|
||||
DataPointUtil.getHeight(data),
|
||||
DataPointUtil.getDepth(data),
|
||||
blockWidth,
|
||||
@@ -72,10 +72,10 @@ public class CubicLodTemplate extends AbstractLodTemplate
|
||||
DataPointUtil.getLightBlock(data),
|
||||
adjShadeDisabled);
|
||||
|
||||
addBoundingBoxToBuffer(buffer, box);
|
||||
addBoundingBoxToBuffer(buffer, vertexOptimizer);
|
||||
}
|
||||
|
||||
private void generateBoundingBox(Box box,
|
||||
private void generateBoundingBox(VertexOptimizer vertexOptimizer,
|
||||
int height, int depth, int width,
|
||||
double xOffset, double yOffset, double zOffset,
|
||||
AbstractBlockPosWrapper bufferCenterBlockPos,
|
||||
@@ -100,38 +100,38 @@ public class CubicLodTemplate extends AbstractLodTemplate
|
||||
// which only uses floats
|
||||
double x = -bufferCenterBlockPos.getX();
|
||||
double z = -bufferCenterBlockPos.getZ();
|
||||
box.reset();
|
||||
box.setColor(color, adjShadeDisabled);
|
||||
box.setLights(skyLight, blockLight);
|
||||
box.setWidth(width, height - depth, width);
|
||||
box.setOffset((int) (xOffset + x), (int) (depth + yOffset), (int) (zOffset + z));
|
||||
box.setUpCulling(32, bufferCenterBlockPos);
|
||||
box.setAdjData(adjData, adjFlags);
|
||||
vertexOptimizer.reset();
|
||||
vertexOptimizer.setColor(color, adjShadeDisabled);
|
||||
vertexOptimizer.setLights(skyLight, blockLight);
|
||||
vertexOptimizer.setWidth(width, height - depth, width);
|
||||
vertexOptimizer.setOffset((int) (xOffset + x), (int) (depth + yOffset), (int) (zOffset + z));
|
||||
vertexOptimizer.setUpCulling(32, bufferCenterBlockPos);
|
||||
vertexOptimizer.setAdjData(adjData, adjFlags);
|
||||
}
|
||||
|
||||
private void addBoundingBoxToBuffer(LodBufferBuilder buffer, Box box)
|
||||
private void addBoundingBoxToBuffer(LodBufferBuilder buffer, VertexOptimizer vertexOptimizer)
|
||||
{
|
||||
int color;
|
||||
int skyLight;
|
||||
int blockLight;
|
||||
for (LodDirection lodDirection : Box.DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.DIRECTIONS)
|
||||
{
|
||||
if(box.isCulled(lodDirection))
|
||||
if(vertexOptimizer.isCulled(lodDirection))
|
||||
continue;
|
||||
|
||||
int verticalFaceIndex = 0;
|
||||
while (box.shouldRenderFace(lodDirection, verticalFaceIndex))
|
||||
while (vertexOptimizer.shouldRenderFace(lodDirection, verticalFaceIndex))
|
||||
{
|
||||
for (int vertexIndex = 0; vertexIndex < 6; vertexIndex++)
|
||||
{
|
||||
color = box.getColor(lodDirection);
|
||||
skyLight = box.getSkyLight(lodDirection, verticalFaceIndex);
|
||||
blockLight = box.getBlockLight();
|
||||
color = vertexOptimizer.getColor(lodDirection);
|
||||
skyLight = vertexOptimizer.getSkyLight(lodDirection, verticalFaceIndex);
|
||||
blockLight = vertexOptimizer.getBlockLight();
|
||||
color = ColorUtil.applyLightValue(color, skyLight, blockLight);
|
||||
addPosAndColor(buffer,
|
||||
box.getX(lodDirection, vertexIndex),
|
||||
box.getY(lodDirection, vertexIndex, verticalFaceIndex) + DataPointUtil.VERTICAL_OFFSET,
|
||||
box.getZ(lodDirection, vertexIndex),
|
||||
vertexOptimizer.getX(lodDirection, vertexIndex),
|
||||
vertexOptimizer.getY(lodDirection, vertexIndex, verticalFaceIndex) + DataPointUtil.VERTICAL_OFFSET,
|
||||
vertexOptimizer.getZ(lodDirection, vertexIndex),
|
||||
color);
|
||||
}
|
||||
verticalFaceIndex++;
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import java.util.Map;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.enums.rendering.DebugMode;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import com.seibel.lod.core.objects.opengl.LodBufferBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DynamicLodTemplate extends AbstractLodTemplate
|
||||
@Override
|
||||
public void addLodToBuffer(LodBufferBuilder buffer, AbstractBlockPosWrapper bufferCenterBlockPos, int color, int data, byte flags,
|
||||
Map<LodDirection, int[]> adjData, Map<LodDirection, byte[]> adjFlags,
|
||||
byte detailLevel, int posX, int posZ, Box box, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
byte detailLevel, int posX, int posZ, VertexOptimizer vertexOptimizer, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
{
|
||||
ClientApi.LOGGER.error(DynamicLodTemplate.class.getSimpleName() + " is not implemented!");
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import java.util.Map;
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.enums.rendering.DebugMode;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import com.seibel.lod.core.objects.opengl.LodBufferBuilder;
|
||||
import com.seibel.lod.core.wrapperInterfaces.block.AbstractBlockPosWrapper;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TriangularLodTemplate extends AbstractLodTemplate
|
||||
@Override
|
||||
public void addLodToBuffer(LodBufferBuilder buffer, AbstractBlockPosWrapper bufferCenterBlockPos, int color, int data, byte flags,
|
||||
Map<LodDirection, int[]> adjData, Map<LodDirection, byte[]> adjFlags,
|
||||
byte detailLevel, int posX, int posZ, Box box, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
byte detailLevel, int posX, int posZ, VertexOptimizer vertexOptimizer, DebugMode debugging, boolean[] adjShadeDisabled)
|
||||
{
|
||||
ClientApi.LOGGER.error(DynamicLodTemplate.class.getSimpleName() + " is not implemented!");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.seibel.lod.core.dataFormat;
|
||||
|
||||
public class BlockDataFormat
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.seibel.lod.core.dataFormat;
|
||||
|
||||
public class ColorFormat
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.seibel.lod.core.dataFormat;
|
||||
|
||||
public class DepthHeightFormat
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.seibel.lod.core.dataFormat;
|
||||
|
||||
public class LightFormat
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.seibel.lod.core.dataFormat;
|
||||
|
||||
public class PositionDataFormat
|
||||
{
|
||||
}
|
||||
+3
-4
@@ -35,12 +35,11 @@ import com.seibel.lod.core.wrapperInterfaces.config.ILodConfigWrapperSingleton;
|
||||
import com.seibel.lod.core.wrapperInterfaces.minecraft.IMinecraftWrapper;
|
||||
|
||||
/**
|
||||
* Similar to Minecraft's AxisAlignedBoundingBox.
|
||||
*
|
||||
* This class handles all the vertex optimization that's needed for a column of lods. W
|
||||
* @author Leonardo Amato
|
||||
* @version 10-2-2021
|
||||
*/
|
||||
public class Box
|
||||
public class VertexOptimizer
|
||||
{
|
||||
private static final IMinecraftWrapper MC = SingletonHandler.get(IMinecraftWrapper.class);
|
||||
private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
|
||||
@@ -207,7 +206,7 @@ public class Box
|
||||
|
||||
/** creates an empty box */
|
||||
@SuppressWarnings("serial")
|
||||
public Box()
|
||||
public VertexOptimizer()
|
||||
{
|
||||
boxOffset = new int[3];
|
||||
boxWidth = new int[3];
|
||||
@@ -26,7 +26,7 @@ import java.util.HashSet;
|
||||
import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.enums.config.HorizontalResolution;
|
||||
import com.seibel.lod.core.enums.config.VanillaOverdraw;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
import com.seibel.lod.core.objects.lod.LodDimension;
|
||||
import com.seibel.lod.core.objects.lod.RegionPos;
|
||||
import com.seibel.lod.core.objects.opengl.DefaultLodVertexFormats;
|
||||
@@ -403,10 +403,10 @@ public class LodUtil
|
||||
return false;
|
||||
int tempX;
|
||||
int tempZ;
|
||||
for (LodDirection lodDirection : Box.ADJ_DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.ADJ_DIRECTIONS)
|
||||
{
|
||||
tempX = x + Box.DIRECTION_NORMAL_MAP.get(lodDirection).x;
|
||||
tempZ = z + Box.DIRECTION_NORMAL_MAP.get(lodDirection).z;
|
||||
tempX = x + VertexOptimizer.DIRECTION_NORMAL_MAP.get(lodDirection).x;
|
||||
tempZ = z + VertexOptimizer.DIRECTION_NORMAL_MAP.get(lodDirection).z;
|
||||
if (vanillaRenderedChunks[x][z] || (!(tempX < 0 || tempZ < 0 || tempX >= vanillaRenderedChunks.length || tempZ >= vanillaRenderedChunks[0].length)
|
||||
&& !vanillaRenderedChunks[tempX][tempZ]))
|
||||
return true;
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import com.seibel.lod.core.enums.LodDirection;
|
||||
import com.seibel.lod.core.objects.Box;
|
||||
import com.seibel.lod.core.objects.VertexOptimizer;
|
||||
|
||||
/**
|
||||
* Holds data used by specific threads so
|
||||
@@ -59,7 +59,7 @@ public class ThreadMapUtil
|
||||
public static final ConcurrentMap<String, boolean[]> adjShadeDisabled = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentMap<String, Map<LodDirection, int[]>> adjDataMap = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentMap<String, Map<LodDirection, byte[]>> adjFlagsMap = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentMap<String, Box> boxMap = new ConcurrentHashMap<>();
|
||||
public static final ConcurrentMap<String, VertexOptimizer> boxMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static int dataPointColor = 0;
|
||||
public static int dataPointData = 0;
|
||||
@@ -73,7 +73,7 @@ public class ThreadMapUtil
|
||||
if (!adjShadeDisabled.containsKey(Thread.currentThread().getName())
|
||||
|| (adjShadeDisabled.get(Thread.currentThread().getName()) == null))
|
||||
{
|
||||
adjShadeDisabled.put(Thread.currentThread().getName(), new boolean[Box.DIRECTIONS.length]);
|
||||
adjShadeDisabled.put(Thread.currentThread().getName(), new boolean[VertexOptimizer.DIRECTIONS.length]);
|
||||
}
|
||||
Arrays.fill(adjShadeDisabled.get(Thread.currentThread().getName()), false);
|
||||
return adjShadeDisabled.get(Thread.currentThread().getName());
|
||||
@@ -90,12 +90,12 @@ public class ThreadMapUtil
|
||||
adjDataMap.put(Thread.currentThread().getName(), new HashMap<>());
|
||||
adjDataMap.get(Thread.currentThread().getName()).put(LodDirection.UP, new int[1]);
|
||||
adjDataMap.get(Thread.currentThread().getName()).put(LodDirection.DOWN, new int[1]);
|
||||
for (LodDirection lodDirection : Box.ADJ_DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.ADJ_DIRECTIONS)
|
||||
adjDataMap.get(Thread.currentThread().getName()).put(lodDirection, new int[verticalData]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (LodDirection lodDirection : Box.ADJ_DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.ADJ_DIRECTIONS)
|
||||
Arrays.fill(adjDataMap.get(Thread.currentThread().getName()).get(lodDirection), 0);
|
||||
}
|
||||
return adjDataMap.get(Thread.currentThread().getName());
|
||||
@@ -112,23 +112,23 @@ public class ThreadMapUtil
|
||||
adjFlagsMap.put(Thread.currentThread().getName(), new HashMap<>());
|
||||
adjFlagsMap.get(Thread.currentThread().getName()).put(LodDirection.UP, new byte[1]);
|
||||
adjFlagsMap.get(Thread.currentThread().getName()).put(LodDirection.DOWN, new byte[1]);
|
||||
for (LodDirection lodDirection : Box.ADJ_DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.ADJ_DIRECTIONS)
|
||||
adjFlagsMap.get(Thread.currentThread().getName()).put(lodDirection, new byte[verticalData]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (LodDirection lodDirection : Box.ADJ_DIRECTIONS)
|
||||
for (LodDirection lodDirection : VertexOptimizer.ADJ_DIRECTIONS)
|
||||
Arrays.fill(adjFlagsMap.get(Thread.currentThread().getName()).get(lodDirection), (byte) 0);
|
||||
}
|
||||
return adjFlagsMap.get(Thread.currentThread().getName());
|
||||
}
|
||||
|
||||
public static Box getBox()
|
||||
public static VertexOptimizer getBox()
|
||||
{
|
||||
if (!boxMap.containsKey(Thread.currentThread().getName())
|
||||
|| (boxMap.get(Thread.currentThread().getName()) == null))
|
||||
{
|
||||
boxMap.put(Thread.currentThread().getName(), new Box());
|
||||
boxMap.put(Thread.currentThread().getName(), new VertexOptimizer());
|
||||
}
|
||||
boxMap.get(Thread.currentThread().getName()).reset();
|
||||
return boxMap.get(Thread.currentThread().getName());
|
||||
|
||||
Reference in New Issue
Block a user