@openglobus/og 0.12.1 → 0.13.0

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 (230) hide show
  1. package/README.md +0 -2
  2. package/dist/@openglobus/og.css +1 -0
  3. package/dist/@openglobus/og.esm.js +21 -0
  4. package/dist/@openglobus/og.esm.js.map +1 -0
  5. package/dist/@openglobus/og.umd.js +21 -0
  6. package/dist/@openglobus/og.umd.js.map +1 -0
  7. package/package.json +8 -8
  8. package/src/og/Extent.js +3 -3
  9. package/src/og/Globe.js +277 -275
  10. package/src/og/ImageCanvas.js +3 -3
  11. package/src/og/LonLat.js +9 -9
  12. package/src/og/QueueArray.js +2 -2
  13. package/src/og/Rectangle.js +5 -5
  14. package/src/og/bv/Box.js +1 -1
  15. package/src/og/bv/Sphere.js +2 -2
  16. package/src/og/camera/Camera.js +1 -1
  17. package/src/og/camera/PlanetCamera.js +649 -646
  18. package/src/og/control/LayerSwitcher.js +1 -1
  19. package/src/og/control/MouseNavigation.js +22 -13
  20. package/src/og/control/MouseWheelZoomControl.js +2 -2
  21. package/src/og/control/ScaleControl.js +1 -1
  22. package/src/og/control/TouchNavigation.js +319 -319
  23. package/src/og/control/ZoomControl.js +132 -132
  24. package/src/og/control/visibleExtent/Segment.js +12 -12
  25. package/src/og/ellipsoid/Ellipsoid.js +577 -567
  26. package/src/og/entity/BillboardHandler.js +878 -1051
  27. package/src/og/entity/Entity.js +1 -1
  28. package/src/og/entity/EntityCollection.js +847 -857
  29. package/src/og/entity/GeoObjectHandler.js +37 -18
  30. package/src/og/entity/LabelHandler.js +888 -1040
  31. package/src/og/entity/LabelWorker.js +0 -6
  32. package/src/og/entity/PointCloud.js +495 -495
  33. package/src/og/entity/Polyline.js +2218 -2222
  34. package/src/og/entity/RayHandler.js +1 -1
  35. package/src/og/layer/CanvasTiles.js +6 -3
  36. package/src/og/layer/GeoImage.js +1 -1
  37. package/src/og/layer/KML.js +24 -17
  38. package/src/og/layer/Layer.js +806 -751
  39. package/src/og/layer/Vector.js +997 -1010
  40. package/src/og/layer/XYZ.js +359 -357
  41. package/src/og/math/Line2.js +4 -4
  42. package/src/og/math/Quat.js +2 -2
  43. package/src/og/math/Ray.js +2 -2
  44. package/src/og/math/Vec2.js +524 -524
  45. package/src/og/math/Vec3.js +900 -900
  46. package/src/og/math/Vec4.js +261 -261
  47. package/src/og/math.js +397 -398
  48. package/src/og/quadTree/EntityCollectionNode.js +389 -387
  49. package/src/og/renderer/Renderer.js +14 -20
  50. package/src/og/renderer/RendererEvents.js +1034 -1045
  51. package/src/og/scene/Planet.js +26 -23
  52. package/src/og/scene/RenderNode.js +347 -354
  53. package/src/og/segment/Segment.js +3 -1
  54. package/src/og/segment/SegmentLonLat.js +1 -4
  55. package/src/og/shaders/billboard.js +220 -204
  56. package/src/og/shaders/drawnode.js +603 -603
  57. package/src/og/shaders/geoObject.js +15 -6
  58. package/src/og/shaders/label.js +596 -456
  59. package/src/og/shaders/polyline.js +365 -361
  60. package/src/og/terrain/MapboxTerrain.js +1 -1
  61. package/src/og/utils/FontAtlas.js +209 -200
  62. package/src/og/utils/GeoImageCreator.js +4 -5
  63. package/src/og/utils/TextureAtlas.js +4 -4
  64. package/src/og/utils/VectorTileCreator.js +414 -414
  65. package/src/og/utils/shared.js +1 -1
  66. package/src/og/webgl/Handler.js +28 -60
  67. package/src/og/webgl/Multisample.js +260 -260
  68. package/src/og/webgl/Program.js +411 -396
  69. package/types/Clock.d.ts +94 -0
  70. package/types/Deferred.d.ts +6 -0
  71. package/types/Events.d.ts +77 -0
  72. package/types/Extent.d.ts +166 -0
  73. package/types/Globe.d.ts +85 -0
  74. package/types/ImageCanvas.d.ts +123 -0
  75. package/types/Lock.d.ts +12 -0
  76. package/types/LonLat.d.ts +108 -0
  77. package/types/Popup.d.ts +42 -0
  78. package/types/QueueArray.d.ts +19 -0
  79. package/types/Rectangle.d.ts +80 -0
  80. package/types/Stack.d.ts +19 -0
  81. package/types/ajax.d.ts +24 -0
  82. package/types/arial.d.ts +48 -0
  83. package/types/astro/astro.d.ts +38 -0
  84. package/types/astro/earth.d.ts +7 -0
  85. package/types/astro/jd.d.ts +254 -0
  86. package/types/bv/Box.d.ts +30 -0
  87. package/types/bv/Sphere.d.ts +38 -0
  88. package/types/bv/index.d.ts +3 -0
  89. package/types/camera/Camera.d.ts +312 -0
  90. package/types/camera/Frustum.d.ts +133 -0
  91. package/types/camera/PlanetCamera.d.ts +219 -0
  92. package/types/camera/index.d.ts +3 -0
  93. package/types/cons.d.ts +40 -0
  94. package/types/control/CompassButton.d.ts +17 -0
  95. package/types/control/Control.d.ts +104 -0
  96. package/types/control/DebugInfo.d.ts +15 -0
  97. package/types/control/EarthCoordinates.d.ts +47 -0
  98. package/types/control/EarthNavigation.d.ts +43 -0
  99. package/types/control/GeoImageDragControl.d.ts +6 -0
  100. package/types/control/KeyboardNavigation.d.ts +21 -0
  101. package/types/control/LayerSwitcher.d.ts +21 -0
  102. package/types/control/Lighting.d.ts +16 -0
  103. package/types/control/MouseNavigation.d.ts +48 -0
  104. package/types/control/MouseWheelZoomControl.d.ts +45 -0
  105. package/types/control/ScaleControl.d.ts +22 -0
  106. package/types/control/ShowFps.d.ts +11 -0
  107. package/types/control/SimpleNavigation.d.ts +25 -0
  108. package/types/control/Sun.d.ts +50 -0
  109. package/types/control/ToggleWireframe.d.ts +12 -0
  110. package/types/control/TouchNavigation.d.ts +48 -0
  111. package/types/control/ZoomControl.d.ts +27 -0
  112. package/types/control/index.d.ts +18 -0
  113. package/types/ellipsoid/Ellipsoid.d.ts +153 -0
  114. package/types/ellipsoid/index.d.ts +3 -0
  115. package/types/ellipsoid/wgs84.d.ts +6 -0
  116. package/types/entity/BaseBillboard.d.ts +215 -0
  117. package/types/entity/Billboard.d.ts +94 -0
  118. package/types/entity/BillboardHandler.d.ts +75 -0
  119. package/types/entity/Entity.d.ts +348 -0
  120. package/types/entity/EntityCollection.d.ts +309 -0
  121. package/types/entity/GeoObject.d.ts +111 -0
  122. package/types/entity/GeoObjectHandler.d.ts +81 -0
  123. package/types/entity/Geometry.d.ts +74 -0
  124. package/types/entity/GeometryHandler.d.ts +76 -0
  125. package/types/entity/Label.d.ts +189 -0
  126. package/types/entity/LabelHandler.d.ts +29 -0
  127. package/types/entity/LabelWorker.d.ts +11 -0
  128. package/types/entity/PointCloud.d.ts +174 -0
  129. package/types/entity/PointCloudHandler.d.ts +38 -0
  130. package/types/entity/Polyline.d.ts +306 -0
  131. package/types/entity/PolylineHandler.d.ts +18 -0
  132. package/types/entity/Ray.d.ts +124 -0
  133. package/types/entity/RayHandler.d.ts +67 -0
  134. package/types/entity/ShapeHandler.d.ts +22 -0
  135. package/types/entity/Strip.d.ts +119 -0
  136. package/types/entity/StripHandler.d.ts +38 -0
  137. package/types/entity/index.d.ts +8 -0
  138. package/types/index.core.d.ts +65 -0
  139. package/types/index.d.ts +45 -0
  140. package/types/index.webgl.d.ts +7 -0
  141. package/types/input/KeyboardHandler.d.ts +10 -0
  142. package/types/input/MouseHandler.d.ts +5 -0
  143. package/types/input/TouchHandler.d.ts +5 -0
  144. package/types/input/input.d.ts +34 -0
  145. package/types/layer/BaseGeoImage.d.ts +94 -0
  146. package/types/layer/CanvasTiles.d.ts +67 -0
  147. package/types/layer/GeoImage.d.ts +52 -0
  148. package/types/layer/GeoTexture2d.d.ts +8 -0
  149. package/types/layer/GeoVideo.d.ts +55 -0
  150. package/types/layer/KML.d.ts +68 -0
  151. package/types/layer/Layer.d.ts +315 -0
  152. package/types/layer/Material.d.ts +45 -0
  153. package/types/layer/Vector.d.ts +201 -0
  154. package/types/layer/WMS.d.ts +61 -0
  155. package/types/layer/XYZ.d.ts +119 -0
  156. package/types/layer/index.d.ts +10 -0
  157. package/types/light/LightSource.d.ts +178 -0
  158. package/types/math/Line2.d.ts +11 -0
  159. package/types/math/Line3.d.ts +10 -0
  160. package/types/math/Mat3.d.ts +65 -0
  161. package/types/math/Mat4.d.ts +176 -0
  162. package/types/math/Plane.d.ts +18 -0
  163. package/types/math/Quat.d.ts +379 -0
  164. package/types/math/Ray.d.ts +82 -0
  165. package/types/math/Vec2.d.ts +309 -0
  166. package/types/math/Vec3.d.ts +467 -0
  167. package/types/math/Vec4.d.ts +162 -0
  168. package/types/math/coder.d.ts +43 -0
  169. package/types/math/index.d.ts +11 -0
  170. package/types/math.d.ts +261 -0
  171. package/types/mercator.d.ts +92 -0
  172. package/types/proj/EPSG3857.d.ts +6 -0
  173. package/types/proj/EPSG4326.d.ts +6 -0
  174. package/types/proj/Proj.d.ts +42 -0
  175. package/types/quadTree/EntityCollectionNode.d.ts +34 -0
  176. package/types/quadTree/Node.d.ts +60 -0
  177. package/types/quadTree/quadTree.d.ts +40 -0
  178. package/types/renderer/Renderer.d.ts +290 -0
  179. package/types/renderer/RendererEvents.d.ts +237 -0
  180. package/types/res/images.d.ts +3 -0
  181. package/types/scene/Axes.d.ts +11 -0
  182. package/types/scene/BaseNode.d.ts +60 -0
  183. package/types/scene/Planet.d.ts +576 -0
  184. package/types/scene/RenderNode.d.ts +142 -0
  185. package/types/scene/SkyBox.d.ts +10 -0
  186. package/types/scene/index.d.ts +4 -0
  187. package/types/segment/Segment.d.ts +275 -0
  188. package/types/segment/SegmentLonLat.d.ts +17 -0
  189. package/types/segment/Slice.d.ts +10 -0
  190. package/types/segment/segmentHelper.d.ts +13 -0
  191. package/types/shaders/billboard.d.ts +3 -0
  192. package/types/shaders/depth.d.ts +2 -0
  193. package/types/shaders/drawnode.d.ts +7 -0
  194. package/types/shaders/geoObject.d.ts +3 -0
  195. package/types/shaders/label.d.ts +4 -0
  196. package/types/shaders/pointCloud.d.ts +2 -0
  197. package/types/shaders/polyline.d.ts +3 -0
  198. package/types/shaders/ray.d.ts +2 -0
  199. package/types/shaders/screenFrame.d.ts +2 -0
  200. package/types/shaders/shape.d.ts +4 -0
  201. package/types/shaders/skybox.d.ts +2 -0
  202. package/types/shaders/toneMapping.d.ts +2 -0
  203. package/types/shapes/BaseShape.d.ts +250 -0
  204. package/types/shapes/Sphere.d.ts +41 -0
  205. package/types/terrain/BilTerrain.d.ts +7 -0
  206. package/types/terrain/EmptyTerrain.d.ts +73 -0
  207. package/types/terrain/Geoid.d.ts +26 -0
  208. package/types/terrain/GlobusTerrain.d.ts +116 -0
  209. package/types/terrain/MapboxTerrain.d.ts +7 -0
  210. package/types/terrain/index.d.ts +5 -0
  211. package/types/utils/FontAtlas.d.ts +16 -0
  212. package/types/utils/GeoImageCreator.d.ts +30 -0
  213. package/types/utils/ImagesCacheManager.d.ts +10 -0
  214. package/types/utils/Loader.d.ts +25 -0
  215. package/types/utils/NormalMapCreator.d.ts +39 -0
  216. package/types/utils/PlainSegmentWorker.d.ts +10 -0
  217. package/types/utils/TerrainWorker.d.ts +9 -0
  218. package/types/utils/TextureAtlas.d.ts +111 -0
  219. package/types/utils/VectorTileCreator.d.ts +16 -0
  220. package/types/utils/colorTable.d.ts +143 -0
  221. package/types/utils/earcut.d.ts +6 -0
  222. package/types/utils/shared.d.ts +231 -0
  223. package/types/webgl/Framebuffer.d.ts +135 -0
  224. package/types/webgl/Handler.d.ts +392 -0
  225. package/types/webgl/Multisample.d.ts +89 -0
  226. package/types/webgl/Program.d.ts +163 -0
  227. package/types/webgl/ProgramController.d.ts +89 -0
  228. package/types/webgl/callbacks.d.ts +1 -0
  229. package/types/webgl/index.d.ts +6 -0
  230. package/types/webgl/types.d.ts +2 -0
