@openglobus/og 0.28.7 → 1.0.0-rc1

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 (202) hide show
  1. package/LICENSE.md +218 -4
  2. package/README.md +30 -17
  3. package/lib/Deferred.d.ts +2 -2
  4. package/lib/Events.d.ts +1 -1
  5. package/lib/Globe.d.ts +8 -5
  6. package/lib/Object3d.d.ts +17 -14
  7. package/lib/Popup.d.ts +2 -2
  8. package/lib/assets/LabelWorker.worker-DYd7xn3M.js.map +1 -0
  9. package/lib/assets/PlainSegmentWorker.worker-JsKldq-e.js.map +1 -0
  10. package/lib/assets/TerrainWorker.worker-CqUJvMOv.js.map +1 -0
  11. package/lib/bv/index.d.ts +2 -2
  12. package/lib/camera/Camera.d.ts +280 -27
  13. package/lib/camera/Frustum.d.ts +100 -15
  14. package/lib/camera/PlanetCamera.d.ts +93 -8
  15. package/lib/camera/index.d.ts +2 -2
  16. package/lib/control/CameraFrameComposer.d.ts +2 -2
  17. package/lib/control/CameraFrameHandler.d.ts +1 -1
  18. package/lib/control/CompassButton.d.ts +2 -2
  19. package/lib/control/EarthCoordinates.d.ts +5 -2
  20. package/lib/control/FramebufferPreview.d.ts +3 -3
  21. package/lib/control/GeoImageDragControl.d.ts +1 -1
  22. package/lib/control/LayerAnimation.d.ts +2 -2
  23. package/lib/control/LayerSwitcher.d.ts +3 -0
  24. package/lib/control/Lighting.d.ts +4 -2
  25. package/lib/control/Navigation.d.ts +15 -11
  26. package/lib/control/OrthoSwitcher.d.ts +18 -0
  27. package/lib/control/SimpleTouchNavigation.d.ts +44 -0
  28. package/lib/control/Sun.d.ts +4 -2
  29. package/lib/control/TouchNavigation.d.ts +4 -8
  30. package/lib/control/atmosphere/Atmosphere.d.ts +2 -0
  31. package/lib/control/atmosphere/AtmosphereConfig.d.ts +2 -6
  32. package/lib/control/cameraDepthHandler/CameraDepthHandler.d.ts +17 -3
  33. package/lib/control/cameraDepthHandler/camera_depth.d.ts +2 -2
  34. package/lib/control/drawing/LineStringDrawingScene.d.ts +1 -0
  35. package/lib/control/drawing/PolygonDrawingScene.d.ts +13 -13
  36. package/lib/control/elevationProfile/ElevationProfile.d.ts +1 -1
  37. package/lib/control/elevationProfile/ElevationProfileLegend.d.ts +1 -1
  38. package/lib/control/elevationProfile/ElevationProfileScene.d.ts +8 -11
  39. package/lib/control/elevationProfile/ElevationProfileView.d.ts +16 -5
  40. package/lib/control/entityEditor/EntityEditor.d.ts +19 -0
  41. package/lib/control/{geoObjectEditor/GeoObjectEditorDialog.d.ts → entityEditor/EntityEditorDialog.d.ts} +9 -8
  42. package/lib/control/{geoObjectEditor/GeoObjectEditorScene.d.ts → entityEditor/EntityEditorScene.d.ts} +11 -11
  43. package/lib/control/{geoObjectEditor → entityEditor}/colors.d.ts +2 -2
  44. package/lib/control/entityTree/EntityTree.d.ts +46 -0
  45. package/lib/control/entityTree/EntityTreeView.d.ts +24 -0
  46. package/lib/control/heightRuler/HeightRulerScene.d.ts +1 -1
  47. package/lib/control/index.d.ts +5 -3
  48. package/lib/control/ruler/RulerScene.d.ts +7 -7
  49. package/lib/control/selection/SelectionScene.d.ts +5 -5
  50. package/lib/control/timeline/TimelineControl.d.ts +2 -2
  51. package/lib/control/timeline/TimelineModel.d.ts +1 -1
  52. package/lib/control/timeline/TimelineView.d.ts +52 -13
  53. package/lib/control/visibleExtent/segment.d.ts +7 -0
  54. package/lib/ellipsoid/index.d.ts +4 -4
  55. package/lib/entity/Entity.d.ts +114 -100
  56. package/lib/entity/EntityCollection.d.ts +95 -70
  57. package/lib/entity/{BaseBillboard.d.ts → billboard/BaseBillboard.d.ts} +16 -17
  58. package/lib/entity/{BaseBillboardHandler.d.ts → billboard/BaseBillboardHandler.d.ts} +24 -9
  59. package/lib/entity/{Billboard.d.ts → billboard/Billboard.d.ts} +4 -4
  60. package/lib/entity/{BillboardHandler.d.ts → billboard/BillboardHandler.d.ts} +1 -1
  61. package/lib/entity/{GeoObject.d.ts → geoObject/GeoObject.d.ts} +7 -6
  62. package/lib/entity/{GeoObjectHandler.d.ts → geoObject/GeoObjectHandler.d.ts} +29 -11
  63. package/lib/entity/{InstanceData.d.ts → geoObject/InstanceData.d.ts} +18 -13
  64. package/lib/entity/{Geometry.d.ts → geometry/Geometry.d.ts} +10 -10
  65. package/lib/entity/{GeometryHandler.d.ts → geometry/GeometryHandler.d.ts} +7 -7
  66. package/lib/entity/index.d.ts +8 -8
  67. package/lib/entity/{Label.d.ts → label/Label.d.ts} +12 -13
  68. package/lib/entity/{LabelHandler.d.ts → label/LabelHandler.d.ts} +31 -7
  69. package/lib/entity/{LabelWorker.d.ts → label/LabelWorker.d.ts} +3 -3
  70. package/lib/entity/{PointCloud.d.ts → pointCloud/PointCloud.d.ts} +18 -12
  71. package/lib/entity/{PointCloudHandler.d.ts → pointCloud/PointCloudHandler.d.ts} +4 -4
  72. package/lib/entity/polyline/Polyline.d.ts +242 -0
  73. package/lib/entity/polyline/PolylineBatchRenderer.d.ts +443 -0
  74. package/lib/entity/{PolylineHandler.d.ts → polyline/PolylineHandler.d.ts} +19 -7
  75. package/lib/entity/{Ray.d.ts → ray/Ray.d.ts} +27 -9
  76. package/lib/entity/{RayHandler.d.ts → ray/RayHandler.d.ts} +18 -8
  77. package/lib/entity/{Strip.d.ts → strip/Strip.d.ts} +21 -17
  78. package/lib/entity/{StripHandler.d.ts → strip/StripHandler.d.ts} +11 -6
  79. package/lib/index.d.ts +47 -42
  80. package/lib/layer/BaseGeoImage.d.ts +20 -17
  81. package/lib/layer/CanvasTiles.d.ts +14 -12
  82. package/lib/layer/GeoImage.d.ts +1 -1
  83. package/lib/layer/GeoTexture2d.d.ts +2 -2
  84. package/lib/layer/KML.d.ts +19 -18
  85. package/lib/layer/Layer.d.ts +72 -53
  86. package/lib/layer/Vector.d.ts +47 -30
  87. package/lib/layer/WMS.d.ts +1 -1
  88. package/lib/layer/XYZ.d.ts +11 -12
  89. package/lib/layer/index.d.ts +12 -12
  90. package/lib/math/Line2.d.ts +1 -1
  91. package/lib/math/Line3.d.ts +1 -1
  92. package/lib/math/Mat3.d.ts +3 -13
  93. package/lib/math/Mat4.d.ts +16 -10
  94. package/lib/math/Plane.d.ts +1 -1
  95. package/lib/math/Quat.d.ts +14 -12
  96. package/lib/math/Ray.d.ts +4 -3
  97. package/lib/math/Vec2.d.ts +25 -17
  98. package/lib/math/Vec3.d.ts +33 -31
  99. package/lib/math/Vec4.d.ts +1 -1
  100. package/lib/math/coder.d.ts +1 -1
  101. package/lib/math/index.d.ts +13 -14
  102. package/lib/mercator.d.ts +4 -4
  103. package/lib/og.css +1 -1
  104. package/lib/og.es.js +1 -1
  105. package/lib/og.es.js.map +1 -1
  106. package/lib/quadTree/EntityCollectionNode.d.ts +10 -10
  107. package/lib/quadTree/EntityCollectionsTreeStrategy.d.ts +5 -5
  108. package/lib/quadTree/QuadTreeStrategy.d.ts +3 -4
  109. package/lib/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +4 -4
  110. package/lib/quadTree/earth/EarthEntityCollectionsTreeStrategy.d.ts +4 -4
  111. package/lib/renderer/AtmosphereDeferredShading.d.ts +12 -0
  112. package/lib/renderer/IDeferredShadingPass.d.ts +8 -0
  113. package/lib/renderer/ITransparencyPass.d.ts +8 -0
  114. package/lib/renderer/PhongDeferredShading.d.ts +16 -0
  115. package/lib/renderer/Renderer.d.ts +166 -99
  116. package/lib/renderer/RendererEvents.d.ts +15 -5
  117. package/lib/renderer/WOITPass.d.ts +14 -0
  118. package/lib/res/night-4326.png +0 -0
  119. package/lib/res/night.png +0 -0
  120. package/lib/scene/AltitudeNearPlaneStrategy.d.ts +17 -0
  121. package/lib/scene/Axes.d.ts +3 -3
  122. package/lib/scene/Planet.d.ts +244 -69
  123. package/lib/scene/{RenderNode.d.ts → Scene.d.ts} +50 -46
  124. package/lib/scene/SkyBox.d.ts +5 -3
  125. package/lib/scene/index.d.ts +2 -2
  126. package/lib/segment/Segment.d.ts +29 -15
  127. package/lib/segment/SegmentLonLat.d.ts +0 -1
  128. package/lib/shadeModeConstants.d.ts +7 -0
  129. package/lib/shaders/applyDeferredDepth.d.ts +2 -0
  130. package/lib/shaders/atmos/atmos.d.ts +3 -3
  131. package/lib/shaders/billboard/billboard.d.ts +4 -3
  132. package/lib/shaders/deferredShading/deferredShading.d.ts +2 -0
  133. package/lib/shaders/deferredShading/deferredShadingAtmos.d.ts +3 -0
  134. package/lib/shaders/depth.d.ts +2 -2
  135. package/lib/shaders/geo_object/geo_object.d.ts +8 -4
  136. package/lib/shaders/label/label.d.ts +4 -4
  137. package/lib/shaders/pointCloud.d.ts +2 -2
  138. package/lib/shaders/polyline/polyline.d.ts +7 -3
  139. package/lib/shaders/ray/ray.d.ts +3 -2
  140. package/lib/shaders/screenFrame.d.ts +2 -2
  141. package/lib/shaders/segment/segment.d.ts +7 -0
  142. package/lib/shaders/skybox.d.ts +2 -2
  143. package/lib/shaders/strip/strip.d.ts +3 -0
  144. package/lib/shaders/tone_mapping/toneMapping.d.ts +2 -2
  145. package/lib/shaders/weightedOITResolve.d.ts +2 -0
  146. package/lib/terrain/BilTerrain.d.ts +1 -1
  147. package/lib/terrain/EmptyTerrain.d.ts +5 -6
  148. package/lib/terrain/GlobusTerrain.d.ts +18 -23
  149. package/lib/terrain/RgbTerrain.d.ts +8 -8
  150. package/lib/terrain/index.d.ts +5 -5
  151. package/lib/tsconfig.tsbuildinfo +1 -1
  152. package/lib/ui/Button.d.ts +7 -5
  153. package/lib/ui/ButtonGroup.d.ts +1 -1
  154. package/lib/ui/Checkbox.d.ts +2 -2
  155. package/lib/ui/Color.d.ts +2 -2
  156. package/lib/ui/Dialog.d.ts +30 -3
  157. package/lib/ui/Input.d.ts +2 -2
  158. package/lib/ui/Slider.d.ts +3 -2
  159. package/lib/ui/ToggleButton.d.ts +2 -2
  160. package/lib/ui/View.d.ts +1 -1
  161. package/lib/ui/icons.d.ts +1 -1
  162. package/lib/ui/index.d.ts +9 -9
  163. package/lib/utils/FontAtlas.d.ts +10 -3
  164. package/lib/utils/GeoImageCreator.d.ts +2 -2
  165. package/lib/utils/ImagesCacheManager.d.ts +3 -3
  166. package/lib/utils/Loader.d.ts +2 -2
  167. package/lib/utils/PlainSegmentWorker.d.ts +2 -2
  168. package/lib/utils/TerrainWorker.d.ts +2 -2
  169. package/lib/utils/TextureAtlas.d.ts +7 -2
  170. package/lib/utils/TextureResourceManager.d.ts +162 -0
  171. package/lib/utils/VectorTileCreator.d.ts +1 -1
  172. package/lib/utils/colorSpace.d.ts +9 -0
  173. package/lib/utils/gltf/gltfParser.d.ts +9 -2
  174. package/lib/utils/gltf/types.d.ts +20 -2
  175. package/lib/utils/shared.d.ts +11 -5
  176. package/lib/utils/textureResourceMeta.d.ts +9 -0
  177. package/lib/webgl/BaseFramebuffer.d.ts +7 -0
  178. package/lib/webgl/Framebuffer.d.ts +9 -6
  179. package/lib/webgl/Handler.d.ts +81 -99
  180. package/lib/webgl/ShaderProgram.d.ts +190 -0
  181. package/lib/webgl/index.d.ts +2 -2
  182. package/lib/webgl/variableHandlers.d.ts +2 -1
  183. package/package.json +77 -76
  184. package/lib/assets/LabelWorker.worker-BT1uJgYn.js.map +0 -1
  185. package/lib/assets/PlainSegmentWorker.worker-CT1cj8jj.js.map +0 -1
  186. package/lib/assets/TerrainWorker.worker-DmikdfB2.js.map +0 -1
  187. package/lib/control/OldMouseNavigation.d.ts +0 -65
  188. package/lib/control/ZoomControl.d.ts +0 -28
  189. package/lib/control/geoObjectEditor/GeoObjectEditor.d.ts +0 -13
  190. package/lib/control/visibleExtent/drawnode.d.ts +0 -7
  191. package/lib/entity/Polyline.d.ts +0 -417
  192. package/lib/light/LightSource.d.ts +0 -36
  193. package/lib/scene/BaseNode.d.ts +0 -61
  194. package/lib/shaders/drawnode/drawnode.d.ts +0 -8
  195. package/lib/webgl/Program.d.ts +0 -161
  196. package/lib/webgl/ProgramController.d.ts +0 -87
  197. /package/lib/control/{geoObjectEditor → entityEditor}/ArrowEntity.d.ts +0 -0
  198. /package/lib/control/{geoObjectEditor → entityEditor}/AxisTrackEntity.d.ts +0 -0
  199. /package/lib/control/{geoObjectEditor → entityEditor}/MoveAxisEntity.d.ts +0 -0
  200. /package/lib/control/{geoObjectEditor → entityEditor}/MovePlaneEntity.d.ts +0 -0
  201. /package/lib/control/{geoObjectEditor → entityEditor}/RotateEntity.d.ts +0 -0
  202. /package/lib/entity/{LabelWorker.worker.d.ts → label/LabelWorker.worker.d.ts} +0 -0
@@ -22,6 +22,21 @@ export interface GltfMetadata {
22
22
  texCoord?: number;
23
23
  };
24
24
  };
25
+ extensions?: {
26
+ KHR_materials_pbrSpecularGlossiness?: {
27
+ diffuseFactor?: number[];
28
+ diffuseTexture?: {
29
+ index: number;
30
+ texCoord?: number;
31
+ };
32
+ specularFactor?: number[];
33
+ glossinessFactor?: number;
34
+ specularGlossinessTexture?: {
35
+ index: number;
36
+ texCoord?: number;
37
+ };
38
+ };
39
+ };
25
40
  normalTexture?: {
26
41
  index: number;
27
42
  texCoord?: number;
@@ -80,7 +95,7 @@ export interface GltfPrimitive {
80
95
  }
81
96
  export type PrimitiveAttributes = {
82
97
  POSITION: number;
83
- NORMAL: number;
98
+ NORMAL?: number;
84
99
  } & Record<string, number>;
85
100
  export interface GltfNode {
86
101
  camera?: number;
@@ -143,7 +158,7 @@ export interface Primitive {
143
158
  name: string;
144
159
  indices?: ArrayBufferLike;
145
160
  vertices: ArrayBufferLike;
146
- normals: ArrayBufferLike;
161
+ normals?: ArrayBufferLike;
147
162
  texCoords?: ArrayBufferLike;
148
163
  material?: Material;
149
164
  mode: PrimitiveMode;
@@ -153,7 +168,10 @@ export interface Material {
153
168
  name: string;
154
169
  baseColorFactor?: number[];
155
170
  baseColorTexture?: Texture;
171
+ metallicFactor?: number;
172
+ roughnessFactor?: number;
156
173
  metallicRoughnessTexture?: Texture;
174
+ specularGlossinessTexture?: Texture;
157
175
  normalTexture?: NormalTexture;
158
176
  occlusionTexture?: OcclusionTexture;
159
177
  emissiveTexture?: Texture;
@@ -20,6 +20,8 @@ export declare function isEmpty(v: any): boolean;
20
20
  */
21
21
  export declare function isUndef(obj?: any): boolean;
22
22
  export declare function isUndefExt(obj: any, defVal: any): any;
23
+ export declare function fnv1a32(bytes: Uint8Array | Uint8ClampedArray): string;
24
+ export declare function normalizeUri(src: string, baseUri?: string): string;
23
25
  export declare function stamp(obj: any): number;
24
26
  export declare function isString(s: any): boolean;
25
27
  export declare function rgbToStringHTML(rgb: NumberArray3 | Vec3): string;
@@ -74,8 +76,9 @@ export declare function parseHTML(htmlStr: string): HTMLElement[];
74
76
  export declare function print2d(id: string, text: string, x: number, y: number): void;
75
77
  export declare function isNumber(value: any): boolean;
76
78
  export declare function defaultString(str?: string, def?: string): string;
77
- export declare function createVector3(v?: number | Vec3 | Vec2 | NumberArray3 | NumberArray2 | null, def?: Vec3): Vec3;
78
- export declare function createVector4(v?: Vec4 | NumberArray4 | null, def?: Vec4): Vec4;
79
+ export declare function createVec2(v?: number | Vec2 | NumberArray2 | null, def?: Vec2): Vec2;
80
+ export declare function createVec3(v?: number | Vec3 | Vec2 | NumberArray3 | NumberArray2 | null, def?: Vec3): Vec3;
81
+ export declare function createVec4(v?: Vec4 | NumberArray4 | null, def?: Vec4): Vec4;
79
82
  export declare function createColorRGBA(c?: string | NumberArray4 | Vec4 | null, def?: Vec4): Vec4;
80
83
  export declare function createColorRGB(c?: string | NumberArray3 | Vec3 | null, def?: Vec3): Vec3;
81
84
  export declare function createExtent(e?: Extent | [[number, number], [number, number]] | null, def?: Extent): Extent;
@@ -193,6 +196,7 @@ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array
193
196
  * @param {TypedArray | number[]} b
194
197
  */
195
198
  export declare function concatTypedArrays(a: TypedArray, b: TypedArray | number[]): TypedArray;
199
+ export declare function insertTypedArray<T extends TypedArray>(arr: T, starting: number, insert: T | number[]): T;
196
200
  /**
197
201
  * Concatenates two the same arrays
198
202
  * @param {TypedArray | number[]} [a=[]] - First array
@@ -238,7 +242,7 @@ export declare function spliceTypedArray<T extends TypedArray>(arr: T, starting:
238
242
  /**
239
243
  * Returns 64-bit triangle coordinate array from inside of the source triangle array.
240
244
  * @static
241
- * @param {TypedArray | number[]} sourceArr - Source array
245
+ * @param {TypedArray | number[]} srcArr - Source array
242
246
  * @param {number} gridSize - Source array square matrix size
243
247
  * @param {number} i0 - First row index source array matrix
244
248
  * @param {number} j0 - First column index
@@ -246,7 +250,7 @@ export declare function spliceTypedArray<T extends TypedArray>(arr: T, starting:
246
250
  * @return {Float64Array} Triangle coordinates array from the source array.
247
251
  * @TODO: optimization
248
252
  */
249
- export declare function getMatrixSubArray64(sourceArr: TypedArray | number[], gridSize: number, i0: number, j0: number, size: number): Float64Array;
253
+ export declare function getMatrixSubArray64(srcArr: TypedArray | number[], gridSize: number, i0: number, j0: number, size: number): Float64Array;
250
254
  /**
251
255
  * Returns 32-bit triangle coordinate array from inside of the source triangle array.
252
256
  * @static
@@ -262,7 +266,7 @@ export declare function getMatrixSubArray32(sourceArr: TypedArray | number[], gr
262
266
  * Returns two float32 triangle coordinate arrays from inside of the source triangle array.
263
267
  * @TODO: optimization
264
268
  */
265
- export declare function getMatrixSubArrayBoundsExt(sourceArr: TypedArray | number[], sourceArrHigh: TypedArray | number[], sourceArrLow: TypedArray | number[], noDataVertices: TypedArray | number[] | undefined, gridSize: number, i0: number, j0: number, size: number, outArr: TypedArray | number[], outArrHigh: TypedArray | number[], outArrLow: TypedArray | number[], outBounds: any, outNoDataVertices: TypedArray | number[]): void;
269
+ export declare function getMatrixSubArrayBoundsExt(srcArr: TypedArray | number[], noDataVertices: TypedArray | number[] | undefined, gridSize: number, i0: number, j0: number, size: number, srcRelativeCenter: Vec3, dstRelativeCenter: Vec3, outArr: TypedArray | number[], outArrHigh: TypedArray | number[], outArrLow: TypedArray | number[], outBounds: any, outNoDataVertices: TypedArray | number[]): void;
266
270
  export declare function cloneArray(items: any[]): any[];
267
271
  /**
268
272
  * Promise for load images
@@ -271,6 +275,8 @@ export declare function cloneArray(items: any[]): any[];
271
275
  * @returns {Promise<Image>} Returns promise.
272
276
  */
273
277
  export declare function loadImage(url: string): Promise<HTMLImageElement>;
278
+ export declare function ensureImageReady(image: HTMLImageElement): Promise<boolean>;
279
+ export declare function prepareTextureImage(image: HTMLImageElement): Promise<HTMLImageElement | HTMLCanvasElement | null>;
274
280
  /**
275
281
  * Gets image is loaded
276
282
  * @param {HTMLImageElement} image
@@ -0,0 +1,9 @@
1
+ export declare const OG_TEXTURE_RESOURCE_META_KEY: unique symbol;
2
+ export interface ITextureResourceMeta {
3
+ resourceKey?: string;
4
+ sourceUri?: string;
5
+ mimeType?: string;
6
+ byteLength?: number;
7
+ }
8
+ export declare function getTextureResourceMeta(target: object | null | undefined): ITextureResourceMeta | undefined;
9
+ export declare function setTextureResourceMeta(target: object | null | undefined, meta: ITextureResourceMeta | undefined): void;
@@ -6,6 +6,7 @@ export interface IBaseFramebufferParams {
6
6
  depthComponent?: string;
7
7
  size?: number;
8
8
  filter?: string;
9
+ sharedDepthFramebuffer?: BaseFramebuffer | null;
9
10
  }
10
11
  export declare class BaseFramebuffer {
11
12
  static __counter__: number;
@@ -13,6 +14,7 @@ export declare class BaseFramebuffer {
13
14
  handler: Handler;
14
15
  _fbo: WebGLFramebuffer | null;
15
16
  protected _depthRenderbuffer: WebGLRenderbuffer | null;
17
+ protected _sharedDepthFramebuffer: BaseFramebuffer | null;
16
18
  _width: number;
17
19
  _height: number;
18
20
  protected _depthComponent: string;
@@ -21,8 +23,13 @@ export declare class BaseFramebuffer {
21
23
  protected _useDepth: boolean;
22
24
  protected _filter: string;
23
25
  constructor(handler: Handler, options?: IBaseFramebufferParams);
26
+ static blitTo(destFramebuffer: BaseFramebuffer, sourceFramebuffer: BaseFramebuffer, glAttachmentIndex: number | null, glMask: number, glFilter: number): void;
27
+ blitDepthFrom(sourceFramebuffer: BaseFramebuffer, glFilter?: number): void;
24
28
  get width(): number;
25
29
  get height(): number;
30
+ get depthRenderbuffer(): WebGLRenderbuffer | null;
31
+ get sharedDepthFramebuffer(): BaseFramebuffer | null;
32
+ get sharedDepthRenderbuffer(): WebGLRenderbuffer | null;
26
33
  /**
27
34
  * Sets framebuffer viewport size.
28
35
  * @public
@@ -5,8 +5,6 @@ import type { TypedArray } from "../utils/shared";
5
5
  import type { NumberArray4 } from "../math/Vec4";
6
6
  export interface ITargetParams {
7
7
  internalFormat?: string;
8
- format?: string;
9
- type?: string;
10
8
  attachment?: string;
11
9
  filter?: string;
12
10
  readAsync?: boolean;
@@ -20,8 +18,8 @@ export interface IFrameBufferParams extends IBaseFramebufferParams {
20
18
  type TypedArrayConstructor = Uint8ArrayConstructor | Float32ArrayConstructor;
21
19
  interface ITarget {
22
20
  internalFormat: string;
23
- format: string;
24
- type: string;
21
+ pixelFormat: string;
22
+ pixelType: string;
25
23
  attachment: string;
26
24
  filter: string;
27
25
  pixelBufferIndex: number;
@@ -52,6 +50,11 @@ export declare class Framebuffer extends BaseFramebuffer {
52
50
  pixelBuffers: IPixelBuffer[];
53
51
  protected _skipFrame: boolean;
54
52
  constructor(handler: Handler, options?: IFrameBufferParams);
53
+ static getTargetReadParams(internalFormat: string): {
54
+ pixelFormat: string;
55
+ pixelType: string;
56
+ TypeArrayConstructor: TypedArrayConstructor;
57
+ };
55
58
  static createTargets(targets?: ITargetParams[]): ITarget[];
56
59
  destroy(): void;
57
60
  /**
@@ -60,11 +63,11 @@ export declare class Framebuffer extends BaseFramebuffer {
60
63
  * @override
61
64
  */
62
65
  init(): void;
66
+ protected _attachExternalDepthRenderbuffer(depthRenderbuffer: WebGLRenderbuffer | null): void;
63
67
  /**
64
68
  * Check your constructor has targets like this
65
69
  * targets: [{
66
- * internalFormat: "RGBA",
67
- * type: "UNSIGNED_BYTE",
70
+ * internalFormat: "RGBA8",
68
71
  * attachment: "COLOR_ATTACHMENT",
69
72
  * readAsync: true
70
73
  * }],
@@ -4,8 +4,7 @@ import type { EventsHandler } from "../Events";
4
4
  import type { TypedArray } from "../utils/shared";
5
5
  import { Vec2 } from "../math/Vec2";
6
6
  import type { NumberArray2 } from "../math/Vec2";
7
- import { ProgramController } from "./ProgramController";
8
- import { Program } from "./Program";
7
+ import { ShaderProgram } from "./ShaderProgram";
9
8
  import { Stack } from "../Stack";
10
9
  export type WebGLContextExt = {
11
10
  type: string;
@@ -100,17 +99,17 @@ declare class Handler {
100
99
  */
101
100
  gl: WebGLContextExt | null;
102
101
  /**
103
- * Shader program controller list.
102
+ * Shader program list.
104
103
  * @public
105
- * @type {Record<string, ProgramController>}
104
+ * @type {Record<string, ShaderProgram>}
106
105
  */
107
- programs: Record<string, ProgramController>;
106
+ programs: Record<string, ShaderProgram>;
108
107
  /**
109
- * Current active shader program controller.
108
+ * Current active shader program.
110
109
  * @public
111
- * @type {ProgramController}
110
+ * @type {ShaderProgram}
112
111
  */
113
- activeProgram: ProgramController | null;
112
+ activeProgram: ShaderProgram | null;
114
113
  /**
115
114
  * Handler parameters.
116
115
  * @private
@@ -157,24 +156,23 @@ declare class Handler {
157
156
  createTexture: Record<string, CreateTextureFunc>;
158
157
  createTextureDefault: CreateTextureFunc;
159
158
  ONCANVASRESIZE: Function | null;
160
- createTexture_n: CreateTextureFunc;
161
- createTexture_l: CreateTextureFunc;
162
- createTexture_mm: CreateTextureFunc;
163
- createTexture_a: CreateTextureFunc;
164
159
  intersectionObserver?: IntersectionObserver;
165
160
  resizeObserver?: ResizeObserver;
166
161
  protected _requestAnimationFrameId: number;
162
+ protected _clipControlZeroToOne: boolean;
163
+ clipControl: ((origin: number, depth: number) => void) | undefined;
164
+ protected _getMipmapLevels(width: number, height: number): number;
167
165
  constructor(canvasTarget: string | HTMLCanvasElement | undefined, params?: IHandlerParameters);
168
166
  set frameDelay(delay: number);
169
167
  isInitialized(): boolean;
170
168
  protected _createCanvas(): void;
171
169
  /**
172
170
  * The return value is null if the extension is not supported, or an extension object otherwise.
173
- * @param {WebGLRenderingContext | WebGL2RenderingContext | null} gl - WebGl context pointer.
171
+ * @param {WebGL2RenderingContext | null} gl - WebGl context pointer.
174
172
  * @param {string} name - Extension name.
175
173
  * @returns {any} -
176
174
  */
177
- static getExtension(gl: WebGLRenderingContext | WebGL2RenderingContext | null, name: string): any | undefined;
175
+ static getExtension(gl: WebGL2RenderingContext | null, name: string): any | undefined;
178
176
  /**
179
177
  * Returns a drawing context on the canvas, or null if the context identifier is not supported.
180
178
  * @param {HTMLCanvasElement} canvas - HTML canvas object.
@@ -189,24 +187,24 @@ declare class Handler {
189
187
  */
190
188
  setFrameCallback(callback: Function): void;
191
189
  /**
192
- * Creates empty texture.
190
+ * Creates an empty immutable 2D texture (WebGL2).
193
191
  * @public
194
- * @param {number} [width=1] - Specifies the width of the texture image.
195
- * @param {number} [height=1] - Specifies the width of the texture image.
196
- * @param {string} [filter="NEAREST"] - Specifies GL_TEXTURE_MIN(MAX)_FILTER texture value.
197
- * @param {string} [internalFormat="RGBA"] - Specifies the color components in the texture.
198
- * @param {string} [format="RGBA"] - Specifies the format of the texel data.
199
- * @param {string} [type="UNSIGNED_BYTE"] - Specifies the data type of the texel data.
200
- * @param {number} [level=0] - Specifies the level-of-detail number. Level 0 is the base image level. Level n is the nth mipmap reduction image.
201
- * @returns {WebGLTexture | null} - WebGL texture object.
192
+ * @param {number} [width=1] - Texture width in pixels.
193
+ * @param {number} [height=1] - Texture height in pixels.
194
+ * @param {string} [filter="NEAREST"] - GL_TEXTURE_MIN_FILTER and GL_TEXTURE_MAG_FILTER value.
195
+ * @param {string} [internalFormat="RGBA8"] - Sized internal format (e.g. "RGBA8", "RGBA16F", "R16F").
196
+ * @param {string} [param="CLAMP_TO_EDGE"] - GL_TEXTURE_WRAP_S/T value.
197
+ * @param {number} [levels=1] - Number of mipmap levels (immutable storage).
198
+ * @returns {WebGLTexture | null} - Created WebGL texture object.
202
199
  */
203
- createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, format?: string, type?: string, param?: string, level?: number): WebGLTexture | null;
200
+ createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, param?: string, levels?: number): WebGLTexture | null;
204
201
  /**
205
202
  * Creates Empty NEAREST filtered texture.
206
203
  * @public
207
204
  * @param {number} width - Empty texture width.
208
205
  * @param {number} height - Empty texture height.
209
- * @param {number} [internalFormat]
206
+ * @param {number} [internalFormat] - Internal texture format, `gl.RGBA` by default.
207
+ * @param {number} [texParami] - Wrap mode for S/T axes, `gl.CLAMP_TO_EDGE` by default.
210
208
  * @returns {WebGLTexture | null} - WebGL texture object.
211
209
  */
212
210
  createEmptyTexture_n(width: number, height: number, internalFormat?: number | null, texParami?: number | null): WebGLTexture | null;
@@ -223,53 +221,13 @@ declare class Handler {
223
221
  /**
224
222
  * Creates NEAREST filter texture.
225
223
  * @public
226
- * @param {HTMLCanvasElement | Image} image - Image or Canvas object.
227
- * @param {number} [internalFormat]
228
- * @param {number} [texParami]
229
- * @param {WebGLTexture | null} [texture=null]
230
- * @returns {WebGLTexture | null} - WebGL texture object.
231
- */
232
- createTexture_n_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
233
- /**
234
- * Creates LINEAR filter texture.
235
- * @public
236
- * @param {ImageSource} image - Image or Canvas object.
237
- * @param {number} [internalFormat]
238
- * @param {number} [texParami]
239
- * @param {WebGLTexture | null} [texture]
240
- * @returns {WebGLTexture | null} - WebGL texture object.
241
- */
242
- createTexture_l_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
243
- /**
244
- * Creates MIPMAP filter texture.
245
- * @public
246
- * @param {ImageSource} image - Image or Canvas object.
247
- * @param {number} [internalFormat]
248
- * @param {number} [texParami]
249
- * @param {WebGLTexture | null} [texture]
250
- * @returns {WebGLTexture | null} - WebGL texture object.
251
- */
252
- createTexture_mm_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
253
- /**
254
- * Creates ANISOTROPY filter texture.
255
- * @public
256
224
  * @param {ImageSource} image - Image or Canvas object.
257
225
  * @param {number} [internalFormat]
258
226
  * @param {number} [texParami]
259
227
  * @param {WebGLTexture | null} [texture]
260
228
  * @returns {WebGLTexture | null} - WebGL texture object.
261
229
  */
262
- createTexture_a_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
263
- /**
264
- * Creates NEAREST filter texture.
265
- * @public
266
- * @param {ImageSource} image - Image or Canvas object.
267
- * @param {number} [internalFormat]
268
- * @param {number} [texParami]
269
- * @param {WebGLTexture | null} [texture]
270
- * @returns {WebGLTexture | null} - WebGL texture object.
271
- */
272
- createTexture_n_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
230
+ createTexture_n(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
273
231
  /**
274
232
  * Creates LINEAR filter texture.
275
233
  * @public
@@ -279,7 +237,7 @@ declare class Handler {
279
237
  * @param {WebGLTexture | null} [texture]
280
238
  * @returns {WebGLTexture | null} - WebGL texture object.
281
239
  */
282
- createTexture_l_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
240
+ createTexture_l(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
283
241
  /**
284
242
  * Creates MIPMAP filter texture.
285
243
  * @public
@@ -289,7 +247,7 @@ declare class Handler {
289
247
  * @param {WebGLTexture | null} [texture]
290
248
  * @returns {WebGLTexture | null} - WebGL texture object.
291
249
  */
292
- createTexture_mm_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
250
+ createTexture_mm(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
293
251
  /**
294
252
  * Creates ANISOTROPY filter texture.
295
253
  * @public
@@ -299,7 +257,7 @@ declare class Handler {
299
257
  * @param {WebGLTexture | null} [texture]
300
258
  * @returns {WebGLTexture | null} - WebGL texture object.
301
259
  */
302
- createTexture_a_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
260
+ createTexture_a(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTextureExt | null;
303
261
  /**
304
262
  * Creates cube texture.
305
263
  * @public
@@ -310,17 +268,19 @@ declare class Handler {
310
268
  * @param {string} params.ny - Negative Y or bottom image url.
311
269
  * @param {string} params.pz - Positive Z or face image url.
312
270
  * @param {string} params.nz - Negative Z or back image url.
271
+ * @param {number} [colorSpace=gl.SRGB8_ALPHA8] - Cube texture internal format (for example gl.SRGB8_ALPHA8 or gl.RGBA8).
272
+ * @param {number} [textureFilter=gl.LINEAR] - Cube texture filter (for example gl.LINEAR or gl.NEAREST).
313
273
  * @returns {WebGLTexture | null} - WebGL texture object.
314
274
  */
315
- loadCubeMapTexture(params: Texture3DParams): WebGLTexture | null;
275
+ loadCubeMapTexture(params: Texture3DParams, colorSpace?: number | null, textureFilter?: number | null): WebGLTextureExt | null;
316
276
  /**
317
277
  * Adds shader program to the handler.
318
278
  * @public
319
- * @param {Program} program - Shader program.
279
+ * @param {ShaderProgram} program - Shader program.
320
280
  * @param {boolean} [activate] - If false program will not compile.
321
- * @return {Program} -
281
+ * @return {ShaderProgram} -
322
282
  */
323
- addProgram(program: Program, activate?: boolean): Program;
283
+ addProgram(program: ShaderProgram, activate?: boolean): ShaderProgram;
324
284
  /**
325
285
  * Removes shader program from handler.
326
286
  * @public
@@ -330,15 +290,15 @@ declare class Handler {
330
290
  /**
331
291
  * Adds shader programs to the handler.
332
292
  * @public
333
- * @param {Array.<Program>} programsArr - Shader program array.
293
+ * @param {Array.<ShaderProgram>} programsArr - Shader program array.
334
294
  */
335
- addPrograms(programsArr: Program[]): void;
295
+ addPrograms(programsArr: ShaderProgram[]): void;
336
296
  /**
337
297
  * Used in addProgram
338
298
  * @protected
339
- * @param {ProgramController} sc - Program controller
299
+ * @param {ShaderProgram} program - ShaderProgram
340
300
  */
341
- protected _initProgramController(sc: ProgramController): void;
301
+ protected _initProgram(program: ShaderProgram): void;
342
302
  /**
343
303
  * Used in init function.
344
304
  * @private
@@ -353,7 +313,7 @@ declare class Handler {
353
313
  */
354
314
  initializeExtension(extensionStr: string, showLog?: boolean): any;
355
315
  /**
356
- * Main function that initialize handler.
316
+ * Main function that initializes handler.
357
317
  * @public
358
318
  */
359
319
  initialize(): void;
@@ -363,41 +323,54 @@ declare class Handler {
363
323
  * @protected
364
324
  */
365
325
  protected _setDefaults(): void;
326
+ /**
327
+ * Returns true when clip-control depth range is currently ZERO_TO_ONE.
328
+ * @public
329
+ * @returns {boolean} -
330
+ */
331
+ get isClipControlZeroToOne(): boolean;
332
+ /**
333
+ * Switches clip-control depth range between ZERO_TO_ONE and NEGATIVE_ONE_TO_ONE.
334
+ * If EXT_clip_control is unavailable, the internal ZERO_TO_ONE flag is reset to false.
335
+ * @public
336
+ * @param {boolean} useZeroToOne - True sets ZERO_TO_ONE, false sets NEGATIVE_ONE_TO_ONE.
337
+ */
338
+ setClipControlZeroToOne(useZeroToOne: boolean): void;
366
339
  getCanvasSize(): NumberArray2;
367
340
  /**
368
- * Creates STREAM_DRAW ARRAY buffer.
341
+ * Creates ARRAY_BUFFER storage for frequently updated data.
369
342
  * @public
370
- * @param {number} itemSize - Array item size.
371
- * @param {number} numItems - Items quantity.
372
- * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
373
- * @param {number} [bytes=4] -
343
+ * @param {number} itemSize - Number of scalar components per item.
344
+ * @param {number} numItems - Number of items.
345
+ * @param {number} [usage=STREAM_DRAW] - GL usage hint (STATIC_DRAW, DYNAMIC_DRAW or STREAM_DRAW).
346
+ * @param {number} [bytes=4] - Bytes per scalar component.
374
347
  * @return {WebGLBufferExt} -
375
348
  */
376
349
  createStreamArrayBuffer(itemSize: number, numItems: number, usage?: number, bytes?: number): WebGLBufferExt;
377
350
  /**
378
- * Sets stream buffer.
351
+ * Uploads data to an existing ARRAY_BUFFER via bufferSubData.
379
352
  * @public
380
- * @param {WebGLBufferExt} buffer -
381
- * @param {TypedArray} array -
382
- * @param {number} [offset=0] -
353
+ * @param {WebGLBufferExt} buffer - Target ARRAY_BUFFER.
354
+ * @param {TypedArray} array - Source data to upload.
355
+ * @param {number} [offset=0] - Byte offset in the target buffer.
383
356
  * @return {WebGLBufferExt} -
384
357
  */
385
358
  setStreamArrayBuffer(buffer: WebGLBufferExt, array: TypedArray, offset?: number): WebGLBufferExt;
386
359
  /**
387
- * Creates ARRAY buffer.
360
+ * Creates and initializes ARRAY_BUFFER from a typed array.
388
361
  * @public
389
- * @param {TypedArray} array - Input array.
390
- * @param {number} itemSize - Array item size.
391
- * @param {number} numItems - Items quantity.
392
- * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
362
+ * @param {TypedArray} array - Source data.
363
+ * @param {number} itemSize - Number of scalar components per item.
364
+ * @param {number} [numItems] - Number of items (computed from array length when omitted).
365
+ * @param {number} [usage=STATIC_DRAW] - GL usage hint (STATIC_DRAW, DYNAMIC_DRAW or STREAM_DRAW).
393
366
  * @return {WebGLBufferExt} -
394
367
  */
395
368
  createArrayBuffer(array: TypedArray, itemSize: number, numItems?: number, usage?: number): WebGLBufferExt;
396
369
  /**
397
- * Creates ARRAY buffer specific length.
370
+ * Creates ARRAY_BUFFER storage with a specific byte length and no initial data.
398
371
  * @public
399
- * @param {number} size -
400
- * @param {number} [usage=STATIC_DRAW] - Parameter of the bufferData call can be one of STATIC_DRAW, DYNAMIC_DRAW, or STREAM_DRAW.
372
+ * @param {number} size - Buffer size in bytes.
373
+ * @param {number} [usage=STATIC_DRAW] - GL usage hint (STATIC_DRAW, DYNAMIC_DRAW or STREAM_DRAW).
401
374
  * @return {WebGLBufferExt} -
402
375
  */
403
376
  createArrayBufferLength(size: number, usage?: number): WebGLBufferExt;
@@ -472,14 +445,23 @@ declare class Handler {
472
445
  */
473
446
  protected _animationFrameCallback(): void;
474
447
  /**
475
- * Creates default texture object.
448
+ * Creates a default 2x2 texture and passes it to callback.
449
+ * If `params.color` is set, a solid color texture is created.
450
+ * If `params.url` is set, the image is loaded asynchronously.
451
+ * Otherwise a fallback gray texture is created.
452
+ * @public
453
+ * @param {IDefaultTextureParams | null} params - Texture source parameters.
454
+ * @param {function(WebGLTextureExt): void} success - Callback with created texture.
455
+ */
456
+ createDefaultTexture(params: IDefaultTextureParams | null, success: (texture: WebGLTextureExt) => void, internalFormat?: number | null): void;
457
+ /**
458
+ * Deletes texture if it is not marked as default.
476
459
  * @public
477
- * @param {IDefaultTextureParams | null} params - Texture parameters.
478
- * @param {function(WebGLTextureExt): void} [success] - Creation callback.
460
+ * @param {WebGLTextureExt | null | undefined} texture - Texture to delete.
479
461
  */
480
- createDefaultTexture(params: IDefaultTextureParams | null, success: (texture: WebGLTextureExt) => void): void;
481
462
  deleteTexture(texture: WebGLTextureExt | null | undefined): void;
482
463
  /**
464
+ * Releases handler resources, WebGL objects, observers and canvas.
483
465
  * @public
484
466
  */
485
467
  destroy(): void;