Move shader initialization out of renderer
Avoid public fields and ! overrides, make almost all fields readonly.
This commit is contained in:
parent
9770eaf432
commit
ebc56db63c
8 changed files with 154 additions and 98 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Reference in a new issue