@openglobus/og 0.22.2 → 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.
Files changed (205) hide show
  1. package/css/og.css +137 -1
  2. package/lib/@openglobus/js/Globe.d.ts +0 -1
  3. package/lib/@openglobus/js/Object3d.d.ts +20 -10
  4. package/lib/@openglobus/js/camera/Camera.d.ts +57 -15
  5. package/lib/@openglobus/js/camera/Frustum.d.ts +3 -0
  6. package/lib/@openglobus/js/camera/PlanetCamera.d.ts +13 -0
  7. package/lib/@openglobus/js/control/CameraLock.d.ts +38 -0
  8. package/lib/@openglobus/js/control/MouseNavigation.d.ts +62 -51
  9. package/lib/@openglobus/js/control/OldMouseNavigation.d.ts +64 -0
  10. package/lib/@openglobus/js/control/SimpleNavigation.d.ts +27 -10
  11. package/lib/@openglobus/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  12. package/lib/@openglobus/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  13. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  14. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  15. package/lib/@openglobus/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  16. package/lib/@openglobus/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  17. package/lib/@openglobus/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  18. package/lib/@openglobus/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  19. package/lib/@openglobus/js/control/geoObjectEditor/colors.d.ts +8 -0
  20. package/lib/@openglobus/js/control/index.d.ts +3 -2
  21. package/lib/@openglobus/js/entity/Entity.d.ts +282 -19
  22. package/lib/@openglobus/js/entity/EntityCollection.d.ts +8 -9
  23. package/lib/@openglobus/js/entity/GeoObject.d.ts +135 -39
  24. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +39 -63
  25. package/lib/@openglobus/js/entity/InstanceData.d.ts +76 -0
  26. package/lib/@openglobus/js/entity/Polyline.d.ts +19 -6
  27. package/lib/@openglobus/js/entity/PolylineHandler.d.ts +7 -0
  28. package/lib/@openglobus/js/index.d.ts +2 -1
  29. package/lib/@openglobus/js/input/MouseHandler.d.ts +1 -0
  30. package/lib/@openglobus/js/layer/Vector.d.ts +4 -0
  31. package/lib/@openglobus/js/light/LightSource.d.ts +1 -139
  32. package/lib/@openglobus/js/math/Mat3.d.ts +1 -1
  33. package/lib/@openglobus/js/math/Mat4.d.ts +10 -1
  34. package/lib/@openglobus/js/math/Plane.d.ts +3 -1
  35. package/lib/@openglobus/js/math/Quat.d.ts +47 -33
  36. package/lib/@openglobus/js/math/Ray.d.ts +10 -14
  37. package/lib/@openglobus/js/math/Vec2.d.ts +22 -0
  38. package/lib/@openglobus/js/math/Vec3.d.ts +15 -0
  39. package/lib/@openglobus/js/math.d.ts +2 -2
  40. package/lib/@openglobus/js/quadTree/EntityCollectionNode.d.ts +2 -2
  41. package/lib/@openglobus/js/quadTree/Node.d.ts +1 -1
  42. package/lib/@openglobus/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  43. package/lib/@openglobus/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  44. package/lib/@openglobus/js/renderer/Renderer.d.ts +63 -44
  45. package/lib/@openglobus/js/renderer/RendererEvents.d.ts +2 -0
  46. package/lib/@openglobus/js/scene/Planet.d.ts +15 -7
  47. package/lib/@openglobus/js/scene/RenderNode.d.ts +10 -25
  48. package/lib/@openglobus/js/shaders/drawnode.d.ts +1 -0
  49. package/lib/@openglobus/js/shaders/geoObject.d.ts +1 -0
  50. package/lib/@openglobus/js/shaders/utils.d.ts +1 -1
  51. package/lib/@openglobus/js/ui/Checkbox.d.ts +31 -0
  52. package/lib/@openglobus/js/ui/Dialog.d.ts +3 -0
  53. package/lib/@openglobus/js/ui/Input.d.ts +32 -0
  54. package/lib/@openglobus/js/ui/View.d.ts +3 -1
  55. package/lib/@openglobus/js/utils/objParser.d.ts +44 -12
  56. package/lib/@openglobus/js/utils/shared.d.ts +22 -0
  57. package/lib/@openglobus/js/webgl/BaseFramebuffer.d.ts +0 -1
  58. package/lib/@openglobus/js/webgl/Framebuffer.d.ts +35 -8
  59. package/lib/@openglobus/js/webgl/Handler.d.ts +22 -12
  60. package/lib/@openglobus/og.css +1 -1
  61. package/lib/@openglobus/og.esm.js +1 -1
  62. package/lib/@openglobus/og.esm.js.map +1 -1
  63. package/lib/@openglobus/og.umd.js +1 -1
  64. package/lib/@openglobus/og.umd.js.map +1 -1
  65. package/lib/js/Globe.d.ts +0 -1
  66. package/lib/js/Globe.js +4 -2
  67. package/lib/js/Object3d.d.ts +20 -10
  68. package/lib/js/Object3d.js +124 -48
  69. package/lib/js/Popup.js +1 -1
  70. package/lib/js/camera/Camera.d.ts +57 -15
  71. package/lib/js/camera/Camera.js +109 -29
  72. package/lib/js/camera/Frustum.d.ts +3 -0
  73. package/lib/js/camera/Frustum.js +7 -0
  74. package/lib/js/camera/PlanetCamera.d.ts +13 -0
  75. package/lib/js/camera/PlanetCamera.js +52 -5
  76. package/lib/js/control/Atmosphere.js +10 -6
  77. package/lib/js/control/CameraLock.d.ts +38 -0
  78. package/lib/js/control/CameraLock.js +216 -0
  79. package/lib/js/control/Control.js +1 -1
  80. package/lib/js/control/DebugInfo.js +38 -8
  81. package/lib/js/control/KeyboardNavigation.js +9 -9
  82. package/lib/js/control/MouseNavigation.d.ts +62 -51
  83. package/lib/js/control/MouseNavigation.js +361 -305
  84. package/lib/js/control/MouseWheelZoomControl.d.ts +0 -44
  85. package/lib/js/control/MouseWheelZoomControl.js +270 -181
  86. package/lib/js/control/OldMouseNavigation.d.ts +64 -0
  87. package/lib/js/control/OldMouseNavigation.js +368 -0
  88. package/lib/js/control/ScaleControl.js +11 -5
  89. package/lib/js/control/SimpleNavigation.d.ts +27 -10
  90. package/lib/js/control/SimpleNavigation.js +149 -49
  91. package/lib/js/control/Sun.js +6 -6
  92. package/lib/js/control/TouchNavigation.js +11 -8
  93. package/lib/js/control/elevationProfile/ElevationProfileScene.js +6 -5
  94. package/lib/js/control/geoObjectEditor/ArrowEntity.d.ts +15 -0
  95. package/lib/js/control/geoObjectEditor/ArrowEntity.js +59 -0
  96. package/lib/js/control/geoObjectEditor/AxisTrackEntity.d.ts +9 -0
  97. package/lib/js/control/geoObjectEditor/AxisTrackEntity.js +93 -0
  98. package/lib/js/control/geoObjectEditor/GeoObjectEditor.d.ts +13 -0
  99. package/lib/js/control/geoObjectEditor/GeoObjectEditor.js +30 -0
  100. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.d.ts +69 -0
  101. package/lib/js/control/geoObjectEditor/GeoObjectEditorDialog.js +488 -0
  102. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.d.ts +78 -9
  103. package/lib/js/control/geoObjectEditor/GeoObjectEditorScene.js +487 -43
  104. package/lib/js/control/geoObjectEditor/MoveAxisEntity.d.ts +17 -0
  105. package/lib/js/control/geoObjectEditor/MoveAxisEntity.js +107 -0
  106. package/lib/js/control/geoObjectEditor/MovePlaneEntity.d.ts +7 -0
  107. package/lib/js/control/geoObjectEditor/MovePlaneEntity.js +31 -0
  108. package/lib/js/control/geoObjectEditor/RotateEntity.d.ts +9 -0
  109. package/lib/js/control/geoObjectEditor/RotateEntity.js +105 -0
  110. package/lib/js/control/geoObjectEditor/colors.d.ts +8 -0
  111. package/lib/js/control/geoObjectEditor/colors.js +8 -0
  112. package/lib/js/control/index.d.ts +3 -2
  113. package/lib/js/control/index.js +3 -2
  114. package/lib/js/control/timeline/TimelineControl.js +2 -0
  115. package/lib/js/control/visibleExtent/Segment.js +4 -4
  116. package/lib/js/entity/Entity.d.ts +282 -19
  117. package/lib/js/entity/Entity.js +497 -62
  118. package/lib/js/entity/EntityCollection.d.ts +8 -9
  119. package/lib/js/entity/EntityCollection.js +48 -45
  120. package/lib/js/entity/GeoObject.d.ts +135 -39
  121. package/lib/js/entity/GeoObject.js +150 -90
  122. package/lib/js/entity/GeoObjectHandler.d.ts +39 -63
  123. package/lib/js/entity/GeoObjectHandler.js +198 -295
  124. package/lib/js/entity/InstanceData.d.ts +76 -0
  125. package/lib/js/entity/InstanceData.js +347 -0
  126. package/lib/js/entity/Polyline.d.ts +19 -6
  127. package/lib/js/entity/Polyline.js +76 -36
  128. package/lib/js/entity/PolylineHandler.d.ts +7 -0
  129. package/lib/js/entity/PolylineHandler.js +26 -1
  130. package/lib/js/index.d.ts +2 -1
  131. package/lib/js/index.js +2 -1
  132. package/lib/js/input/MouseHandler.d.ts +1 -0
  133. package/lib/js/input/MouseHandler.js +12 -1
  134. package/lib/js/layer/Bing.js +2 -2
  135. package/lib/js/layer/Vector.d.ts +4 -0
  136. package/lib/js/layer/Vector.js +16 -0
  137. package/lib/js/light/LightSource.d.ts +1 -139
  138. package/lib/js/light/LightSource.js +21 -227
  139. package/lib/js/math/Mat3.d.ts +1 -1
  140. package/lib/js/math/Mat3.js +1 -1
  141. package/lib/js/math/Mat4.d.ts +10 -1
  142. package/lib/js/math/Mat4.js +17 -1
  143. package/lib/js/math/Plane.d.ts +3 -1
  144. package/lib/js/math/Plane.js +11 -1
  145. package/lib/js/math/Quat.d.ts +47 -33
  146. package/lib/js/math/Quat.js +92 -90
  147. package/lib/js/math/Ray.d.ts +10 -14
  148. package/lib/js/math/Ray.js +56 -33
  149. package/lib/js/math/Vec2.d.ts +22 -0
  150. package/lib/js/math/Vec2.js +32 -0
  151. package/lib/js/math/Vec3.d.ts +15 -0
  152. package/lib/js/math/Vec3.js +30 -1
  153. package/lib/js/math.d.ts +2 -2
  154. package/lib/js/math.js +3 -3
  155. package/lib/js/quadTree/EntityCollectionNode.d.ts +2 -2
  156. package/lib/js/quadTree/EntityCollectionNode.js +8 -8
  157. package/lib/js/quadTree/Node.d.ts +1 -1
  158. package/lib/js/quadTree/Node.js +2 -2
  159. package/lib/js/quadTree/QuadTreeStrategy.js +1 -1
  160. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.d.ts +1 -1
  161. package/lib/js/quadTree/earth/EarthEntityCollectionNodeLonLat.js +2 -2
  162. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.d.ts +1 -1
  163. package/lib/js/quadTree/equi/EquiEntityCollectionNodeLonLat.js +2 -2
  164. package/lib/js/renderer/Renderer.d.ts +63 -44
  165. package/lib/js/renderer/Renderer.js +267 -266
  166. package/lib/js/renderer/RendererEvents.d.ts +2 -0
  167. package/lib/js/renderer/RendererEvents.js +5 -2
  168. package/lib/js/scene/Planet.d.ts +15 -7
  169. package/lib/js/scene/Planet.js +133 -90
  170. package/lib/js/scene/RenderNode.d.ts +10 -25
  171. package/lib/js/scene/RenderNode.js +70 -58
  172. package/lib/js/segment/Segment.js +4 -4
  173. package/lib/js/shaders/depth.js +2 -5
  174. package/lib/js/shaders/drawnode.d.ts +1 -0
  175. package/lib/js/shaders/drawnode.js +51 -52
  176. package/lib/js/shaders/geoObject.d.ts +1 -0
  177. package/lib/js/shaders/geoObject.js +154 -91
  178. package/lib/js/shaders/polyline.js +68 -51
  179. package/lib/js/shaders/utils.d.ts +1 -1
  180. package/lib/js/shaders/utils.js +11 -0
  181. package/lib/js/terrain/GlobusTerrain.js +2 -2
  182. package/lib/js/ui/Checkbox.d.ts +31 -0
  183. package/lib/js/ui/Checkbox.js +110 -0
  184. package/lib/js/ui/Color.js +2 -1
  185. package/lib/js/ui/Dialog.d.ts +3 -0
  186. package/lib/js/ui/Dialog.js +20 -0
  187. package/lib/js/ui/Input.d.ts +32 -0
  188. package/lib/js/ui/Input.js +107 -0
  189. package/lib/js/ui/View.d.ts +3 -1
  190. package/lib/js/ui/View.js +6 -0
  191. package/lib/js/utils/objParser.d.ts +44 -12
  192. package/lib/js/utils/objParser.js +241 -149
  193. package/lib/js/utils/shared.d.ts +22 -0
  194. package/lib/js/utils/shared.js +34 -0
  195. package/lib/js/webgl/BaseFramebuffer.d.ts +0 -1
  196. package/lib/js/webgl/Framebuffer.d.ts +35 -8
  197. package/lib/js/webgl/Framebuffer.js +136 -29
  198. package/lib/js/webgl/Handler.d.ts +22 -12
  199. package/lib/js/webgl/Handler.js +53 -34
  200. package/lib/js/webgl/Program.js +0 -8
  201. package/package.json +5 -3
  202. package/lib/@openglobus/js/control/EarthNavigation.d.ts +0 -50
  203. package/lib/@openglobus/js/control/MouseWheelZoomControl.d.ts +0 -44
  204. package/lib/js/control/EarthNavigation.d.ts +0 -50
  205. package/lib/js/control/EarthNavigation.js +0 -202
