mirror of https://github.com/webbukkit/dynmap.git
Start prep for shadow lighting rework
This commit is contained in:
parent
fd420f739f
commit
e22ad9b8bf
|
@ -128,6 +128,26 @@ public abstract class GenericMapChunkCache extends MapChunkCache {
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
/**
|
||||||
|
* Get block sky and emitted light, relative to current coordinate
|
||||||
|
* @return (emitted light * 256) + sky light
|
||||||
|
*/
|
||||||
|
public final int getBlockLight(int xoff, int yoff, int zoff) {
|
||||||
|
int emit = 0, sky = 15;
|
||||||
|
int nx = x + xoff;
|
||||||
|
int ny = y + yoff;
|
||||||
|
int nz = z + zoff;
|
||||||
|
GenericChunkSection sect;
|
||||||
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
|
sect = snaparray[nchunkindex].getSection(ny);
|
||||||
|
emit = sect.emitted.getLight(nx, ny, nz);
|
||||||
|
sky = sect.sky.getLight(nx, ny, nz);
|
||||||
|
}
|
||||||
|
return (emit << 8) + sky;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final BiomeMap getBiome() {
|
public final BiomeMap getBiome() {
|
||||||
try {
|
try {
|
||||||
return snap.getBiome(bx, y, bz);
|
return snap.getBiome(bx, y, bz);
|
||||||
|
|
|
@ -31,6 +31,14 @@ public interface MapIterator extends MapDataContext {
|
||||||
* @return (emitted light * 256) + sky light
|
* @return (emitted light * 256) + sky light
|
||||||
*/
|
*/
|
||||||
int getBlockLight(BlockStep step);
|
int getBlockLight(BlockStep step);
|
||||||
|
/**
|
||||||
|
* Get block sky and emitted light, relative to current coordinate
|
||||||
|
* @param xoff - x offset from current position
|
||||||
|
* @param yoff - y offset from current position
|
||||||
|
* @param zoff - z offset from current position
|
||||||
|
* @return (emitted light * 256) + sky light
|
||||||
|
*/
|
||||||
|
int getBlockLight(int xoff, int yoff, int zoff);
|
||||||
/**
|
/**
|
||||||
* Get biome at coordinates
|
* Get biome at coordinates
|
||||||
* @return biome
|
* @return biome
|
||||||
|
|
|
@ -14,9 +14,6 @@ import org.dynmap.DynmapChunk;
|
||||||
import org.dynmap.DynmapCore;
|
import org.dynmap.DynmapCore;
|
||||||
import org.dynmap.DynmapWorld;
|
import org.dynmap.DynmapWorld;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
import org.dynmap.bukkit.helper.BukkitVersionHelper;
|
|
||||||
import org.dynmap.bukkit.helper.BukkitWorld;
|
|
||||||
import org.dynmap.bukkit.helper.SnapshotCache;
|
|
||||||
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
|
import org.dynmap.bukkit.helper.SnapshotCache.SnapshotRec;
|
||||||
import org.dynmap.common.BiomeMap;
|
import org.dynmap.common.BiomeMap;
|
||||||
import org.dynmap.hdmap.HDBlockModels;
|
import org.dynmap.hdmap.HDBlockModels;
|
||||||
|
@ -181,6 +178,23 @@ public abstract class AbstractMapChunkCache extends MapChunkCache {
|
||||||
}
|
}
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* Get block sky and emitted light, relative to current coordinate
|
||||||
|
* @return (emitted light * 256) + sky light
|
||||||
|
*/
|
||||||
|
public final int getBlockLight(int xoff, int yoff, int zoff) {
|
||||||
|
int emit = 0, sky = 15;
|
||||||
|
int nx = x + xoff;
|
||||||
|
int ny = y + yoff;
|
||||||
|
int nz = z + zoff;
|
||||||
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
|
emit = snaparray[nchunkindex].getBlockEmittedLight(nx, ny, nz);
|
||||||
|
sky = snaparray[nchunkindex].getBlockSkyLight(nx, ny, nz);
|
||||||
|
}
|
||||||
|
return (emit << 8) + sky;
|
||||||
|
}
|
||||||
|
|
||||||
private void biomePrep() {
|
private void biomePrep() {
|
||||||
if(sameneighborbiomecnt != null)
|
if(sameneighborbiomecnt != null)
|
||||||
|
|
|
@ -201,6 +201,23 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||||
}
|
}
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* Get block sky and emitted light, relative to current coordinate
|
||||||
|
* @return (emitted light * 256) + sky light
|
||||||
|
*/
|
||||||
|
public final int getBlockLight(int xoff, int yoff, int zoff) {
|
||||||
|
int emit = 0, sky = 15;
|
||||||
|
int nx = x + xoff;
|
||||||
|
int ny = y + yoff;
|
||||||
|
int nz = z + zoff;
|
||||||
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
|
emit = snaparray[nchunkindex].getBlockEmittedLight(nx, ny, nz);
|
||||||
|
sky = snaparray[nchunkindex].getBlockSkyLight(nx, ny, nz);
|
||||||
|
}
|
||||||
|
return (emit << 8) + sky;
|
||||||
|
}
|
||||||
|
|
||||||
private void biomePrep()
|
private void biomePrep()
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,6 +197,23 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||||
}
|
}
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* Get block sky and emitted light, relative to current coordinate
|
||||||
|
* @return (emitted light * 256) + sky light
|
||||||
|
*/
|
||||||
|
public final int getBlockLight(int xoff, int yoff, int zoff) {
|
||||||
|
int emit = 0, sky = 15;
|
||||||
|
int nx = x + xoff;
|
||||||
|
int ny = y + yoff;
|
||||||
|
int nz = z + zoff;
|
||||||
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
|
emit = snaparray[nchunkindex].getBlockEmittedLight(nx, ny, nz);
|
||||||
|
sky = snaparray[nchunkindex].getBlockSkyLight(nx, ny, nz);
|
||||||
|
}
|
||||||
|
return (emit << 8) + sky;
|
||||||
|
}
|
||||||
|
|
||||||
private void biomePrep()
|
private void biomePrep()
|
||||||
{
|
{
|
||||||
|
|
|
@ -197,6 +197,23 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||||
}
|
}
|
||||||
return (emit << 8) + sky;
|
return (emit << 8) + sky;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
/**
|
||||||
|
* Get block sky and emitted light, relative to current coordinate
|
||||||
|
* @return (emitted light * 256) + sky light
|
||||||
|
*/
|
||||||
|
public final int getBlockLight(int xoff, int yoff, int zoff) {
|
||||||
|
int emit = 0, sky = 15;
|
||||||
|
int nx = x + xoff;
|
||||||
|
int ny = y + yoff;
|
||||||
|
int nz = z + zoff;
|
||||||
|
int nchunkindex = ((nx >> 4) - x_min) + (((nz >> 4) - z_min) * x_dim);
|
||||||
|
if ((nchunkindex < snapcnt) && (nchunkindex >= 0)) {
|
||||||
|
emit = snaparray[nchunkindex].getBlockEmittedLight(nx, ny, nz);
|
||||||
|
sky = snaparray[nchunkindex].getBlockSkyLight(nx, ny, nz);
|
||||||
|
}
|
||||||
|
return (emit << 8) + sky;
|
||||||
|
}
|
||||||
|
|
||||||
private void biomePrep()
|
private void biomePrep()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue