add visuals
This commit is contained in:
parent
1bf4578ad8
commit
220a8432ef
13 changed files with 81 additions and 93 deletions
|
@ -707,9 +707,9 @@ public class Client implements IThreadListener {
|
|||
|
||||
@Variable(name = "gl_light_blend", category = CVarCategory.RENDER, min = 0.0f, max = 1.0f, precision = 2, unit = "%", display = "Lichtüberdeckung")
|
||||
public float lightBlend = 0.5f;
|
||||
@Variable(name = "gl_dynlight_maxdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Lichtq. -> Mitte")
|
||||
@Variable(name = "gl_dynlight_maxdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Lichtquelle")
|
||||
public float lightDistVert = 128.0f;
|
||||
@Variable(name = "gl_dynlight_viewdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Lichtq. -> Kamera")
|
||||
@Variable(name = "gl_dynlight_viewdist", category = CVarCategory.RENDER, min = 1.0f, max = 10000.0f, display = "Entfernung Licht Kamera")
|
||||
public float lightDistCam = 256.0f;
|
||||
|
||||
@Variable(name = "gl_dynlight_max", category = CVarCategory.RENDER, min = 0, max = 112, display = "Max. Dyn. Lichtquellen", callback = MaxLightFunction.class)
|
||||
|
@ -864,6 +864,7 @@ public class Client implements IThreadListener {
|
|||
this.renderItem.onReload();
|
||||
this.renderer.cacheSprites();
|
||||
EntityTexManager.loadNpcTextures();
|
||||
this.updateTexture();
|
||||
this.renderer.loadRenderers();
|
||||
this.logFeed("Texturen wurden neu geladen");
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ public enum Shader {
|
|||
context.vec("screen", (float)Client.CLIENT.fbRawX, (float)Client.CLIENT.fbRawY);
|
||||
context.matrix("view", MatrixState.getModelView());
|
||||
context.matrix("projection", MatrixState.getProjection());
|
||||
context.vec("time", (float)Util.ftime());
|
||||
|
||||
float angle = -90.0f + Client.CLIENT.world.getCelestialAngle(Client.CLIENT.getTickFraction());
|
||||
|
||||
|
@ -64,15 +65,6 @@ public enum Shader {
|
|||
VIS("vis", "vis", null, context -> {
|
||||
context.matrix("view", MatrixState.getModelView());
|
||||
context.matrix("projection", MatrixState.getProjection());
|
||||
}),
|
||||
|
||||
GRID("grid", "grid", null, context -> {
|
||||
context.vec("clip_near", Client.CLIENT.renderer.getNearPlane());
|
||||
context.vec("clip_far", Client.CLIENT.renderer.getFarPlane());
|
||||
context.vec("screen", (float)Client.CLIENT.fbRawX, (float)Client.CLIENT.fbRawY);
|
||||
context.matrix("view", MatrixState.getModelView());
|
||||
context.matrix("projection", MatrixState.getProjection());
|
||||
context.vec("time", (float)Util.ftime());
|
||||
});
|
||||
|
||||
// BLIT("blit", "blit", context -> context.integer("tex", 0), context -> {
|
||||
|
|
|
@ -112,20 +112,14 @@ public class TextureUtil
|
|||
return img;
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
int i = -16777216;
|
||||
int j = -524040;
|
||||
int[] aint = new int[] { -524040, -524040, -524040, -524040, -524040, -524040, -524040, -524040};
|
||||
int[] aint1 = new int[] { -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216};
|
||||
int k = aint.length;
|
||||
|
||||
for (int l = 0; l < 16; ++l)
|
||||
{
|
||||
System.arraycopy(l < k ? aint : aint1, 0, MISSING_DATA, 16 * l, k);
|
||||
System.arraycopy(l < k ? aint1 : aint, 0, MISSING_DATA, 16 * l + k, k);
|
||||
}
|
||||
|
||||
MISSING.updateTexture();
|
||||
}
|
||||
static {
|
||||
int color1 = 0xff000000;
|
||||
int color2 = 0xffff00ff;
|
||||
for(int x = 0; x < 16; x++) {
|
||||
for(int y = 0; y < 16; y++) {
|
||||
MISSING_DATA[y * 16 + x] = ((x >> 1 & 1) ^ (y >> 1 & 1)) == 0 ? color1 : color2;
|
||||
}
|
||||
}
|
||||
MISSING.updateTexture();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
out vec4 FragColor;
|
||||
|
||||
in vec3 vertex;
|
||||
in vec2 tex_coord;
|
||||
|
||||
uniform float time;
|
||||
|
||||
#define GLM_PI 3.14159265358979323846264338327950288
|
||||
#define GLM_SQRT2 1.41421356237309504880168872420969808
|
||||
#define vis_div 24.0
|
||||
|
||||
float v2rand(vec2 uv) {
|
||||
return fract(sin(dot(uv, vec2(12.9898,78.233))) * 43758.5453123);
|
||||
}
|
||||
|
||||
float avg(vec4 v) {
|
||||
return ((v.r + v.g + v.b) / 3.0) * v.a;
|
||||
}
|
||||
|
||||
float gauss(float v, float b, float c) {
|
||||
return (1.0 / (c * sqrt(2.0 * GLM_PI))) * exp(-(pow(v - b, 2.0) / (2.0 * pow(c, 2.0))));
|
||||
}
|
||||
|
||||
float dgauss(float v, float b, float c) {
|
||||
return b + v * c;
|
||||
}
|
||||
|
||||
float inside(vec2 vec, vec2 offs, float a, float b, float scale, float x1, float x2, float y1, float y2) {
|
||||
vec2 cscaled = (mod(vec + offs + 1.0, 1.0)) * scale;
|
||||
return (x2 < x1 ? (cscaled.x >= x1 || cscaled.x <= x2) : (cscaled.x >= x1 && cscaled.x <= x2)) || (y2 < y1 ? (cscaled.y >= y1 || cscaled.y <= y2) : (cscaled.y >= y1 && cscaled.y <= y2)) || (abs(cscaled.y - (cscaled.x - (x2 < x1 ? (x1 - x2) : (x2 - x1)) * GLM_SQRT2 * (x2 < x1 ? 0.0 : (x1 < scale / 2.0 ? x1 : (x2 - scale))))) < GLM_SQRT2) ? b : a;
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 coord = vec2(vertex.x, vertex.z) * 16.0f;
|
||||
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;
|
||||
vec3 cl = vec3(inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 1.0, 3.0, 1.0, 3.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 63.0, 1.0, 63.0, 1.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 61.0, 63.0, 61.0, 63.0));
|
||||
FragColor = vec4(mix(vec3(0.0, 0.0, clamp(0.1 + 0.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0)), cl, clamp(cl.x + cl.y + cl.z, 0.0, 1.0)), 1.0);
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
layout (location = 0) in vec3 pos;
|
||||
layout (location = 1) in vec4 color;
|
||||
layout (location = 2) in vec2 coord;
|
||||
layout (location = 3) in vec2 light;
|
||||
|
||||
out vec3 vertex;
|
||||
out vec2 tex_coord;
|
||||
|
||||
uniform mat4 model;
|
||||
uniform mat4 view;
|
||||
uniform mat4 projection;
|
||||
uniform vec3 offset;
|
||||
|
||||
void main() {
|
||||
vertex = vec3(model * vec4(pos, 1.0));
|
||||
tex_coord = coord;
|
||||
gl_Position = projection * view * vec4(offset + vertex, 1.0);
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
#define GLM_PI 3.14159265358979323846264338327950288
|
||||
#define GLM_SQRT2 1.41421356237309504880168872420969808
|
||||
#define vis_div 24.0
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
struct light_t {
|
||||
|
@ -27,10 +31,32 @@ uniform vec3 moon_ambient;
|
|||
uniform int n_lights;
|
||||
uniform bool sky_light;
|
||||
uniform bool moon_light;
|
||||
uniform float time;
|
||||
uniform light_block {
|
||||
light_t lights[MAX_LIGHTS];
|
||||
};
|
||||
|
||||
float v2rand(vec2 uv) {
|
||||
return fract(sin(dot(uv, vec2(12.9898,78.233))) * 43758.5453123);
|
||||
}
|
||||
|
||||
float avg(vec4 v) {
|
||||
return ((v.r + v.g + v.b) / 3.0) * v.a;
|
||||
}
|
||||
|
||||
float gauss(float v, float b, float c) {
|
||||
return (1.0 / (c * sqrt(2.0 * GLM_PI))) * exp(-(pow(v - b, 2.0) / (2.0 * pow(c, 2.0))));
|
||||
}
|
||||
|
||||
float dgauss(float v, float b, float c) {
|
||||
return b + v * c;
|
||||
}
|
||||
|
||||
float inside(vec2 vec, vec2 offs, float a, float b, float scale, float x1, float x2, float y1, float y2) {
|
||||
vec2 cscaled = (mod(vec + offs + 1.0, 1.0)) * scale;
|
||||
return (x2 < x1 ? (cscaled.x >= x1 || cscaled.x <= x2) : (cscaled.x >= x1 && cscaled.x <= x2)) || (y2 < y1 ? (cscaled.y >= y1 || cscaled.y <= y2) : (cscaled.y >= y1 && cscaled.y <= y2)) || (abs(cscaled.y - (cscaled.x - (x2 < x1 ? (x1 - x2) : (x2 - x1)) * GLM_SQRT2 * (x2 < x1 ? 0.0 : (x1 < scale / 2.0 ? x1 : (x2 - scale))))) < GLM_SQRT2) ? b : a;
|
||||
}
|
||||
|
||||
/*
|
||||
vec4 pcf_sample(sampler2D stex, vec2 pos) {
|
||||
vec4 avg = vec4(0.0);
|
||||
|
@ -73,12 +99,21 @@ vec3 calc_point_light(light_t light, vec3 norm, vec3 dir, vec3 rgb) {
|
|||
}
|
||||
|
||||
void main() {
|
||||
if(shine <= 0.0) {
|
||||
vec2 coord = fract(tex_coord * 2.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;
|
||||
vec3 cl = vec3(inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 1.0, 3.0, 1.0, 3.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 63.0, 1.0, 63.0, 1.0), inside(coord / vis_div, shift, 0.0, 1.0, 64.0, 61.0, 63.0, 61.0, 63.0));
|
||||
FragColor = vec4(mix(vec3(0.0, 0.0, clamp(0.1 + 0.2 * (vertex.y + 64.0) / 128.0, 0.0, 1.0)), cl, clamp(cl.x + cl.y + cl.z, 0.0, 1.0)), 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec3 norm = normalize(normal);
|
||||
vec3 dir = normalize(cam_pos - vertex);
|
||||
vec4 texel = texture(tex, tex_coord);
|
||||
float sky = sky_light ? vertex.y < 0.0 ? 0.0 : (vertex.y < 64.0 ? vertex.y / 64.0 : 1.0) : 1.0;
|
||||
vec3 rgb = texel.rgb;
|
||||
vec3 direct = rgb * sky * (1.0 - light_color.a * 0.5);
|
||||
vec3 direct = rgb * sky * (1.0 - light_color.a * light_factor);
|
||||
vec3 result = rgb * light_color.rgb + calc_dir_light(norm, dir, direct, sun_direction, sun_ambient);
|
||||
if(moon_light)
|
||||
result += calc_dir_light(norm, dir, direct, moon_direction, moon_ambient);
|
||||
|
|
BIN
client/src/main/resources/textures/blocks/cyber.png
Normal file
BIN
client/src/main/resources/textures/blocks/cyber.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 330 KiB |
|
@ -3,7 +3,6 @@ package common.block.artificial;
|
|||
import common.block.Material;
|
||||
import common.item.CheatTab;
|
||||
import common.properties.Property;
|
||||
import common.util.Clientside;
|
||||
import common.util.Color;
|
||||
|
||||
public class BlockStainedGlassPane extends BlockPane
|
||||
|
@ -41,9 +40,4 @@ public class BlockStainedGlassPane extends BlockPane
|
|||
protected String getPaneEdge() {
|
||||
return this.color.getName() + "_glass_pane";
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public float getShinyness() {
|
||||
return 16.0f;
|
||||
}
|
||||
}
|
||||
|
|
23
common/src/main/java/common/block/natural/BlockCyber.java
Normal file
23
common/src/main/java/common/block/natural/BlockCyber.java
Normal file
|
@ -0,0 +1,23 @@
|
|||
package common.block.natural;
|
||||
|
||||
import common.block.Block;
|
||||
import common.block.Material;
|
||||
import common.block.SoundType;
|
||||
import common.item.CheatTab;
|
||||
import common.util.Clientside;
|
||||
|
||||
public class BlockCyber extends Block {
|
||||
public BlockCyber() {
|
||||
super(Material.SOLID);
|
||||
this.setTab(CheatTab.ROCK);
|
||||
this.setHardness(1.25F);
|
||||
this.setResistance(7.0F);
|
||||
this.setSound(SoundType.STONE);
|
||||
this.setDisplay("CYBER");
|
||||
}
|
||||
|
||||
@Clientside
|
||||
public float getShinyness() {
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
|
@ -159,6 +159,7 @@ public abstract class BlockRegistry {
|
|||
colored_clay[color.ordinal()] = register(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F)
|
||||
.setSound(SoundType.STONE).setDisplay(color.getDisplay() + " gefärbter Ton"));
|
||||
}
|
||||
register("cyber", new BlockCyber());
|
||||
register("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Sand").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
|
||||
register("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Roter Sand").setMiningTool(Equipment.SHOVEL).setTab(CheatTab.NATURE));
|
||||
register("gravel", (new BlockGravel()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Kies").setMiningTool(Equipment.SHOVEL));
|
||||
|
|
|
@ -869,6 +869,7 @@ public abstract class Blocks {
|
|||
public static final BlockFurnace titanium_furnace = get("titanium_furnace");
|
||||
public static final BlockItemPipe pipe = get("pipe");
|
||||
public static final BlockSuctionPipe suction_pipe = get("suction_pipe");
|
||||
public static final BlockCyber cyber = get("cyber");
|
||||
|
||||
private static <T extends Block> T get(String id) {
|
||||
T block = (T)BlockRegistry.byNameExact(id);
|
||||
|
|
|
@ -1702,6 +1702,7 @@ public abstract class Items {
|
|||
public static final ItemTool zinc_shears = get("zinc_shears");
|
||||
public static final ItemTool zinc_shovel = get("zinc_shovel");
|
||||
public static final ItemTool zinc_sword = get("zinc_sword");
|
||||
public static final Item cyber = get("cyber");
|
||||
|
||||
private static <T extends Item> T get(String id) {
|
||||
T item = (T)ItemRegistry.byName(id);
|
||||
|
|
|
@ -64,6 +64,7 @@ import server.worldgen.component.FeatureDungeons;
|
|||
import server.worldgen.generator.GeneratorCavern;
|
||||
import server.worldgen.generator.GeneratorFlat;
|
||||
import server.worldgen.generator.GeneratorPerlin;
|
||||
import server.worldgen.generator.GeneratorSettings;
|
||||
import server.worldgen.generator.GeneratorSimple;
|
||||
import server.worldgen.layer.Biome;
|
||||
import server.worldgen.layer.BiomeGenerator;
|
||||
|
@ -760,8 +761,10 @@ public abstract class UniverseRegistry extends DimensionRegistry {
|
|||
.addSpawn(EntityMouse.class, 10, 8, 8));
|
||||
});
|
||||
registerDomain("Digital", () -> {
|
||||
registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15, Blocks.dark_green_clay.getState(), Blocks.air.getState(), 2).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction(),
|
||||
new GeneratorData().setGenerator(new GeneratorFlat()));
|
||||
GeneratorSettings settings = new GeneratorSettings();
|
||||
settings.stretchY = 48.0f;
|
||||
registerArea("Cyberspace", new Area(0x000000, 16777216, 293.15f, 15, Blocks.cyber.getState(), Blocks.air.getState(), 63).setLightColor(0x00ff00).setBlockColor(0xff0000).enableBlockLightSubtraction(),
|
||||
new GeneratorData().setGenerator(new GeneratorPerlin(false, settings, 0.1f, 3.5f)));
|
||||
});
|
||||
registerDomain("hell", "Hölle", () -> {
|
||||
registerArea("thedric", "Kreis Thedric", new Area(0x330707, 105639735, 347.15f, 2, Blocks.hellrock.getState(), Blocks.lava.getState(), 63).enableDenseFog(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue