From c491b0024cbc926a94755c47046a29657f7768a1 Mon Sep 17 00:00:00 2001 From: Karsten Schmidt Date: Sun, 5 Apr 2020 00:21:04 +0100 Subject: [PATCH] refactor(webgl): switch to non-const enums --- packages/webgl/src/api/blend.ts | 10 ++++---- packages/webgl/src/api/model.ts | 4 ++-- packages/webgl/src/api/stencil.ts | 8 +++---- packages/webgl/src/api/texture.ts | 40 +++++++++++++++---------------- 4 files changed, 31 insertions(+), 31 deletions(-) diff --git a/packages/webgl/src/api/blend.ts b/packages/webgl/src/api/blend.ts index 2e5074ea67..86faa78c88 100644 --- a/packages/webgl/src/api/blend.ts +++ b/packages/webgl/src/api/blend.ts @@ -1,6 +1,6 @@ import type { Tuple } from "@thi.ng/api"; -export const enum Blend { +export enum Blend { ZERO = 0, ONE = 1, SRC_COLOR = 768, @@ -15,15 +15,15 @@ export const enum Blend { ONE_MINUS_CONSTANT_COLOR = 32770, CONSTANT_ALPHA = 32771, ONE_MINUS_CONSTANT_ALPHA = 32772, - SRC_ALPHA_SATURATE = 776 + SRC_ALPHA_SATURATE = 776, } -export const enum BlendEquation { +export enum BlendEquation { FUNC_ADD = 32774, FUNC_REVERSE_SUBTRACT = 32779, FUNC_SUBTRACT = 32778, MAX = 32776, - MIN = 32775 + MIN = 32775, } export type BlendFunc = Tuple; @@ -33,7 +33,7 @@ export type BlendFunc = Tuple; export const BLEND_NORMAL: BlendFunc = [ Blend.SRC_ALPHA, - Blend.ONE_MINUS_SRC_ALPHA + Blend.ONE_MINUS_SRC_ALPHA, ]; export const BLEND_ADD: BlendFunc = [Blend.SRC_ALPHA, Blend.DST_ALPHA]; diff --git a/packages/webgl/src/api/model.ts b/packages/webgl/src/api/model.ts index 90b40b4d51..647f1fab85 100644 --- a/packages/webgl/src/api/model.ts +++ b/packages/webgl/src/api/model.ts @@ -4,14 +4,14 @@ import type { IndexBufferSpec, IWebGLBuffer } from "./buffers"; import type { AttribBufferData, IShader, UniformValues } from "./shader"; import type { ITexture } from "./texture"; -export const enum DrawMode { +export enum DrawMode { POINTS = 0, LINES = 1, LINE_LOOP = 2, LINE_STRIP = 3, TRIANGLES = 4, TRIANGLE_STRIP = 5, - TRIANGLE_FAN = 6 + TRIANGLE_FAN = 6, } export type ModelAttributeSpecs = IObjectOf; diff --git a/packages/webgl/src/api/stencil.ts b/packages/webgl/src/api/stencil.ts index c6e3e17739..5d5f5a6f23 100644 --- a/packages/webgl/src/api/stencil.ts +++ b/packages/webgl/src/api/stencil.ts @@ -1,6 +1,6 @@ import type { Tuple } from "@thi.ng/api"; -export const enum StencilOp { +export enum StencilOp { KEEP = 7680, ZERO = 0, REPLACE = 7681, @@ -8,10 +8,10 @@ export const enum StencilOp { INCR_WRAP = 34055, DECR = 7683, DECR_WRAP = 34056, - INVERT = 5386 + INVERT = 5386, } -export const enum StencilFn { +export enum StencilFn { NEVER = 512, LESS = 513, EQUAL = 514, @@ -19,7 +19,7 @@ export const enum StencilFn { GREATER = 516, NOTEQUAL = 517, GEQUAL = 518, - ALWAYS = 519 + ALWAYS = 519, } export type StencilOpParams = Tuple; diff --git a/packages/webgl/src/api/texture.ts b/packages/webgl/src/api/texture.ts index e11316b154..e3baa43ee3 100644 --- a/packages/webgl/src/api/texture.ts +++ b/packages/webgl/src/api/texture.ts @@ -1,7 +1,7 @@ import type { IBind, IObjectOf, IRelease } from "@thi.ng/api"; import type { IConfigure } from "./buffers"; -export const enum TextureFormat { +export enum TextureFormat { ALPHA = 0x1906, DEPTH_COMPONENT = 0x1902, DEPTH_COMPONENT16 = 0x81a5, @@ -68,10 +68,10 @@ export const enum TextureFormat { RGBA8I = 0x8d8e, RGBA8UI = 0x8d7c, SRGB8 = 0x8c41, - SRGB8_ALPHA8 = 0x8c43 + SRGB8_ALPHA8 = 0x8c43, } -export const enum TextureType { +export enum TextureType { BYTE = 0x1400, UNSIGNED_BYTE, SHORT, @@ -88,29 +88,29 @@ export const enum TextureType { UNSIGNED_INT_10F_11F_11F_REV = 0x8c3b, UNSIGNED_INT_5_9_9_9_REV = 0x8c3e, HALF_FLOAT_OES = 0x8d61, - FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8dad + FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8dad, } -export const enum TextureTarget { +export enum TextureTarget { TEXTURE_2D = 3553, TEXTURE_3D = 32879, TEXTURE_CUBE_MAP = 34067, - TEXTURE_2D_ARRAY = 35866 + TEXTURE_2D_ARRAY = 35866, } -export const enum TextureFilter { +export enum TextureFilter { LINEAR = 9729, NEAREST = 9728, NEAREST_MIPMAP_NEAREST = 9984, LINEAR_MIPMAP_NEAREST = 9985, NEAREST_MIPMAP_LINEAR = 9986, - LINEAR_MIPMAP_LINEAR = 9987 + LINEAR_MIPMAP_LINEAR = 9987, } -export const enum TextureRepeat { +export enum TextureRepeat { REPEAT = 10497, CLAMP = 33071, - REPEAT_MIRROR = 33648 + REPEAT_MIRROR = 33648, } export interface TextureFormatDecl { @@ -158,7 +158,7 @@ const $ = ( render, renderExt, filter, - num + num, }); export const TEX_FORMATS: IObjectOf = { @@ -172,7 +172,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.HALF_FLOAT_OES, 2, TextureType.FLOAT, - 4 + 4, ], 1, true, @@ -230,7 +230,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.HALF_FLOAT_OES, 4, TextureType.FLOAT, - 8 + 8, ], 2, true, @@ -246,7 +246,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.HALF_FLOAT_OES, 2, TextureType.FLOAT, - 4 + 4, ], 1, true, @@ -260,7 +260,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.HALF_FLOAT, 6, TextureType.UNSIGNED_INT_10F_11F_11F_REV, - 4 + 4, ], 3, false, @@ -411,7 +411,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.FLOAT, 12, TextureType.UNSIGNED_SHORT_5_6_5, - 2 + 2, ], 3, true, @@ -466,7 +466,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.UNSIGNED_SHORT_5_5_5_1, 2, TextureType.UNSIGNED_INT_2_10_10_10_REV, - 4 + 4, ], 4, true, @@ -511,7 +511,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.HALF_FLOAT, 6, TextureType.UNSIGNED_INT_5_9_9_9_REV, - 4 + 4, ], 3, false, @@ -531,7 +531,7 @@ export const TEX_FORMATS: IObjectOf = { TextureType.UNSIGNED_SHORT_4_4_4_4, 2, TextureType.UNSIGNED_SHORT_5_5_5_1, - 2 + 2, ], 4, true, @@ -623,7 +623,7 @@ export const TEX_FORMATS: IObjectOf = { 3, false, true - ) + ), }; export type ReadableTextureFormat =