Fix typos

This commit is contained in:
schmelczerandras 2020-11-02 10:08:35 +01:00
parent 55eb0cf0d2
commit 5b37f4bcd4
8 changed files with 25 additions and 26 deletions

View file

@ -19,10 +19,10 @@ export const NoisyPolygonFactory = (
public static descriptor: DrawableDescriptor = { public static descriptor: DrawableDescriptor = {
sdf: { sdf: {
shader: ` shader: `
uniform vec2 noisyPolygon${vertexCount}Vertices[NOISY_POLGYON${vertexCount}_COUNT * ${vertexCount}]; uniform vec2 noisyPolygon${vertexCount}Vertices[NOISY_POLYGON${vertexCount}_COUNT * ${vertexCount}];
uniform vec2 noisyPolygon${vertexCount}Centers[NOISY_POLGYON${vertexCount}_COUNT]; uniform vec2 noisyPolygon${vertexCount}Centers[NOISY_POLYGON${vertexCount}_COUNT];
uniform float noisyPolygon${vertexCount}Lengths[NOISY_POLGYON${vertexCount}_COUNT]; uniform float noisyPolygon${vertexCount}Lengths[NOISY_POLYGON${vertexCount}_COUNT];
uniform float noisyPolygon${vertexCount}Randoms[NOISY_POLGYON${vertexCount}_COUNT]; uniform float noisyPolygon${vertexCount}Randoms[NOISY_POLYGON${vertexCount}_COUNT];
uniform sampler2D noiseTexture; uniform sampler2D noiseTexture;
@ -56,7 +56,7 @@ export const NoisyPolygonFactory = (
float minDistance = 100.0; float minDistance = 100.0;
for (int j = 0; j < NOISY_POLGYON${vertexCount}_COUNT; j++) { for (int j = 0; j < NOISY_POLYGON${vertexCount}_COUNT; j++) {
vec2 startEnd = noisyPolygon${vertexCount}Vertices[j * ${vertexCount}]; vec2 startEnd = noisyPolygon${vertexCount}Vertices[j * ${vertexCount}];
vec2 vb = startEnd; vec2 vb = startEnd;
@ -110,7 +110,7 @@ export const NoisyPolygonFactory = (
center: `noisyPolygon${vertexCount}Centers`, center: `noisyPolygon${vertexCount}Centers`,
vertices: `noisyPolygon${vertexCount}Vertices`, vertices: `noisyPolygon${vertexCount}Vertices`,
}, },
uniformCountMacroName: `NOISY_POLGYON${vertexCount}_COUNT`, uniformCountMacroName: `NOISY_POLYGON${vertexCount}_COUNT`,
shaderCombinationSteps: [0, 1, 2, 3, 8, 16], shaderCombinationSteps: [0, 1, 2, 3, 8, 16],
empty: (new NoisyPolygon( empty: (new NoisyPolygon(
new Array(vertexCount).fill(vec2.create()) new Array(vertexCount).fill(vec2.create())
@ -123,7 +123,7 @@ export const NoisyPolygonFactory = (
super(vertices); super(vertices);
} }
protected getObjectToSerialize(transform2d: mat2d, transform1d: number): any { protected getObjectToSerialize(transform2d: mat2d, _: number): any {
const transformedVertices = (this as any).actualVertices.map((v: vec2) => const transformedVertices = (this as any).actualVertices.map((v: vec2) =>
vec2.transformMat2d(vec2.create(), v, transform2d) vec2.transformMat2d(vec2.create(), v, transform2d)
); );

View file

@ -25,7 +25,7 @@ export const PolygonFactory = (
public static descriptor: DrawableDescriptor = { public static descriptor: DrawableDescriptor = {
sdf: { sdf: {
shader: ` shader: `
uniform vec2 polygon${vertexCount}Vertices[POLGYON${vertexCount}_COUNT * ${vertexCount}]; uniform vec2 polygon${vertexCount}Vertices[POLYGON${vertexCount}_COUNT * ${vertexCount}];
vec2 polygon${vertexCount}LineDistance(vec2 target, vec2 from, vec2 to) { vec2 polygon${vertexCount}LineDistance(vec2 target, vec2 from, vec2 to) {
vec2 targetFromDelta = target - from; vec2 targetFromDelta = target - from;
@ -47,7 +47,7 @@ export const PolygonFactory = (
float minDistance = 100.0; float minDistance = 100.0;
for (int j = 0; j < POLGYON${vertexCount}_COUNT; j++) { for (int j = 0; j < POLYGON${vertexCount}_COUNT; j++) {
vec2 startEnd = polygon${vertexCount}Vertices[j * ${vertexCount}]; vec2 startEnd = polygon${vertexCount}Vertices[j * ${vertexCount}];
vec2 vb = startEnd; vec2 vb = startEnd;
@ -85,7 +85,7 @@ export const PolygonFactory = (
vertices: `polygon${vertexCount}Vertices`, vertices: `polygon${vertexCount}Vertices`,
}, },
objectCountScaler: 1 / vertexCount, objectCountScaler: 1 / vertexCount,
uniformCountMacroName: `POLGYON${vertexCount}_COUNT`, uniformCountMacroName: `POLYGON${vertexCount}_COUNT`,
shaderCombinationSteps: [0, 1, 2, 3, 8, 16], shaderCombinationSteps: [0, 1, 2, 3, 8, 16],
empty: new Polygon(new Array(vertexCount).fill(vec2.create())), empty: new Polygon(new Array(vertexCount).fill(vec2.create())),
}; };
@ -147,7 +147,7 @@ export const PolygonFactory = (
: this.vertices; : this.vertices;
} }
protected getObjectToSerialize(transform2d: mat2d, transform1d: number): any { protected getObjectToSerialize(transform2d: mat2d, _: number): any {
return { return {
vertices: this.actualVertices.map((v) => vertices: this.actualVertices.map((v) =>
vec2.transformMat2d(vec2.create(), v, transform2d) vec2.transformMat2d(vec2.create(), v, transform2d)

View file

@ -73,7 +73,7 @@ export class WebGlStopwatch {
return this.state == StopwatchState.waitingForResults; return this.state == StopwatchState.waitingForResults;
} }
public get resultsInMilliSeconds(): number { public get resultsInMilliseconds(): number {
return this.resultsInNanoSeconds! / 1000 / 1000; return this.resultsInNanoSeconds! / 1000 / 1000;
} }
} }

View file

@ -15,9 +15,9 @@ import { Renderer } from './renderer/renderer';
* ``` * ```
*/ */
export class FpsQualityAutoscaler { export class FpsQualityAutoscaler {
private readonly maxAdjusmentRateInMilliseconds = 10000; private readonly maxAdjustmentRateInMilliseconds = 10000;
private readonly adjusmentRateIncrease = 2; private readonly adjustmentRateIncrease = 2;
private adjusmentRateInMilliseconds = 500; private adjustmentRateInMilliseconds = 500;
private fps = 0; private fps = 0;
public static fpsTarget = 30; public static fpsTarget = 30;
@ -39,12 +39,12 @@ export class FpsQualityAutoscaler {
public addDeltaTime(deltaTimeInMilliseconds: DOMHighResTimeStamp) { public addDeltaTime(deltaTimeInMilliseconds: DOMHighResTimeStamp) {
this.deltaTimes.push(deltaTimeInMilliseconds); this.deltaTimes.push(deltaTimeInMilliseconds);
this.deltaTimeSinceLastAdjustment += deltaTimeInMilliseconds; this.deltaTimeSinceLastAdjustment += deltaTimeInMilliseconds;
if (this.deltaTimeSinceLastAdjustment > this.adjusmentRateInMilliseconds) { if (this.deltaTimeSinceLastAdjustment > this.adjustmentRateInMilliseconds) {
this.calculateFPS(); this.calculateFPS();
this.adjustQuality(); this.adjustQuality();
this.adjusmentRateInMilliseconds = Math.min( this.adjustmentRateInMilliseconds = Math.min(
this.maxAdjusmentRateInMilliseconds, this.maxAdjustmentRateInMilliseconds,
this.adjusmentRateInMilliseconds * this.adjusmentRateIncrease this.adjustmentRateInMilliseconds * this.adjustmentRateIncrease
); );
this.deltaTimeSinceLastAdjustment = 0; this.deltaTimeSinceLastAdjustment = 0;
} }

View file

@ -31,13 +31,13 @@ export const renderNoise = async (
const program = new FragmentShaderOnlyProgram(gl); const program = new FragmentShaderOnlyProgram(gl);
const compiler = new ParallelCompiler(gl); const compiler = new ParallelCompiler(gl);
const pogramPromise = program.initialize( const programPromise = program.initialize(
gl.isWebGL2 ? [randomVertex, randomFragment] : [randomVertex100, randomFragment100], gl.isWebGL2 ? [randomVertex, randomFragment] : [randomVertex100, randomFragment100],
compiler compiler
); );
await compiler.compilePrograms(); await compiler.compilePrograms();
await pogramPromise; await programPromise;
program.draw({ program.draw({
scale, scale,

View file

@ -230,7 +230,7 @@ export class RendererImplementation implements Renderer {
this.stopwatch.start(); this.stopwatch.start();
} else { } else {
this.stopwatch.tryGetResults(); this.stopwatch.tryGetResults();
this.gl.insights.gpuRenderTimeInMilliseconds = this.stopwatch.resultsInMilliSeconds; this.gl.insights.gpuRenderTimeInMilliseconds = this.stopwatch.resultsInMilliseconds;
} }
} }

View file

@ -47,7 +47,7 @@ export interface Renderer {
/** /**
* The inverse of `displayToWorldCoordinates`, returns the screen space position * The inverse of `displayToWorldCoordinates`, returns the screen space position
* of a point given in world space cooridnates. * of a point given in world space coordinates.
* *
* While the origin for worldCoordinates resides in the bottom-left corner, * While the origin for worldCoordinates resides in the bottom-left corner,
* the origin of the returned display coordinates is placed in the top left. * the origin of the returned display coordinates is placed in the top left.
@ -89,10 +89,9 @@ export interface Renderer {
/** /**
* Get useful information about the hardware and the SDF2D renderer. * Get useful information about the hardware and the SDF2D renderer.
* *
* Its sheme is subject to change. * Its scheme is subject to change.
* *
* During context lost it might be null. * During context lost it might be null.
*
*/ */
readonly insights: RendererInfo | null; readonly insights: RendererInfo | null;
} }

View file

@ -5,7 +5,7 @@ import { rgb255 } from './rgb255';
* Return a color given in a hexadecimal form as a vec3. * Return a color given in a hexadecimal form as a vec3.
* *
* @param hex A hexadecimal color with (#ff0000) or without (ff0000) * @param hex A hexadecimal color with (#ff0000) or without (ff0000)
* a leading hashmark. * a leading hash mark.
* *
* source: https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb * source: https://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
* *