@@ -0,0 +1,392 @@
1
+ /**
2
+ * A WebGL handler for accessing low-level WebGL capabilities.
3
+ * @class
4
+ * @param {string} id - Canvas element id that WebGL handler assing with. If it's null
5
+ * or undefined creates hidden canvas and handler bacomes hidden.
6
+ * @param {Object} [params] - Handler options:
7
+ * @param {number} [params.anisotropy] - Anisotropy filter degree. 8 is default.
8
+ * @param {number} [params.width] - Hidden handler width. 256 is default.
9
+ * @param {number} [params.height] - Hidden handler height. 256 is default.
10
+ * @param {Array.<string>} [params.extensions] - Additional WebGL extension list. Available by default: EXT_texture_filter_anisotropic.
11
+ */
12
+ export class Handler {
13
+ /**
14
+ * The return value is null if the extension is not supported, or an extension object otherwise.
15
+ * @param {Object} gl - WebGl context pointer.
16
+ * @param {String} name - Extension name.
17
+ * @returns {Object} -
18
+ */
19
+ static getExtension(gl: any, name: string): any;
20
+ /**
21
+ * Returns a drawing context on the canvas, or null if the context identifier is not supported.
22
+ * @param {Object} canvas - HTML canvas object.
23
+ * @param {Object} [contextAttributes] - See canvas.getContext contextAttributes.
24
+ * @returns {Object} -
25
+ */
26
+ static getContext(canvas: any, contextAttributes?: any): any;
27
+ constructor(id: any, params: any);
28
+ /**
29
+ * Application default timer.
30
+ * @public
31
+ * @type {Clock}
32
+ */
33
+ public defaultClock: Clock;
34
+ /**
35
+ * Custom timers.
36
+ * @protected
37
+ * @type{Clock[]}
38
+ */
39
+ protected _clocks: Clock[];
40
+ /**
41
+ * Draw frame time in milliseconds.
42
+ * @public
43
+ * @readonly
44
+ * @type {number}
45
+ */
46
+ public readonly deltaTime: number;
47
+ /**
48
+ * WebGL rendering canvas element.
49
+ * @public
50
+ * @type {Object}
51
+ */
52
+ public canvas: any;
53
+ /**
54
+ * WebGL context.
55
+ * @public
56
+ * @type {Object}
57
+ */
58
+ public gl: any;
59
+ /**
60
+ * Shader program controller list.
61
+ * @public
62
+ * @type {Object.<og.webgl.ProgramController>}
63
+ */
64
+ public programs: any;
65
+ /**
66
+ * Current active shader program controller.
67
+ * @public
68
+ * @type {ProgramController}
69
+ */
70
+ public activeProgram: ProgramController;
71
+ /**
72
+ * Handler parameters.
73
+ * @private
74
+ * @type {Object}
75
+ */
76
+ private _params;
77
+ _oneByHeight: number;
78
+ /**
79
+ * Current WebGL extensions. Becomes here after context initialization.
80
+ * @public
81
+ * @type {Object}
82
+ */
83
+ public extensions: any;
84
+ /**
85
+ * HTML Canvas object id.
86
+ * @private
87
+ * @type {Object}
88
+ */
89
+ private _id;
90
+ _lastAnimationFrameTime: number;
91
+ _initialized: boolean;
92
+ /**
93
+ * Animation frame function assigned from outside(Ex. from Renderer).
94
+ * @private
95
+ * @type {frameCallback}
96
+ */
97
+ private _frameCallback;
98
+ transparentTexture: any;
99
+ framebufferStack: Stack;
100
+ createTexture: {
101
+ NEAREST: any;
102
+ LINEAR: any;
103
+ MIPMAP: any;
104
+ ANISOTROPIC: any;
105
+ };
106
+ createTextureDefault: any;
107
+ createTexture_n: (image: any, internalFormat: any) => any;
108
+ /**
109
+ * Sets animation frame function.
110
+ * @public
111
+ * @param {callback} callback - Frame callback.
112
+ */
113
+ public setFrameCallback(callback: any): void;
114
+ /**
115
+ * Creates empty texture.
116
+ * @public
117
+ * @param {Number} [width=1] - Specifies the width of the texture image..
118
+ * @param {Number} [height=1] - Specifies the width of the texture image..
119
+ * @param {String} [filter="NEAREST"] - Specifies GL_TEXTURE_MIN(MAX)_FILTER texture value.
120
+ * @param {String} [internalFormat="RGBA"] - Specifies the color components in the texture.
121
+ * @param {String} [format="RGBA"] - Specifies the format of the texel data.
122
+ * @param {String} [type="UNSIGNED_BYTE"] - Specifies the data type of the texel data.
123
+ * @param {Number} [levels=0] - Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.
124
+ * @returns {Object} - WebGL texture object.
125
+ */
126
+ public createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, format?: string, type?: string, level?: number): any;
127
+ /**
128
+ * Creates Empty NEAREST filtered texture.
129
+ * @public
130
+ * @param {number} width - Empty texture width.
131
+ * @param {number} height - Empty texture height.
132
+ * @returns {Object} - WebGL texture object.
133
+ */
134
+ public createEmptyTexture_n(width: number, height: number, internalFormat: any): any;
135
+ /**
136
+ * Creates empty LINEAR filtered texture.
137
+ * @public
138
+ * @param {number} width - Empty texture width.
139
+ * @param {number} height - Empty texture height.
140
+ * @returns {Object} - WebGL texture object.
141
+ */
142
+ public createEmptyTexture_l(width: number, height: number, internalFormat: any): any;
143
+ /**
144
+ * Creates NEAREST filter texture.
145
+ * @public
146
+ * @param {Object} image - Image or Canvas object.
147
+ * @returns {Object} - WebGL texture object.
148
+ */
149
+ public createTexture_n_webgl1(image: any, internalFormat: any): any;
150
+ /**
151
+ * Creates LINEAR filter texture.
152
+ * @public
153
+ * @param {Object} image - Image or Canvas object.
154
+ * @returns {Object} - WebGL texture object.
155
+ */
156
+ public createTexture_l_webgl1(image: any, internalFormat: any): any;
157
+ /**
158
+ * Creates MIPMAP filter texture.
159
+ * @public
160
+ * @param {Object} image - Image or Canvas object.
161
+ * @returns {Object} - WebGL texture object.
162
+ */
163
+ public createTexture_mm_webgl1(image: any, internalFormat: any): any;
164
+ /**
165
+ * Creates ANISOTROPY filter texture.
166
+ * @public
167
+ * @param {Object} image - Image or Canvas object.
168
+ * @returns {Object} - WebGL texture object.
169
+ */
170
+ public createTexture_a_webgl1(image: any, internalFormat: any): any;
171
+ /**
172
+ * Creates NEAREST filter texture.
173
+ * @public
174
+ * @param {Object} image - Image or Canvas object.
175
+ * @returns {Object} - WebGL texture object.
176
+ */
177
+ public createTexture_n_webgl2(image: any, internalFormat: any): any;
178
+ /**
179
+ * Creates LINEAR filter texture.
180
+ * @public
181
+ * @param {Object} image - Image or Canvas object.
182
+ * @returns {Object} - WebGL texture object.
183
+ */
184
+ public createTexture_l_webgl2(image: any, internalFormat: any): any;
185
+ /**
186
+ * Creates MIPMAP filter texture.
187
+ * @public
188
+ * @param {Object} image - Image or Canvas object.
189
+ * @returns {Object} - WebGL texture object.
190
+ */
191
+ public createTexture_mm_webgl2(image: any, internalFormat: any): any;
192
+ /**
193
+ * Creates ANISOTROPY filter texture.
194
+ * @public
195
+ * @param {Object} image - Image or Canvas object.
196
+ * @returns {Object} - WebGL texture object.
197
+ */
198
+ public createTexture_a_webgl2(image: any, internalFormat: any): any;
199
+ /**
200
+ * Creates cube texture.
201
+ * @public
202
+ * @param {Object.<string>} params - Face image urls:
203
+ * @param {string} params.px - Positive X or right image url.
204
+ * @param {string} params.nx - Negative X or left image url.
205
+ * @param {string} params.py - Positive Y or up image url.
206
+ * @param {string} params.ny - Negative Y or bottom image url.
207
+ * @param {string} params.pz - Positive Z or face image url.
208
+ * @param {string} params.nz - Negative Z or back image url.
209
+ * @returns {Object} - WebGL texture object.
210
+ */
211
+ public loadCubeMapTexture(params: any): any;
212
+ /**
213
+ * Adds shader program to the handler.
214
+ * @public
215
+ * @param {Program} program - Shader program.
216
+ * @param {boolean} [notActivate] - If it's true program will not compile.
217
+ * @return {Program} -
218
+ */
219
+ public addProgram(program: Program, notActivate?: boolean): Program;
220
+ /**
221
+ * Removes shader program from handler.
222
+ * @public
223
+ * @param {String} name - Shader program name.
224
+ */
225
+ public removeProgram(name: string): void;
226
+ /**
227
+ * Adds shader programs to the handler.
228
+ * @public
229
+ * @param {Array.<Program>} programsArr - Shader program array.
230
+ */
231
+ public addPrograms(programsArr: Array<Program>): void;
232
+ /**
233
+ * Used in addProgram
234
+ * @private
235
+ * @param {ProgramController} sc - Program controller
236
+ */
237
+ private _initProgramController;
238
+ /**
239
+ * Used in init function.
240
+ * @private
241
+ */
242
+ private _initPrograms;
243
+ /**
244
+ * Initialize additional WebGL extensions.
245
+ * @public
246
+ * @param {string} extensionStr - Extension name.
247
+ * @param {boolean} showLog - Show logging.
248
+ * @return {Object} -
249
+ */
250
+ public initializeExtension(extensionStr: string, showLog: boolean): any;
251
+ /**
252
+ * Main function that initialize handler.
253
+ * @public
254
+ */
255
+ public initialize(): void;
256
+ createTexture_l: any;
257
+ createTexture_mm: any;
258
+ createTexture_a: any;
259
+ /**
260
+ * Sets default gl render parameters. Used in init function.
261
+ * @private
262
+ */
263
+ private _setDefaults;
264
+ /**
265
+ * Creates STREAM_DRAW ARRAY buffer.
266
+ * @public
267
+ * @param {Array.<number>} array - Input array.
268
+ * @param {number} itemSize - Array item size.
269
+ * @param {number} numItems - Items quantity.
270
+ * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
271
+ * @return {Object} -
272
+ */
273
+ public createStreamArrayBuffer(itemSize: number, numItems: number, usage?: number, bites?: number): any;
274
+ /**
275
+ * Load stream ARRAY buffer.
276
+ * @public
277
+ * @param {Array.<number>} array - Input array.
278
+ * @param {number} itemSize - Array item size.
279
+ * @param {number} numItems - Items quantity.
280
+ * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
281
+ * @return {Object} -
282
+ */
283
+ public setStreamArrayBuffer(buffer: any, array: Array<number>, offset?: number): any;
284
+ /**
285
+ * Creates ARRAY buffer.
286
+ * @public
287
+ * @param {Array.<number>} array - Input array.
288
+ * @param {number} itemSize - Array item size.
289
+ * @param {number} numItems - Items quantity.
290
+ * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
291
+ * @return {Object} -
292
+ */
293
+ public createArrayBuffer(array: Array<number>, itemSize: number, numItems: number, usage?: number): any;
294
+ /**
295
+ * Creates ARRAY buffer specific length.
296
+ * @public
297
+ * @param {Array.<number>} array - Input array.
298
+ * @param {number} itemSize - Array item size.
299
+ * @param {number} numItems - Items quantity.
300
+ * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
301
+ * @return {Object} -
302
+ */
303
+ public createArrayBufferLength(size: any, usage?: number): any;
304
+ /**
305
+ * Creates ELEMENT ARRAY buffer.
306
+ * @public
307
+ * @param {Array.<number>} array - Input array.
308
+ * @param {number} itemSize - Array item size.
309
+ * @param {number} numItems - Items quantity.
310
+ * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
311
+ * @return {Object} -
312
+ */
313
+ public createElementArrayBuffer(array: Array<number>, itemSize: number, numItems: number, usage?: number): any;
314
+ /**
315
+ * Sets handler canvas size.
316
+ * @public
317
+ * @param {number} w - Canvas width.
318
+ * @param {number} h - Canvas height.
319
+ */
320
+ public setSize(w: number, h: number): void;
321
+ set pixelRatio(arg: any);
322
+ get pixelRatio(): any;
323
+ /**
324
+ * Returns context screen width.
325
+ * @public
326
+ * @returns {number} -
327
+ */
328
+ public getWidth(): number;
329
+ /**
330
+ * Returns context screen height.
331
+ * @public
332
+ * @returns {number} -
333
+ */
334
+ public getHeight(): number;
335
+ /**
336
+ * Returns canvas aspect ratio.
337
+ * @public
338
+ * @returns {number} -
339
+ */
340
+ public getClientAspect(): number;
341
+ /**
342
+ * Returns screen center coordinates.
343
+ * @public
344
+ * @returns {number} -
345
+ */
346
+ public getCenter(): number;
347
+ /**
348
+ * Draw single frame.
349
+ * @public
350
+ * @param {number} now - Frame current time milliseconds.
351
+ */
352
+ public drawFrame(): void;
353
+ /**
354
+ * Clearing gl frame.
355
+ * @public
356
+ */
357
+ public clearFrame(): void;
358
+ /**
359
+ * Starts animation loop.
360
+ * @public
361
+ */
362
+ public start(): void;
363
+ stop(): void;
364
+ _requestAnimationFrameId: number;
365
+ /**
366
+ * Check is gl context type equals webgl2
367
+ * @public
368
+ */
369
+ public isWebGl2(): boolean;
370
+ /**
371
+ * Make animation.
372
+ * @private
373
+ */
374
+ private _animationFrameCallback;
375
+ /**
376
+ * Creates default texture object
377
+ * @public
378
+ * @param {Object} [params] - Texture parameters:
379
+ * @param {callback} [success] - Creation callback
380
+ */
381
+ public createDefaultTexture(params?: any, success?: callback): void;
382
+ /**
383
+ * @public
384
+ */
385
+ public destroy(): void;
386
+ addClock(clock: any): void;
387
+ addClocks(clockArr: any): void;
388
+ removeClock(clock: any): void;
389
+ }
390
+ import { Clock } from "../Clock.js";
391
+ import { ProgramController } from "./ProgramController.js";
392
+ import { Stack } from "../Stack.js";
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Class represents multisample framebuffer.
3
+ * @class
4
+ * @param {Handler} handler - WebGL handler.
5
+ * @param {Object} [options] - Framebuffer options:
6
+ * @param {number} [options.width] - Framebuffer width. Default is handler canvas width.
7
+ * @param {number} [options.height] - Framebuffer height. Default is handler canvas height.
8
+ * @param {Object} [options.texture] - Texture to render.
9
+ * @param {String} [options.depthComponent="DEPTH_COMPONENT16"] - Specifies depth buffer size.
10
+ * @param {Boolean} [options.useDepth] - Using depth buffer during the rendering.
11
+ */
12
+ export class Multisample {
13
+ constructor(handler: any, options: any);
14
+ /**
15
+ * WebGL handler.
16
+ * @public
17
+ * @type {Handler}
18
+ */
19
+ public handler: Handler;
20
+ _internalFormat: any;
21
+ /**
22
+ * Framebuffer object.
23
+ * @private
24
+ * @type {Object}
25
+ */
26
+ private _fbo;
27
+ /**
28
+ * Renderbuffer object.
29
+ * @private
30
+ * @type {Object}
31
+ */
32
+ private _depthRenderbuffer;
33
+ /**
34
+ * Framebuffer width.
35
+ * @private
36
+ * @type {number}
37
+ */
38
+ private _width;
39
+ /**
40
+ * Framebuffer width.
41
+ * @private
42
+ * @type {number}
43
+ */
44
+ private _height;
45
+ _msaa: any;
46
+ _useDepth: any;
47
+ _depthComponent: any;
48
+ /**
49
+ * Framebuffer activity.
50
+ * @private
51
+ * @type {boolean}
52
+ */
53
+ private _active;
54
+ _size: any;
55
+ _filter: any;
56
+ _glFilter: any;
57
+ renderbuffers: any[];
58
+ destroy(): void;
59
+ /**
60
+ * Framebuffer initialization.
61
+ * @private
62
+ */
63
+ private init;
64
+ blitTo(framebuffer: any, attachmentIndex?: number): void;
65
+ /**
66
+ * Sets framebuffer viewport size.
67
+ * @public
68
+ * @param {number} width - Framebuffer width.
69
+ * @param {number} height - Framebuffer height.
70
+ */
71
+ public setSize(width: number, height: number, forceDestroy: any): void;
72
+ /**
73
+ * Returns framebuffer completed.
74
+ * @public
75
+ * @returns {boolean} -
76
+ */
77
+ public isComplete(): boolean;
78
+ /**
79
+ * Activate framebuffer frame to draw.
80
+ * @public
81
+ * @returns {Framebuffer} Returns Current framebuffer.
82
+ */
83
+ public activate(): Framebuffer;
84
+ /**
85
+ * Deactivate framebuffer frame.
86
+ * @public
87
+ */
88
+ public deactivate(): void;
89
+ }
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Represents more comfortable using WebGL shader program.
3
+ * @class
4
+ * @param {string} name - Shader program name identificator.
5
+ * @param {object} material - Object stores uniforms, attributes and program codes:
6
+ * @param {object} material.uniforms - Uniforms definition section.
7
+ * @param {object} material.attributes - Attributes definition section.
8
+ * @param {string} material.vertexShader - Vertex glsl code.
9
+ * @param {string} material.fragmentShader - Fragment glsl code.
10
+ */
11
+ export class Program {
12
+ /**
13
+ * Bind program buffer.
14
+ * @function
15
+ * @param {Program} program - Used program.
16
+ * @param {Object} variable - Variable represents buffer data.
17
+ */
18
+ static bindBuffer(program: Program, variable: any): void;
19
+ constructor(name: any, material: any);
20
+ /**
21
+ * Shader progarm name.
22
+ * @public
23
+ * @type {string}
24
+ */
25
+ public name: string;
26
+ attributes: {};
27
+ uniforms: {};
28
+ /**
29
+ * Attributes.
30
+ * @public
31
+ * @type {Object}
32
+ */
33
+ public _attributes: any;
34
+ /**
35
+ * Uniforms.
36
+ * @public
37
+ * @type {Object}
38
+ */
39
+ public _uniforms: any;
40
+ /**
41
+ * Vertex shader.
42
+ * @public
43
+ * @type {string}
44
+ */
45
+ public vertexShader: string;
46
+ /**
47
+ * Fragment shader.
48
+ * @public
49
+ * @type {string}
50
+ */
51
+ public fragmentShader: string;
52
+ /**
53
+ * Webgl context.
54
+ * @public
55
+ * @type {Object}
56
+ */
57
+ public gl: any;
58
+ /**
59
+ * All program variables.
60
+ * @private
61
+ * @type {Object}
62
+ */
63
+ private _variables;
64
+ /**
65
+ * Program pointer.
66
+ * @private
67
+ * @type {Object}
68
+ */
69
+ private _p;
70
+ /**
71
+ * Texture counter.
72
+ * @prvate
73
+ * @type {number}
74
+ */
75
+ _textureID: number;
76
+ /**
77
+ * Program attributes array.
78
+ * @private
79
+ * @type {Array.<Object>}
80
+ */
81
+ private _attribArrays;
82
+ /**
83
+ * Program attributes divisor.
84
+ * @private
85
+ * @type {Array.<Object>}
86
+ */
87
+ private _attribDivisor;
88
+ /**
89
+ * Sets the current program frame.
90
+ * @public
91
+ */
92
+ public use(): void;
93
+ /**
94
+ * Sets program variables.
95
+ * @public
96
+ * @param {Object} material - Variables and values object.
97
+ */
98
+ public set(material: any): void;
99
+ /**
100
+ * Apply current variables.
101
+ * @public
102
+ */
103
+ public apply(): void;
104
+ /**
105
+ * Calls drawElements index buffer function.
106
+ * @public
107
+ * @param {number} mode - Draw mode(GL_TRIANGLES, GL_LINESTRING etc.).
108
+ * @param {Object} buffer - Index buffer.
109
+ */
110
+ public drawIndexBuffer(mode: number, buffer: any): void;
111
+ /**
112
+ * Calls drawArrays function.
113
+ * @public
114
+ * @param {number} mode - Draw mode(GL_TRIANGLES, GL_LINESTRING etc.).
115
+ * @param {number} numItems - Curent binded buffer drawing items count.
116
+ */
117
+ public drawArrays(mode: number, numItems: number): void;
118
+ /**
119
+ * Check and log for an shader compile errors and warnings. Returns True - if no errors otherwise returns False.
120
+ * @private
121
+ * @param {Object} shader - WebGl shader program.
122
+ * @param {string} src - Shader program source.
123
+ * @returns {boolean} -
124
+ */
125
+ private _getShaderCompileStatus;
126
+ /**
127
+ * Returns compiled vertex shader program pointer.
128
+ * @private
129
+ * @param {string} src - Vertex shader source code.
130
+ * @returns {Object} -
131
+ */
132
+ private _createVertexShader;
133
+ /**
134
+ * Returns compiled fragment shader program pointer.
135
+ * @private
136
+ * @param {string} src - Vertex shader source code.
137
+ * @returns {Object} -
138
+ */
139
+ private _createFragmentShader;
140
+ /**
141
+ * Disable current program vertexAttribArrays.
142
+ * @public
143
+ */
144
+ public disableAttribArrays(): void;
145
+ /**
146
+ * Enable current program vertexAttribArrays.
147
+ * @public
148
+ */
149
+ public enableAttribArrays(): void;
150
+ vertexAttribDivisor(index: any, divisor: any): void;
151
+ /**
152
+ * Delete program.
153
+ * @public
154
+ */
155
+ public delete(): void;
156
+ /**
157
+ * Creates program.
158
+ * @public
159
+ * @param {Object} gl - WebGl context.
160
+ */
161
+ public createProgram(gl: any): void;
162
+ drawElementsInstanced: any;
163
+ }