Skip to content

Commit

Permalink
fix const enum iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Aug 27, 2022
1 parent c7a5b40 commit 9c324da
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/filters/base_filter.class.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//@ts-nocheck

import { config } from "../config";
import { WebGLPrecision } from "../typedefs";
import { TWebGLPrecision } from "../typedefs";


(function(global) {
Expand Down Expand Up @@ -77,9 +77,9 @@ import { WebGLPrecision } from "../typedefs";
createProgram: function(gl, fragmentSource, vertexSource) {
fragmentSource = fragmentSource || this.fragmentSource;
vertexSource = vertexSource || this.vertexSource;
if (config.webGLPrecision !== WebGLPrecision.high) {
if (config.webGLPrecision !== TWebGLPrecision.high) {
fragmentSource = fragmentSource.replace(
new RegExp(`precision ${WebGLPrecision.high} float`,'g'),
new RegExp(`precision ${TWebGLPrecision.high} float`,'g'),
`precision ${config.webGLPrecision} float`
);
}
Expand Down
16 changes: 13 additions & 3 deletions src/typedefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,18 @@ export type TransformEvent<T> = TEvent & T & {
}
}

export const enum WebGLPrecision {
export const enum TWebGLPrecision {
low = 'lowp',
mediump = 'mediump',
medium = 'mediump',
high = 'highp'
}
}

/**
* @todo remove once rollup supports transforming enums... ANNOYING!
* https://github.com/rollup/plugins/issues/463
*/
export const WebGLPrecision = [
TWebGLPrecision.low,
TWebGLPrecision.medium,
TWebGLPrecision.high
];

0 comments on commit 9c324da

Please sign in to comment.