@antv/l7-renderer 2.21.0 → 2.21.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/es/device/DeviceAttribute.js +26 -32
  2. package/es/device/DeviceBuffer.js +31 -49
  3. package/es/device/DeviceCache.js +136 -170
  4. package/es/device/DeviceElements.js +32 -38
  5. package/es/device/DeviceFramebuffer.js +76 -104
  6. package/es/device/DeviceModel.js +358 -384
  7. package/es/device/DeviceTexture2D.js +103 -122
  8. package/es/device/constants.js +117 -34
  9. package/es/device/index.js +254 -381
  10. package/es/device/utils/HashMap.js +71 -138
  11. package/es/device/utils/pipeline.js +6 -1
  12. package/es/device/utils/typedarray.js +23 -24
  13. package/es/device/utils/webgl.js +7 -6
  14. package/es/index.js +5 -4
  15. package/es/regl/ReglAttribute.js +17 -33
  16. package/es/regl/ReglBuffer.js +25 -40
  17. package/es/regl/ReglElements.js +21 -36
  18. package/es/regl/ReglFramebuffer.js +24 -44
  19. package/es/regl/ReglModel.js +266 -306
  20. package/es/regl/ReglRenderbuffer.js +19 -36
  21. package/es/regl/ReglTexture2D.js +72 -103
  22. package/es/regl/constants.js +133 -21
  23. package/es/regl/index.js +205 -290
  24. package/lib/device/DeviceAttribute.d.ts +13 -0
  25. package/lib/device/DeviceBuffer.d.ts +18 -0
  26. package/lib/device/DeviceCache.d.ts +14 -0
  27. package/lib/device/DeviceElements.d.ts +13 -0
  28. package/lib/device/DeviceFramebuffer.d.ts +24 -0
  29. package/lib/device/DeviceModel.d.ts +53 -0
  30. package/lib/device/DeviceModel.js +22 -15
  31. package/lib/device/DeviceTexture2D.d.ts +23 -0
  32. package/lib/device/constants.d.ts +35 -0
  33. package/lib/device/index.d.ts +68 -0
  34. package/lib/device/index.js +58 -36
  35. package/lib/device/utils/HashMap.d.ts +24 -0
  36. package/lib/device/utils/pipeline.d.ts +1 -0
  37. package/lib/device/utils/typedarray.d.ts +7 -0
  38. package/lib/device/utils/webgl.d.ts +1 -0
  39. package/lib/index.d.ts +6 -0
  40. package/lib/regl/ReglAttribute.d.ts +16 -0
  41. package/lib/regl/ReglBuffer.d.ts +17 -0
  42. package/lib/regl/ReglElements.d.ts +14 -0
  43. package/lib/regl/ReglFramebuffer.d.ts +16 -0
  44. package/lib/regl/ReglModel.d.ts +46 -0
  45. package/lib/regl/ReglModel.js +21 -11
  46. package/lib/regl/ReglRenderbuffer.d.ts +16 -0
  47. package/lib/regl/ReglTexture2D.d.ts +22 -0
  48. package/lib/regl/constants.d.ts +43 -0
  49. package/lib/regl/index.d.ts +56 -0
  50. package/lib/regl/index.js +70 -48
  51. package/package.json +14 -18
  52. package/CHANGELOG.md +0 -350
  53. package/LICENSE.md +0 -21
@@ -1,28 +1,28 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- import { TextureUsage as DeviceTextureUsage, FilterMode, Format, MipmapFilterMode } from '@antv/g-device-api';
5
- import { TextureUsage, gl } from '@antv/l7-core';
1
+ // src/device/DeviceTexture2D.ts
2
+ import {
3
+ TextureUsage as DeviceTextureUsage,
4
+ FilterMode,
5
+ Format,
6
+ MipmapFilterMode
7
+ } from "@antv/g-device-api";
8
+ import { TextureUsage, gl } from "@antv/l7-core";
6
9
  import { wrapModeMap } from "./constants";
7
10
  import { extend3ChannelsTo4 } from "./utils/typedarray";
