Fixed text rendering, added more conditions to recalculate lighting.
This commit is contained in:
parent
4f9cb191c4
commit
7ffa6c1023
|
|
@ -136,7 +136,7 @@ public class EntityPlayer extends Entity implements EntityAlive, EntityInventory
|
||||||
{
|
{
|
||||||
chunk = layer.getChunk(pos);
|
chunk = layer.getChunk(pos);
|
||||||
|
|
||||||
if(chunk != null && (last_chunk == null || !chunk.c_pos.equal(last_chunk))) {
|
if(chunk != null && chunk.c_pos != null && (last_chunk == null || !chunk.c_pos.equal(last_chunk))) {
|
||||||
last_chunk = chunk.c_pos;
|
last_chunk = chunk.c_pos;
|
||||||
TileLighting.setDirty();
|
TileLighting.setDirty();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
package projectzombie.menu.gui;
|
package projectzombie.menu.gui;
|
||||||
|
|
||||||
|
import gl_engine.matrix.Matrix4;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec3d;
|
import gl_engine.vec.Vec3d;
|
||||||
|
import projectzombie.text.Text;
|
||||||
|
|
||||||
public class Label implements GUIComponent
|
public class Label implements GUIComponent
|
||||||
{
|
{
|
||||||
|
|
@ -32,7 +34,27 @@ public class Label implements GUIComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d mousePos) {
|
public void render(Vec2d mousePos)
|
||||||
|
{
|
||||||
|
double off = 0;
|
||||||
|
|
||||||
|
switch(alignment)
|
||||||
|
{
|
||||||
|
case LEFT:
|
||||||
|
off = size.x * text.length();
|
||||||
|
break;
|
||||||
|
case CENTRE:
|
||||||
|
off = size.x * text.length() / 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Matrix4 matrix = Matrix4.identity();
|
||||||
|
matrix = Matrix4.multiply(matrix, Matrix4.scale(new Vec3d(size, 1)));
|
||||||
|
matrix = Matrix4.multiply(matrix, Matrix4.translate(pos.x - off, pos.y, 1));
|
||||||
|
|
||||||
|
Text.render(text, matrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ public class LayerGenLavaCaves extends LayerGen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ColorRange getLightLevel() {
|
public ColorRange getLightLevel() {
|
||||||
return new ColorRange(new Vec3d(0, 0, 0), new Vec3d(0.06, 0, 0));
|
return new ColorRange(new Vec3d(0, 0, 0), new Vec3d(0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,6 @@ uniform int time;
|
||||||
|
|
||||||
uniform vec3 lighting_day_low;
|
uniform vec3 lighting_day_low;
|
||||||
uniform vec3 lighting_day_high;
|
uniform vec3 lighting_day_high;
|
||||||
uniform vec3 lighting_src_low;
|
|
||||||
uniform vec3 lighting_src_high;
|
|
||||||
|
|
||||||
uniform vec2 lightmap_offset;
|
uniform vec2 lightmap_offset;
|
||||||
uniform vec2 lightmap_size;
|
uniform vec2 lightmap_size;
|
||||||
|
|
@ -86,7 +84,7 @@ void main()
|
||||||
map(floor(pos.z), lightmap_offset.y, lightmap_offset.y + lightmap_size.y, 0, 1)));
|
map(floor(pos.z), lightmap_offset.y, lightmap_offset.y + lightmap_size.y, 0, 1)));
|
||||||
|
|
||||||
vec3 light_day = mapVec(light.r, 0, 1, lighting_day_low, lighting_day_high);
|
vec3 light_day = mapVec(light.r, 0, 1, lighting_day_low, lighting_day_high);
|
||||||
vec3 light_src = mapVec(light.g, 0, 1, lighting_src_low, lighting_src_high);
|
vec3 light_src = vec3(1, 1, 1) * light.g;
|
||||||
|
|
||||||
pLighting = biggest(light_day, light_src);
|
pLighting = biggest(light_day, light_src);
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue