Add files
This commit is contained in:
commit
77bde04db3
97 changed files with 10327 additions and 0 deletions
7839
build/main-bundle.js
Normal file
7839
build/main-bundle.js
Normal file
File diff suppressed because it is too large
Load diff
0
build/src/game.d.ts
vendored
Normal file
0
build/src/game.d.ts
vendored
Normal file
7
build/src/graphics/drawables/i-drawable-descriptor.d.ts
vendored
Normal file
7
build/src/graphics/drawables/i-drawable-descriptor.d.ts
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { IDrawable } from './i-drawable';
|
||||
export interface IDrawableDescriptor {
|
||||
uniformName: string;
|
||||
countMacroName: string;
|
||||
shaderCombinationSteps: Array<number>;
|
||||
readonly empty: IDrawable;
|
||||
}
|
||||
5
build/src/graphics/drawables/i-drawable.d.ts
vendored
Normal file
5
build/src/graphics/drawables/i-drawable.d.ts
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { vec2, mat2d } from 'gl-matrix';
|
||||
export interface IDrawable {
|
||||
distance(target: vec2): number;
|
||||
serializeToUniforms(uniforms: any, scale: number, transform: mat2d): void;
|
||||
}
|
||||
14
build/src/graphics/drawables/lights/circle-light.d.ts
vendored
Normal file
14
build/src/graphics/drawables/lights/circle-light.d.ts
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { mat2d, vec2, vec3 } from 'gl-matrix';
|
||||
import { IDrawableDescriptor } from '../i-drawable-descriptor';
|
||||
import { ILight } from './i-light';
|
||||
export declare class CircleLight implements ILight {
|
||||
center: vec2;
|
||||
lightDrop: number;
|
||||
color: vec3;
|
||||
lightness: number;
|
||||
static descriptor: IDrawableDescriptor;
|
||||
constructor(center: vec2, lightDrop: number, color: vec3, lightness: number);
|
||||
distance(_: vec2): number;
|
||||
serializeToUniforms(uniforms: any, scale: number, transform: mat2d): void;
|
||||
get value(): vec3;
|
||||
}
|
||||
15
build/src/graphics/drawables/lights/flashlight.d.ts
vendored
Normal file
15
build/src/graphics/drawables/lights/flashlight.d.ts
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { mat2d, vec2, vec3 } from 'gl-matrix';
|
||||
import { IDrawableDescriptor } from '../i-drawable-descriptor';
|
||||
import { ILight } from './i-light';
|
||||
export declare class Flashlight implements ILight {
|
||||
center: vec2;
|
||||
direction: vec2;
|
||||
lightDrop: number;
|
||||
color: vec3;
|
||||
lightness: number;
|
||||
static descriptor: IDrawableDescriptor;
|
||||
constructor(center: vec2, direction: vec2, lightDrop: number, color: vec3, lightness: number);
|
||||
distance(_: vec2): number;
|
||||
serializeToUniforms(uniforms: any, scale: number, transform: mat2d): void;
|
||||
get value(): vec3;
|
||||
}
|
||||
2
build/src/graphics/drawables/lights/i-light.d.ts
vendored
Normal file
2
build/src/graphics/drawables/lights/i-light.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { IDrawable } from '../i-drawable';
|
||||
export declare type ILight = IDrawable;
|
||||
1
build/src/graphics/graphics-library/compiling/check-program.d.ts
vendored
Normal file
1
build/src/graphics/graphics-library/compiling/check-program.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const checkProgram: (gl: WebGL2RenderingContext, program: WebGLProgram) => void;
|
||||
1
build/src/graphics/graphics-library/compiling/check-shader.d.ts
vendored
Normal file
1
build/src/graphics/graphics-library/compiling/check-shader.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const checkShader: (gl: WebGL2RenderingContext, shader: WebGLShader) => void;
|
||||
3
build/src/graphics/graphics-library/compiling/create-program.d.ts
vendored
Normal file
3
build/src/graphics/graphics-library/compiling/create-program.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare const createProgram: (gl: WebGL2RenderingContext, vertexShaderSource: string, fragmentShaderSource: string, substitutions: {
|
||||
[name: string]: string;
|
||||
}) => Promise<WebGLProgram>;
|
||||
3
build/src/graphics/graphics-library/compiling/create-shader.d.ts
vendored
Normal file
3
build/src/graphics/graphics-library/compiling/create-shader.d.ts
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export declare const createShader: (gl: WebGL2RenderingContext, type: GLenum, source: string, substitutions: {
|
||||
[name: string]: string;
|
||||
}) => WebGLShader;
|
||||
5
build/src/graphics/graphics-library/frame-buffer/default-frame-buffer.d.ts
vendored
Normal file
5
build/src/graphics/graphics-library/frame-buffer/default-frame-buffer.d.ts
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { FrameBuffer } from './frame-buffer';
|
||||
export declare class DefaultFrameBuffer extends FrameBuffer {
|
||||
constructor(gl: WebGL2RenderingContext);
|
||||
setSize(): boolean;
|
||||
}
|
||||
12
build/src/graphics/graphics-library/frame-buffer/frame-buffer.d.ts
vendored
Normal file
12
build/src/graphics/graphics-library/frame-buffer/frame-buffer.d.ts
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
export declare abstract class FrameBuffer {
|
||||
protected gl: WebGL2RenderingContext;
|
||||
renderScale: number;
|
||||
enableHighDpiRendering: boolean;
|
||||
protected size: vec2;
|
||||
protected frameBuffer: WebGLFramebuffer | null;
|
||||
constructor(gl: WebGL2RenderingContext);
|
||||
bindAndClear(colorInput?: WebGLTexture): void;
|
||||
setSize(): boolean;
|
||||
getSize(): vec2;
|
||||
}
|
||||
10
build/src/graphics/graphics-library/frame-buffer/intermediate-frame-buffer.d.ts
vendored
Normal file
10
build/src/graphics/graphics-library/frame-buffer/intermediate-frame-buffer.d.ts
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { FrameBuffer } from './frame-buffer';
|
||||
export declare class IntermediateFrameBuffer extends FrameBuffer {
|
||||
private frameTexture;
|
||||
private floatLinearEnabled;
|
||||
constructor(gl: WebGL2RenderingContext);
|
||||
get colorTexture(): WebGLTexture;
|
||||
setSize(): boolean;
|
||||
private configureTexture;
|
||||
private configureFrameBuffer;
|
||||
}
|
||||
2
build/src/graphics/graphics-library/helper/enable-extension.d.ts
vendored
Normal file
2
build/src/graphics/graphics-library/helper/enable-extension.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export declare const tryEnableExtension: (gl: WebGL2RenderingContext, name: string) => any | null;
|
||||
export declare const enableExtension: (gl: WebGL2RenderingContext, name: string) => any;
|
||||
1
build/src/graphics/graphics-library/helper/get-webgl2-context.d.ts
vendored
Normal file
1
build/src/graphics/graphics-library/helper/get-webgl2-context.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const getWebGl2Context: (canvas: HTMLCanvasElement) => WebGL2RenderingContext;
|
||||
1
build/src/graphics/graphics-library/helper/load-uniform.d.ts
vendored
Normal file
1
build/src/graphics/graphics-library/helper/load-uniform.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const loadUniform: (gl: WebGL2RenderingContext, value: any, type: GLenum, location: WebGLUniformLocation) => any;
|
||||
11
build/src/graphics/graphics-library/helper/stopwatch.d.ts
vendored
Normal file
11
build/src/graphics/graphics-library/helper/stopwatch.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export declare class WebGlStopwatch {
|
||||
private gl;
|
||||
private timerExtension;
|
||||
private timerQuery?;
|
||||
private isReady;
|
||||
private resultsInNanoSeconds?;
|
||||
constructor(gl: WebGL2RenderingContext);
|
||||
start(): void;
|
||||
stop(): void;
|
||||
get resultsInMilliSeconds(): number;
|
||||
}
|
||||
11
build/src/graphics/graphics-library/program/fragment-shader-only-program.d.ts
vendored
Normal file
11
build/src/graphics/graphics-library/program/fragment-shader-only-program.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import Program from './program';
|
||||
export declare class FragmentShaderOnlyProgram extends Program {
|
||||
private vao?;
|
||||
constructor(gl: WebGL2RenderingContext, sources: [string, string], substitutions: {
|
||||
[name: string]: string;
|
||||
});
|
||||
initialize(): Promise<void>;
|
||||
bind(): void;
|
||||
draw(): void;
|
||||
private prepareScreenQuad;
|
||||
}
|
||||
10
build/src/graphics/graphics-library/program/i-program.d.ts
vendored
Normal file
10
build/src/graphics/graphics-library/program/i-program.d.ts
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
export interface IProgram {
|
||||
initialize(): Promise<void>;
|
||||
setDrawingRectangleUV(bottomLeft: vec2, size: vec2): void;
|
||||
bindAndSetUniforms(values: {
|
||||
[name: string]: any;
|
||||
}): void;
|
||||
draw(): void;
|
||||
delete(): void;
|
||||
}
|
||||
25
build/src/graphics/graphics-library/program/program.d.ts
vendored
Normal file
25
build/src/graphics/graphics-library/program/program.d.ts
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { IProgram } from './i-program';
|
||||
export default abstract class Program implements IProgram {
|
||||
protected gl: WebGL2RenderingContext;
|
||||
protected program?: WebGLProgram;
|
||||
private programPromise;
|
||||
private modelTransform;
|
||||
private readonly ndcToUv;
|
||||
private uniforms;
|
||||
constructor(gl: WebGL2RenderingContext, [vertexShaderSource, fragmentShaderSource]: [string, string], substitutions: {
|
||||
[name: string]: string;
|
||||
});
|
||||
initialize(): Promise<void>;
|
||||
bindAndSetUniforms(values: {
|
||||
[name: string]: any;
|
||||
}): void;
|
||||
setDrawingRectangleUV(bottomLeft: vec2, size: vec2): void;
|
||||
setUniforms(values: {
|
||||
[name: string]: any;
|
||||
}): void;
|
||||
delete(): void;
|
||||
abstract draw(): void;
|
||||
protected bind(): void;
|
||||
private queryUniforms;
|
||||
}
|
||||
20
build/src/graphics/graphics-library/program/uniform-array-autoscaling-program.d.ts
vendored
Normal file
20
build/src/graphics/graphics-library/program/uniform-array-autoscaling-program.d.ts
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { IDrawableDescriptor } from '../../drawables/i-drawable-descriptor';
|
||||
import { IProgram } from './i-program';
|
||||
export declare class UniformArrayAutoScalingProgram implements IProgram {
|
||||
private gl;
|
||||
private descriptors;
|
||||
private programs;
|
||||
private current?;
|
||||
private drawingRectangleBottomLeft;
|
||||
private drawingRectangleSize;
|
||||
constructor(gl: WebGL2RenderingContext, shaderSources: [string, string], descriptors: Array<IDrawableDescriptor>);
|
||||
initialize(): Promise<void>;
|
||||
bindAndSetUniforms(uniforms: {
|
||||
[name: string]: any;
|
||||
}): void;
|
||||
setDrawingRectangleUV(bottomLeft: vec2, size: vec2): void;
|
||||
draw(): void;
|
||||
delete(): void;
|
||||
private createProgram;
|
||||
}
|
||||
14
build/src/graphics/i-renderer.d.ts
vendored
Normal file
14
build/src/graphics/i-renderer.d.ts
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { IDrawable } from './drawables/i-drawable';
|
||||
import { ILight } from './drawables/lights/i-light';
|
||||
export interface IRenderer {
|
||||
initialize(): Promise<void>;
|
||||
startFrame(deltaTime: DOMHighResTimeStamp): void;
|
||||
finishFrame(): void;
|
||||
drawShape(drawable: IDrawable): void;
|
||||
drawLight(light: ILight): void;
|
||||
drawInfoText(text: string): void;
|
||||
readonly canvasSize: vec2;
|
||||
setViewArea(topLeft: vec2, size: vec2): void;
|
||||
setCursorPosition(position: vec2): void;
|
||||
}
|
||||
9
build/src/graphics/rendering/fps-autoscaler.d.ts
vendored
Normal file
9
build/src/graphics/rendering/fps-autoscaler.d.ts
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Autoscaler as AutoScaler } from '../../helper/autoscaler';
|
||||
export declare class FpsAutoscaler extends AutoScaler {
|
||||
private timeSinceLastAdjusment;
|
||||
private exponentialDecayedDeltaTime;
|
||||
constructor(setters: {
|
||||
[key: string]: (value: number | boolean) => void;
|
||||
});
|
||||
autoscale(lastDeltaTime: DOMHighResTimeStamp): void;
|
||||
}
|
||||
12
build/src/graphics/rendering/rendering-pass.d.ts
vendored
Normal file
12
build/src/graphics/rendering/rendering-pass.d.ts
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { IDrawable } from '../drawables/i-drawable';
|
||||
import { IDrawableDescriptor } from '../drawables/i-drawable-descriptor';
|
||||
import { FrameBuffer } from '../graphics-library/frame-buffer/frame-buffer';
|
||||
export declare class RenderingPass {
|
||||
private frame;
|
||||
private drawables;
|
||||
private program;
|
||||
constructor(gl: WebGL2RenderingContext, shaderSources: [string, string], drawableDescriptors: Array<IDrawableDescriptor>, frame: FrameBuffer);
|
||||
initialize(): Promise<void>;
|
||||
addDrawable(drawable: IDrawable): void;
|
||||
render(commonUniforms: any, inputTexture?: WebGLTexture): void;
|
||||
}
|
||||
18
build/src/graphics/rendering/uniforms-provider.d.ts
vendored
Normal file
18
build/src/graphics/rendering/uniforms-provider.d.ts
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
export declare class UniformsProvider {
|
||||
private gl;
|
||||
private scaleWorldLengthToNDC;
|
||||
private transformWorldToNDC;
|
||||
private viewAreaBottomLeft;
|
||||
private worldAreaInView;
|
||||
private squareToAspectRatio;
|
||||
private uvToWorld;
|
||||
private cursorPosition;
|
||||
softShadowsEnabled?: boolean;
|
||||
constructor(gl: WebGL2RenderingContext);
|
||||
getUniforms(uniforms: any): any;
|
||||
private getScreenToWorldTransform;
|
||||
uvToWorldCoordinate(screenUvPosition: vec2): vec2;
|
||||
setViewArea(topLeft: vec2, size: vec2): void;
|
||||
setCursorPosition(position: vec2): void;
|
||||
}
|
||||
27
build/src/graphics/rendering/webgl2-renderer.d.ts
vendored
Normal file
27
build/src/graphics/rendering/webgl2-renderer.d.ts
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { IDrawable } from '../drawables/i-drawable';
|
||||
import { ILight } from '../drawables/lights/i-light';
|
||||
import { IRenderer } from '../i-renderer';
|
||||
export declare class WebGl2Renderer implements IRenderer {
|
||||
private canvas;
|
||||
private overlay;
|
||||
private gl;
|
||||
private stopwatch?;
|
||||
private uniformsProvider;
|
||||
private distanceFieldFrameBuffer;
|
||||
private lightingFrameBuffer;
|
||||
private distancePass;
|
||||
private lightingPass;
|
||||
private autoscaler;
|
||||
private initializePromise;
|
||||
constructor(canvas: HTMLCanvasElement, overlay: HTMLElement);
|
||||
initialize(): Promise<void>;
|
||||
drawShape(shape: IDrawable): void;
|
||||
drawLight(light: ILight): void;
|
||||
startFrame(deltaTime: DOMHighResTimeStamp): void;
|
||||
finishFrame(): void;
|
||||
setViewArea(topLeft: vec2, size: vec2): void;
|
||||
setCursorPosition(position: vec2): void;
|
||||
get canvasSize(): vec2;
|
||||
drawInfoText(text: string): void;
|
||||
}
|
||||
27
build/src/graphics/settings.d.ts
vendored
Normal file
27
build/src/graphics/settings.d.ts
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
export declare const settings: {
|
||||
enableHighDpiRendering: boolean;
|
||||
qualityScaling: {
|
||||
targetDeltaTimeInMilliseconds: number;
|
||||
deltaTimeError: number;
|
||||
deltaTimeResponsiveness: number;
|
||||
adjusmentRateInMilliseconds: number;
|
||||
qualityTargets: {
|
||||
distanceRenderScale: number;
|
||||
finalRenderScale: number;
|
||||
softShadowsEnabled: boolean;
|
||||
}[];
|
||||
startingTargetIndex: number;
|
||||
scalingOptions: {
|
||||
additiveIncrease: number;
|
||||
multiplicativeDecrease: number;
|
||||
};
|
||||
};
|
||||
tileMultiplier: number;
|
||||
shaderMacros: {};
|
||||
shaderCombinations: {
|
||||
lineSteps: number[];
|
||||
blobSteps: number[];
|
||||
circleLightSteps: number[];
|
||||
flashlightSteps: number[];
|
||||
};
|
||||
};
|
||||
11
build/src/helper/array.d.ts
vendored
Normal file
11
build/src/helper/array.d.ts
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
declare global {
|
||||
interface Array<T> {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
interface Float32Array {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
}
|
||||
export declare const applyArrayPlugins: () => void;
|
||||
17
build/src/helper/autoscaler.d.ts
vendored
Normal file
17
build/src/helper/autoscaler.d.ts
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
export declare class Autoscaler {
|
||||
private setters;
|
||||
private targets;
|
||||
private scalingOptions;
|
||||
private index;
|
||||
constructor(setters: {
|
||||
[key: string]: (value: number | boolean) => void;
|
||||
}, targets: Array<{
|
||||
[key: string]: number | boolean;
|
||||
}>, startingIndex: number, scalingOptions: {
|
||||
additiveIncrease: number;
|
||||
multiplicativeDecrease: number;
|
||||
});
|
||||
increase(): void;
|
||||
decrease(): void;
|
||||
private applyScaling;
|
||||
}
|
||||
2
build/src/helper/clamp.d.ts
vendored
Normal file
2
build/src/helper/clamp.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export declare const clamp: (value: number, min: number, max: number) => number;
|
||||
export declare const clamp01: (value: number) => number;
|
||||
1
build/src/helper/exponential-decay.d.ts
vendored
Normal file
1
build/src/helper/exponential-decay.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const exponentialDecay: (accumulator: number, nextValue: number, biasOfNextValue: number) => number;
|
||||
1
build/src/helper/get-combinations.d.ts
vendored
Normal file
1
build/src/helper/get-combinations.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const getCombinations: (values: Array<Array<number>>) => Array<Array<number>>;
|
||||
1
build/src/helper/last.d.ts
vendored
Normal file
1
build/src/helper/last.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function last<T>(a: Array<T>): T | null;
|
||||
1
build/src/helper/mix.d.ts
vendored
Normal file
1
build/src/helper/mix.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const mix: (from: number, to: number, q: number) => number;
|
||||
5
build/src/helper/random.d.ts
vendored
Normal file
5
build/src/helper/random.d.ts
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
export declare abstract class Random {
|
||||
private static _seed;
|
||||
static set seed(value: number);
|
||||
static getRandom(): number;
|
||||
}
|
||||
2
build/src/helper/rotate-90-deg.d.ts
vendored
Normal file
2
build/src/helper/rotate-90-deg.d.ts
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
export declare const rotate90Deg: (vec: vec2) => vec2;
|
||||
1
build/src/helper/timing.d.ts
vendored
Normal file
1
build/src/helper/timing.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare function timeIt(interval?: number): (target: any, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
||||
1
build/src/helper/to-percent.d.ts
vendored
Normal file
1
build/src/helper/to-percent.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const toPercent: (value: number) => string;
|
||||
1
build/src/helper/wait-while-false.d.ts
vendored
Normal file
1
build/src/helper/wait-while-false.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const waitWhileFalse: (body: () => boolean) => Promise<void>;
|
||||
1
build/src/helper/wait.d.ts
vendored
Normal file
1
build/src/helper/wait.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare const wait: (ms: number) => Promise<void>;
|
||||
1
build/src/main.d.ts
vendored
Normal file
1
build/src/main.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
Loading…
Add table
Add a link
Reference in a new issue