8
- export function isTexture2D(t) {
9
- return !!(t && t['texture']);
11
+ function isTexture2D(t) {
12
+ return !!(t && t["texture"]);
10
13
  }
11
- var DeviceTexture2D = /*#__PURE__*/function () {
12
- function DeviceTexture2D(device, options) {
13
- _classCallCheck(this, DeviceTexture2D);
14
- _defineProperty(this, "isDestroy", false);
14
+ var DeviceTexture2D = class {
15
+ constructor(device, options) {
15
16
  this.device = device;
16
17
  this.options = options;
17
- var _options$wrapS = options.wrapS,
18
- wrapS = _options$wrapS === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapS,
19
- _options$wrapT = options.wrapT,
20
- wrapT = _options$wrapT === void 0 ? gl.CLAMP_TO_EDGE : _options$wrapT,
21
- aniso = options.aniso,
22
- _options$mag = options.mag,
23
- mag = _options$mag === void 0 ? gl.NEAREST : _options$mag,
24
- _options$min = options.min,
25
- min = _options$min === void 0 ? gl.NEAREST : _options$min;
18
+ this.isDestroy = false;
19
+ const {
20
+ wrapS = gl.CLAMP_TO_EDGE,
21
+ wrapT = gl.CLAMP_TO_EDGE,
22
+ aniso,
23
+ mag = gl.NEAREST,
24
+ min = gl.NEAREST
25
+ } = options;
26
26
  this.createTexture(options);
27
27
  this.sampler = device.createSampler({
28
28
  addressModeU: wrapModeMap[wrapS],
@@ -35,115 +35,96 @@ var DeviceTexture2D = /*#__PURE__*/function () {
35
35
  maxAnisotropy: aniso
36
36
  });
37
37
  }
38
- _createClass(DeviceTexture2D, [{
39
- key: "createTexture",
40
- value: function createTexture(options) {
41
- var _options$type = options.type,
42
- type = _options$type === void 0 ? gl.UNSIGNED_BYTE : _options$type,
43
- width = options.width,
44
- height = options.height,
45
- _options$flipY = options.flipY,
46
- flipY = _options$flipY === void 0 ? false : _options$flipY,
47
- _options$format = options.format,
48
- format = _options$format === void 0 ? gl.RGBA : _options$format,
49
- _options$alignment = options.alignment,
50
- alignment = _options$alignment === void 0 ? 1 : _options$alignment,
51
- _options$usage = options.usage,
52
- usage = _options$usage === void 0 ? TextureUsage.SAMPLED : _options$usage,
53
- _options$unorm = options.unorm,
54
- unorm = _options$unorm === void 0 ? false : _options$unorm,
55
- label = options.label;
56
- var data = options.data;
57
- this.width = width;
58
- this.height = height;
59
- var pixelFormat = Format.U8_RGBA_RT;
60
- if (type === gl.UNSIGNED_BYTE && format === gl.RGBA) {
61
- pixelFormat = unorm ? Format.U8_RGBA_NORM : Format.U8_RGBA_RT;
62
- } else if (type === gl.UNSIGNED_BYTE && format === gl.LUMINANCE) {
63
- pixelFormat = Format.U8_LUMINANCE;
64
- } else if (type === gl.FLOAT && format === gl.RGB) {
65
- // @see https://github.com/antvis/L7/pull/2262
66
- if (this.device.queryVendorInfo().platformString === 'WebGPU') {
67
- if (data) {
68
- // @ts-ignore
69
- data = extend3ChannelsTo4(data, 0);
70
- }
71
- pixelFormat = Format.F32_RGBA;
72
- } else {
73
- pixelFormat = Format.F32_RGB;
38
+ createTexture(options) {
39
+ const {
40
+ type = gl.UNSIGNED_BYTE,
41
+ width,
42
+ height,
43
+ flipY = false,
44
+ format = gl.RGBA,
45
+ alignment = 1,
46
+ usage = TextureUsage.SAMPLED,
47
+ // premultiplyAlpha = false,
48
+ unorm = false,
49
+ // colorSpace = gl.BROWSER_DEFAULT_WEBGL,
50
+ // x = 0,
51
+ // y = 0,
52
+ // copy = false,
53
+ label
54
+ } = options;
55
+ let { data } = options;
56
+ this.width = width;
57
+ this.height = height;
58
+ let pixelFormat = Format.U8_RGBA_RT;
59
+ if (type === gl.UNSIGNED_BYTE && format === gl.RGBA) {
60
+ pixelFormat = unorm ? Format.U8_RGBA_NORM : Format.U8_RGBA_RT;
61
+ } else if (type === gl.UNSIGNED_BYTE && format === gl.LUMINANCE) {
62
+ pixelFormat = Format.U8_LUMINANCE;
63
+ } else if (type === gl.FLOAT && format === gl.RGB) {
64
+ if (this.device.queryVendorInfo().platformString === "WebGPU") {
65
+ if (data) {
66
+ data = extend3ChannelsTo4(data, 0);
74
67
  }
75
- } else if (type === gl.FLOAT && format === gl.RGBA) {
76
68
  pixelFormat = Format.F32_RGBA;
77
- } else if (type === gl.FLOAT && format === gl.RED) {
78
- pixelFormat = Format.F32_R;
79
69
  } else {
80
- throw new Error("create texture error, type: ".concat(type, ", format: ").concat(format));
81
- }
82
- this.texture = this.device.createTexture({
83
- format: pixelFormat,
84
- width: width,
85
- height: height,
86
- usage: usage === TextureUsage.SAMPLED ? DeviceTextureUsage.SAMPLED : DeviceTextureUsage.RENDER_TARGET,
87
- pixelStore: {
88
- unpackFlipY: flipY,
89
- packAlignment: alignment
90
- },
91
- // mipLevelCount: usage === TextureUsage.RENDER_TARGET ? 1 : mipmap ? 1 : 0,
92
- mipLevelCount: 1
93
- });
94
- if (label) {
95
- this.device.setResourceName(this.texture, label);
96
- }
97
- if (data) {
98
- // @ts-ignore
99
- this.texture.setImageData([data]);
70
+ pixelFormat = Format.F32_RGB;
100
71
  }
72
+ } else if (type === gl.FLOAT && format === gl.RGBA) {
73
+ pixelFormat = Format.F32_RGBA;
74
+ } else if (type === gl.FLOAT && format === gl.RED) {
75
+ pixelFormat = Format.F32_R;
76
+ } else {
77
+ throw new Error(`create texture error, type: ${type}, format: ${format}`);
101
78
  }
102
- }, {
103
- key: "get",
104
- value: function get() {
105
- return this.texture;
79
+ this.texture = this.device.createTexture({
80
+ format: pixelFormat,
81
+ width,
82
+ height,
83
+ usage: usage === TextureUsage.SAMPLED ? DeviceTextureUsage.SAMPLED : DeviceTextureUsage.RENDER_TARGET,
84
+ pixelStore: {
85
+ unpackFlipY: flipY,
86
+ packAlignment: alignment
87
+ },
88
+ // mipLevelCount: usage === TextureUsage.RENDER_TARGET ? 1 : mipmap ? 1 : 0,
89
+ mipLevelCount: 1
90
+ });
91
+ if (label) {
92
+ this.device.setResourceName(this.texture, label);
106
93
  }
107
- }, {
108
- key: "update",
109
- value: function update(props) {
110
- var data = props.data;
94
+ if (data) {
111
95
  this.texture.setImageData([data]);
112
96
  }
113
- }, {
114
- key: "bind",
115
- value: function bind() {
116
- // this.texture._texture.bind();
117
- }
118
- }, {
119
- key: "resize",
120
- value: function resize(_ref) {
121
- var width = _ref.width,
122
- height = _ref.height;
123
- if (this.width !== width || this.height !== height) {
124
- this.destroy();
125
- }
126
- this.options.width = width;
127
- this.options.height = height;
128
- this.createTexture(this.options);
129
- this.isDestroy = false;
130
- }
131
- }, {
132
- key: "getSize",
133
- value: function getSize() {
134
- return [this.width, this.height];
97
+ }
98
+ get() {
99
+ return this.texture;
100
+ }
101
+ update(props) {
102
+ const { data } = props;
103
+ this.texture.setImageData([data]);
104
+ }
105
+ bind() {
106
+ }
107
+ resize({ width, height }) {
108
+ if (this.width !== width || this.height !== height) {
109
+ this.destroy();
135
110
  }
136
- }, {
137
- key: "destroy",
138
- value: function destroy() {
139
- // @ts-ignore
140
- if (!this.isDestroy && !this.texture.destroyed) {
141
- var _this$texture;
142
- (_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
143
- }
144
- this.isDestroy = true;
111
+ this.options.width = width;
112
+ this.options.height = height;
113
+ this.createTexture(this.options);
114
+ this.isDestroy = false;
115
+ }
116
+ getSize() {
117
+ return [this.width, this.height];
118
+ }
119
+ destroy() {
120
+ var _a;
121
+ if (!this.isDestroy && !this.texture.destroyed) {
122
+ (_a = this.texture) == null ? void 0 : _a.destroy();
145
123
  }
146
- }]);
147
- return DeviceTexture2D;
148
- }();
149
- export { DeviceTexture2D as default };
124
+ this.isDestroy = true;
125
+ }
126
+ };
127
+ export {
128
+ DeviceTexture2D as default,
129
+ isTexture2D
130
+ };
@@ -1,34 +1,117 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- var _typedArrayCtorMap, _primitiveMap, _sizeFormatMap, _hintMap, _wrapModeMap, _depthFuncMap, _cullFaceMap, _blendEquationMap, _blendFuncMap, _stencilOpMap, _stencilFuncMap;
3
- import { AddressMode, BlendFactor, BlendMode, BufferFrequencyHint, CompareFunction, CullMode, Format, PrimitiveTopology, StencilOp } from '@antv/g-device-api';
4
- import { gl } from '@antv/l7-core';
5
- export var typedArrayCtorMap = (_typedArrayCtorMap = {}, _defineProperty(_typedArrayCtorMap, gl.FLOAT, Float32Array), _defineProperty(_typedArrayCtorMap, gl.UNSIGNED_BYTE, Uint8Array), _defineProperty(_typedArrayCtorMap, gl.SHORT, Int16Array), _defineProperty(_typedArrayCtorMap, gl.UNSIGNED_SHORT, Uint16Array), _defineProperty(_typedArrayCtorMap, gl.INT, Int32Array), _defineProperty(_typedArrayCtorMap, gl.UNSIGNED_INT, Uint32Array), _typedArrayCtorMap);
6
- export var primitiveMap = (_primitiveMap = {}, _defineProperty(_primitiveMap, gl.POINTS, PrimitiveTopology.POINTS), _defineProperty(_primitiveMap, gl.LINES, PrimitiveTopology.LINES), _defineProperty(_primitiveMap, gl.LINE_LOOP, PrimitiveTopology.LINES), _defineProperty(_primitiveMap, gl.LINE_STRIP, PrimitiveTopology.LINE_STRIP), _defineProperty(_primitiveMap, gl.TRIANGLES, PrimitiveTopology.TRIANGLES), _defineProperty(_primitiveMap, gl.TRIANGLE_FAN, PrimitiveTopology.TRIANGLES), _defineProperty(_primitiveMap, gl.TRIANGLE_STRIP, PrimitiveTopology.TRIANGLE_STRIP), _primitiveMap);
7
- export var sizeFormatMap = (_sizeFormatMap = {}, _defineProperty(_sizeFormatMap, 1, Format.F32_R), _defineProperty(_sizeFormatMap, 2, Format.F32_RG), _defineProperty(_sizeFormatMap, 3, Format.F32_RGB), _defineProperty(_sizeFormatMap, 4, Format.F32_RGBA), _sizeFormatMap);
8
- export var hintMap = (_hintMap = {}, _defineProperty(_hintMap, gl.STATIC_DRAW, BufferFrequencyHint.STATIC), _defineProperty(_hintMap, gl.DYNAMIC_DRAW, BufferFrequencyHint.DYNAMIC), _defineProperty(_hintMap, gl.STREAM_DRAW, BufferFrequencyHint.DYNAMIC), _hintMap);
9
- export var wrapModeMap = (_wrapModeMap = {}, _defineProperty(_wrapModeMap, gl.REPEAT, AddressMode.REPEAT), _defineProperty(_wrapModeMap, gl.CLAMP_TO_EDGE, AddressMode.CLAMP_TO_EDGE), _defineProperty(_wrapModeMap, gl.MIRRORED_REPEAT, AddressMode.MIRRORED_REPEAT), _wrapModeMap);
10
- export var depthFuncMap = (_depthFuncMap = {}, _defineProperty(_depthFuncMap, gl.NEVER, CompareFunction.NEVER), _defineProperty(_depthFuncMap, gl.ALWAYS, CompareFunction.ALWAYS), _defineProperty(_depthFuncMap, gl.LESS, CompareFunction.LESS), _defineProperty(_depthFuncMap, gl.LEQUAL, CompareFunction.LEQUAL), _defineProperty(_depthFuncMap, gl.GREATER, CompareFunction.GREATER), _defineProperty(_depthFuncMap, gl.GEQUAL, CompareFunction.GEQUAL), _defineProperty(_depthFuncMap, gl.EQUAL, CompareFunction.EQUAL), _defineProperty(_depthFuncMap, gl.NOTEQUAL, CompareFunction.NOTEQUAL), _depthFuncMap);
11
- export var cullFaceMap = (_cullFaceMap = {}, _defineProperty(_cullFaceMap, gl.FRONT, CullMode.FRONT), _defineProperty(_cullFaceMap, gl.BACK, CullMode.BACK), _cullFaceMap);
12
- export var blendEquationMap = (_blendEquationMap = {}, _defineProperty(_blendEquationMap, gl.FUNC_ADD, BlendMode.ADD), _defineProperty(_blendEquationMap, gl.MIN_EXT, BlendMode.MIN), _defineProperty(_blendEquationMap, gl.MAX_EXT, BlendMode.MAX), _defineProperty(_blendEquationMap, gl.FUNC_SUBTRACT, BlendMode.SUBSTRACT), _defineProperty(_blendEquationMap, gl.FUNC_REVERSE_SUBTRACT, BlendMode.REVERSE_SUBSTRACT), _blendEquationMap);
13
- export var blendFuncMap = (_blendFuncMap = {}, _defineProperty(_blendFuncMap, gl.ZERO, BlendFactor.ZERO), _defineProperty(_blendFuncMap, gl.ONE, BlendFactor.ONE), _defineProperty(_blendFuncMap, gl.SRC_COLOR, BlendFactor.SRC), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_COLOR, BlendFactor.ONE_MINUS_SRC), _defineProperty(_blendFuncMap, gl.SRC_ALPHA, BlendFactor.SRC_ALPHA), _defineProperty(_blendFuncMap, gl.ONE_MINUS_SRC_ALPHA, BlendFactor.ONE_MINUS_SRC_ALPHA), _defineProperty(_blendFuncMap, gl.DST_COLOR, BlendFactor.DST), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_COLOR, BlendFactor.ONE_MINUS_DST), _defineProperty(_blendFuncMap, gl.DST_ALPHA, BlendFactor.DST_ALPHA), _defineProperty(_blendFuncMap, gl.ONE_MINUS_DST_ALPHA, BlendFactor.ONE_MINUS_DST_ALPHA), _defineProperty(_blendFuncMap, gl.CONSTANT_COLOR, BlendFactor.CONST), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_COLOR, BlendFactor.ONE_MINUS_CONSTANT), _defineProperty(_blendFuncMap, gl.CONSTANT_ALPHA, BlendFactor.CONST), _defineProperty(_blendFuncMap, gl.ONE_MINUS_CONSTANT_ALPHA, BlendFactor.ONE_MINUS_CONSTANT), _defineProperty(_blendFuncMap, gl.SRC_ALPHA_SATURATE, BlendFactor.SRC_ALPHA_SATURATE), _blendFuncMap);
14
- export var stencilOpMap = (_stencilOpMap = {}, _defineProperty(_stencilOpMap, gl.REPLACE, StencilOp.REPLACE), _defineProperty(_stencilOpMap, gl.KEEP, StencilOp.KEEP), _defineProperty(_stencilOpMap, gl.ZERO, StencilOp.ZERO), _defineProperty(_stencilOpMap, gl.INVERT, StencilOp.INVERT), _defineProperty(_stencilOpMap, gl.INCR, StencilOp.INCREMENT_CLAMP), _defineProperty(_stencilOpMap, gl.DECR, StencilOp.DECREMENT_CLAMP), _defineProperty(_stencilOpMap, gl.INCR_WRAP, StencilOp.INCREMENT_WRAP), _defineProperty(_stencilOpMap, gl.DECR_WRAP, StencilOp.DECREMENT_WRAP), _stencilOpMap);
15
- export var stencilFuncMap = (_stencilFuncMap = {}, _defineProperty(_stencilFuncMap, gl.ALWAYS, CompareFunction.ALWAYS), _defineProperty(_stencilFuncMap, gl.EQUAL, CompareFunction.EQUAL), _defineProperty(_stencilFuncMap, gl.GEQUAL, CompareFunction.GEQUAL), _defineProperty(_stencilFuncMap, gl.GREATER, CompareFunction.GREATER), _defineProperty(_stencilFuncMap, gl.LEQUAL, CompareFunction.LEQUAL), _defineProperty(_stencilFuncMap, gl.LESS, CompareFunction.LESS), _defineProperty(_stencilFuncMap, gl.NEVER, CompareFunction.NEVER), _defineProperty(_stencilFuncMap, gl.NOTEQUAL, CompareFunction.NOTEQUAL), _stencilFuncMap);
16
-
17
- // export const filterMap: {
18
- // [key: string]: FilterMode;
19
- // } = {
20
- // [gl.NEAREST]: 'nearest',
21
- // [gl.LINEAR]: 'linear',
22
- // [gl.LINEAR_MIPMAP_LINEAR]: 'mipmap',
23
- // [gl.NEAREST_MIPMAP_LINEAR]: 'nearest mipmap linear',
24
- // [gl.LINEAR_MIPMAP_NEAREST]: 'linear mipmap nearest',
25
- // [gl.NEAREST_MIPMAP_NEAREST]: 'nearest mipmap nearest',
26
- // };
27
-
28
- // export const mipmapMap: {
29
- // [key: string]: MipmapFilterMode;
30
- // } = {
31
- // [gl.DONT_CARE]: MipmapFilterMode,
32
- // [gl.NICEST]: 'nice',
33
- // [gl.FASTEST]: 'fast',
34
- // };
1
+ // src/device/constants.ts
2
+ import {
3
+ AddressMode,
4
+ BlendFactor,
5
+ BlendMode,
6
+ BufferFrequencyHint,
7
+ CompareFunction,
8
+ CullMode,
9
+ Format,
10
+ PrimitiveTopology,
11
+ StencilOp
12
+ } from "@antv/g-device-api";
13
+ import { gl } from "@antv/l7-core";
14
+ var typedArrayCtorMap = {
15
+ [gl.FLOAT]: Float32Array,
16
+ [gl.UNSIGNED_BYTE]: Uint8Array,
17
+ [gl.SHORT]: Int16Array,
18
+ [gl.UNSIGNED_SHORT]: Uint16Array,
19
+ [gl.INT]: Int32Array,
20
+ [gl.UNSIGNED_INT]: Uint32Array
21
+ };
22
+ var primitiveMap = {
23
+ [gl.POINTS]: PrimitiveTopology.POINTS,
24
+ [gl.LINES]: PrimitiveTopology.LINES,
25
+ [gl.LINE_LOOP]: PrimitiveTopology.LINES,
26
+ [gl.LINE_STRIP]: PrimitiveTopology.LINE_STRIP,
27
+ [gl.TRIANGLES]: PrimitiveTopology.TRIANGLES,
28
+ [gl.TRIANGLE_FAN]: PrimitiveTopology.TRIANGLES,
29
+ [gl.TRIANGLE_STRIP]: PrimitiveTopology.TRIANGLE_STRIP
30
+ };
31
+ var sizeFormatMap = {
32
+ [1]: Format.F32_R,
33
+ [2]: Format.F32_RG,
34
+ [3]: Format.F32_RGB,
35
+ [4]: Format.F32_RGBA
36
+ };
37
+ var hintMap = {
38
+ [gl.STATIC_DRAW]: BufferFrequencyHint.STATIC,
39
+ [gl.DYNAMIC_DRAW]: BufferFrequencyHint.DYNAMIC,
40
+ [gl.STREAM_DRAW]: BufferFrequencyHint.DYNAMIC
41
+ };
42
+ var wrapModeMap = {
43
+ [gl.REPEAT]: AddressMode.REPEAT,
44
+ [gl.CLAMP_TO_EDGE]: AddressMode.CLAMP_TO_EDGE,
45
+ [gl.MIRRORED_REPEAT]: AddressMode.MIRRORED_REPEAT
46
+ };
47
+ var depthFuncMap = {
48
+ [gl.NEVER]: CompareFunction.NEVER,
49
+ [gl.ALWAYS]: CompareFunction.ALWAYS,
50
+ [gl.LESS]: CompareFunction.LESS,
51
+ [gl.LEQUAL]: CompareFunction.LEQUAL,
52
+ [gl.GREATER]: CompareFunction.GREATER,
53
+ [gl.GEQUAL]: CompareFunction.GEQUAL,
54
+ [gl.EQUAL]: CompareFunction.EQUAL,
55
+ [gl.NOTEQUAL]: CompareFunction.NOTEQUAL
56
+ };
57
+ var cullFaceMap = {
58
+ [gl.FRONT]: CullMode.FRONT,
59
+ [gl.BACK]: CullMode.BACK
60
+ };
61
+ var blendEquationMap = {
62
+ [gl.FUNC_ADD]: BlendMode.ADD,
63
+ [gl.MIN_EXT]: BlendMode.MIN,
64
+ [gl.MAX_EXT]: BlendMode.MAX,
65
+ [gl.FUNC_SUBTRACT]: BlendMode.SUBSTRACT,
66
+ [gl.FUNC_REVERSE_SUBTRACT]: BlendMode.REVERSE_SUBSTRACT
67
+ };
68
+ var blendFuncMap = {
69
+ [gl.ZERO]: BlendFactor.ZERO,
70
+ [gl.ONE]: BlendFactor.ONE,
71
+ [gl.SRC_COLOR]: BlendFactor.SRC,
72
+ [gl.ONE_MINUS_SRC_COLOR]: BlendFactor.ONE_MINUS_SRC,
73
+ [gl.SRC_ALPHA]: BlendFactor.SRC_ALPHA,
74
+ [gl.ONE_MINUS_SRC_ALPHA]: BlendFactor.ONE_MINUS_SRC_ALPHA,
75
+ [gl.DST_COLOR]: BlendFactor.DST,
76
+ [gl.ONE_MINUS_DST_COLOR]: BlendFactor.ONE_MINUS_DST,
77
+ [gl.DST_ALPHA]: BlendFactor.DST_ALPHA,
78
+ [gl.ONE_MINUS_DST_ALPHA]: BlendFactor.ONE_MINUS_DST_ALPHA,
79
+ [gl.CONSTANT_COLOR]: BlendFactor.CONST,
80
+ [gl.ONE_MINUS_CONSTANT_COLOR]: BlendFactor.ONE_MINUS_CONSTANT,
81
+ [gl.CONSTANT_ALPHA]: BlendFactor.CONST,
82
+ [gl.ONE_MINUS_CONSTANT_ALPHA]: BlendFactor.ONE_MINUS_CONSTANT,
83
+ [gl.SRC_ALPHA_SATURATE]: BlendFactor.SRC_ALPHA_SATURATE
84
+ };
85
+ var stencilOpMap = {
86
+ [gl.REPLACE]: StencilOp.REPLACE,
87
+ [gl.KEEP]: StencilOp.KEEP,
88
+ [gl.ZERO]: StencilOp.ZERO,
89
+ [gl.INVERT]: StencilOp.INVERT,
90
+ [gl.INCR]: StencilOp.INCREMENT_CLAMP,
91
+ [gl.DECR]: StencilOp.DECREMENT_CLAMP,
92
+ [gl.INCR_WRAP]: StencilOp.INCREMENT_WRAP,
93
+ [gl.DECR_WRAP]: StencilOp.DECREMENT_WRAP
94
+ };
95
+ var stencilFuncMap = {
96
+ [gl.ALWAYS]: CompareFunction.ALWAYS,
97
+ [gl.EQUAL]: CompareFunction.EQUAL,
98
+ [gl.GEQUAL]: CompareFunction.GEQUAL,
99
+ [gl.GREATER]: CompareFunction.GREATER,
100
+ [gl.LEQUAL]: CompareFunction.LEQUAL,
101
+ [gl.LESS]: CompareFunction.LESS,
102
+ [gl.NEVER]: CompareFunction.NEVER,
103
+ [gl.NOTEQUAL]: CompareFunction.NOTEQUAL
104
+ };
105
+ export {
106
+ blendEquationMap,
107
+ blendFuncMap,
108
+ cullFaceMap,
109
+ depthFuncMap,
110
+ hintMap,
111
+ primitiveMap,
112
+ sizeFormatMap,
113
+ stencilFuncMap,
114
+ stencilOpMap,
115
+ typedArrayCtorMap,
116
+ wrapModeMap
117
+ };