(#48) Make it zoom towards the center of the screen

pull/51/head
rexim 5 years ago
parent 5e879f7adc
commit decd54cdbf

@ -11,8 +11,8 @@ uniform vec2 cursorPos;
vec3 to_world(vec3 v) {
vec2 ratio = vec2(
windowSize.x / screenshotSize.x,
windowSize.y / screenshotSize.y);
windowSize.x / screenshotSize.x / cameraScale,
windowSize.y / screenshotSize.y / cameraScale);
return vec3((v.x / screenshotSize.x * 2.0 - 1.0) / ratio.x,
(v.y / screenshotSize.y * 2.0 - 1.0) / ratio.y,
v.z);
@ -20,6 +20,6 @@ vec3 to_world(vec3 v) {
void main()
{
gl_Position = vec4(to_world((aPos - vec3(cameraPos * vec2(1.0, -1.0), 0.0)) * cameraScale), 1.0);
gl_Position = vec4(to_world((aPos - vec3(cameraPos * vec2(1.0, -1.0), 0.0))), 1.0);
texcoord = aTexCoord;
}

Loading…
Cancel
Save