@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
package/css/og.css CHANGED
@@ -8,6 +8,7 @@
8
8
  --grey6: #bfbfbf; /*map button icon color*/
9
9
  --grey7: #707070; /*slider progress color*/
10
10
  --grey8: #e2e2e2; /*text color*/
11
+ --grey9: #9f9f9f;
11
12
  --blue0: #1700a9ee;
12
13
  }
13
14
 
@@ -744,7 +745,7 @@ input {
744
745
  height: 20px;
745
746
  }
746
747
 
747
- .og-atmosphere.og-options-container .og-slider input{
748
+ .og-atmosphere.og-options-container .og-slider input {
748
749
  width: 87px;
749
750
  }
750
751
 
@@ -870,6 +871,7 @@ TIMELINE
870
871
  flex-direction: row;
871
872
  width: 200px;
872
873
  /*height: 20px;*/
874
+ gap: 5px;
873
875
  }
874
876
 
875
877
  .og-slider .og-slider-label {
@@ -890,6 +892,7 @@ TIMELINE
890
892
  height: 20px;
891
893
  background-color: var(--grey1);
892
894
  z-index: 1;
895
+ border-radius: 5px;
893
896
  }
894
897
 
895
898
  .og-slider .og-slider-panel .og-slider-progress {
@@ -897,6 +900,8 @@ TIMELINE
897
900
  height: 100%;
898
901
  background-color: var(--grey7);
899
902
  pointer-events: none;
903
+ border-top-left-radius: 5px;
904
+ border-bottom-left-radius: 5px;
900
905
  }
901
906
 
902
907
  .og-slider .og-slider-panel .og-slider-pointer {
@@ -919,6 +924,7 @@ TIMELINE
919
924
  color: var(--grey3);
920
925
  padding-left: 5px;
921
926
  width: 60px;
927
+ border-radius: 5px;
922
928
  }
923
929
 
924
930
  .og-slider input:focus-visible {
@@ -937,6 +943,116 @@ TIMELINE
937
943
  -moz-appearance: textfield;
938
944
  }
939
945
 
