summaryrefslogtreecommitdiffstats
path: root/src/view/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/renderer')
-rw-r--r--src/view/renderer/renderer.ts11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/view/renderer/renderer.ts b/src/view/renderer/renderer.ts
index 062c868..93f8589 100644
--- a/src/view/renderer/renderer.ts
+++ b/src/view/renderer/renderer.ts
@@ -3,7 +3,8 @@ import { Shaders } from './shaders';
import { mat4, vec2 } from 'gl-matrix';
export class Renderer {
- private readonly viewScale = 64;
+ public readonly coordScale = 32;
+ private readonly viewScale = 2;
private readonly gl: WebGLRenderingContext;
private readonly shaders: Shaders;
@@ -67,9 +68,9 @@ export class Renderer {
}
public snapToGrid(out: vec2, a: vec2|number[]): void {
- vec2.scale(out, a, this.viewScale);
+ vec2.scale(out, a, this.coordScale);
vec2.round(out, out);
- vec2.scale(out, out, 1 / this.viewScale);
+ vec2.scale(out, out, 1 / this.coordScale);
}
private mkContext(): WebGLRenderingContext {
@@ -89,8 +90,10 @@ export class Renderer {
this.gl.viewport(0, 0, w, h);
this.clear();
+ const scale = this.viewScale * this.coordScale;
+
mat4.identity(this.viewport);
- mat4.scale(this.viewport, this.viewport, [2 * this.viewScale / w, -2 * this.viewScale / h, 1.0]);
+ mat4.scale(this.viewport, this.viewport, [2 * scale / w, -2 * scale / h, 1.0]);
this.gl.uniformMatrix4fv(this.shaders.viewportLoc, false, this.viewport);
}
}