Fixed positions jumping with shader zoom-out
This commit is contained in:
@@ -5,7 +5,6 @@ import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import com.badlogic.gdx.utils.FloatArray;
|
||||
import io.anuke.ucore.core.Core;
|
||||
import io.anuke.ucore.core.Settings;
|
||||
import io.anuke.ucore.core.Timers;
|
||||
import io.anuke.ucore.graphics.Shader;
|
||||
import io.anuke.ucore.scene.ui.layout.Unit;
|
||||
@@ -46,7 +45,6 @@ public class Shaders{
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
float scale = Settings.getBool("pixelate") ? 1 : Core.cameraScale / Core.camera.zoom;
|
||||
float scaling = Core.cameraScale / 4f / Core.camera.zoom;
|
||||
if(hits.size > 0){
|
||||
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_time", Timers.time() / Unit.dp.scl(1f));
|
||||
shader.setUniformf("u_scaling", scaling);
|
||||
shader.setUniformf("u_offset", vec.set(Core.camera.position.x, Core.camera.position.y));
|
||||
shader.setUniformf("u_texsize", vec.set(region.getTexture().getWidth() / scale,
|
||||
region.getTexture().getHeight() / scale));
|
||||
shader.setUniformf("u_offset",
|
||||
Core.camera.position.x - Core.camera.viewportWidth/2 * Core.camera.zoom,
|
||||
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
|
||||
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,
|
||||
Gdx.graphics.getHeight() / Core.cameraScale * Core.camera.zoom);
|
||||
shader.setUniformf("time", Timers.time());
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
package io.anuke.mindustry.world.blocks;
|
||||
|
||||
import io.anuke.mindustry.graphics.DrawLayer;
|
||||
import io.anuke.mindustry.graphics.Fx;
|
||||
import io.anuke.mindustry.resource.Item;
|
||||
import io.anuke.mindustry.resource.ItemStack;
|
||||
import io.anuke.mindustry.resource.Liquid;
|
||||
import io.anuke.mindustry.world.Block;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
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 static final Block
|
||||
@@ -51,17 +47,6 @@ public class Blocks{
|
||||
liquid = true;
|
||||
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"){
|
||||
@@ -72,13 +57,6 @@ public class Blocks{
|
||||
liquid = true;
|
||||
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"){{
|
||||
|
||||
Reference in New Issue
Block a user