Move shader initialization out of renderer

Avoid public fields and ! overrides, make almost all fields readonly.
This commit is contained in:
Matthias Schiffer 2018-10-24 23:05:13 +02:00
parent 9770eaf432
commit ebc56db63c
Signed by: neocturne
GPG key ID: 16EF3F64CB201D9C
8 changed files with 154 additions and 98 deletions

View file

@ -2,7 +2,7 @@ import {mapValues, mapValuesAsync, nextPowerOf2} from '../util';
import MapData from '../model/MapData';
import MapView from './MapView';
import Renderer from './Renderer';
import Renderer from './renderer/Renderer';
function loadImage(url: string): Promise<HTMLImageElement> {
return new Promise((resolve, reject) => {
@ -56,7 +56,7 @@ function mkTileTexture(gl: WebGLRenderingContext, tiles: Map<string, HTMLImageEl
export async function loadMap(r: Renderer, mapData: MapData): Promise<MapView> {
const tiles = await loadTiles(mapData.tiles);
const [tileTexture, tileMap] = mkTileTexture(r.gl, tiles);
const [tileTexture, tileMap] = mkTileTexture(r.getContext(), tiles);
return new MapView(r, mapData, tileTexture, tileMap);
}