mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-09-19 09:31:48 +02:00
Tune render performance
This commit is contained in:
parent
cf08f243d0
commit
9e7e333cc5
@ -96,6 +96,8 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
Vector3D top, bottom;
|
Vector3D top, bottom;
|
||||||
int px, py;
|
int px, py;
|
||||||
BlockStep laststep = BlockStep.Y_MINUS;
|
BlockStep laststep = BlockStep.Y_MINUS;
|
||||||
|
|
||||||
|
BlockStep stepx, stepy, stepz;
|
||||||
/* Raytrace state variables */
|
/* Raytrace state variables */
|
||||||
double dx, dy, dz;
|
double dx, dy, dz;
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
@ -115,6 +117,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
int subalpha;
|
int subalpha;
|
||||||
double mt;
|
double mt;
|
||||||
double mtend;
|
double mtend;
|
||||||
|
int mxout, myout, mzout;
|
||||||
|
|
||||||
int[] subblock_xyz = new int[3];
|
int[] subblock_xyz = new int[3];
|
||||||
MapIterator mapiter;
|
MapIterator mapiter;
|
||||||
@ -238,56 +241,76 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
/* Compute number of steps and increments for each */
|
/* Compute number of steps and increments for each */
|
||||||
n = 1;
|
n = 1;
|
||||||
|
|
||||||
|
int mxout, myout, mzout;
|
||||||
|
|
||||||
/* If perpendicular to X axis */
|
/* If perpendicular to X axis */
|
||||||
if (dx == 0) {
|
if (dx == 0) {
|
||||||
x_inc = 0;
|
x_inc = 0;
|
||||||
t_next_x = Double.MAX_VALUE;
|
t_next_x = Double.MAX_VALUE;
|
||||||
|
stepx = BlockStep.X_PLUS;
|
||||||
|
mxout = modscale;
|
||||||
}
|
}
|
||||||
/* If bottom is right of top */
|
/* If bottom is right of top */
|
||||||
else if (bottom.x > top.x) {
|
else if (bottom.x > top.x) {
|
||||||
x_inc = 1;
|
x_inc = 1;
|
||||||
n += (int) (Math.floor(bottom.x)) - x;
|
n += (int) (Math.floor(bottom.x)) - x;
|
||||||
t_next_x = (Math.floor(top.x) + 1 - top.x) * dt_dx;
|
t_next_x = (Math.floor(top.x) + 1 - top.x) * dt_dx;
|
||||||
|
stepx = BlockStep.X_PLUS;
|
||||||
|
mxout = modscale;
|
||||||
}
|
}
|
||||||
/* Top is right of bottom */
|
/* Top is right of bottom */
|
||||||
else {
|
else {
|
||||||
x_inc = -1;
|
x_inc = -1;
|
||||||
n += x - (int) (Math.floor(bottom.x));
|
n += x - (int) (Math.floor(bottom.x));
|
||||||
t_next_x = (top.x - Math.floor(top.x)) * dt_dx;
|
t_next_x = (top.x - Math.floor(top.x)) * dt_dx;
|
||||||
|
stepx = BlockStep.X_MINUS;
|
||||||
|
mxout = -1;
|
||||||
}
|
}
|
||||||
/* If perpendicular to Y axis */
|
/* If perpendicular to Y axis */
|
||||||
if (dy == 0) {
|
if (dy == 0) {
|
||||||
y_inc = 0;
|
y_inc = 0;
|
||||||
t_next_y = Double.MAX_VALUE;
|
t_next_y = Double.MAX_VALUE;
|
||||||
|
stepy = BlockStep.Y_PLUS;
|
||||||
|
myout = modscale;
|
||||||
}
|
}
|
||||||
/* If bottom is above top */
|
/* If bottom is above top */
|
||||||
else if (bottom.y > top.y) {
|
else if (bottom.y > top.y) {
|
||||||
y_inc = 1;
|
y_inc = 1;
|
||||||
n += (int) (Math.floor(bottom.y)) - y;
|
n += (int) (Math.floor(bottom.y)) - y;
|
||||||
t_next_y = (Math.floor(top.y) + 1 - top.y) * dt_dy;
|
t_next_y = (Math.floor(top.y) + 1 - top.y) * dt_dy;
|
||||||
|
stepy = BlockStep.Y_PLUS;
|
||||||
|
myout = modscale;
|
||||||
}
|
}
|
||||||
/* If top is above bottom */
|
/* If top is above bottom */
|
||||||
else {
|
else {
|
||||||
y_inc = -1;
|
y_inc = -1;
|
||||||
n += y - (int) (Math.floor(bottom.y));
|
n += y - (int) (Math.floor(bottom.y));
|
||||||
t_next_y = (top.y - Math.floor(top.y)) * dt_dy;
|
t_next_y = (top.y - Math.floor(top.y)) * dt_dy;
|
||||||
|
stepy = BlockStep.Y_MINUS;
|
||||||
|
myout = -1;
|
||||||
}
|
}
|
||||||
/* If perpendicular to Z axis */
|
/* If perpendicular to Z axis */
|
||||||
if (dz == 0) {
|
if (dz == 0) {
|
||||||
z_inc = 0;
|
z_inc = 0;
|
||||||
t_next_z = Double.MAX_VALUE;
|
t_next_z = Double.MAX_VALUE;
|
||||||
|
stepz = BlockStep.Z_PLUS;
|
||||||
|
mzout = modscale;
|
||||||
}
|
}
|
||||||
/* If bottom right of top */
|
/* If bottom right of top */
|
||||||
else if (bottom.z > top.z) {
|
else if (bottom.z > top.z) {
|
||||||
z_inc = 1;
|
z_inc = 1;
|
||||||
n += (int) (Math.floor(bottom.z)) - z;
|
n += (int) (Math.floor(bottom.z)) - z;
|
||||||
t_next_z = (Math.floor(top.z) + 1 - top.z) * dt_dz;
|
t_next_z = (Math.floor(top.z) + 1 - top.z) * dt_dz;
|
||||||
|
stepz = BlockStep.Z_PLUS;
|
||||||
|
mzout = modscale;
|
||||||
}
|
}
|
||||||
/* If bottom left of top */
|
/* If bottom left of top */
|
||||||
else {
|
else {
|
||||||
z_inc = -1;
|
z_inc = -1;
|
||||||
n += z - (int) (Math.floor(bottom.z));
|
n += z - (int) (Math.floor(bottom.z));
|
||||||
t_next_z = (top.z - Math.floor(top.z)) * dt_dz;
|
t_next_z = (top.z - Math.floor(top.z)) * dt_dz;
|
||||||
|
stepz = BlockStep.Z_MINUS;
|
||||||
|
mzout = -1;
|
||||||
}
|
}
|
||||||
/* Walk through scene */
|
/* Walk through scene */
|
||||||
laststep = BlockStep.Y_MINUS; /* Last step is down into map */
|
laststep = BlockStep.Y_MINUS; /* Last step is down into map */
|
||||||
@ -363,10 +386,29 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
|
|
||||||
return cd.ordinal();
|
return cd.ordinal();
|
||||||
}
|
}
|
||||||
|
private final boolean handleSubModel(short[] model, HDShaderState[] shaderstate, boolean[] shaderdone) {
|
||||||
|
boolean firststep = true;
|
||||||
|
|
||||||
|
while(!raytraceSubblock(model, firststep)) {
|
||||||
|
boolean done = true;
|
||||||
|
skylevel = emitlevel = -1;
|
||||||
|
for(int i = 0; i < shaderstate.length; i++) {
|
||||||
|
if(!shaderdone[i])
|
||||||
|
shaderdone[i] = shaderstate[i].processBlock(this);
|
||||||
|
done = done && shaderdone[i];
|
||||||
|
}
|
||||||
|
/* If all are done, we're out */
|
||||||
|
if(done)
|
||||||
|
return true;
|
||||||
|
nonairhit = true;
|
||||||
|
firststep = false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Process visit of ray to block
|
* Process visit of ray to block
|
||||||
*/
|
*/
|
||||||
private boolean visit_block(MapIterator mapiter, HDShaderState[] shaderstate, boolean[] shaderdone) {
|
private final boolean visit_block(MapIterator mapiter, HDShaderState[] shaderstate, boolean[] shaderdone) {
|
||||||
lastblocktypeid = blocktypeid;
|
lastblocktypeid = blocktypeid;
|
||||||
blocktypeid = mapiter.getBlockTypeID();
|
blocktypeid = mapiter.getBlockTypeID();
|
||||||
if(skiptoair) { /* If skipping until we see air */
|
if(skiptoair) { /* If skipping until we see air */
|
||||||
@ -374,33 +416,21 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
skiptoair = false;
|
skiptoair = false;
|
||||||
}
|
}
|
||||||
else if(nonairhit || (blocktypeid != 0)) {
|
else if(nonairhit || (blocktypeid != 0)) {
|
||||||
blockdata = mapiter.getBlockData();
|
switch(blocktypeid) {
|
||||||
if(blocktypeid == FENCE_BLKTYPEID) { /* Special case for fence - need to fake data so we can render properly */
|
case FENCE_BLKTYPEID: /* Special case for fence - need to fake data so we can render properly */
|
||||||
blockdata = generateFenceBlockData(mapiter);
|
blockdata = generateFenceBlockData(mapiter);
|
||||||
|
break;
|
||||||
|
case CHEST_BLKTYPEID: /* Special case for chest - need to fake data so we can render */
|
||||||
|
blockdata = generateChestBlockData(mapiter);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
blockdata = mapiter.getBlockData();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if(blocktypeid == CHEST_BLKTYPEID) { /* Special case for chest - need to fake data so we can render */
|
|
||||||
blockdata = generateChestBlockData(mapiter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Look up to see if block is modelled */
|
/* Look up to see if block is modelled */
|
||||||
short[] model = scalemodels.getScaledModel(blocktypeid, blockdata);
|
short[] model = scalemodels.getScaledModel(blocktypeid, blockdata);
|
||||||
if(model != null) {
|
if(model != null) {
|
||||||
boolean firststep = true;
|
return handleSubModel(model, shaderstate, shaderdone);
|
||||||
|
|
||||||
while(!raytraceSubblock(model, firststep)) {
|
|
||||||
boolean done = true;
|
|
||||||
skylevel = emitlevel = -1;
|
|
||||||
for(int i = 0; i < shaderstate.length; i++) {
|
|
||||||
if(!shaderdone[i])
|
|
||||||
shaderdone[i] = shaderstate[i].processBlock(this);
|
|
||||||
done = done && shaderdone[i];
|
|
||||||
}
|
|
||||||
/* If all are done, we're out */
|
|
||||||
if(done)
|
|
||||||
return true;
|
|
||||||
nonairhit = true;
|
|
||||||
firststep = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boolean done = true;
|
boolean done = true;
|
||||||
@ -437,12 +467,7 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
x += x_inc;
|
x += x_inc;
|
||||||
t = t_next_x;
|
t = t_next_x;
|
||||||
t_next_x += dt_dx;
|
t_next_x += dt_dx;
|
||||||
if(x_inc > 0) {
|
laststep = stepx;
|
||||||
laststep = BlockStep.X_PLUS;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
laststep = BlockStep.X_MINUS;
|
|
||||||
}
|
|
||||||
mapiter.stepPosition(laststep);
|
mapiter.stepPosition(laststep);
|
||||||
}
|
}
|
||||||
/* If Y step is next best */
|
/* If Y step is next best */
|
||||||
@ -450,30 +475,17 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
y += y_inc;
|
y += y_inc;
|
||||||
t = t_next_y;
|
t = t_next_y;
|
||||||
t_next_y += dt_dy;
|
t_next_y += dt_dy;
|
||||||
if(y_inc > 0) {
|
laststep = stepy;
|
||||||
laststep = BlockStep.Y_PLUS;
|
mapiter.stepPosition(laststep);
|
||||||
mapiter.stepPosition(laststep);
|
/* If outside 0-127 range */
|
||||||
if(mapiter.getY() > 127)
|
if((y & (~0x7F)) != 0) return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
laststep = BlockStep.Y_MINUS;
|
|
||||||
mapiter.stepPosition(laststep);
|
|
||||||
if(mapiter.getY() < 0)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Else, Z step is next best */
|
/* Else, Z step is next best */
|
||||||
else {
|
else {
|
||||||
z += z_inc;
|
z += z_inc;
|
||||||
t = t_next_z;
|
t = t_next_z;
|
||||||
t_next_z += dt_dz;
|
t_next_z += dt_dz;
|
||||||
if(z_inc > 0) {
|
laststep = stepz;
|
||||||
laststep = BlockStep.Z_PLUS;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
laststep = BlockStep.Z_MINUS;
|
|
||||||
}
|
|
||||||
mapiter.stepPosition(laststep);
|
mapiter.stepPosition(laststep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -531,56 +543,32 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
mx += x_inc;
|
mx += x_inc;
|
||||||
mt = mt_next_x;
|
mt = mt_next_x;
|
||||||
mt_next_x += mdt_dx;
|
mt_next_x += mdt_dx;
|
||||||
if(x_inc > 0) {
|
laststep = stepx;
|
||||||
laststep = BlockStep.X_PLUS;
|
if(mx == mxout)
|
||||||
if(mx >= modscale)
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
laststep = BlockStep.X_MINUS;
|
|
||||||
if(mx < 0)
|
|
||||||
//mx += modscale;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* If Y step is next best */
|
/* If Y step is next best */
|
||||||
else if((mt_next_y <= mt_next_x) && (mt_next_y <= mt_next_z)) {
|
else if((mt_next_y <= mt_next_x) && (mt_next_y <= mt_next_z)) {
|
||||||
my += y_inc;
|
my += y_inc;
|
||||||
mt = mt_next_y;
|
mt = mt_next_y;
|
||||||
mt_next_y += mdt_dy;
|
mt_next_y += mdt_dy;
|
||||||
if(y_inc > 0) {
|
laststep = stepy;
|
||||||
laststep = BlockStep.Y_PLUS;
|
if(my == myout)
|
||||||
if(my >= modscale)
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
laststep = BlockStep.Y_MINUS;
|
|
||||||
if(my < 0)
|
|
||||||
//my += modscale;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Else, Z step is next best */
|
/* Else, Z step is next best */
|
||||||
else {
|
else {
|
||||||
mz += z_inc;
|
mz += z_inc;
|
||||||
mt = mt_next_z;
|
mt = mt_next_z;
|
||||||
mt_next_z += mdt_dz;
|
mt_next_z += mdt_dz;
|
||||||
if(z_inc > 0) {
|
laststep = stepz;
|
||||||
laststep = BlockStep.Z_PLUS;
|
if(mz == mzout)
|
||||||
if(mz >= modscale)
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
laststep = BlockStep.Z_MINUS;
|
|
||||||
if(mz < 0)
|
|
||||||
//mz += modscale;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public int[] getSubblockCoord() {
|
public final int[] getSubblockCoord() {
|
||||||
double tt = t + 0.000001;
|
double tt = t + 0.000001;
|
||||||
if(subalpha >= 0)
|
if(subalpha >= 0)
|
||||||
tt = mt;
|
tt = mt;
|
||||||
|
@ -55,9 +55,10 @@ public class TexturePack {
|
|||||||
private static final String CUSTOMWATERFLOWING_PNG = "custom_water_flowing.png";
|
private static final String CUSTOMWATERFLOWING_PNG = "custom_water_flowing.png";
|
||||||
|
|
||||||
/* Color modifier codes (x1000 for value in mapping code) */
|
/* Color modifier codes (x1000 for value in mapping code) */
|
||||||
|
private static final int COLORMOD_NONE = 0;
|
||||||
private static final int COLORMOD_GRASSTONED = 1;
|
private static final int COLORMOD_GRASSTONED = 1;
|
||||||
private static final int COLORMOD_FOLIAGETONED = 2;
|
private static final int COLORMOD_FOLIAGETONED = 2;
|
||||||
// private static final int COLORMOD_WATERTONED = 3;
|
private static final int COLORMOD_WATERTONED = 3; /* Not used */
|
||||||
private static final int COLORMOD_ROT90 = 4;
|
private static final int COLORMOD_ROT90 = 4;
|
||||||
private static final int COLORMOD_ROT180 = 5;
|
private static final int COLORMOD_ROT180 = 5;
|
||||||
private static final int COLORMOD_ROT270 = 6;
|
private static final int COLORMOD_ROT270 = 6;
|
||||||
@ -703,7 +704,7 @@ public class TexturePack {
|
|||||||
/**
|
/**
|
||||||
* Read color for given subblock coordinate, with given block id and data and face
|
* Read color for given subblock coordinate, with given block id and data and face
|
||||||
*/
|
*/
|
||||||
public void readColor(HDPerspectiveState ps, MapIterator mapiter, Color rslt, int blkid, int lastblocktype, boolean biome_shaded) {
|
public final void readColor(final HDPerspectiveState ps, final MapIterator mapiter, final Color rslt, final int blkid, final int lastblocktype, final boolean biome_shaded) {
|
||||||
int blkdata = ps.getBlockData();
|
int blkdata = ps.getBlockData();
|
||||||
HDTextureMap map = HDTextureMap.getMap(blkid, blkdata);
|
HDTextureMap map = HDTextureMap.getMap(blkid, blkdata);
|
||||||
BlockStep laststep = ps.getLastBlockStep();
|
BlockStep laststep = ps.getLastBlockStep();
|
||||||
@ -749,80 +750,89 @@ public class TexturePack {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Handle U-V transorms before fetching color */
|
/* Handle U-V transorms before fetching color */
|
||||||
if(textop > 0) {
|
switch(textop) {
|
||||||
switch(textop) {
|
case COLORMOD_NONE:
|
||||||
case COLORMOD_ROT90:
|
case COLORMOD_GRASSTONED:
|
||||||
tmp = u; u = native_scale - v - 1; v = tmp;
|
case COLORMOD_FOLIAGETONED:
|
||||||
break;
|
case COLORMOD_WATERTONED:
|
||||||
case COLORMOD_ROT180:
|
break;
|
||||||
u = native_scale - u - 1; v = native_scale - v - 1;
|
case COLORMOD_ROT90:
|
||||||
break;
|
tmp = u; u = native_scale - v - 1; v = tmp;
|
||||||
case COLORMOD_ROT270:
|
break;
|
||||||
tmp = u; u = v; v = native_scale - tmp - 1;
|
case COLORMOD_ROT180:
|
||||||
break;
|
u = native_scale - u - 1; v = native_scale - v - 1;
|
||||||
case COLORMOD_FLIPHORIZ:
|
break;
|
||||||
u = native_scale - u - 1;
|
case COLORMOD_ROT270:
|
||||||
break;
|
tmp = u; u = v; v = native_scale - tmp - 1;
|
||||||
case COLORMOD_SHIFTDOWNHALF:
|
break;
|
||||||
case COLORMOD_SHIFTDOWNHALFANDFLIPHORIZ:
|
case COLORMOD_FLIPHORIZ:
|
||||||
if(v < native_scale/2) {
|
u = native_scale - u - 1;
|
||||||
rslt.setTransparent();
|
break;
|
||||||
return;
|
case COLORMOD_SHIFTDOWNHALF:
|
||||||
|
if(v < native_scale/2) {
|
||||||
|
rslt.setTransparent();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
v -= native_scale/2;
|
||||||
|
break;
|
||||||
|
case COLORMOD_SHIFTDOWNHALFANDFLIPHORIZ:
|
||||||
|
if(v < native_scale/2) {
|
||||||
|
rslt.setTransparent();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
v -= native_scale/2;
|
||||||
|
u = native_scale - u - 1;
|
||||||
|
break;
|
||||||
|
case COLORMOD_INCLINEDTORCH:
|
||||||
|
if(v >= (3*native_scale/4)) {
|
||||||
|
rslt.setTransparent();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
v += native_scale/4;
|
||||||
|
if(u < native_scale/2) u = native_scale/2-1;
|
||||||
|
if(u > native_scale/2) u = native_scale/2;
|
||||||
|
break;
|
||||||
|
case COLORMOD_GRASSSIDE:
|
||||||
|
/* Check if snow above block */
|
||||||
|
if(mapiter.getBlockTypeIDAt(BlockStep.Y_PLUS) == 78) {
|
||||||
|
texture = terrain_argb[68]; /* Snow block */
|
||||||
|
textid = 68;
|
||||||
|
}
|
||||||
|
else { /* Else, check the grass color overlay */
|
||||||
|
int ovclr = terrain_argb[38][v*native_scale+u];
|
||||||
|
if((ovclr & 0xFF000000) != 0) { /* Hit? */
|
||||||
|
texture = terrain_argb[38]; /* Use it */
|
||||||
|
textop = COLORMOD_GRASSTONED; /* Force grass toning */
|
||||||
}
|
}
|
||||||
v -= native_scale/2;
|
}
|
||||||
if(textop == COLORMOD_SHIFTDOWNHALFANDFLIPHORIZ)
|
break;
|
||||||
u = native_scale - u - 1;
|
case COLORMOD_CLEARINSIDE:
|
||||||
break;
|
break;
|
||||||
case COLORMOD_INCLINEDTORCH:
|
|
||||||
if(v >= (3*native_scale/4)) {
|
|
||||||
rslt.setTransparent();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
v += native_scale/4;
|
|
||||||
if(u < native_scale/2) u = native_scale/2-1;
|
|
||||||
if(u > native_scale/2) u = native_scale/2;
|
|
||||||
break;
|
|
||||||
case COLORMOD_GRASSSIDE:
|
|
||||||
/* Check if snow above block */
|
|
||||||
if(mapiter.getBlockTypeIDAt(BlockStep.Y_PLUS) == 78) {
|
|
||||||
texture = terrain_argb[68]; /* Snow block */
|
|
||||||
textid = 68;
|
|
||||||
}
|
|
||||||
else { /* Else, check the grass color overlay */
|
|
||||||
int ovclr = terrain_argb[38][v*native_scale+u];
|
|
||||||
if((ovclr & 0xFF000000) != 0) { /* Hit? */
|
|
||||||
texture = terrain_argb[38]; /* Use it */
|
|
||||||
textop = COLORMOD_GRASSTONED; /* Force grass toning */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* Read color from texture */
|
/* Read color from texture */
|
||||||
rslt.setARGB(texture[v*native_scale + u]);
|
rslt.setARGB(texture[v*native_scale + u]);
|
||||||
if(textop > 0) {
|
|
||||||
LoadedImage li;
|
LoadedImage li;
|
||||||
/* Switch based on texture modifier */
|
/* Switch based on texture modifier */
|
||||||
switch(textop) {
|
switch(textop) {
|
||||||
case COLORMOD_GRASSTONED:
|
case COLORMOD_GRASSTONED:
|
||||||
li = imgs[IMG_GRASSCOLOR];
|
li = imgs[IMG_GRASSCOLOR];
|
||||||
if((li.argb == null) || (!biome_shaded)) {
|
if((li.argb == null) || (!biome_shaded)) {
|
||||||
rslt.blendColor(li.trivial_color);
|
rslt.blendColor(li.trivial_color);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rslt.blendColor(biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature()));
|
rslt.blendColor(biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COLORMOD_FOLIAGETONED:
|
case COLORMOD_FOLIAGETONED:
|
||||||
li = imgs[IMG_FOLIAGECOLOR];
|
li = imgs[IMG_FOLIAGECOLOR];
|
||||||
if((li.argb == null) || (!biome_shaded)) {
|
if((li.argb == null) || (!biome_shaded)) {
|
||||||
rslt.blendColor(li.trivial_color);
|
rslt.blendColor(li.trivial_color);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rslt.blendColor(biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature()));
|
rslt.blendColor(biomeLookup(li.argb, li.width, mapiter.getRawBiomeRainfall(), mapiter.getRawBiomeTemperature()));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user