improve rendering, fix lightmap
This commit is contained in:
parent
ec9173433e
commit
0e003971bc
4 changed files with 15 additions and 13 deletions
|
@ -3724,7 +3724,7 @@ public class Renderer {
|
|||
double d0 = (double)blockPosIn.getX();
|
||||
double d1 = (double)blockPosIn.getY();
|
||||
double d2 = (double)blockPosIn.getZ();
|
||||
float f11 = 0.001F;
|
||||
float f11 = 0.0F;
|
||||
|
||||
if (up)
|
||||
{
|
||||
|
|
|
@ -72,35 +72,37 @@ vec4 pcf_sample(sampler2D stex, vec2 pos) {
|
|||
*/
|
||||
|
||||
vec3 calc_dir_light(vec3 norm, vec3 dir, vec3 rgb, vec3 direction, vec3 color) {
|
||||
if(shine <= -2.0)
|
||||
return color * rgb;
|
||||
vec3 ldir = normalize(-direction);
|
||||
float diff = max(dot(norm, ldir), 0.0);
|
||||
vec3 rdir = reflect(-ldir, norm);
|
||||
float spec = pow(max(dot(dir, rdir), 0.0), shine);
|
||||
vec3 ambient = color * rgb + clamp(vec3(0.0), 0.0, 1.0);
|
||||
float spec = shine <= 0.0 ? 0.0 : pow(max(dot(dir, rdir), 0.0), shine) * (shine < 1.0 ? shine : 1.0);
|
||||
vec3 ambient = color * rgb; // + clamp(vec3(0.0), 0.0, 1.0);
|
||||
vec3 diffuse = color * 0.125 * diff * rgb;
|
||||
vec3 specular = color * 1.25 * spec * specular * rgb;
|
||||
return (ambient + diffuse + specular);
|
||||
vec3 speculars = color * 1.25 * spec * specular * rgb;
|
||||
return (ambient + diffuse + speculars);
|
||||
}
|
||||
|
||||
vec3 calc_point_light(light_t light, vec3 norm, vec3 dir, vec3 rgb) {
|
||||
rgb = clamp(rgb + light_factor, 0.0, 1.0);
|
||||
vec3 ldir = normalize(light.position.xyz - vertex);
|
||||
float diff = max(dot(norm, ldir), 0.0);
|
||||
float diff = shine <= -3.0 ? 0.0 : max(dot(norm, ldir), 0.0);
|
||||
vec3 rdir = reflect(-ldir, norm);
|
||||
float spec = pow(max(dot(dir, rdir), 0.0), shine);
|
||||
float spec = shine <= -1.0 ? 0.0 : pow(max(dot(dir, rdir), 0.0), shine) * (shine < 1.0 ? shine : 1.0);
|
||||
float distance = length((light.position.xyz - vertex) / light.range.xyz);
|
||||
float attenuation = 1.0 / (light.ambient.w + light.diffuse.w * distance + light.specular.w * (distance * distance));
|
||||
vec3 ambient = light.ambient.xyz * rgb;
|
||||
vec3 diffuse = light.diffuse.xyz * diff * rgb;
|
||||
vec3 specular = light.specular.xyz * spec * specular * rgb;
|
||||
vec3 speculars = light.specular.xyz * spec * specular * rgb;
|
||||
ambient *= attenuation;
|
||||
diffuse *= attenuation;
|
||||
specular *= attenuation;
|
||||
return (ambient + diffuse + specular);
|
||||
speculars *= attenuation;
|
||||
return (ambient + diffuse + speculars);
|
||||
}
|
||||
|
||||
void main() {
|
||||
if(shine <= 0.0) {
|
||||
if(shine <= -16.0) {
|
||||
vec2 coord = fract(tex_coord * textureSize(tex, 0) / 256.0) * vis_div; // vertex.xz + vec2(0.25, 0.5)) * 24.0 / 2.0;
|
||||
vec2 shift = vec2(v2rand(coord + fract(time)) * 2.0 - 1.0, v2rand(coord + 0.5 + fract(time)) * 2.0 - 1.0);
|
||||
shift = vec2(dgauss(shift.x, 0.0, 1.0), dgauss(shift.y, 0.0, 1.0)) * 0.015;
|
||||
|
|
|
@ -1066,7 +1066,7 @@ public class Block {
|
|||
|
||||
@Clientside
|
||||
public float getShinyness() {
|
||||
return 1.0f;
|
||||
return 0.75f;
|
||||
}
|
||||
|
||||
@Clientside
|
||||
|
|
|
@ -17,6 +17,6 @@ public class BlockCyber extends BlockNonBlock {
|
|||
|
||||
@Clientside
|
||||
public float getShinyness() {
|
||||
return 0.0f;
|
||||
return -32.0f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue