@openglobus/og 0.27.24 → 0.28.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.
@@ -304,6 +304,11 @@ declare class EntityCollection {
304
304
  * @public
305
305
  */
306
306
  updateLabelsFontAtlas(): void;
307
+ /**
308
+ * Updates stroke texture atlas.
309
+ * @public
310
+ */
311
+ updateStrokeTextureAtlas(): void;
307
312
  /**
308
313
  * Removes collection from render node.
309
314
  * @public
@@ -10,6 +10,7 @@ import { RenderNode } from "../scene/RenderNode";
10
10
  import type { WebGLBufferExt } from "../webgl/Handler";
11
11
  import type { TypedArray } from "../utils/shared";
12
12
  import { Ellipsoid } from "../ellipsoid/Ellipsoid";
13
+ import type { HTMLImageElementExt } from "../utils/ImagesCacheManager";
13
14
  export type Geodetic = LonLat | NumberArray2 | NumberArray3;
14
15
  export type Cartesian = Vec3 | NumberArray3;
15
16
  export type SegmentPath3vExt = Cartesian[];
@@ -29,6 +30,10 @@ export interface IPolylineParams {
29
30
  pathLonLat?: SegmentPathLonLatExt[];
30
31
  visibleSpherePosition?: Cartesian;
31
32
  visibleSphereRadius?: number;
33
+ src?: string;
34
+ image?: HTMLImageElement;
35
+ texOffset?: number;
36
+ strokeSize?: number;
32
37
  }
33
38
  /**
34
39
  * Polyline object.
@@ -109,11 +114,14 @@ declare class Polyline {
109
114
  protected _orders: TypedArray | number[];
110
115
  protected _indexes: TypedArray | number[];
111
116
  protected _colors: TypedArray | number[];
117
+ protected _texCoordArr: TypedArray | number[];
118
+ protected _atlasTexCoords: number[];
112
119
  protected _verticesHighBuffer: WebGLBufferExt | null;
113
120
  protected _verticesLowBuffer: WebGLBufferExt | null;
114
121
  protected _ordersBuffer: WebGLBufferExt | null;
115
122
  protected _indexesBuffer: WebGLBufferExt | null;
116
123
  protected _colorsBuffer: WebGLBufferExt | null;
124
+ protected _texCoordBuffer: WebGLBufferExt | null;
117
125
  protected _pickingColor: NumberArray3;
118
126
  protected _renderNode: RenderNode | null;
119
127
  /**
@@ -133,7 +141,43 @@ declare class Polyline {
133
141
  protected _changedBuffers: boolean[];
134
142
  protected _visibleSphere: Float32Array;
135
143
  __doubleToTwoFloats: (pos: Vec3, highPos: Vec3, lowPos: Vec3) => void;
144
+ /**
145
+ * Stroke image src.
146
+ * @protected
147
+ * @type {string}
148
+ */
149
+ protected _src: string | null;
150
+ /**
151
+ * Stroke image object.
152
+ * @protected
153
+ * @type {Object}
154
+ */
155
+ protected _image: HTMLImageElement & {
156
+ __nodeIndex?: number;
157
+ } | null;
158
+ protected _texOffset: number;
159
+ protected _strokeSize: number;
136
160
  constructor(options?: IPolylineParams);
161
+ get texOffset(): number;
162
+ set texOffset(value: number);
163
+ get strokeSize(): number;
164
+ set strokeSize(value: number);
165
+ /**
166
+ * Sets image template url source.
167
+ * @public
168
+ * @param {string} src - Image url.
169
+ */
170
+ setSrc(src: string | null): void;
171
+ getSrc(): string | null;
172
+ /**
173
+ * Sets image template object.
174
+ * @public
175
+ * @param {Object} image - JavaScript image object.
176
+ */
177
+ setImage(image: HTMLImageElement): void;
178
+ getImage(): HTMLImageElementExt | null;
179
+ _setTexCoordArr(tcoordArr: number[]): void;
180
+ setTextureDisabled(): void;
137
181
  /**
138
182
  * Appends to the line array new cartesian coordinates line data.
139
183
  */
@@ -142,12 +186,25 @@ declare class Polyline {
142
186
  * Appends to the line new cartesian coordinates point data.
143
187
  */
144
188
  protected __appendPoint3v(path3v: SegmentPath3vExt[], point3v: Vec3, pathColors: SegmentPathColor[], color: NumberArray4, isClosed: boolean, outVerticesHigh: number[], outVerticesLow: number[], outColors: number[], outOrders: number[], outIndexes: number[], ellipsoid: Ellipsoid | null, outTransformedPathLonLat: SegmentPathLonLatExt[], outTransformedPathMerc: LonLat[][], outExtent: Extent): void;
189
+ /**
190
+
191
+ [1, -1, 2, -2] - orders for triangle strip line segment
192
+ t2 t3
193
+ (2)-------(-2)
194
+ | |
195
+ | |
196
+ | |
197
+ | |
198
+ (1)-------(-1)
199
+ t0 t1
200
+ */
201
+ static setPathTexCoords(path3v: SegmentPath3vExt[], tCoordArr: number[], outTexCoords: number[]): void;
145
202
  static setPathColors(pathLonLat: SegmentPathLonLatExt[], pathColors: SegmentPathColor[], defaultColor: NumberArray4, outColors: number[]): void;
146
203
  /**
147
204
  * Appends to the line array new geodetic coordinates line data.
148
205
  * @static
149
206
  */
150
- protected __appendLineDataLonLat(pathLonLat: SegmentPathLonLatExt[], pathColors: SegmentPathColor[], defaultColor: NumberArray4, isClosed: boolean, outVerticesHigh: number[], outVerticesLow: number[], outOrders: number[], outIndexes: number[], ellipsoid: Ellipsoid, outTransformedPathCartesian: SegmentPath3vExt[], outPathLonLat: SegmentPathLonLatExt[], outTransformedPathMerc: LonLat[][], outExtent: Extent, outColors: number[]): void;
207
+ protected __appendLineDataLonLat(pathLonLat: SegmentPathLonLatExt[], pathColors: SegmentPathColor[], defaultColor: NumberArray4, isClosed: boolean, outVerticesHigh: number[], outVerticesLow: number[], outOrders: number[], outIndexes: number[], outTexCoords: number[], ellipsoid: Ellipsoid, outTransformedPathCartesian: SegmentPath3vExt[], outPathLonLat: SegmentPathLonLatExt[], outTransformedPathMerc: LonLat[][], outExtent: Extent, outColors: number[]): void;
151
208
  /**
152
209
  * Sets polyline path with cartesian coordinates.
153
210
  * @protected
@@ -232,13 +289,12 @@ declare class Polyline {
232
289
  /**
233
290
  * Gets polyline opacity.
234
291
  * @public
235
- * @param {number} opacity - Opacity.
236
292
  */
237
293
  getOpacity(): number;
238
294
  /**
239
295
  * Sets Polyline thickness in screen pixels.
240
296
  * @public
241
- * @param {number} thickness - Thickness.
297
+ * @param {number} altitude - ALtitude value.
242
298
  */
243
299
  setAltitude(altitude: number): void;
244
300
  /**
@@ -305,7 +361,7 @@ declare class Polyline {
305
361
  setPathColors(pathColors: SegmentPathColor[]): void;
306
362
  /**
307
363
  * Sets polyline color
308
- * @param {string} htmlColor- HTML color
364
+ * @param {string} htmlColor - HTML color.
309
365
  */
310
366
  setColorHTML(htmlColor: string): void;
311
367
  setPathLonLatFast(pathLonLat: SegmentPathLonLatExt[], pathColors?: SegmentPathColor[]): void;
@@ -354,6 +410,7 @@ declare class Polyline {
354
410
  */
355
411
  protected _createIndexBuffer(): void;
356
412
  protected _createColorsBuffer(): void;
413
+ _createTexCoordBuffer(): void;
357
414
  setVisibleSphere(p: Vec3, r: number): void;
358
415
  updateRTCPosition(): void;
359
416
  }
@@ -25,5 +25,8 @@ declare class PolylineHandler {
25
25
  getRTCPosition(pos: Vec3, rtcPositionHigh: Vec3, rtcPositionLow: Vec3): void;
26
26
  setRelativeCenter(c: Vec3): void;
27
27
  protected _updateRTCEyePosition(): void;
28
+ reloadTextures(): void;
29
+ get polylines(): Polyline[];
30
+ refreshTexCoordsArr(): void;
28
31
  }
29
32
  export { PolylineHandler };
@@ -4,6 +4,7 @@ import type { NumberArray3 } from "../math/Vec3";
4
4
  import type { NumberArray4 } from "../math/Vec4";
5
5
  import { Entity } from "./Entity";
6
6
  import { RayHandler } from "./RayHandler";
7
+ import type { HTMLImageElementExt } from "../utils/ImagesCacheManager";
7
8
  export interface IRayParams {
8
9
  thickness?: number;
9
10
  startPosition?: Vec3 | NumberArray3;
@@ -11,6 +12,10 @@ export interface IRayParams {
11
12
  startColor?: string | NumberArray4;
12
13
  endColor?: string | NumberArray4;
13
14
  visibility?: boolean;
15
+ src?: string;
16
+ image?: HTMLImageElement;
17
+ texOffset?: number;
18
+ strokeSize?: number;
14
19
  }
15
20
  /**
16
21
  * Ray class.
@@ -63,6 +68,22 @@ declare class Ray {
63
68
  * @type {number}
64
69
  */
65
70
  _handlerIndex: number;
71
+ /**
72
+ * Stroke image src.
73
+ * @protected
74
+ * @type {string}
75
+ */
76
+ protected _src: string | null;
77
+ /**
78
+ * Stroke image object.
79
+ * @protected
80
+ * @type {Object}
81
+ */
82
+ protected _image: HTMLImageElement & {
83
+ __nodeIndex?: number;
84
+ } | null;
85
+ protected _texOffset: number;
86
+ protected _strokeSize: number;
66
87
  constructor(options?: IRayParams);
67
88
  /**
68
89
  * Sets ray start position.
@@ -73,6 +94,20 @@ declare class Ray {
73
94
  */
74
95
  setStartPosition(x: number, y: number, z: number): void;
75
96
  getLength(): number;
97
+ /**
98
+ * Sets image template url source.
99
+ * @public
100
+ * @param {string} src - Image url.
101
+ */
102
+ setSrc(src: string | null): void;
103
+ getSrc(): string | null;
104
+ /**
105
+ * Sets image template object.
106
+ * @public
107
+ * @param {Object} image - JavaScript image object.
108
+ */
109
+ setImage(image: HTMLImageElement): void;
110
+ getImage(): HTMLImageElementExt | null;
76
111
  /**
77
112
  * Sets ray start position.
78
113
  * @public
@@ -96,6 +131,10 @@ declare class Ray {
96
131
  setThickness(thickness: number): void;
97
132
  setColors4v(startColor?: Vec4, endColor?: Vec4): void;
98
133
  setColorsHTML(startColor?: string, endColor?: string): void;
134
+ get texOffset(): number;
135
+ set texOffset(value: number);
136
+ get strokeSize(): number;
137
+ set strokeSize(value: number);
99
138
  /**
100
139
  * Returns ray start position.
101
140
  * @public
@@ -14,7 +14,7 @@ declare class RayHandler {
14
14
  * @type {boolean}
15
15
  */
16
16
  pickingEnabled: boolean;
17
- protected _entityCollection: EntityCollection;
17
+ _entityCollection: EntityCollection;
18
18
  protected _renderer: Renderer | null;
19
19
  protected _rays: Ray[];
20
20
  protected _vertexBuffer: WebGLBufferExt | null;
@@ -25,6 +25,9 @@ declare class RayHandler {
25
25
  protected _thicknessBuffer: WebGLBufferExt | null;
26
26
  protected _rgbaBuffer: WebGLBufferExt | null;
27
27
  protected _pickingColorBuffer: WebGLBufferExt | null;
28
+ protected _texCoordBuffer: WebGLBufferExt | null;
29
+ protected _texOffsetBuffer: WebGLBufferExt | null;
30
+ protected _strokeSizeBuffer: WebGLBufferExt | null;
28
31
  protected _vertexArr: TypedArray | number[];
29
32
  protected _startPositionHighArr: TypedArray | number[];
30
33
  protected _startPositionLowArr: TypedArray | number[];
@@ -33,10 +36,15 @@ declare class RayHandler {
33
36
  protected _thicknessArr: TypedArray | number[];
34
37
  protected _rgbaArr: TypedArray | number[];
35
38
  protected _pickingColorArr: TypedArray | number[];
39
+ protected _texCoordArr: TypedArray;
40
+ protected _texOffsetArr: TypedArray;
41
+ protected _strokeSizeArr: TypedArray;
36
42
  protected _buffersUpdateCallbacks: Function[];
37
43
  protected _changedBuffers: boolean[];
38
44
  constructor(entityCollection: EntityCollection);
39
45
  static concArr(dest: number[], curr: number[]): void;
46
+ reloadTextures(): void;
47
+ get rays(): Ray[];
40
48
  initProgram(): void;
41
49
  setRenderer(renderer: Renderer): void;
42
50
  refresh(): void;
@@ -65,6 +73,14 @@ declare class RayHandler {
65
73
  createRgbaBuffer(): void;
66
74
  createThicknessBuffer(): void;
67
75
  createVertexBuffer(): void;
76
+ createTexCoordBuffer(): void;
77
+ createTexOffsetBuffer(): void;
78
+ createStrokeSizeBuffer(): void;
68
79
  createPickingColorBuffer(): void;
80
+ setTexCoordArr(index: number, tcoordArr: number[] | TypedArray): void;
81
+ setTextureDisabled(index: number): void;
82
+ setTexOffsetArr(index: number, value: number): void;
83
+ setStrokeSizeArr(index: number, value: number): void;
84
+ refreshTexCoordsArr(): void;
69
85
  }
70
86
  export { RayHandler };