@openglobus/og 0.23.0 → 0.24.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.
- package/lib/@openglobus/js/Globe.d.ts +0 -1
- package/lib/@openglobus/js/camera/Camera.d.ts +48 -15
- package/lib/@openglobus/js/camera/PlanetCamera.d.ts +13 -0
- package/lib/@openglobus/js/control/MouseNavigation.d.ts +62 -51
- package/lib/@openglobus/js/control/OldMouseNavigation.d.ts +64 -0
- package/lib/@openglobus/js/control/index.d.ts +1 -2
- package/lib/@openglobus/js/entity/Entity.d.ts +24 -20
- package/lib/@openglobus/js/entity/GeoObject.d.ts +0 -9
- package/lib/@openglobus/js/input/MouseHandler.d.ts +1 -0
- package/lib/@openglobus/js/math/Mat3.d.ts +1 -1
- package/lib/@openglobus/js/math/Mat4.d.ts +10 -1
- package/lib/@openglobus/js/math/Plane.d.ts +3 -1
- package/lib/@openglobus/js/math/Quat.d.ts +1 -0
- package/lib/@openglobus/js/math/Ray.d.ts +6 -16
- package/lib/@openglobus/js/math/Vec2.d.ts +22 -0
- package/lib/@openglobus/js/renderer/RendererEvents.d.ts +1 -0
- package/lib/@openglobus/js/scene/Planet.d.ts +4 -0
- package/lib/@openglobus/js/webgl/Handler.d.ts +21 -12
- package/lib/@openglobus/og.esm.js +1 -1
- package/lib/@openglobus/og.esm.js.map +1 -1
- package/lib/@openglobus/og.umd.js +1 -1
- package/lib/@openglobus/og.umd.js.map +1 -1
- package/lib/js/Globe.d.ts +0 -1
- package/lib/js/Globe.js +4 -2
- package/lib/js/Popup.js +1 -1
- package/lib/js/camera/Camera.d.ts +48 -15
- package/lib/js/camera/Camera.js +82 -28
- package/lib/js/camera/PlanetCamera.d.ts +13 -0
- package/lib/js/camera/PlanetCamera.js +52 -5
- package/lib/js/control/CameraLock.js +1 -1
- package/lib/js/control/DebugInfo.js +30 -10
- package/lib/js/control/KeyboardNavigation.js +8 -8
- package/lib/js/control/MouseNavigation.d.ts +62 -51
- package/lib/js/control/MouseNavigation.js +361 -305
- package/lib/js/control/MouseWheelZoomControl.d.ts +0 -44
- package/lib/js/control/MouseWheelZoomControl.js +270 -181
- package/lib/js/control/OldMouseNavigation.d.ts +64 -0
- package/lib/js/control/OldMouseNavigation.js +368 -0
- package/lib/js/control/ScaleControl.js +2 -2
- package/lib/js/control/SimpleNavigation.js +8 -7
- package/lib/js/control/Sun.js +5 -5
- package/lib/js/control/TouchNavigation.js +11 -8
- package/lib/js/control/elevationProfile/ElevationProfileScene.js +2 -1
- package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +19 -33
- package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +18 -18
- package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +3 -2
- package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +1 -4
- package/lib/js/control/geoObjectEditor/RotateEntity.js +1 -1
- package/lib/js/control/index.d.ts +1 -2
- package/lib/js/control/index.js +1 -2
- package/lib/js/control/visibleExtent/Segment.js +4 -4
- package/lib/js/entity/Entity.d.ts +24 -20
- package/lib/js/entity/Entity.js +62 -47
- package/lib/js/entity/GeoObject.d.ts +0 -9
- package/lib/js/entity/GeoObject.js +0 -3
- package/lib/js/entity/InstanceData.js +6 -3
- package/lib/js/input/MouseHandler.d.ts +1 -0
- package/lib/js/input/MouseHandler.js +12 -1
- package/lib/js/math/Mat3.d.ts +1 -1
- package/lib/js/math/Mat3.js +1 -1
- package/lib/js/math/Mat4.d.ts +10 -1
- package/lib/js/math/Mat4.js +17 -1
- package/lib/js/math/Plane.d.ts +3 -1
- package/lib/js/math/Plane.js +11 -1
- package/lib/js/math/Quat.d.ts +1 -0
- package/lib/js/math/Quat.js +1 -0
- package/lib/js/math/Ray.d.ts +6 -16
- package/lib/js/math/Ray.js +53 -46
- package/lib/js/math/Vec2.d.ts +22 -0
- package/lib/js/math/Vec2.js +32 -0
- package/lib/js/renderer/Renderer.js +10 -6
- package/lib/js/renderer/RendererEvents.d.ts +1 -0
- package/lib/js/renderer/RendererEvents.js +3 -1
- package/lib/js/scene/Planet.d.ts +4 -0
- package/lib/js/scene/Planet.js +24 -3
- package/lib/js/segment/Segment.js +4 -4
- package/lib/js/terrain/GlobusTerrain.js +2 -2
- package/lib/js/webgl/Handler.d.ts +21 -12
- package/lib/js/webgl/Handler.js +42 -33
- package/package.json +2 -2
- package/lib/@openglobus/js/control/EarthNavigation.d.ts +0 -50
- package/lib/@openglobus/js/control/MouseWheelZoomControl.d.ts +0 -44
- package/lib/js/control/EarthNavigation.d.ts +0 -50
- package/lib/js/control/EarthNavigation.js +0 -202
|
@@ -17,7 +17,7 @@ export type WebGLTextureExt = {
|
|
|
17
17
|
default?: boolean;
|
|
18
18
|
} & WebGLTexture;
|
|
19
19
|
export type ImageSource = HTMLCanvasElement | ImageBitmap | ImageData | HTMLImageElement | HTMLVideoElement;
|
|
20
|
-
type CreateTextureFunc = (image: ImageSource, internalFormat?: number, texture?: WebGLTextureExt) => WebGLTextureExt | null;
|
|
20
|
+
type CreateTextureFunc = (image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTextureExt) => WebGLTextureExt | null;
|
|
21
21
|
export interface IHandlerParameters {
|
|
22
22
|
anisotropy?: number;
|
|
23
23
|
width?: number;
|
|
@@ -197,7 +197,7 @@ declare class Handler {
|
|
|
197
197
|
* @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.
|
|
198
198
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
199
199
|
*/
|
|
200
|
-
createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, format?: string, type?: string, level?: number): WebGLTexture | null;
|
|
200
|
+
createEmptyTexture2DExt(width?: number, height?: number, filter?: string, internalFormat?: string, format?: string, type?: string, param?: string, level?: number): WebGLTexture | null;
|
|
201
201
|
/**
|
|
202
202
|
* Creates Empty NEAREST filtered texture.
|
|
203
203
|
* @public
|
|
@@ -206,88 +206,97 @@ declare class Handler {
|
|
|
206
206
|
* @param {number} [internalFormat]
|
|
207
207
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
208
208
|
*/
|
|
209
|
-
createEmptyTexture_n(width: number, height: number, internalFormat?: number): WebGLTexture | null;
|
|
209
|
+
createEmptyTexture_n(width: number, height: number, internalFormat?: number | null, texParami?: number | null): WebGLTexture | null;
|
|
210
210
|
/**
|
|
211
211
|
* Creates empty LINEAR filtered texture.
|
|
212
212
|
* @public
|
|
213
213
|
* @param {number} width - Empty texture width.
|
|
214
214
|
* @param {number} height - Empty texture height.
|
|
215
215
|
* @param {number} [internalFormat]
|
|
216
|
+
* @param {number} [texParami]
|
|
216
217
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
217
218
|
*/
|
|
218
|
-
createEmptyTexture_l(width: number, height: number, internalFormat?: number): WebGLTexture | null;
|
|
219
|
+
createEmptyTexture_l(width: number, height: number, internalFormat?: number | null, texParami?: number | null): WebGLTexture | null;
|
|
219
220
|
/**
|
|
220
221
|
* Creates NEAREST filter texture.
|
|
221
222
|
* @public
|
|
222
223
|
* @param {HTMLCanvasElement | Image} image - Image or Canvas object.
|
|
223
224
|
* @param {number} [internalFormat]
|
|
225
|
+
* @param {number} [texParami]
|
|
224
226
|
* @param {WebGLTexture | null} [texture=null]
|
|
225
227
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
226
228
|
*/
|
|
227
|
-
createTexture_n_webgl1(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
229
|
+
createTexture_n_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
228
230
|
/**
|
|
229
231
|
* Creates LINEAR filter texture.
|
|
230
232
|
* @public
|
|
231
233
|
* @param {ImageSource} image - Image or Canvas object.
|
|
232
234
|
* @param {number} [internalFormat]
|
|
235
|
+
* @param {number} [texParami]
|
|
233
236
|
* @param {WebGLTexture | null} [texture]
|
|
234
237
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
235
238
|
*/
|
|
236
|
-
createTexture_l_webgl1(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
239
|
+
createTexture_l_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
237
240
|
/**
|
|
238
241
|
* Creates MIPMAP filter texture.
|
|
239
242
|
* @public
|
|
240
243
|
* @param {ImageSource} image - Image or Canvas object.
|
|
241
244
|
* @param {number} [internalFormat]
|
|
245
|
+
* @param {number} [texParami]
|
|
242
246
|
* @param {WebGLTexture | null} [texture]
|
|
243
247
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
244
248
|
*/
|
|
245
|
-
createTexture_mm_webgl1(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
249
|
+
createTexture_mm_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
246
250
|
/**
|
|
247
251
|
* Creates ANISOTROPY filter texture.
|
|
248
252
|
* @public
|
|
249
253
|
* @param {ImageSource} image - Image or Canvas object.
|
|
250
254
|
* @param {number} [internalFormat]
|
|
255
|
+
* @param {number} [texParami]
|
|
251
256
|
* @param {WebGLTexture | null} [texture]
|
|
252
257
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
253
258
|
*/
|
|
254
|
-
createTexture_a_webgl1(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
259
|
+
createTexture_a_webgl1(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
255
260
|
/**
|
|
256
261
|
* Creates NEAREST filter texture.
|
|
257
262
|
* @public
|
|
258
263
|
* @param {ImageSource} image - Image or Canvas object.
|
|
259
264
|
* @param {number} [internalFormat]
|
|
265
|
+
* @param {number} [texParami]
|
|
260
266
|
* @param {WebGLTexture | null} [texture]
|
|
261
267
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
262
268
|
*/
|
|
263
|
-
createTexture_n_webgl2(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
269
|
+
createTexture_n_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
264
270
|
/**
|
|
265
271
|
* Creates LINEAR filter texture.
|
|
266
272
|
* @public
|
|
267
273
|
* @param {ImageSource} image - Image or Canvas object.
|
|
268
274
|
* @param {number} [internalFormat]
|
|
275
|
+
* @param {number} [texParami]
|
|
269
276
|
* @param {WebGLTexture | null} [texture]
|
|
270
277
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
271
278
|
*/
|
|
272
|
-
createTexture_l_webgl2(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
279
|
+
createTexture_l_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
273
280
|
/**
|
|
274
281
|
* Creates MIPMAP filter texture.
|
|
275
282
|
* @public
|
|
276
283
|
* @param {ImageSource} image - Image or Canvas object.
|
|
277
284
|
* @param {number} [internalFormat]
|
|
285
|
+
* @param {number} [texParami]
|
|
278
286
|
* @param {WebGLTexture | null} [texture]
|
|
279
287
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
280
288
|
*/
|
|
281
|
-
createTexture_mm_webgl2(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
289
|
+
createTexture_mm_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
282
290
|
/**
|
|
283
291
|
* Creates ANISOTROPY filter texture.
|
|
284
292
|
* @public
|
|
285
293
|
* @param {ImageSource} image - Image or Canvas object.
|
|
286
294
|
* @param {number} [internalFormat]
|
|
295
|
+
* @param {number} [texParami]
|
|
287
296
|
* @param {WebGLTexture | null} [texture]
|
|
288
297
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
289
298
|
*/
|
|
290
|
-
createTexture_a_webgl2(image: ImageSource, internalFormat?: number, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
299
|
+
createTexture_a_webgl2(image: ImageSource, internalFormat?: number | null, texParami?: number | null, texture?: WebGLTexture | null): WebGLTexture | null;
|
|
291
300
|
/**
|
|
292
301
|
* Creates cube texture.
|
|
293
302
|
* @public
|
package/lib/js/webgl/Handler.js
CHANGED
|
@@ -206,7 +206,7 @@ class Handler {
|
|
|
206
206
|
* @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.
|
|
207
207
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
208
208
|
*/
|
|
209
|
-
createEmptyTexture2DExt(width = 1, height = 1, filter = "NEAREST", internalFormat = "RGBA", format = "RGBA", type = "UNSIGNED_BYTE", level = 0) {
|
|
209
|
+
createEmptyTexture2DExt(width = 1, height = 1, filter = "NEAREST", internalFormat = "RGBA", format = "RGBA", type = "UNSIGNED_BYTE", param = "CLAMP_TO_EDGE", level = 0) {
|
|
210
210
|
let gl = this.gl;
|
|
211
211
|
let texture = gl.createTexture();
|
|
212
212
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -214,8 +214,8 @@ class Handler {
|
|
|
214
214
|
gl.texImage2D(gl.TEXTURE_2D, level, gl[internalFormat.toUpperCase()], width, height, 0, gl[format.toUpperCase()], gl[type.toUpperCase()], null);
|
|
215
215
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl[filter.toUpperCase()]);
|
|
216
216
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl[filter.toUpperCase()]);
|
|
217
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.
|
|
218
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.
|
|
217
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl[param.toUpperCase()]);
|
|
218
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl[param.toUpperCase()]);
|
|
219
219
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
220
220
|
return texture;
|
|
221
221
|
}
|
|
@@ -227,7 +227,7 @@ class Handler {
|
|
|
227
227
|
* @param {number} [internalFormat]
|
|
228
228
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
229
229
|
*/
|
|
230
|
-
createEmptyTexture_n(width, height, internalFormat) {
|
|
230
|
+
createEmptyTexture_n(width, height, internalFormat, texParami) {
|
|
231
231
|
let gl = this.gl;
|
|
232
232
|
let texture = gl.createTexture();
|
|
233
233
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -235,8 +235,8 @@ class Handler {
|
|
|
235
235
|
gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
236
236
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
237
237
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
238
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
239
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
238
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
239
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
240
240
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
241
241
|
return texture;
|
|
242
242
|
}
|
|
@@ -246,9 +246,10 @@ class Handler {
|
|
|
246
246
|
* @param {number} width - Empty texture width.
|
|
247
247
|
* @param {number} height - Empty texture height.
|
|
248
248
|
* @param {number} [internalFormat]
|
|
249
|
+
* @param {number} [texParami]
|
|
249
250
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
250
251
|
*/
|
|
251
|
-
createEmptyTexture_l(width, height, internalFormat) {
|
|
252
|
+
createEmptyTexture_l(width, height, internalFormat, texParami) {
|
|
252
253
|
let gl = this.gl;
|
|
253
254
|
let texture = gl.createTexture();
|
|
254
255
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -256,8 +257,8 @@ class Handler {
|
|
|
256
257
|
gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
|
257
258
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
258
259
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
259
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
260
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
260
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
261
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
261
262
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
262
263
|
return texture;
|
|
263
264
|
}
|
|
@@ -266,10 +267,11 @@ class Handler {
|
|
|
266
267
|
* @public
|
|
267
268
|
* @param {HTMLCanvasElement | Image} image - Image or Canvas object.
|
|
268
269
|
* @param {number} [internalFormat]
|
|
270
|
+
* @param {number} [texParami]
|
|
269
271
|
* @param {WebGLTexture | null} [texture=null]
|
|
270
272
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
271
273
|
*/
|
|
272
|
-
createTexture_n_webgl1(image, internalFormat, texture = null) {
|
|
274
|
+
createTexture_n_webgl1(image, internalFormat, texParami, texture = null) {
|
|
273
275
|
let gl = this.gl;
|
|
274
276
|
texture = texture || gl.createTexture();
|
|
275
277
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -277,8 +279,8 @@ class Handler {
|
|
|
277
279
|
gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
278
280
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
279
281
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
280
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
281
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
282
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
283
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
282
284
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
283
285
|
return texture;
|
|
284
286
|
}
|
|
@@ -287,18 +289,19 @@ class Handler {
|
|
|
287
289
|
* @public
|
|
288
290
|
* @param {ImageSource} image - Image or Canvas object.
|
|
289
291
|
* @param {number} [internalFormat]
|
|
292
|
+
* @param {number} [texParami]
|
|
290
293
|
* @param {WebGLTexture | null} [texture]
|
|
291
294
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
292
295
|
*/
|
|
293
|
-
createTexture_l_webgl1(image, internalFormat, texture = null) {
|
|
296
|
+
createTexture_l_webgl1(image, internalFormat, texParami, texture = null) {
|
|
294
297
|
let gl = this.gl;
|
|
295
298
|
texture = texture || gl.createTexture();
|
|
296
299
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
297
300
|
gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
298
301
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
299
302
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
300
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
301
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
303
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
304
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
302
305
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
303
306
|
return texture;
|
|
304
307
|
}
|
|
@@ -307,10 +310,11 @@ class Handler {
|
|
|
307
310
|
* @public
|
|
308
311
|
* @param {ImageSource} image - Image or Canvas object.
|
|
309
312
|
* @param {number} [internalFormat]
|
|
313
|
+
* @param {number} [texParami]
|
|
310
314
|
* @param {WebGLTexture | null} [texture]
|
|
311
315
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
312
316
|
*/
|
|
313
|
-
createTexture_mm_webgl1(image, internalFormat, texture = null) {
|
|
317
|
+
createTexture_mm_webgl1(image, internalFormat, texParami, texture = null) {
|
|
314
318
|
let gl = this.gl;
|
|
315
319
|
texture = texture || gl.createTexture();
|
|
316
320
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -318,8 +322,8 @@ class Handler {
|
|
|
318
322
|
gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat || gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
319
323
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
320
324
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
321
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
322
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
325
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
326
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
323
327
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
324
328
|
return texture;
|
|
325
329
|
}
|
|
@@ -328,10 +332,11 @@ class Handler {
|
|
|
328
332
|
* @public
|
|
329
333
|
* @param {ImageSource} image - Image or Canvas object.
|
|
330
334
|
* @param {number} [internalFormat]
|
|
335
|
+
* @param {number} [texParami]
|
|
331
336
|
* @param {WebGLTexture | null} [texture]
|
|
332
337
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
333
338
|
*/
|
|
334
|
-
createTexture_a_webgl1(image, internalFormat, texture = null) {
|
|
339
|
+
createTexture_a_webgl1(image, internalFormat, texParami, texture = null) {
|
|
335
340
|
let gl = this.gl;
|
|
336
341
|
texture = texture || gl.createTexture();
|
|
337
342
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -340,8 +345,8 @@ class Handler {
|
|
|
340
345
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
341
346
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
342
347
|
gl.texParameterf(gl.TEXTURE_2D, this.extensions.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT, this._params.anisotropy);
|
|
343
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
344
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
348
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
349
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
345
350
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
346
351
|
return texture;
|
|
347
352
|
}
|
|
@@ -350,10 +355,11 @@ class Handler {
|
|
|
350
355
|
* @public
|
|
351
356
|
* @param {ImageSource} image - Image or Canvas object.
|
|
352
357
|
* @param {number} [internalFormat]
|
|
358
|
+
* @param {number} [texParami]
|
|
353
359
|
* @param {WebGLTexture | null} [texture]
|
|
354
360
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
355
361
|
*/
|
|
356
|
-
createTexture_n_webgl2(image, internalFormat, texture = null) {
|
|
362
|
+
createTexture_n_webgl2(image, internalFormat, texParami, texture = null) {
|
|
357
363
|
let gl = this.gl;
|
|
358
364
|
texture = texture || gl.createTexture();
|
|
359
365
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -363,8 +369,8 @@ class Handler {
|
|
|
363
369
|
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
364
370
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
|
365
371
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
366
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
367
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
372
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
373
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
368
374
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
369
375
|
return texture;
|
|
370
376
|
}
|
|
@@ -373,10 +379,11 @@ class Handler {
|
|
|
373
379
|
* @public
|
|
374
380
|
* @param {ImageSource} image - Image or Canvas object.
|
|
375
381
|
* @param {number} [internalFormat]
|
|
382
|
+
* @param {number} [texParami]
|
|
376
383
|
* @param {WebGLTexture | null} [texture]
|
|
377
384
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
378
385
|
*/
|
|
379
|
-
createTexture_l_webgl2(image, internalFormat, texture = null) {
|
|
386
|
+
createTexture_l_webgl2(image, internalFormat, texParami, texture = null) {
|
|
380
387
|
let gl = this.gl;
|
|
381
388
|
texture = texture || gl.createTexture();
|
|
382
389
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -386,8 +393,8 @@ class Handler {
|
|
|
386
393
|
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
387
394
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
|
388
395
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
389
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
390
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
396
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
397
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
391
398
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
392
399
|
return texture;
|
|
393
400
|
}
|
|
@@ -396,10 +403,11 @@ class Handler {
|
|
|
396
403
|
* @public
|
|
397
404
|
* @param {ImageSource} image - Image or Canvas object.
|
|
398
405
|
* @param {number} [internalFormat]
|
|
406
|
+
* @param {number} [texParami]
|
|
399
407
|
* @param {WebGLTexture | null} [texture]
|
|
400
408
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
401
409
|
*/
|
|
402
|
-
createTexture_mm_webgl2(image, internalFormat, texture = null) {
|
|
410
|
+
createTexture_mm_webgl2(image, internalFormat, texParami, texture = null) {
|
|
403
411
|
let gl = this.gl;
|
|
404
412
|
texture = texture || gl.createTexture();
|
|
405
413
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -408,8 +416,8 @@ class Handler {
|
|
|
408
416
|
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
|
409
417
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
410
418
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
411
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
412
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
419
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
420
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
413
421
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
414
422
|
return texture;
|
|
415
423
|
}
|
|
@@ -418,10 +426,11 @@ class Handler {
|
|
|
418
426
|
* @public
|
|
419
427
|
* @param {ImageSource} image - Image or Canvas object.
|
|
420
428
|
* @param {number} [internalFormat]
|
|
429
|
+
* @param {number} [texParami]
|
|
421
430
|
* @param {WebGLTexture | null} [texture]
|
|
422
431
|
* @returns {WebGLTexture | null} - WebGL texture object.
|
|
423
432
|
*/
|
|
424
|
-
createTexture_a_webgl2(image, internalFormat, texture = null) {
|
|
433
|
+
createTexture_a_webgl2(image, internalFormat, texParami, texture = null) {
|
|
425
434
|
let gl = this.gl;
|
|
426
435
|
texture = texture || gl.createTexture();
|
|
427
436
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -432,8 +441,8 @@ class Handler {
|
|
|
432
441
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
433
442
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
434
443
|
gl.texParameterf(gl.TEXTURE_2D, this.extensions.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT, this._params.anisotropy);
|
|
435
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
436
|
-
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
444
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, texParami || gl.CLAMP_TO_EDGE);
|
|
445
|
+
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, texParami || gl.CLAMP_TO_EDGE);
|
|
437
446
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
438
447
|
return texture;
|
|
439
448
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "[openglobus](https://www.openglobus.org/) is a javascript/typescript library designed to display interactive 3d maps and planets with map tiles, imagery and vector data, markers, and 3D objects. It uses the WebGL technology, open source, and completely free.",
|
|
5
5
|
"directories": {
|
|
6
6
|
"example": "./sandbox"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"docs": "jsdoc -r ./src/ -c ./jsdoc.conf.json -d ./docs",
|
|
13
13
|
"serve_docs": "cd docs; ws -p 8088",
|
|
14
|
-
"serve": "ws -p
|
|
14
|
+
"serve": "ws -p 8080",
|
|
15
15
|
"build": "rollup -c --bundleConfigAsCjs",
|
|
16
16
|
"clean": "rm -rf ./lib ./docs",
|
|
17
17
|
"prepublishOnly": "npm run build; npm run gen_js",
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Control, IControlParams } from "./Control";
|
|
2
|
-
import { ITouchState } from "../renderer/RendererEvents";
|
|
3
|
-
import { IMouseState } from "../renderer/RendererEvents";
|
|
4
|
-
import { Quat } from "../math/Quat";
|
|
5
|
-
import { Sphere } from "../bv/Sphere";
|
|
6
|
-
import { Vec3 } from "../math/Vec3";
|
|
7
|
-
interface IEarthNavigationParams extends IControlParams {
|
|
8
|
-
}
|
|
9
|
-
declare class TouchExt {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
prev_x: number;
|
|
13
|
-
prev_y: number;
|
|
14
|
-
grabbedPoint: Vec3 | null;
|
|
15
|
-
grabbedSpheroid: Sphere;
|
|
16
|
-
constructor();
|
|
17
|
-
dX(): number;
|
|
18
|
-
dY(): number;
|
|
19
|
-
}
|
|
20
|
-
export declare class EarthNavigation extends Control {
|
|
21
|
-
protected grabbedPoint: Vec3 | null;
|
|
22
|
-
protected grabbedDir: Vec3;
|
|
23
|
-
inertia: number;
|
|
24
|
-
protected grabbedSpheroid: Sphere;
|
|
25
|
-
protected _vRot: Quat;
|
|
26
|
-
protected _hRot: Quat;
|
|
27
|
-
protected _a: number;
|
|
28
|
-
protected scaleRot: number;
|
|
29
|
-
protected currState: number;
|
|
30
|
-
protected positionState: {
|
|
31
|
-
h: number;
|
|
32
|
-
max: number;
|
|
33
|
-
min: number;
|
|
34
|
-
}[];
|
|
35
|
-
protected touches: TouchExt[];
|
|
36
|
-
constructor(options?: IEarthNavigationParams);
|
|
37
|
-
switchZoomState(wheelDelta: number): void;
|
|
38
|
-
protected onMouseWheel(event: IMouseState): void;
|
|
39
|
-
oninit(): void;
|
|
40
|
-
onactivate(): void;
|
|
41
|
-
protected onTouchStart(e: ITouchState): void;
|
|
42
|
-
protected onTouchEnd(e: ITouchState): void;
|
|
43
|
-
protected onTouchMove(e: ITouchState): void;
|
|
44
|
-
protected onMouseLeftButtonClick(e: IMouseState): void;
|
|
45
|
-
stopRotation(): void;
|
|
46
|
-
protected onMouseLeftButtonUp(e: IMouseState): void;
|
|
47
|
-
protected onMouseLeftButtonDown(e: IMouseState): void;
|
|
48
|
-
protected onDraw(): void;
|
|
49
|
-
}
|
|
50
|
-
export {};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Sphere } from "../bv/Sphere";
|
|
2
|
-
import { Key } from "../Lock";
|
|
3
|
-
import { Quat } from "../math/Quat";
|
|
4
|
-
import { Vec3 } from "../math/Vec3";
|
|
5
|
-
import { Control, IControlParams } from "./Control";
|
|
6
|
-
import { IStepForward } from "./MouseNavigation";
|
|
7
|
-
interface IMouseWheelZoomControl extends IControlParams {
|
|
8
|
-
minSlope?: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class MouseWheelZoomControl extends Control {
|
|
11
|
-
protected grabbedPoint: Vec3;
|
|
12
|
-
protected _eye0: Vec3;
|
|
13
|
-
protected pointOnEarth: Vec3;
|
|
14
|
-
protected earthUp: Vec3;
|
|
15
|
-
inertia: number;
|
|
16
|
-
protected grabbedSpheroid: Sphere;
|
|
17
|
-
protected qRot: Quat;
|
|
18
|
-
protected scaleRot: number;
|
|
19
|
-
protected distDiff: number;
|
|
20
|
-
protected stepsCount: number;
|
|
21
|
-
protected stepsForward: IStepForward[] | null;
|
|
22
|
-
protected stepIndex: number;
|
|
23
|
-
protected _lmbDoubleClickActive: boolean;
|
|
24
|
-
protected minSlope: number;
|
|
25
|
-
protected _keyLock: Key;
|
|
26
|
-
protected _deactivate: boolean;
|
|
27
|
-
protected _move: number;
|
|
28
|
-
constructor(options?: IMouseWheelZoomControl);
|
|
29
|
-
oninit(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Planet zoom in.
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
zoomIn(): void;
|
|
35
|
-
/**
|
|
36
|
-
* Planet zoom out.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
zoomOut(): void;
|
|
40
|
-
stopRotation(): void;
|
|
41
|
-
stopZoom(): void;
|
|
42
|
-
protected _draw(): void;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Control, IControlParams } from "./Control";
|
|
2
|
-
import { ITouchState } from "../renderer/RendererEvents";
|
|
3
|
-
import { IMouseState } from "../renderer/RendererEvents";
|
|
4
|
-
import { Quat } from "../math/Quat";
|
|
5
|
-
import { Sphere } from "../bv/Sphere";
|
|
6
|
-
import { Vec3 } from "../math/Vec3";
|
|
7
|
-
interface IEarthNavigationParams extends IControlParams {
|
|
8
|
-
}
|
|
9
|
-
declare class TouchExt {
|
|
10
|
-
x: number;
|
|
11
|
-
y: number;
|
|
12
|
-
prev_x: number;
|
|
13
|
-
prev_y: number;
|
|
14
|
-
grabbedPoint: Vec3 | null;
|
|
15
|
-
grabbedSpheroid: Sphere;
|
|
16
|
-
constructor();
|
|
17
|
-
dX(): number;
|
|
18
|
-
dY(): number;
|
|
19
|
-
}
|
|
20
|
-
export declare class EarthNavigation extends Control {
|
|
21
|
-
protected grabbedPoint: Vec3 | null;
|
|
22
|
-
protected grabbedDir: Vec3;
|
|
23
|
-
inertia: number;
|
|
24
|
-
protected grabbedSpheroid: Sphere;
|
|
25
|
-
protected _vRot: Quat;
|
|
26
|
-
protected _hRot: Quat;
|
|
27
|
-
protected _a: number;
|
|
28
|
-
protected scaleRot: number;
|
|
29
|
-
protected currState: number;
|
|
30
|
-
protected positionState: {
|
|
31
|
-
h: number;
|
|
32
|
-
max: number;
|
|
33
|
-
min: number;
|
|
34
|
-
}[];
|
|
35
|
-
protected touches: TouchExt[];
|
|
36
|
-
constructor(options?: IEarthNavigationParams);
|
|
37
|
-
switchZoomState(wheelDelta: number): void;
|
|
38
|
-
protected onMouseWheel(event: IMouseState): void;
|
|
39
|
-
oninit(): void;
|
|
40
|
-
onactivate(): void;
|
|
41
|
-
protected onTouchStart(e: ITouchState): void;
|
|
42
|
-
protected onTouchEnd(e: ITouchState): void;
|
|
43
|
-
protected onTouchMove(e: ITouchState): void;
|
|
44
|
-
protected onMouseLeftButtonClick(e: IMouseState): void;
|
|
45
|
-
stopRotation(): void;
|
|
46
|
-
protected onMouseLeftButtonUp(e: IMouseState): void;
|
|
47
|
-
protected onMouseLeftButtonDown(e: IMouseState): void;
|
|
48
|
-
protected onDraw(): void;
|
|
49
|
-
}
|
|
50
|
-
export {};
|