diff options
Diffstat (limited to 'src/view')
-rw-r--r-- | src/view/Renderer.ts | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/view/Renderer.ts b/src/view/Renderer.ts index 1b9dd84..f1b7bac 100644 --- a/src/view/Renderer.ts +++ b/src/view/Renderer.ts @@ -1,14 +1,18 @@ import {mat4} from 'gl-matrix'; +import vertexShaderSrc from './default.vs'; +import fragmentShaderSrc from './default.fs'; + + export default class Renderer { public gl: WebGLRenderingContext; - public vertexPosLoc: number; - public textureCoordLoc: number; - private viewportLoc: WebGLUniformLocation; - private translateLoc: WebGLUniformLocation; - public samplerLoc: WebGLUniformLocation; + public vertexPosLoc!: number; + public textureCoordLoc!: number; + private viewportLoc!: WebGLUniformLocation; + private translateLoc!: WebGLUniformLocation; + public samplerLoc!: WebGLUniformLocation; private viewport: mat4 = mat4.create(); @@ -66,8 +70,8 @@ export default class Renderer { if (!shaderProgram) throw new Error('Unable to create shader program'); - let vertexShader = this.compileShader(this.gl.VERTEX_SHADER, require('./default.vs')); - let fragmentShader = this.compileShader(this.gl.FRAGMENT_SHADER, require('./default.fs')); + let vertexShader = this.compileShader(this.gl.VERTEX_SHADER, vertexShaderSrc); + let fragmentShader = this.compileShader(this.gl.FRAGMENT_SHADER, fragmentShaderSrc); this.gl.attachShader(shaderProgram, vertexShader); |