System uses lightmap now
This commit is contained in:
@@ -260,6 +260,8 @@ public class LodBuilder
|
||||
int depth = 0;
|
||||
int color = 0;
|
||||
int light = 0;
|
||||
int lightSky = 0;
|
||||
int lightBlock = 0;
|
||||
int generation = config.distanceGenerationMode.complexity;
|
||||
|
||||
int xRel;
|
||||
@@ -290,6 +292,7 @@ public class LodBuilder
|
||||
//Calculate the height of the lod
|
||||
yAbs = 255;
|
||||
int count = 0;
|
||||
boolean topBlock = true;
|
||||
while (yAbs > 0)
|
||||
{
|
||||
height = determineHeightPointFrom(chunk, config, xRel, zRel, yAbs, blockPos);
|
||||
@@ -307,10 +310,16 @@ public class LodBuilder
|
||||
depth = determineBottomPointFrom(chunk, config, xRel, zRel, yAbs, blockPos);
|
||||
blockPos.set(xAbs, yAbs + 1, zAbs);
|
||||
light = getLightValue(chunk, blockPos);
|
||||
lightBlock = light & 0b1111;
|
||||
if(topBlock)
|
||||
lightSky = 15; //default max light
|
||||
else
|
||||
lightSky = (light >> 4) & 0b1111;
|
||||
topBlock = false;
|
||||
|
||||
//System.out.println(dataToMerge.length + " " + index +" " + count + " " + yAbs);
|
||||
//System.out.println(dataToMerge.length + " " + dataToMerge[index].length);
|
||||
dataToMerge[index][count] = DataPointUtil.createDataPoint(height, depth, color, (light >> 4) & 0b1111, light & 0b1111, generation);
|
||||
dataToMerge[index][count] = DataPointUtil.createDataPoint(height, depth, color, lightSky, lightBlock, generation);
|
||||
yAbs = depth - 1;
|
||||
count++;
|
||||
}
|
||||
@@ -443,7 +452,8 @@ public class LodBuilder
|
||||
blockPos.set(xAbs, yAbs + 1, zAbs);
|
||||
light = getLightValue(chunk, blockPos);
|
||||
lightBlock = light & 0b1111;
|
||||
lightSky = (light >> 4) & 0b1111;
|
||||
//lightSky = (light >> 4) & 0b1111;
|
||||
lightSky = 15; //default max light
|
||||
dataToMerge[index] = DataPointUtil.createDataPoint(height, depth, color, lightSky, lightBlock, generation);
|
||||
}
|
||||
return dataToMerge;
|
||||
|
||||
@@ -250,7 +250,7 @@ public class LodRenderer
|
||||
farPlaneBlockDistance = LodConfig.CLIENT.graphics.lodChunkRenderDistance.get() * LodUtil.CHUNK_WIDTH;
|
||||
|
||||
setupProjectionMatrix(partialTicks);
|
||||
setupLighting(lodDim, partialTicks);
|
||||
//setupLighting(lodDim, partialTicks);
|
||||
|
||||
NearFarFogSettings fogSettings = determineFogSettings();
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.seibel.lod.util;
|
||||
|
||||
import com.seibel.lod.enums.DistanceGenerationMode;
|
||||
import com.seibel.lod.wrappers.MinecraftWrapper;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import java.lang.annotation.Native;
|
||||
|
||||
public class DataPointUtil
|
||||
{
|
||||
@@ -176,27 +181,14 @@ public class DataPointUtil
|
||||
int lightBlock = getLightBlock(dataPoint);
|
||||
int lightSky = getLightSky(dataPoint);
|
||||
|
||||
NativeImage lightMap = MinecraftWrapper.INSTANCE.getCurrentLightMap();
|
||||
/**TODO ALL of this should be dimension dependent and lightMap dependent*/
|
||||
int red;
|
||||
int green;
|
||||
int blue;
|
||||
if(roof)
|
||||
{
|
||||
red = LodUtil.clamp(0, getRed(dataPoint) + -30 + lightBlock*4,255);
|
||||
green = LodUtil.clamp(0, getGreen(dataPoint) + -30 + lightBlock*4,255);
|
||||
blue = LodUtil.clamp(0, getBlue(dataPoint) + -30 + lightBlock*2,255);
|
||||
}else{
|
||||
if(day){
|
||||
red = LodUtil.clamp(0, getRed(dataPoint) + -30 + LodUtil.clamp(0, lightBlock + lightSky,15)*4,255);
|
||||
green = LodUtil.clamp(0, getGreen(dataPoint) + -30 + LodUtil.clamp(0, lightBlock + lightSky,15)*4,255);
|
||||
blue = LodUtil.clamp(0, getBlue(dataPoint) + -30 + LodUtil.clamp(0, lightBlock/2 + lightSky,15)*4,255);
|
||||
}else{
|
||||
red = LodUtil.clamp(0, getRed(dataPoint) + -60 + lightBlock*6,255);
|
||||
green = LodUtil.clamp(0, getGreen(dataPoint) + -60 + lightBlock*6,255);
|
||||
blue = LodUtil.clamp(0, getBlue(dataPoint) + -30 + lightBlock*2,255);
|
||||
}
|
||||
}
|
||||
return ColorUtil.rgbToInt(red, green, blue);
|
||||
int color = lightMap.getPixelRGBA(lightBlock, lightSky);
|
||||
int red = ColorUtil.getBlue(color);
|
||||
int green = ColorUtil.getGreen(color);
|
||||
int blue = ColorUtil.getRed(color);
|
||||
|
||||
return ColorUtil.multiplyRGBcolors(getColor(dataPoint), ColorUtil.rgbToInt(red, green, blue));
|
||||
}
|
||||
|
||||
public static String toString(long dataPoint)
|
||||
|
||||
Reference in New Issue
Block a user