@@ -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,181 +1,270 @@
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 } from "./Control";
6
- import { MouseNavigation } from "./MouseNavigation";
7
- export class MouseWheelZoomControl extends Control {
8
- constructor(options = {}) {
9
- super(options);
10
- this._name = "MouseWheelZoomControl";
11
- this.grabbedPoint = new Vec3();
12
- this._eye0 = new Vec3();
13
- this.pointOnEarth = new Vec3();
14
- this.earthUp = new Vec3();
15
- this.inertia = 0.007;
16
- this.grabbedSpheroid = new Sphere();
17
- this.planet = null;
18
- this.qRot = new Quat();
19
- this.scaleRot = 0.0;
20
- this.distDiff = 0.3;
21
- this.stepsCount = 8;
22
- this.stepsForward = null;
23
- this.stepIndex = 0;
24
- this._lmbDoubleClickActive = true;
25
- this.minSlope = options.minSlope || 0.1;
26
- this._keyLock = new Key();
27
- this._deactivate = false;
28
- this._move = 0;
29
- }
30
- oninit() {
31
- let zoomDiv = document.createElement("div"), btnZoomIn = document.createElement("button"), btnZoomOut = document.createElement("button");
32
- zoomDiv.className = "ogZoomControl";
33
- btnZoomIn.className = "ogZoomButton ogZoomIn";
34
- btnZoomOut.className = "ogZoomButton ogZoomOut";
35
- zoomDiv.appendChild(btnZoomIn);
36
- zoomDiv.appendChild(btnZoomOut);
37
- this.renderer.div.appendChild(zoomDiv);
38
- btnZoomIn.addEventListener("mousedown", () => this.zoomIn());
39
- btnZoomIn.addEventListener("mouseup", () => this.stopZoom());
40
- btnZoomOut.addEventListener("mousedown", () => this.zoomOut());
41
- btnZoomOut.addEventListener("mouseup", () => this.stopZoom());
42
- btnZoomIn.addEventListener("touchstart", (e) => {
43
- e.preventDefault();
44
- this.zoomIn();
45
- });
46
- btnZoomIn.addEventListener("touchend", (e) => {
47
- e.preventDefault();
48
- this.stopZoom();
49
- });
50
- btnZoomIn.addEventListener("touchcancel", (e) => {
51
- e.preventDefault();
52
- this.stopZoom();
53
- });
54
- btnZoomOut.addEventListener("touchstart", (e) => {
55
- e.preventDefault();
56
- this.zoomOut();
57
- });
58
- btnZoomOut.addEventListener("touchend", (e) => {
59
- e.preventDefault();
60
- this.stopZoom();
61
- });
62
- btnZoomOut.addEventListener("touchcancel", (e) => {
63
- e.preventDefault();
64
- this.stopZoom();
65
- });
66
- this.renderer.events.on("draw", this._draw, this);
67
- }
68
- /**
69
- * Planet zoom in.
70
- * @public
71
- */
72
- zoomIn() {
73
- if (this.stepIndex) {
74
- return;
75
- }
76
- this.planet.stopFlying();
77
- this.stopRotation();
78
- this._deactivate = true;
79
- this.planet.layerLock.lock(this._keyLock);
80
- this.planet.terrainLock.lock(this._keyLock);
81
- this.planet._normalMapCreator.lock(this._keyLock);
82
- this.stepsForward = MouseNavigation.getMovePointsFromPixelTerrain(this.planet.camera, this.planet, this.stepsCount, this.distDiff, this.renderer.handler.getCenter(), true, null) || null;
83
- if (this.stepsForward) {
84
- this.stepIndex = this.stepsCount;
85
- }
86
- }
87
- /**
88
- * Planet zoom out.
89
- * @public
90
- */
91
- zoomOut() {
92
- if (this.stepIndex) {
93
- return;
94
- }
95
- this.planet.stopFlying();
96
- this.stopRotation();
97
- this._deactivate = true;
98
- this.planet.layerLock.lock(this._keyLock);
99
- this.planet.terrainLock.lock(this._keyLock);
100
- this.planet._normalMapCreator.lock(this._keyLock);
101
- this.stepsForward = MouseNavigation.getMovePointsFromPixelTerrain(this.planet.camera, this.planet, this.stepsCount, this.distDiff, this.renderer.handler.getCenter(), false, null) || null;
102
- if (this.stepsForward) {
103
- this.stepIndex = this.stepsCount;
104
- }
105
- }
106
- stopRotation() {
107
- this.qRot.clear();
108
- this.planet.layerLock.free(this._keyLock);
109
- this.planet.terrainLock.free(this._keyLock);
110
- this.planet._normalMapCreator.free(this._keyLock);
111
- }
112
- stopZoom() {
113
- this._move = 0;
114
- this.planet.layerLock.free(this._keyLock);
115
- this.planet.terrainLock.free(this._keyLock);
116
- this.planet._normalMapCreator.free(this._keyLock);
117
- }
118
- _draw() {
119
- if (this._active) {
120
- let r = this.renderer;
121
- let cam = this.planet.camera;
122
- let prevEye = cam.eye.clone();
123
- if (this.stepIndex) {
124
- r.controlsBag.scaleRot = 1.0;
125
- let sf = this.stepsForward[this.stepsCount - this.stepIndex--];
126
- let maxAlt = cam.maxAltitude + this.planet.ellipsoid.equatorialSize;
127
- let minAlt = cam.minAltitude + this.planet.ellipsoid.equatorialSize;
128
- const camAlt = sf.eye.length();
129
- if (camAlt > maxAlt || camAlt < minAlt) {
130
- return;
131
- }
132
- cam.eye = sf.eye;
133
- cam._u = sf.v;
134
- cam._r = sf.u;
135
- cam._b = sf.n;
136
- cam.checkTerrainCollision();
137
- cam.update();
138
- }
139
- else {
140
- if (this._deactivate) {
141
- this._deactivate = false;
142
- this.planet.layerLock.free(this._keyLock);
143
- this.planet.terrainLock.free(this._keyLock);
144
- this.planet._normalMapCreator.free(this._keyLock);
145
- }
146
- }
147
- if (r.events.mouseState.leftButtonDown || !this.scaleRot) {
148
- return;
149
- }
150
- this.scaleRot -= this.inertia;
151
- if (this.scaleRot <= 0.0) {
152
- this.scaleRot = 0.0;
153
- }
154
- else {
155
- r.controlsBag.scaleRot = this.scaleRot;
156
- let rot = this.qRot
157
- .slerp(Quat.IDENTITY, 1.0 - this.scaleRot * this.scaleRot * this.scaleRot)
158
- .normalize();
159
- if (!(rot.x || rot.y || rot.z)) {
160
- this.scaleRot = 0.0;
161
- }
162
- cam.eye = rot.mulVec3(cam.eye);
163
- cam._u = rot.mulVec3(cam._u);
164
- cam._r = rot.mulVec3(cam._r);
165
- cam._b = rot.mulVec3(cam._b);
166
- cam.checkTerrainCollision();
167
- cam.update();
168
- }
169
- if (cam.eye.distance(prevEye) / cam.getAltitude() > 0.01) {
170
- this.planet.layerLock.lock(this._keyLock);
171
- this.planet.terrainLock.lock(this._keyLock);
172
- this.planet._normalMapCreator.lock(this._keyLock);
173
- }
174
- else {
175
- this.planet.layerLock.free(this._keyLock);
176
- this.planet.terrainLock.free(this._keyLock);
177
- this.planet._normalMapCreator.free(this._keyLock);
178
- }
179
- }
180
- }
181
- }
1
+ "use strict";
2
+ // import {Sphere} from "../bv/Sphere";
3
+ // import {Key} from "../Lock";
4
+ // import {Quat} from "../math/Quat";
5
+ // import {Vec3} from "../math/Vec3";
6
+ // import {Control, IControlParams} from "./Control";
7
+ // import {IStepForward, MouseNavigation} from "./MouseNavigation";
8
+ //
9
+ // interface IMouseWheelZoomControl extends IControlParams {
10
+ // minSlope?: number;
11
+ // }
12
+ //
13
+ // export class MouseWheelZoomControl extends Control {
14
+ // protected grabbedPoint: Vec3;
15
+ // protected _eye0: Vec3;
16
+ // protected pointOnEarth: Vec3;
17
+ // protected earthUp: Vec3;
18
+ // public inertia: number;
19
+ // protected grabbedSpheroid: Sphere;
20
+ // protected qRot: Quat;
21
+ // protected scaleRot: number;
22
+ // protected distDiff: number;
23
+ // protected stepsCount: number;
24
+ // protected stepsForward: IStepForward[] | null;
25
+ // protected stepIndex: number;
26
+ // protected _lmbDoubleClickActive: boolean;
27
+ // protected minSlope: number;
28
+ // protected _keyLock: Key;
29
+ // protected _deactivate: boolean;
30
+ // protected _move: number;
31
+ //
32
+ // constructor(options: IMouseWheelZoomControl = {}) {
33
+ // super(options);
34
+ //
35
+ // this._name = "MouseWheelZoomControl";
36
+ //
37
+ // this.grabbedPoint = new Vec3();
38
+ // this._eye0 = new Vec3();
39
+ // this.pointOnEarth = new Vec3();
40
+ // this.earthUp = new Vec3();
41
+ // this.inertia = 0.007;
42
+ // this.grabbedSpheroid = new Sphere();
43
+ // this.planet = null;
44
+ // this.qRot = new Quat();
45
+ // this.scaleRot = 0.0;
46
+ //
47
+ // this.distDiff = 0.3;
48
+ // this.stepsCount = 8;
49
+ // this.stepsForward = null;
50
+ // this.stepIndex = 0;
51
+ //
52
+ // this._lmbDoubleClickActive = true;
53
+ //
54
+ // this.minSlope = options.minSlope || 0.1;
55
+ //
56
+ // this._keyLock = new Key();
57
+ //
58
+ // this._deactivate = false;
59
+ //
60
+ // this._move = 0;
61
+ // }
62
+ //
63
+ // public override oninit() {
64
+ // let zoomDiv = document.createElement("div"),
65
+ // btnZoomIn = document.createElement("button"),
66
+ // btnZoomOut = document.createElement("button");
67
+ //
68
+ // zoomDiv.className = "ogZoomControl";
69
+ // btnZoomIn.className = "ogZoomButton ogZoomIn";
70
+ // btnZoomOut.className = "ogZoomButton ogZoomOut";
71
+ //
72
+ // zoomDiv.appendChild(btnZoomIn);
73
+ // zoomDiv.appendChild(btnZoomOut);
74
+ //
75
+ // this.renderer!.div!.appendChild(zoomDiv);
76
+ //
77
+ // btnZoomIn.addEventListener("mousedown", () => this.zoomIn());
78
+ // btnZoomIn.addEventListener("mouseup", () => this.stopZoom());
79
+ //
80
+ // btnZoomOut.addEventListener("mousedown", () => this.zoomOut());
81
+ // btnZoomOut.addEventListener("mouseup", () => this.stopZoom());
82
+ //
83
+ // btnZoomIn.addEventListener("touchstart", (e: TouchEvent) => {
84
+ // e.preventDefault();
85
+ // this.zoomIn();
86
+ // });
87
+ // btnZoomIn.addEventListener("touchend", (e: TouchEvent) => {
88
+ // e.preventDefault();
89
+ // this.stopZoom();
90
+ // });
91
+ // btnZoomIn.addEventListener("touchcancel", (e: TouchEvent) => {
92
+ // e.preventDefault();
93
+ // this.stopZoom();
94
+ // });
95
+ //
96
+ // btnZoomOut.addEventListener("touchstart", (e: TouchEvent) => {
97
+ // e.preventDefault();
98
+ // this.zoomOut();
99
+ // });
100
+ // btnZoomOut.addEventListener("touchend", (e: TouchEvent) => {
101
+ // e.preventDefault();
102
+ // this.stopZoom();
103
+ // });
104
+ // btnZoomOut.addEventListener("touchcancel", (e: TouchEvent) => {
105
+ // e.preventDefault();
106
+ // this.stopZoom();
107
+ // });
108
+ //
109
+ // this.renderer!.events.on("draw", this._draw, this);
110
+ // }
111
+ //
112
+ // /**
113
+ // * Planet zoom in.
114
+ // * @public
115
+ // */
116
+ // public zoomIn() {
117
+ // if (this.stepIndex) {
118
+ // return;
119
+ // }
120
+ //
121
+ // this.planet!.stopFlying();
122
+ //
123
+ // this.stopRotation();
124
+ //
125
+ // this._deactivate = true;
126
+ //
127
+ // this.planet!.layerLock.lock(this._keyLock);
128
+ // this.planet!.terrainLock.lock(this._keyLock);
129
+ // this.planet!._normalMapCreator.lock(this._keyLock);
130
+ //
131
+ // this.stepsForward = MouseNavigation.getMovePointsFromPixelTerrain(
132
+ // this.planet!.camera,
133
+ // this.planet!,
134
+ // this.stepsCount,
135
+ // this.distDiff,
136
+ // this.renderer!.handler.getCenter(),
137
+ // true,
138
+ // null
139
+ // ) || null;
140
+ //
141
+ // if (this.stepsForward) {
142
+ // this.stepIndex = this.stepsCount;
143
+ // }
144
+ // }
145
+ //
146
+ // /**
147
+ // * Planet zoom out.
148
+ // * @public
149
+ // */
150
+ // public zoomOut() {
151
+ // if (this.stepIndex) {
152
+ // return;
153
+ // }
154
+ //
155
+ // this.planet!.stopFlying();
156
+ //
157
+ // this.stopRotation();
158
+ //
159
+ // this._deactivate = true;
160
+ //
161
+ // this.planet!.layerLock.lock(this._keyLock);
162
+ // this.planet!.terrainLock.lock(this._keyLock);
163
+ // this.planet!._normalMapCreator.lock(this._keyLock);
164
+ //
165
+ // this.stepsForward = MouseNavigation.getMovePointsFromPixelTerrain(
166
+ // this.planet!.camera,
167
+ // this.planet!,
168
+ // this.stepsCount,
169
+ // this.distDiff,
170
+ // this.renderer!.handler.getCenter(),
171
+ // false,
172
+ // null
173
+ // ) || null;
174
+ //
175
+ // if (this.stepsForward) {
176
+ // this.stepIndex = this.stepsCount;
177
+ // }
178
+ // }
179
+ //
180
+ // public stopRotation() {
181
+ // this.qRot.clear();
182
+ // this.planet!.layerLock.free(this._keyLock);
183
+ // this.planet!.terrainLock.free(this._keyLock);
184
+ // this.planet!._normalMapCreator.free(this._keyLock);
185
+ // }
186
+ //
187
+ // public stopZoom() {
188
+ // this._move = 0;
189
+ //
190
+ // this.planet!.layerLock.free(this._keyLock);
191
+ // this.planet!.terrainLock.free(this._keyLock);
192
+ // this.planet!._normalMapCreator.free(this._keyLock);
193
+ // }
194
+ //
195
+ // protected _draw() {
196
+ // if (this._active) {
197
+ // let r = this.renderer!;
198
+ // let cam = this.planet!.camera;
199
+ // let prevEye = cam.eye.clone();
200
+ //
201
+ // if (this.stepIndex) {
202
+ // r.controlsBag.scaleRot = 1.0;
203
+ // let sf = this.stepsForward![this.stepsCount - this.stepIndex--];
204
+ //
205
+ // let maxAlt = cam.maxAltitude + this.planet!.ellipsoid.equatorialSize;
206
+ // let minAlt = cam.minAltitude + this.planet!.ellipsoid.equatorialSize;
207
+ // const camAlt = sf.eye.length();
208
+ // if (camAlt > maxAlt || camAlt < minAlt) {
209
+ // return;
210
+ // }
211
+ //
212
+ // cam.eye = sf.eye;
213
+ // cam._u = sf.v;
214
+ // cam._r = sf.u;
215
+ // cam._b = sf.n;
216
+ //
217
+ // cam.checkTerrainCollision();
218
+ //
219
+ // cam.update();
220
+ // } else {
221
+ // if (this._deactivate) {
222
+ // this._deactivate = false;
223
+ //
224
+ // this.planet!.layerLock.free(this._keyLock);
225
+ // this.planet!.terrainLock.free(this._keyLock);
226
+ // this.planet!._normalMapCreator.free(this._keyLock);
227
+ // }
228
+ // }
229
+ //
230
+ // if (r.events.mouseState.leftButtonDown || !this.scaleRot) {
231
+ // return;
232
+ // }
233
+ //
234
+ // this.scaleRot -= this.inertia;
235
+ // if (this.scaleRot <= 0.0) {
236
+ // this.scaleRot = 0.0;
237
+ // } else {
238
+ //
239
+ // r.controlsBag.scaleRot = this.scaleRot;
240
+ //
241
+ // let rot = this.qRot
242
+ // .slerp(Quat.IDENTITY, 1.0 - this.scaleRot * this.scaleRot * this.scaleRot)
243
+ // .normalize();
244
+ //
245
+ // if (!(rot.x || rot.y || rot.z)) {
246
+ // this.scaleRot = 0.0;
247
+ // }
248
+ //
249
+ // cam.eye = rot.mulVec3(cam.eye);
250
+ // cam._u = rot.mulVec3(cam._u);
251
+ // cam._r = rot.mulVec3(cam._r);
252
+ // cam._b = rot.mulVec3(cam._b);
253
+ //
254
+ // cam.checkTerrainCollision();
255
+ //
256
+ // cam.update();
257
+ // }
258
+ //
259
+ // if (cam.eye.distance(prevEye) / cam.getAltitude() > 0.01) {
260
+ // this.planet!.layerLock.lock(this._keyLock);
261
+ // this.planet!.terrainLock.lock(this._keyLock);
262
+ // this.planet!._normalMapCreator.lock(this._keyLock);
263
+ // } else {
264
+ // this.planet!.layerLock.free(this._keyLock);
265
+ // this.planet!.terrainLock.free(this._keyLock);
266
+ // this.planet!._normalMapCreator.free(this._keyLock);
267
+ // }
268
+ // }
269
+ // }
270
+ // }
@@ -0,0 +1,64 @@
1
+ import { Control, IControlParams } from "./Control";
2
+ import { Key } from "../Lock";
3
+ import { Quat } from "../math/Quat";
4
+ import { Sphere } from "../bv/Sphere";
5
+ import { Vec3 } from "../math/Vec3";
6
+ import { Vec2 } from "../math/Vec2";
7
+ import { Planet } from "../scene/Planet";
8
+ import { PlanetCamera } from "../camera/PlanetCamera";
9
+ import { IMouseState } from "../renderer/RendererEvents";
10
+ export interface IStepForward {
11
+ eye: Vec3;
12
+ v: Vec3;
13
+ u: Vec3;
14
+ n: Vec3;
15
+ }
16
+ interface IMouseNavigationParams extends IControlParams {
17
+ minSlope?: number;
18
+ }
19
+ /**
20
+ * Mouse planet camera dragging control.
21
+ */
22
+ export declare class OldMouseNavigation extends Control {
23
+ protected grabbedPoint: Vec3;
24
+ protected _eye0: Vec3;
25
+ protected pointOnEarth: Vec3;
26
+ protected earthUp: Vec3;
27
+ inertia: number;
28
+ protected grabbedSpheroid: Sphere;
29
+ protected qRot: Quat;
30
+ protected scaleRot: number;
31
+ protected distDiff: number;
32
+ protected stepsCount: number;
33
+ protected stepsForward: IStepForward[] | null;
34
+ protected stepIndex: number;
35
+ protected _lmbDoubleClickActive: boolean;
36
+ minSlope: number;
37
+ protected _wheelDirection: number;
38
+ protected _keyLock: Key;
39
+ protected _deactivate: boolean;
40
+ protected _shiftBusy: boolean;
41
+ constructor(options?: IMouseNavigationParams);
42
+ static getMovePointsFromPixelTerrain(cam: PlanetCamera, planet: Planet, stepsCount: number, delta: number, point: Vec2, forward: boolean, dir?: Vec3 | null): IStepForward[] | undefined;
43
+ onactivate(): void;
44
+ ondeactivate(): void;
45
+ activateDoubleClickZoom(): void;
46
+ deactivateDoubleClickZoom(): void;
47
+ protected onMouseEnter(e: IMouseState): void;
48
+ protected onMouseLeave(): void;
49
+ protected onMouseWheel(e: IMouseState): void;
50
+ oninit(): void;
51
+ protected onMouseLeftButtonDoubleClick(e: IMouseState): void;
52
+ protected onMouseLeftButtonClick(): void;
53
+ stopRotation(): void;
54
+ protected onMouseLeftButtonUp(e: IMouseState): void;
55
+ protected onMouseLeftButtonDown(e: IMouseState): void;
56
+ protected onMouseRightButtonClick(e: IMouseState): void;
57
+ protected onMouseRightButtonDown(e: IMouseState): void;
58
+ onShiftFree(): void;
59
+ protected onMouseMove(e: IMouseState): void;
60
+ protected onDraw(): void;
61
+ lockPlanet(skipTerrain?: boolean): void;
62
+ freePlanet(): void;
63
+ }
64
+ export {};