946
+
947
+ /*
948
+ INPUT
949
+ */
950
+
951
+ .og-checkbox,
952
+ .og-input {
953
+ display: flex;
954
+ flex-direction: row;
955
+ margin: 5px;
956
+ }
957
+
958
+ .og-checkbox .og-input-label,
959
+ .og-input .og-input-label {
960
+ width: 100%;
961
+ height: 100%;
962
+ color: var(--grey6);
963
+ font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
964
+ font-size: 14px;
965
+ align-items: center;
966
+ text-align: left;
967
+ margin-right: 5px;
968
+ }
969
+
970
+ .og-checkbox input,
971
+ .og-input input {
972
+ position: relative;
973
+ height: 100%;
974
+ width: 100%;
975
+ background: var(--grey5);
976
+ border: 1px solid var(--grey1);
977
+ z-index: 0;
978
+ color: var(--grey3);
979
+ padding-left: 5px;
980
+ border-radius: 5px;
981
+ }
982
+
983
+ .og-checkbox input:focus-visible,
984
+ .og-input input:focus-visible {
985
+ outline: none;
986
+ }
987
+
988
+ .og-checkbox input[type="checkbox"] {
989
+ width: 14px;
990
+ height: 14px;
991
+ appearance: none;
992
+ -webkit-appearance: none;
993
+ display: flex;
994
+ align-content: center;
995
+ justify-content: center;
996
+ border: 1px solid var(--grey1);
997
+ border-radius: 3px;
998
+ background: var(--grey8);
999
+ cursor: pointer;
1000
+ position: relative;
1001
+ padding: 0;
1002
+ }
1003
+
1004
+ .og-checkbox input[type="checkbox"]::before {
1005
+ content: "";
1006
+ position: absolute;
1007
+ width: 3px;
1008
+ height: 6px;
1009
+ border: solid black;
1010
+ border-width: 0 2px 2px 0;
1011
+ transform: rotate(45deg);
1012
+ top: 2px;
1013
+ left: 3.5px;
1014
+ opacity: 0;
1015
+ transition: opacity 0.2s ease-in-out;
1016
+ }
1017
+
1018
+ .og-checkbox input[type="checkbox"]:checked::before {
1019
+ opacity: 1;
1020
+ }
1021
+
1022
+ .og-checkbox input[type="checkbox"]:hover {
1023
+ border-color: var(--grey2);
1024
+ }
1025
+
1026
+ .og-checkbox .og-input-label {
1027
+ margin-right: 0;
1028
+ }
1029
+
1030
+ .og-checkbox-input {
1031
+ width: 100%;
1032
+ }
1033
+
1034
+ .og-input-disabled {
1035
+ pointer-events: none;
1036
+ opacity: 0.7;
1037
+ }
1038
+
1039
+ .og-input-disabled input[type="checkbox"] {
1040
+ background: var(--grey9);
1041
+ }
1042
+
1043
+ /* Chrome, Safari, Edge, Opera */
1044
+ /*.og-input input::-webkit-outer-spin-button,*/
1045
+ /*.og-input input::-webkit-inner-spin-button {*/
1046
+ /* -webkit-appearance: none;*/
1047
+ /* margin: 0;*/
1048
+ /*}*/
1049
+
1050
+ /* Firefox */
1051
+ .og-input input[type=number] {
1052
+ -moz-appearance: textfield;
1053
+ }
1054
+
1055
+
940
1056
  .og-selection_button {
941
1057
  top: 117px;
942
1058
  right: 12px;
@@ -1203,4 +1319,24 @@ TIMELINE
1203
1319
 
1204
1320
  .ldio-p0v5a1f6oz div {
1205
1321
  box-sizing: content-box;
1322
+ }
1323
+
1324
+ .og-editor-ground_button {
1325
+ width: fit-content;
1326
+ background: var(--grey1);
1327
+ padding: 4px 6px 8px;
1328
+ margin-left: 5px;
1329
+ margin-top: 15px;
1330
+ }
1331
+
1332
+ .og-editor_toolbar {
1333
+ padding-bottom: 8px;
1334
+ display: flex;
1335
+ }
1336
+
1337
+ .og-editor_toolbar-button {
1338
+ width: 25px;
1339
+ height: 25px;
1340
+ float: left;
1341
+ margin: 3px;
1206
1342
  }
@@ -33,7 +33,6 @@ export interface IGlobeParams {
33
33
  transitionOpacityEnabled?: boolean;
34
34
  terrain?: EmptyTerrain;
35
35
  controls?: Control[];
36
- useEarthNavigation?: boolean;
37
36
  minSlope?: number;
38
37
  sun?: {
39
38
  active?: boolean;
@@ -8,32 +8,39 @@ interface IObject3dParams {
8
8
  indices?: number[];
9
9
  normals?: number[];
10
10
  center?: boolean;
11
- src?: string;
12
11
  color?: number[] | TypedArray | string;
13
12
  scale?: number | Vec3;
13
+ ambient?: string | NumberArray3;
14
+ diffuse?: string | NumberArray3;
15
+ specular?: string | NumberArray3;
16
+ shininess?: number;
17
+ colorTexture?: string;
18
+ normalTexture?: string;
19
+ metallicRoughnessTexture?: string;
14
20
  }
15
21
  declare class Object3d {
16
22
  protected _name: string;
17
23
  protected _vertices: number[];
18
24
  protected _numVertices: number;
19
25
  protected _texCoords: number[];
20
- /**
21
- * Image src.
22
- * @protected
23
- * @type {string}
24
- */
25
- protected _src: string | null;
26
- protected color: Float32Array;
27
26
  protected _indices: number[];
28
27
  protected _normals: number[];
28
+ color: Float32Array;
29
+ ambient: Float32Array;
30
+ diffuse: Float32Array;
31
+ specular: Float32Array;
32
+ shininess: number;
33
+ colorTexture: string;
34
+ normalTexture: string;
35
+ metallicRoughnessTexture: string;
36
+ center: Vec3;
29
37
  constructor(data?: IObject3dParams);
38
+ static getCenter(verts: number[]): Vec3;
30
39
  static centering(verts: number[]): void;
31
40
  centering(): this;
32
41
  applyMat4(m: Mat4): this;
33
42
  scale(s: Vec3): this;
34
43
  translate(v: Vec3): this;
35
- get src(): string | null;
36
- set src(src: string | null);
37
44
  get name(): string;
38
45
  get vertices(): number[];
39
46
  get normals(): number[];
@@ -63,8 +70,11 @@ declare class Object3d {
63
70
  static createFrustum(length?: number, width?: number, height?: number, xOffset?: number, yOffset?: number, zOffset?: number): Object3d;
64
71
  static createCylinder(radiusTop?: number, radiusBottom?: number, height?: number, radialSegments?: number, heightSegments?: number, isTop?: boolean, isBottom?: boolean, offsetX?: number, offsetY?: number, offsetZ?: number): Object3d;
65
72
  static createCube(length?: number, height?: number, depth?: number, xOffset?: number, yOffset?: number, zOffset?: number): Object3d;
73
+ static createPlane(width?: number, height?: number, xOffset?: number, yOffset?: number, zOffset?: number): Object3d;
66
74
  static createArrow(back?: number, height?: number, front?: number): Object3d;
75
+ static readFileObj(objFile: File, mtlFile?: File): Promise<Object3d[]>;
67
76
  static loadObj(src: string): Promise<Object3d[]>;
68
77
  merge(other: Object3d): Object3d;
78
+ static merge(objects: Object3d[], maxSize?: number): Object3d;
69
79
  }
70
80
  export { Object3d };
@@ -6,6 +6,7 @@ import { Renderer } from "../renderer/Renderer";
6
6
  import { Vec2, NumberArray2 } from "../math/Vec2";
7
7
  import { Vec3 } from "../math/Vec3";
8
8
  import { Sphere } from "../bv/Sphere";
9
+ import { Quat } from "../math/Quat";
9
10
  type CameraEvents = ["viewchange", "moveend"];
10
11
  export interface ICameraParams {
11
12
  eye?: Vec3;
@@ -80,6 +81,7 @@ declare class Camera {
80
81
  * @type {Mat4}
81
82
  */
82
83
  protected _viewMatrix: Mat4;
84
+ protected _viewMatrixRTE: Mat4;
83
85
  /**
84
86
  * Camera normal matrix.
85
87
  * @protected
@@ -88,22 +90,28 @@ declare class Camera {
88
90
  protected _normalMatrix: Mat3;
89
91
  /**
90
92
  * Camera right vector.
91
- * @public
93
+ * @protected
92
94
  * @type {Vec3}
93
95
  */
94
96
  _r: Vec3;
95
97
  /**
96
98
  * Camera up vector.
97
- * @public
99
+ * @protected
98
100
  * @type {Vec3}
99
101
  */
100
102
  _u: Vec3;
101
103
  /**
102
104
  * Camera backward vector.
103
- * @public
105
+ * @protected
104
106
  * @type {Vec3}
105
107
  */
106
108
  _b: Vec3;
109
+ /**
110
+ * Camera forward vector.
111
+ * @protected
112
+ * @type {Vec3}
113
+ */
114
+ _f: Vec3;
107
115
  protected _pr: Vec3;
108
116
  protected _pu: Vec3;
109
117
  protected _pb: Vec3;
@@ -116,6 +124,7 @@ declare class Camera {
116
124
  frustumColors: number[];
117
125
  FARTHEST_FRUSTUM_INDEX: number;
118
126
  currentFrustumIndex: number;
127
+ frustumColorIndex: number;
119
128
  isFirstPass: boolean;
120
129
  constructor(renderer: Renderer | null, options?: ICameraParams);
121
130
  checkMoveEnd(): void;
@@ -206,23 +215,40 @@ declare class Camera {
206
215
  */
207
216
  slide(du: number, dv: number, dn: number): void;
208
217
  /**
209
- * Roll the camera to the angle in degrees
218
+ * Roll the camera to the angle in radians
219
+ * @public
220
+ * @param {number} angle - Delta roll angle in radians
221
+ */
222
+ setRoll(angle: number): void;
223
+ /**
224
+ * Pitch the camera to the angle in radians
210
225
  * @public
211
- * @param {number} angle - Delta roll angle in degrees
226
+ * @param {number} angle - Delta pitch angle in radians
212
227
  */
213
- roll(angle: number): void;
228
+ setPitch(angle: number): void;
214
229
  /**
215
- * Pitch the camera to the angle in degrees
230
+ * Yaw the camera to the angle in radians
216
231
  * @public
217
- * @param {number} angle - Delta pitch angle in degrees
232
+ * @param {number} angle - Delta yaw angle in radians
218
233
  */
219
- pitch(angle: number): void;
234
+ setYaw(angle: number): void;
235
+ setPitchYawRoll(pitch: number, yaw: number, roll: number): void;
236
+ getPitch(): number;
237
+ getYaw(): number;
238
+ getRoll(): number;
220
239
  /**
221
- * Yaw the camera to the angle in degrees
240
+ * Returns camera quaternion
241
+ */
242
+ getRotation(): Quat;
243
+ setRotation(rot: Quat, up?: Vec3, right?: Vec3, back?: Vec3): void;
244
+ rotate(rot: Quat): void;
245
+ /**
246
+ * Returns normal vector direction to the unprojected screen point from camera eye
222
247
  * @public
223
- * @param {number} angle - Delta yaw angle in degrees
248
+ * @param {Vec2} pos - Screen X coordinate
249
+ * @returns {Vec3} - Direction vector
224
250
  */
225
- yaw(angle: number): void;
251
+ unproject2v(pos: Vec2): Vec3;
226
252
  /**
227
253
  * Returns normal vector direction to the unprojected screen point from camera eye
228
254
  * @public
@@ -237,7 +263,16 @@ declare class Camera {
237
263
  * @param {Vec3} v - Cartesian 3d coordinates
238
264
  * @returns {Vec2} - Screen point coordinates
239
265
  */
240
- project(v: Vec3): Vec2;
266
+ project3v(v: Vec3): Vec2;
267
+ /**
268
+ * Gets projected 3d point to the 2d screen coordinates
269
+ * @public
270
+ * @param {number} x - X coordinate
271
+ * @param {number} y - Y coordinate
272
+ * @param {number} z - Z coordinate
273
+ * @returns {Vec2} - Screen point coordinates
274
+ */
275
+ project(x: number, y: number, z: number): Vec2;
241
276
  /**
242
277
  * Rotates camera around center point
243
278
  * @public
@@ -247,7 +282,7 @@ declare class Camera {
247
282
  * @param {Vec3} [center] - Point that the camera rotates around
248
283
  * @param {Vec3} [up] - Camera up vector
249
284
  */
250
- rotateAround(angle: number, isArc?: boolean, center?: Vec3 | null, up?: Vec3 | null): void;
285
+ rotateAround(angle: number, isArc?: boolean, center?: Vec3, up?: Vec3): void;
251
286
  /**
252
287
  * Rotates camera around center point by horizontal.
253
288
  * @public
@@ -257,7 +292,7 @@ declare class Camera {
257
292
  * @param {Vec3} [center] - Point that the camera rotates around.
258
293
  * @param {Vec3} [up] - Camera up vector.
259
294
  */
260
- rotateHorizontal(angle: number, isArc?: boolean, center?: Vec3 | null, up?: Vec3 | null): void;
295
+ rotateHorizontal(angle: number, isArc?: boolean, center?: Vec3, up?: Vec3): void;
261
296
  /**
262
297
  * Rotates camera around center point by vertical.
263
298
  * @param {number} angle - Rotation angle in radians.
@@ -300,6 +335,12 @@ declare class Camera {
300
335
  * @return {Mat4} - Projection-view matrix.
301
336
  */
302
337
  getProjectionViewMatrix(): NumberArray16;
338
+ /**
339
+ * Returns projection and model RTE matrix product.
340
+ * @public
341
+ * @return {Mat4} - Projection-view matrix.
342
+ */
343
+ getProjectionViewRTEMatrix(): NumberArray16;
303
344
  /**
304
345
  * Returns inverse projection and model matrix product.
305
346
  * @public
@@ -312,5 +353,6 @@ declare class Camera {
312
353
  * @returns {Mat4} - Inverse projection-view matrix.
313
354
  */
314
355
  getInverseProjectionMatrix(): NumberArray16;
356
+ viewDistance(cartesian: Vec3, distance?: number): void;
315
357
  }
316
358
  export { Camera };
@@ -35,6 +35,7 @@ declare class Frustum {
35
35
  * @type {Mat4}
36
36
  */
37
37
  projectionViewMatrix: Mat4;
38
+ projectionViewRTEMatrix: Mat4;
38
39
  /**
39
40
  * Inverse projectionView Matrix.
40
41
  * @protected
@@ -81,6 +82,7 @@ declare class Frustum {
81
82
  getBackwardPlane(): NumberArray4;
82
83
  getForwardPlane(): NumberArray4;
83
84
  getProjectionViewMatrix(): NumberArray16;
85
+ getProjectionViewRTEMatrix(): NumberArray16;
84
86
  getProjectionMatrix(): NumberArray16;
85
87
  getInverseProjectionMatrix(): NumberArray16;
86
88
  /**
@@ -92,6 +94,7 @@ declare class Frustum {
92
94
  * @param {number} far - Far camera distance.
93
95
  */
94
96
  setProjectionMatrix(angle: number, aspect: number, near: number, far: number): void;
97
+ setProjectionViewRTEMatrix(viewRTEMatrix: Mat4): void;
95
98
  /**
96
99
  * Camera's projection matrix values.
97
100
  * @public
@@ -228,7 +228,20 @@ declare class PlanetCamera extends Camera {
228
228
  checkFly(): void;
229
229
  checkTerrainCollision(): Vec3 | undefined;
230
230
  getSurfaceVisibleDistance(d: number): number;
231
+ /**
232
+ * should be yje same as getYaw
233
+ */
231
234
  getHeading(): number;
232
235
  isVisible(poi: Vec3): boolean;
236
+ getPitch(): number;
237
+ /**
238
+ * should be the same as getHeading
239
+ */
240
+ getYaw(): number;
241
+ getRoll(): number;
242
+ setPitch(a: number): void;
243
+ setYaw(a: number): void;
244
+ setRoll(a: number): void;
245
+ setPitchYawRoll(pitch: number, yaw: number, roll: number): void;
233
246
  }
234
247
  export { PlanetCamera };
@@ -0,0 +1,38 @@
1
+ import { Control, IControlParams } from "./Control";
2
+ import { LonLat } from "../LonLat";
3
+ import { Vec3 } from "../math/Vec3";
4
+ import { EventsHandler } from "../Events";
5
+ import { Entity } from "../entity/Entity";
6
+ import { IMouseState } from "../renderer/RendererEvents";
7
+ import { Planet } from "../scene/Planet";
8
+ type CameraLockEventsList = ["lockview", "unlockview"];
9
+ interface ICameraLockParams extends IControlParams {
10
+ planet?: Planet | null;
11
+ }
12
+ export declare class CameraLock extends Control {
13
+ events: EventsHandler<CameraLockEventsList>;
14
+ protected _lockDistance: number;
15
+ protected _isFromTheBack: boolean;
16
+ protected _lockEntity: Entity | null;
17
+ protected _viewDir: Vec3;
18
+ constructor(options?: ICameraLockParams);
19
+ onactivate(): void;
20
+ ondeactivate(): void;
21
+ oninit(): void;
22
+ flyCartesian(cartesian: Vec3, dist?: number): void;
23
+ lockView(entity: Entity, fromTheBack?: boolean): void;
24
+ protected _activateNav(): void;
25
+ protected _deactivateNav(): void;
26
+ unlockView(): void;
27
+ private _getCenterDist;
28
+ protected _getDistance(entity: Entity, prevEntity?: Entity | null): number;
29
+ isVisibleDistance(cart: Vec3, C?: number): boolean;
30
+ get lockEntity(): Entity | null;
31
+ flyLonLat(lonLat: LonLat, dist?: number): void;
32
+ protected _activateLockViewEvents(): void;
33
+ protected _deactivateLockViewEvents(): void;
34
+ private _onLockViewDraw;
35
+ protected _onMouseWheel: (e: IMouseState) => void;
36
+ protected _onMouseMove: (ms: IMouseState) => void;
37
+ }
38
+ export {};
@@ -1,64 +1,75 @@
1
1
  import { Control, IControlParams } from "./Control";
2
- import { Key } from "../Lock";
2
+ import { IMouseState } from "../renderer/RendererEvents";
3
3
  import { Quat } from "../math/Quat";
4
4
  import { Sphere } from "../bv/Sphere";
5
- import { Vec3 } from "../math/Vec3";
6
5
  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;
6
+ import { Vec3 } from "../math/Vec3";
7
+ interface IEarthNavigationParams extends IControlParams {
8
+ speed?: number;
9
+ fixedUp?: boolean;
18
10
  }
19
- /**
20
- * Mouse planet camera dragging control.
21
- */
22
11
  export declare class MouseNavigation 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;
12
+ speed: number;
13
+ force: Vec3;
14
+ force_h: number;
15
+ force_v: number;
16
+ vel: Vec3;
17
+ vel_h: number;
18
+ vel_v: number;
19
+ mass: number;
20
+ vel_roll: number;
21
+ force_roll: number;
22
+ protected _lookPos: Vec3 | undefined;
23
+ protected _grabbedPoint: Vec3 | null;
24
+ protected _targetZoomPoint: Vec3 | null;
25
+ protected _targetDragPoint: Vec3 | null;
26
+ protected _targetRotationPoint: Vec3 | null;
27
+ protected _grabbedSphere: Sphere;
37
28
  protected _wheelDirection: number;
38
- protected _keyLock: Key;
39
- protected _deactivate: boolean;
29
+ protected _currScreenPos: Vec2;
30
+ protected _tUp: Vec3;
31
+ protected _tRad: number;
40
32
  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;
33
+ protected fixedUp: boolean;
34
+ protected _curPitch: number;
35
+ protected _curYaw: number;
36
+ protected _curRoll: number;
37
+ protected _rot: Quat;
38
+ protected _eye0: Vec3;
39
+ protected _grabbedCameraHeight: number;
40
+ protected _newEye: Vec3;
41
+ protected _isTouchPad: boolean;
42
+ protected _velInertia: number;
43
+ protected _hold: boolean;
44
+ protected _prevVel: Vec3;
45
+ protected _screenPosIsChanged: boolean;
46
+ protected _rotHDir: number;
47
+ protected _rotVDir: number;
48
+ constructor(options?: IEarthNavigationParams);
49
+ oninit(): void;
43
50
  onactivate(): void;
44
51
  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
52
  protected onDraw(): void;
61
- lockPlanet(skipTerrain?: boolean): void;
62
- freePlanet(): void;
53
+ _onShiftFree: () => void;
54
+ protected _onMouseMove: (e: IMouseState) => void;
55
+ protected _onMouseEnter: (e: IMouseState) => void;
56
+ protected _onMouseLeave: () => void;
57
+ protected _onRHold: (e: IMouseState) => void;
58
+ protected _handleRotation(): void;
59
+ protected _onRDown: (e: IMouseState) => void;
60
+ protected _getTargetPoint(p: Vec2): Vec3 | null;
61
+ protected _onMouseWheel: (e: IMouseState) => void;
62
+ protected _onLDown: (e: IMouseState) => void;
63
+ protected _onLHold: (e: IMouseState) => void;
64
+ protected _onLUp: (e: IMouseState) => void;
65
+ protected _handleDrag(): void;
66
+ protected _corrRoll(): void;
67
+ protected _handleZoom(): void;
68
+ protected _updateVel(): void;
69
+ protected _updateVel_h(): void;
70
+ protected _updateVel_v(): void;
71
+ protected _updateVel_roll(): void;
72
+ protected get dt(): number;
73
+ stop(): void;
63
74
  }
64
75
  export {};
@@ -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 {};