mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-15 02:07:53 +07:00
Fixed positions jumping with shader zoom-out
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
precision mediump float;
|
precision highp float;
|
||||||
precision mediump int;
|
precision mediump int;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -72,14 +72,17 @@ void main() {
|
|||||||
color = old;
|
color = old;
|
||||||
}
|
}
|
||||||
|
|
||||||
float n1 = snoise(coords / 20.0 + vec2(time) / 250.0);
|
const float bs = 1.0;
|
||||||
float n2 = snoise((coords + vec2(632.0)) / 9.0 + vec2(0.0, -time) / 220.0);
|
|
||||||
|
|
||||||
float r = (n1 + n2) / 2.0;
|
float n1 = snoise(coords / (20.0 * bs) + vec2(time) / 250.0);
|
||||||
|
float n2 = snoise((coords + vec2(632.0)) / (9.0 * bs) + vec2(0.0, -time) / 220.0);
|
||||||
|
float n3 = snoise((coords + vec2(2233.0)) / (15.0 * bs) + vec2(time, 0.0) / 290.0);
|
||||||
|
|
||||||
if(r < -0.6){
|
float r = (n1 + n2 + n3) / 3.0;
|
||||||
|
|
||||||
|
if(r < -0.5){
|
||||||
color = s2;
|
color = s2;
|
||||||
}else if(r < -0.2 && r > -0.6){
|
}else if(r < -0.2){
|
||||||
color = s1;
|
color = s1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
precision mediump float;
|
precision highp float;
|
||||||
precision mediump int;
|
precision mediump int;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ void main() {
|
|||||||
float r = (n1 + n2) / 2.0;
|
float r = (n1 + n2) / 2.0;
|
||||||
|
|
||||||
if(r < -0.3 && r > -0.6){
|
if(r < -0.3 && r > -0.6){
|
||||||
color *= 1.3;
|
color *= 1.4;
|
||||||
color.a = 1.0;
|
color.a = 1.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#ifdef GL_ES
|
#ifdef GL_ES
|
||||||
precision mediump float;
|
precision highp float;
|
||||||
precision mediump int;
|
precision mediump int;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#Autogenerated file. Do not modify.
|
#Autogenerated file. Do not modify.
|
||||||
#Wed Mar 14 12:49:40 EDT 2018
|
#Wed Mar 14 14:12:06 EDT 2018
|
||||||
version=release
|
version=release
|
||||||
androidBuildCode=491
|
androidBuildCode=496
|
||||||
name=Mindustry
|
name=Mindustry
|
||||||
code=3.4
|
code=3.4
|
||||||
build=custom build
|
build=custom build
|
||||||
|
@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.Color;
|
|||||||
import com.badlogic.gdx.math.Vector2;
|
import com.badlogic.gdx.math.Vector2;
|
||||||
import com.badlogic.gdx.utils.FloatArray;
|
import com.badlogic.gdx.utils.FloatArray;
|
||||||
import io.anuke.ucore.core.Core;
|
import io.anuke.ucore.core.Core;
|
||||||
import io.anuke.ucore.core.Settings;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
import io.anuke.ucore.core.Timers;
|
||||||
import io.anuke.ucore.graphics.Shader;
|
import io.anuke.ucore.graphics.Shader;
|
||||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||||
@ -46,7 +45,6 @@ public class Shaders{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(){
|
public void apply(){
|
||||||
float scale = Settings.getBool("pixelate") ? 1 : Core.cameraScale / Core.camera.zoom;
|
|
||||||
float scaling = Core.cameraScale / 4f / Core.camera.zoom;
|
float scaling = Core.cameraScale / 4f / Core.camera.zoom;
|
||||||
if(hits.size > 0){
|
if(hits.size > 0){
|
||||||
shader.setUniform3fv("u_hits[0]", hits.items, 0, Math.min(hits.size, MAX_HITS));
|
shader.setUniform3fv("u_hits[0]", hits.items, 0, Math.min(hits.size, MAX_HITS));
|
||||||
@ -56,9 +54,11 @@ public class Shaders{
|
|||||||
shader.setUniformf("u_color", color);
|
shader.setUniformf("u_color", color);
|
||||||
shader.setUniformf("u_time", Timers.time() / Unit.dp.scl(1f));
|
shader.setUniformf("u_time", Timers.time() / Unit.dp.scl(1f));
|
||||||
shader.setUniformf("u_scaling", scaling);
|
shader.setUniformf("u_scaling", scaling);
|
||||||
shader.setUniformf("u_offset", vec.set(Core.camera.position.x, Core.camera.position.y));
|
shader.setUniformf("u_offset",
|
||||||
shader.setUniformf("u_texsize", vec.set(region.getTexture().getWidth() / scale,
|
Core.camera.position.x - Core.camera.viewportWidth/2 * Core.camera.zoom,
|
||||||
region.getTexture().getHeight() / scale));
|
Core.camera.position.y - Core.camera.viewportHeight/2 * Core.camera.zoom);
|
||||||
|
shader.setUniformf("u_texsize", Gdx.graphics.getWidth() / Core.cameraScale * Core.camera.zoom,
|
||||||
|
Gdx.graphics.getHeight() / Core.cameraScale * Core.camera.zoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +70,9 @@ public class Shaders{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(){
|
public void apply(){
|
||||||
shader.setUniformf("camerapos", Core.camera.position.x + Core.camera.zoom, Core.camera.position.y);
|
shader.setUniformf("camerapos",
|
||||||
|
Core.camera.position.x - Core.camera.viewportWidth/2 * Core.camera.zoom,
|
||||||
|
Core.camera.position.y - Core.camera.viewportHeight/2 * Core.camera.zoom);
|
||||||
shader.setUniformf("screensize", Gdx.graphics.getWidth() / Core.cameraScale * Core.camera.zoom,
|
shader.setUniformf("screensize", Gdx.graphics.getWidth() / Core.cameraScale * Core.camera.zoom,
|
||||||
Gdx.graphics.getHeight() / Core.cameraScale * Core.camera.zoom);
|
Gdx.graphics.getHeight() / Core.cameraScale * Core.camera.zoom);
|
||||||
shader.setUniformf("time", Timers.time());
|
shader.setUniformf("time", Timers.time());
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
package io.anuke.mindustry.world.blocks;
|
package io.anuke.mindustry.world.blocks;
|
||||||
|
|
||||||
import io.anuke.mindustry.graphics.DrawLayer;
|
import io.anuke.mindustry.graphics.DrawLayer;
|
||||||
import io.anuke.mindustry.graphics.Fx;
|
|
||||||
import io.anuke.mindustry.resource.Item;
|
import io.anuke.mindustry.resource.Item;
|
||||||
import io.anuke.mindustry.resource.ItemStack;
|
import io.anuke.mindustry.resource.ItemStack;
|
||||||
import io.anuke.mindustry.resource.Liquid;
|
import io.anuke.mindustry.resource.Liquid;
|
||||||
import io.anuke.mindustry.world.Block;
|
import io.anuke.mindustry.world.Block;
|
||||||
import io.anuke.mindustry.world.Tile;
|
import io.anuke.mindustry.world.Tile;
|
||||||
import io.anuke.mindustry.world.blocks.types.*;
|
import io.anuke.mindustry.world.blocks.types.*;
|
||||||
import io.anuke.ucore.core.Effects;
|
|
||||||
import io.anuke.ucore.core.Timers;
|
|
||||||
import io.anuke.ucore.util.Mathf;
|
|
||||||
|
|
||||||
public class Blocks{
|
public class Blocks{
|
||||||
public static final Block
|
public static final Block
|
||||||
@ -51,17 +47,6 @@ public class Blocks{
|
|||||||
liquid = true;
|
liquid = true;
|
||||||
drawLayer = DrawLayer.lava;
|
drawLayer = DrawLayer.lava;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(Tile tile){
|
|
||||||
if(Mathf.chance(0.001 * Timers.delta())){
|
|
||||||
Effects.effect(Fx.lava, tile.worldx() + Mathf.range(5f), tile.worldy() + Mathf.range(5f));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Mathf.chance(0.002 * Timers.delta())){
|
|
||||||
Effects.effect(Fx.lavabubble, tile.worldx() + Mathf.range(3f), tile.worldy() + Mathf.range(3f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
oil = new Floor("oil"){
|
oil = new Floor("oil"){
|
||||||
@ -72,13 +57,6 @@ public class Blocks{
|
|||||||
liquid = true;
|
liquid = true;
|
||||||
drawLayer = DrawLayer.oil;
|
drawLayer = DrawLayer.oil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update(Tile tile){
|
|
||||||
if(Mathf.chance(0.0022 * Timers.delta())){
|
|
||||||
Effects.effect(Fx.oilbubble, tile.worldx() + Mathf.range(2f), tile.worldy() + Mathf.range(2f));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
stone = new Floor("stone"){{
|
stone = new Floor("stone"){{
|
||||||
|
Reference in New Issue
Block a user