diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-10-31 10:52:57 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-10-31 10:52:57 +0100 |
commit | 1712352d1c72628a045300fe922c82cd3214070a (patch) | |
tree | 620bd559e2e8fb018d692cf10c20ecd7d108cb04 /src/view/renderer | |
parent | a86a80e402d5cc58bc2bf248ddbf82d5fafa88a1 (diff) | |
download | rpgedit-1712352d1c72628a045300fe922c82cd3214070a.tar rpgedit-1712352d1c72628a045300fe922c82cd3214070a.zip |
view: add simple input handlers
Diffstat (limited to 'src/view/renderer')
-rw-r--r-- | src/view/renderer/Renderer.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/view/renderer/Renderer.ts b/src/view/renderer/Renderer.ts index 9358515..a0ecf41 100644 --- a/src/view/renderer/Renderer.ts +++ b/src/view/renderer/Renderer.ts @@ -45,6 +45,10 @@ export default class Renderer { return this.shaders.samplerLoc; } + public setTranslation(v: Float32List) { + this.gl.uniform2fv(this.shaders.translateLoc, v); + } + private mkContext(): WebGLRenderingContext { const gl = ( this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl') @@ -66,6 +70,6 @@ export default class Renderer { mat4.scale(this.viewport, this.viewport, [2 * 64 / w, -2 * 64 / h, 1.0]); this.gl.uniformMatrix4fv(this.shaders.viewportLoc, false, this.viewport); - this.gl.uniform2f(this.shaders.translateLoc, -5.0, -5.0); + this.setTranslation([-5, -5]); } } |