@openglobus/og 0.15.0 → 0.15.1
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/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/control/Control.js +25 -15
- package/src/og/control/Sun.js +1 -1
- package/src/og/index.js +3 -1
- package/src/og/scene/Planet.js +5 -5
- package/types/index.d.ts +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openglobus/og",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "[OpenGlobus](https://www.openglobus.org/) is a javascript 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"
|
|
@@ -41,7 +41,7 @@ class Control {
|
|
|
41
41
|
* @public
|
|
42
42
|
* @type {Boolean}
|
|
43
43
|
*/
|
|
44
|
-
this.autoActivate = options.autoActivate
|
|
44
|
+
this.autoActivate = options.autoActivate || false;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Control activity.
|
|
@@ -76,35 +76,40 @@ class Control {
|
|
|
76
76
|
* @public
|
|
77
77
|
* @virtual
|
|
78
78
|
*/
|
|
79
|
-
oninit() {
|
|
79
|
+
oninit() {
|
|
80
|
+
}
|
|
80
81
|
|
|
81
82
|
/**
|
|
82
83
|
* Control renderer assigning function have to be overriden.
|
|
83
84
|
* @public
|
|
84
85
|
* @virtual
|
|
85
86
|
*/
|
|
86
|
-
onadd() {
|
|
87
|
+
onadd() {
|
|
88
|
+
}
|
|
87
89
|
|
|
88
90
|
/**
|
|
89
91
|
* Control remove function have to be overriden.
|
|
90
92
|
* @public
|
|
91
93
|
* @virtual
|
|
92
94
|
*/
|
|
93
|
-
onremove() {
|
|
95
|
+
onremove() {
|
|
96
|
+
}
|
|
94
97
|
|
|
95
98
|
/**
|
|
96
99
|
* Control activation function have to be overriden.
|
|
97
100
|
* @public
|
|
98
101
|
* @virtual
|
|
99
102
|
*/
|
|
100
|
-
onactivate() {
|
|
103
|
+
onactivate() {
|
|
104
|
+
}
|
|
101
105
|
|
|
102
106
|
/**
|
|
103
107
|
* Control deactivation function have to be overriden.
|
|
104
108
|
* @public
|
|
105
109
|
* @virtual
|
|
106
110
|
*/
|
|
107
|
-
ondeactivate() {
|
|
111
|
+
ondeactivate() {
|
|
112
|
+
}
|
|
108
113
|
|
|
109
114
|
/**
|
|
110
115
|
* Assign renderer to the control.
|
|
@@ -116,9 +121,10 @@ class Control {
|
|
|
116
121
|
this.renderer = renderer;
|
|
117
122
|
renderer.controls[this.name] = this;
|
|
118
123
|
this.onadd && this.onadd();
|
|
124
|
+
this._initialized = true;
|
|
125
|
+
this.oninit && this.oninit();
|
|
119
126
|
if (this.autoActivate) {
|
|
120
|
-
this.
|
|
121
|
-
this.oninit && this.oninit();
|
|
127
|
+
this.activate();
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
}
|
|
@@ -154,12 +160,14 @@ class Control {
|
|
|
154
160
|
* @public
|
|
155
161
|
*/
|
|
156
162
|
activate() {
|
|
157
|
-
if (!this.
|
|
158
|
-
this._initialized
|
|
159
|
-
|
|
163
|
+
if (!this._active) {
|
|
164
|
+
if (!this._initialized) {
|
|
165
|
+
this._initialized = true;
|
|
166
|
+
this.oninit && this.oninit();
|
|
167
|
+
}
|
|
168
|
+
this._active = true;
|
|
169
|
+
this.onactivate && this.onactivate();
|
|
160
170
|
}
|
|
161
|
-
this._active = true;
|
|
162
|
-
this.onactivate && this.onactivate();
|
|
163
171
|
}
|
|
164
172
|
|
|
165
173
|
/**
|
|
@@ -167,8 +175,10 @@ class Control {
|
|
|
167
175
|
* @public
|
|
168
176
|
*/
|
|
169
177
|
deactivate() {
|
|
170
|
-
this._active
|
|
171
|
-
|
|
178
|
+
if (this._active) {
|
|
179
|
+
this._active = false;
|
|
180
|
+
this.ondeactivate && this.ondeactivate();
|
|
181
|
+
}
|
|
172
182
|
}
|
|
173
183
|
|
|
174
184
|
/**
|
package/src/og/control/Sun.js
CHANGED
package/src/og/index.js
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
|
|
48
48
|
import pkg from "../../package.json";
|
|
49
49
|
|
|
50
|
+
import { Object3d } from './Object3d.js';
|
|
50
51
|
const { Handler } = webgl, { Control } = control;
|
|
51
52
|
const { Layer, Vector, XYZ} = layer;
|
|
52
53
|
const {
|
|
@@ -107,5 +108,6 @@ export {
|
|
|
107
108
|
MarsQuadTreeStrategy,
|
|
108
109
|
EarthQuadTreeStrategy,
|
|
109
110
|
Wgs84QuadTreeStrategy,
|
|
110
|
-
quadTreeStrategyType
|
|
111
|
+
quadTreeStrategyType,
|
|
112
|
+
Object3d
|
|
111
113
|
};
|
package/src/og/scene/Planet.js
CHANGED
|
@@ -342,10 +342,10 @@ export class Planet extends RenderNode {
|
|
|
342
342
|
this._specularTexture = null;
|
|
343
343
|
|
|
344
344
|
//TODO: replace to a function
|
|
345
|
-
let a = utils.createColorRGB(options.ambient, new Vec3(0.2, 0.2, 0.
|
|
346
|
-
let d = utils.createColorRGB(options.diffuse, new Vec3(0
|
|
347
|
-
let s = utils.createColorRGB(options.specular, new Vec3(0.
|
|
348
|
-
let shininess = options.shininess ||
|
|
345
|
+
let a = utils.createColorRGB(options.ambient, new Vec3(0.2, 0.2, 0.3));
|
|
346
|
+
let d = utils.createColorRGB(options.diffuse, new Vec3(1.0, 1.0, 1.0));
|
|
347
|
+
let s = utils.createColorRGB(options.specular, new Vec3(0.00063, 0.00055, 0.00032));
|
|
348
|
+
let shininess = options.shininess || 18.0;
|
|
349
349
|
|
|
350
350
|
this._ambient = new Float32Array([a.x, a.y, a.z]);
|
|
351
351
|
this._diffuse = new Float32Array([d.x, d.y, d.z]);
|
|
@@ -430,7 +430,7 @@ export class Planet extends RenderNode {
|
|
|
430
430
|
* Night texture brightness coefficient
|
|
431
431
|
* @type {number}
|
|
432
432
|
*/
|
|
433
|
-
this.nightTextureCoefficient =
|
|
433
|
+
this.nightTextureCoefficient = 2.0;
|
|
434
434
|
|
|
435
435
|
this._renderScreenNodesPASS = this._renderScreenNodesPASSNoAtmos;
|
|
436
436
|
|
package/types/index.d.ts
CHANGED
|
@@ -49,4 +49,5 @@ import { MarsQuadTreeStrategy } from "./quadTree/index.js";
|
|
|
49
49
|
import { EarthQuadTreeStrategy } from "./quadTree/index.js";
|
|
50
50
|
import { Wgs84QuadTreeStrategy } from "./quadTree/index.js";
|
|
51
51
|
import { quadTreeStrategyType } from "./quadTree/index.js";
|
|
52
|
-
|
|
52
|
+
import { Object3d } from "./Object3d.js";
|
|
53
|
+
export { bv, jd, math, mercator, utils, input, layer, terrain, control, webgl, wgs84, Camera, Ellipsoid, PlanetCamera, Globe, LightSource, Renderer, Clock, Events, Extent, LonLat, scene, RenderNode, Line2, Line3, Mat3, Mat4, Plane, Quat, Ray, Vec2, Vec3, Vec4, entity, Geoid, Popup, QuadTreeStrategy, MarsQuadTreeStrategy, EarthQuadTreeStrategy, Wgs84QuadTreeStrategy, quadTreeStrategyType, Object3d };
|