mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
screen zooming, temporarily toggle with Z key
This commit is contained in:
@@ -20,6 +20,8 @@ uniform float rcount = 64.0; // it even works on 256.0!
|
||||
uniform float gcount = 64.0; // using 64: has less banding and most monitors are internally 6-bit
|
||||
uniform float bcount = 64.0;
|
||||
|
||||
// inverted zoom; this value must set to (1f/zoom)
|
||||
uniform float zoomInv = 1f;
|
||||
|
||||
/*int bayer[7 * 7] = int[](
|
||||
32,42,10,27,37,5,15,
|
||||
@@ -72,12 +74,13 @@ void main(void) {
|
||||
|
||||
float scale = v_texCoords.y * (1.0 - parallax_size) + (parallax_size / 2.0) + (parallax * parallax_size / 2.0);
|
||||
|
||||
float zoomSamplePoint = (1f - zoomInv) / 2f; // will never quite exceed 0.5
|
||||
|
||||
float inR = mix(bottomColor.r, topColor.r, scale);
|
||||
float inG = mix(bottomColor.g, topColor.g, scale);
|
||||
float inB = mix(bottomColor.b, topColor.b, scale);
|
||||
// I don't even know if it works, and also not sure if I actually want it
|
||||
vec3 newBottom = mix(bottomColor, topColor, zoomSamplePoint);
|
||||
vec3 newTop = mix(topColor, bottomColor, zoomSamplePoint);
|
||||
|
||||
vec4 inColor = vec4(inR, inG, inB, 1.0);
|
||||
vec4 inColor = vec4(mix(newBottom, newTop, scale), 1.0);
|
||||
|
||||
vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize));
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ void main() {
|
||||
vec2 overscannedScreenDimension = tilesInAxes * tileSizeInPx; // how many tiles will fit into a screen; one used by the tileFromMap
|
||||
vec2 flippedFragCoord = vec2(gl_FragCoord.x, screenDimension.y - gl_FragCoord.y) + cameraTranslation; // NO IVEC2!!; this flips Y
|
||||
//vec2 pxCoord = flippedFragCoord.xy; // TODO do I actually need 'pxCoord'?
|
||||
vec2 zoomVec = vec2(zoom);
|
||||
|
||||
// get required tile numbers //
|
||||
|
||||
@@ -97,8 +98,8 @@ void main() {
|
||||
|
||||
// get final UV coord for the actual sampling //
|
||||
|
||||
vec2 finalUVCoordForTile = uvCoordForTile + uvCoordOffsetTile;// where we should be actually looking for in atlas, using UV coord (0..1)
|
||||
vec2 finalUVCoordForBreakage = uvCoordForTile + uvCoordOffsetBreakage;
|
||||
vec2 finalUVCoordForTile = (uvCoordForTile + uvCoordOffsetTile);// where we should be actually looking for in atlas, using UV coord (0..1)
|
||||
vec2 finalUVCoordForBreakage = (uvCoordForTile + uvCoordOffsetBreakage);
|
||||
|
||||
// blending a breakage tex with main tex //
|
||||
|
||||
|
||||
Reference in New Issue
Block a user