more rendering code, not much changes, beginning refactor of the rendering API
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
namespace WebGEngine {
|
||||
class Engine {
|
||||
private _GL: WebGL2RenderingContext;
|
||||
private _DrawMode: EngineDrawMode = EngineDrawMode.TEXTURE;
|
||||
|
||||
constructor(canvas: HTMLCanvasElement) {
|
||||
let context = canvas.getContext('webgl2');
|
||||
if (!context) throw new Error(`Failed to get webgl2 context from ${canvas}`);
|
||||
|
||||
this._GL = context;
|
||||
this.init();
|
||||
}
|
||||
|
||||
private init(): void {}
|
||||
}
|
||||
|
||||
enum EngineDrawMode {
|
||||
TEXTURE = 0,
|
||||
WIREFRAME = 1,
|
||||
VERTEX = 2
|
||||
}
|
||||
|
||||
interface ShaderSrc {
|
||||
type: number,
|
||||
|
||||
}
|
||||
|
||||
interface EngineConfig {
|
||||
canvas: HTMLCanvasElement,
|
||||
vertexShader: string,
|
||||
fragmentShader: string,
|
||||
additionalShaders?:
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export default WebGEngine;
|
||||
Reference in New Issue
Block a user