Finish documentation
This commit is contained in:
parent
49473bf905
commit
31fcfd3d6b
27 changed files with 1351 additions and 8453 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
import { FrameBuffer } from './frame-buffer';
|
||||
|
||||
/** @internal */
|
||||
export class DefaultFrameBuffer extends FrameBuffer {
|
||||
constructor(gl: UniversalRenderingContext) {
|
||||
super(gl);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
export abstract class FrameBuffer {
|
||||
public renderScale = 1;
|
||||
public enableHighDpiRendering = false;
|
||||
public enableHighDpiRendering!: boolean;
|
||||
|
||||
protected size = vec2.create();
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { enableExtension } from '../helper/enable-extension';
|
|||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
import { FrameBuffer } from './frame-buffer';
|
||||
|
||||
/** @internal */
|
||||
export class IntermediateFrameBuffer extends FrameBuffer {
|
||||
private frameTexture: WebGLTexture;
|
||||
private floatEnabled = false;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
/** @internal */
|
||||
let isEnabled = false;
|
||||
|
||||
/** @internal */
|
||||
export const enableContextLostSimulator = (canvas: HTMLCanvasElement) => {
|
||||
if (isEnabled) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Insights } from '../../rendering/insights';
|
||||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
export const tryEnableExtension = (
|
||||
gl: UniversalRenderingContext,
|
||||
name: string
|
||||
|
|
@ -15,6 +16,7 @@ export const tryEnableExtension = (
|
|||
return extension;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export const enableExtension = (gl: UniversalRenderingContext, name: string): any => {
|
||||
const extension = tryEnableExtension(gl, name);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { mat3, ReadonlyVec3, ReadonlyVec4, vec2, vec3, vec4 } from 'gl-matrix';
|
||||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
const loaderMat3 = mat3.create();
|
||||
|
||||
/** @internal */
|
||||
export const loadUniform = (
|
||||
gl: UniversalRenderingContext,
|
||||
value: any,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
import { enableExtension } from './enable-extension';
|
||||
|
||||
/** @internal */
|
||||
enum StopwatchState {
|
||||
ready = 'ready',
|
||||
running = 'running',
|
||||
waitingForResults = 'waitingForResults',
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
export class WebGlStopwatch {
|
||||
private state = StopwatchState.ready;
|
||||
private resultsInNanoSeconds = 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { vec3, vec4 } from 'gl-matrix';
|
||||
import { UniversalRenderingContext } from './universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
export class PaletteTexture {
|
||||
private texture: WebGLTexture;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Insights } from '../rendering/insights';
|
|||
import { tryEnableExtension } from './helper/enable-extension';
|
||||
import { UniversalRenderingContext } from './universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
type CompilingProgram = {
|
||||
program: WebGLProgram;
|
||||
resolvePromise: ((program: WebGLProgram) => void) | null;
|
||||
|
|
@ -10,8 +11,10 @@ type CompilingProgram = {
|
|||
fragmentShader: ShaderWithSource;
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
type ShaderWithSource = WebGLShader & { source: string };
|
||||
|
||||
/** @internal */
|
||||
export class ParallelCompiler {
|
||||
private extension?: any;
|
||||
private gl: UniversalRenderingContext;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { ParallelCompiler } from '../parallel-compiler';
|
|||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
import Program from './program';
|
||||
|
||||
/** @internal */
|
||||
export class FragmentShaderOnlyProgram extends Program {
|
||||
private vao?: WebGLVertexArrayObject;
|
||||
private vertexArrayExtension: any;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
/** @internal */
|
||||
export interface IProgram {
|
||||
setDrawingRectangleUV(bottomLeft: vec2, size: vec2): void;
|
||||
draw(values: { [name: string]: any }): void;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { ParallelCompiler } from '../parallel-compiler';
|
|||
import { UniversalRenderingContext } from '../universal-rendering-context';
|
||||
import { IProgram } from './i-program';
|
||||
|
||||
/** @internal */
|
||||
export default abstract class Program implements IProgram {
|
||||
protected program?: WebGLProgram;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { UniversalRenderingContext } from '../universal-rendering-context';
|
|||
import { FragmentShaderOnlyProgram } from './fragment-shader-only-program';
|
||||
import { IProgram } from './i-program';
|
||||
|
||||
/** @internal */
|
||||
export class UniformArrayAutoScalingProgram implements IProgram {
|
||||
private programs: Array<{
|
||||
program: FragmentShaderOnlyProgram;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
import { Insights } from '../rendering/insights';
|
||||
|
||||
/** @internal */
|
||||
export type UniversalRenderingContext = WebGL2RenderingContext &
|
||||
WebGLRenderingContext & { isWebGL2: boolean };
|
||||
|
||||
/** @internal */
|
||||
export const getUniversalRenderingContext = (
|
||||
canvas: HTMLCanvasElement,
|
||||
ignoreWebGL2 = false
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { exponentialDecay } from '../../helper/exponential-decay';
|
|||
import { mix } from '../../helper/mix';
|
||||
import { Insights } from './insights';
|
||||
|
||||
/** @internal */
|
||||
const settings = {
|
||||
targetDeltaTimeInMilliseconds: 20,
|
||||
deltaTimeErrorInMilliseconds: 3,
|
||||
|
|
@ -30,6 +31,7 @@ const settings = {
|
|||
qualityStepDecrese: 0.2,
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
export class FpsAutoscaler {
|
||||
private timeSinceLastAdjusment = 0;
|
||||
private exponentialDecayedDeltaTime = settings.targetDeltaTimeInMilliseconds;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { last } from '../../helper/last';
|
||||
import { msToString } from '../../helper/ms-to-string';
|
||||
|
||||
/** @internal */
|
||||
export class Insights {
|
||||
private static insights: any = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,10 @@ import { Drawable } from '../../../drawables/drawable';
|
|||
import { Insights } from '../insights';
|
||||
import { RenderPass } from './render-pass';
|
||||
|
||||
/** @internal */
|
||||
export class DistanceRenderPass extends RenderPass {
|
||||
public tileMultiplier = 8;
|
||||
public isWorldInverted = false;
|
||||
public tileMultiplier!: number;
|
||||
public isWorldInverted!: boolean;
|
||||
|
||||
private drawables: Array<Drawable> = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import { clamp01 } from '../../../helper/clamp';
|
|||
import { Insights } from '../insights';
|
||||
import { RenderPass } from './render-pass';
|
||||
|
||||
/** @internal */
|
||||
export class LightsRenderPass extends RenderPass {
|
||||
public lightCutoffDistance = 400;
|
||||
public lightCutoffDistance!: number;
|
||||
private drawables: Array<LightDrawable> = [];
|
||||
|
||||
public addDrawable(drawable: LightDrawable) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { ParallelCompiler } from '../../graphics-library/parallel-compiler';
|
|||
import { UniformArrayAutoScalingProgram } from '../../graphics-library/program/uniform-array-autoscaling-program';
|
||||
import { UniversalRenderingContext } from '../../graphics-library/universal-rendering-context';
|
||||
|
||||
/** @internal */
|
||||
export abstract class RenderPass {
|
||||
protected program: UniformArrayAutoScalingProgram;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
import { Drawable, DrawableDescriptor } from '../../../main';
|
||||
import { Drawable } from '../../../drawables/drawable';
|
||||
import { DrawableDescriptor } from '../../../drawables/drawable-descriptor';
|
||||
import { RuntimeSettings } from '../settings/runtime-settings';
|
||||
import { StartupSettings } from '../settings/startup-settings';
|
||||
import { Renderer } from './renderer';
|
||||
import { RendererImplementation } from './renderer-implementation';
|
||||
|
||||
/** @internal */
|
||||
export class ContextAwareRenderer implements Renderer {
|
||||
private renderer?: RendererImplementation;
|
||||
private isRendererReady = false;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue