@openglobus/og 0.11.1 → 0.11.6

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 (255) hide show
  1. package/package.json +18 -20
  2. package/src/og/Clock.js +11 -11
  3. package/src/og/Deferred.js +1 -1
  4. package/src/og/Events.js +9 -7
  5. package/src/og/Extent.js +117 -72
  6. package/src/og/Globe.js +35 -22
  7. package/src/og/ImageCanvas.js +24 -18
  8. package/src/og/Lock.js +2 -2
  9. package/src/og/LonLat.js +40 -37
  10. package/src/og/Popup.js +21 -15
  11. package/src/og/QueueArray.js +7 -3
  12. package/src/og/Rectangle.js +11 -6
  13. package/src/og/Stack.js +8 -5
  14. package/src/og/ajax.js +21 -33
  15. package/src/og/astro/astro.js +5 -5
  16. package/src/og/astro/earth.js +23 -17
  17. package/src/og/astro/jd.js +44 -39
  18. package/src/og/astro/orbit.js +20 -18
  19. package/src/og/astro/rotation.js +17 -8
  20. package/src/og/bv/Box.js +7 -3
  21. package/src/og/bv/Sphere.js +17 -9
  22. package/src/og/camera/Camera.js +137 -86
  23. package/src/og/camera/Frustum.js +30 -19
  24. package/src/og/camera/PlanetCamera.js +30 -26
  25. package/src/og/control/CompassButton.js +8 -2
  26. package/src/og/control/Control.js +13 -11
  27. package/src/og/control/DebugInfo.js +4 -1
  28. package/src/og/control/EarthCoordinates.js +62 -41
  29. package/src/og/control/EarthNavigation.js +20 -22
  30. package/src/og/control/GeoImageDragControl.js +1 -1
  31. package/src/og/control/KeyboardNavigation.js +12 -12
  32. package/src/og/control/LayerSwitcher.js +24 -23
  33. package/src/og/control/Lighting.js +1 -1
  34. package/src/og/control/MouseNavigation.js +1 -1
  35. package/src/og/control/ScaleControl.js +1 -1
  36. package/src/og/control/SegmentBoundVisualization.js +8 -9
  37. package/src/og/control/ShowFps.js +15 -10
  38. package/src/og/control/SimpleNavigation.js +8 -10
  39. package/src/og/control/Sun.js +25 -15
  40. package/src/og/control/ToggleWireframe.js +5 -5
  41. package/src/og/control/TouchNavigation.js +58 -45
  42. package/src/og/control/ZoomControl.js +41 -25
  43. package/src/og/control/index.js +4 -0
  44. package/src/og/ellipsoid/Ellipsoid.js +181 -85
  45. package/src/og/ellipsoid/wgs84.js +4 -4
  46. package/src/og/entity/BaseBillboard.js +97 -44
  47. package/src/og/entity/Billboard.js +15 -11
  48. package/src/og/entity/BillboardHandler.js +314 -64
  49. package/src/og/entity/Entity.js +106 -74
  50. package/src/og/entity/EntityCollection.js +72 -49
  51. package/src/og/entity/GeoObject.js +228 -0
  52. package/src/og/entity/GeoObjectHandler.js +910 -0
  53. package/src/og/entity/Geometry.js +29 -26
  54. package/src/og/entity/GeometryHandler.js +598 -126
  55. package/src/og/entity/Label.js +74 -40
  56. package/src/og/entity/LabelHandler.js +47 -246
  57. package/src/og/entity/LabelWorker.js +213 -0
  58. package/src/og/entity/Object3d.js +504 -0
  59. package/src/og/entity/PointCloud.js +81 -33
  60. package/src/og/entity/PointCloudHandler.js +9 -9
  61. package/src/og/entity/Polyline.js +39 -39
  62. package/src/og/entity/Ray.js +61 -28
  63. package/src/og/entity/ShapeHandler.js +1 -1
  64. package/src/og/entity/Strip.js +77 -48
  65. package/src/og/entity/StripHandler.js +27 -27
  66. package/src/og/entity/index.js +8 -16
  67. package/src/og/input/KeyboardHandler.js +107 -104
  68. package/src/og/input/MouseHandler.js +81 -78
  69. package/src/og/input/TouchHandler.js +55 -51
  70. package/src/og/layer/BaseGeoImage.js +61 -30
  71. package/src/og/layer/CanvasTiles.js +26 -24
  72. package/src/og/layer/GeoImage.js +10 -10
  73. package/src/og/layer/GeoTexture2d.js +1 -1
  74. package/src/og/layer/GeoVideo.js +3 -3
  75. package/src/og/layer/KML.js +66 -40
  76. package/src/og/layer/Layer.js +27 -17
  77. package/src/og/layer/Material.js +93 -61
  78. package/src/og/layer/Vector.js +118 -72
  79. package/src/og/layer/WMS.js +36 -19
  80. package/src/og/layer/XYZ.js +55 -48
  81. package/src/og/light/LightSource.js +47 -40
  82. package/src/og/math/Line2.js +24 -24
  83. package/src/og/math/Line3.js +103 -102
  84. package/src/og/math/Mat3.js +134 -121
  85. package/src/og/math/Mat4.js +603 -459
  86. package/src/og/math/Plane.js +21 -20
  87. package/src/og/math/Quat.js +980 -927
  88. package/src/og/math/Ray.js +195 -187
  89. package/src/og/math/Vec2.js +127 -117
  90. package/src/og/math/Vec3.js +206 -176
  91. package/src/og/math/Vec4.js +49 -53
  92. package/src/og/math/coder.js +18 -18
  93. package/src/og/math.js +12 -12
  94. package/src/og/mercator.js +11 -11
  95. package/src/og/proj/EPSG3857.js +4 -4
  96. package/src/og/proj/EPSG4326.js +4 -4
  97. package/src/og/proj/Proj.js +31 -31
  98. package/src/og/quadTree/EntityCollectionNode.js +310 -300
  99. package/src/og/quadTree/Node.js +1008 -993
  100. package/src/og/renderer/Renderer.js +768 -747
  101. package/src/og/renderer/RendererEvents.js +9 -6
  102. package/src/og/scene/Axes.js +1 -1
  103. package/src/og/scene/BaseNode.js +8 -9
  104. package/src/og/scene/Planet.js +115 -87
  105. package/src/og/scene/RenderNode.js +29 -22
  106. package/src/og/scene/SkyBox.js +1 -1
  107. package/src/og/segment/Segment.js +1886 -1878
  108. package/src/og/segment/SegmentLonLat.js +298 -268
  109. package/src/og/segment/segmentHelper.js +11 -11
  110. package/src/og/shaders/bloom.js +1 -1
  111. package/src/og/shaders/blur.js +2 -2
  112. package/src/og/shaders/depth.js +1 -1
  113. package/src/og/shaders/geoObject.js +211 -0
  114. package/src/og/shaders/label.js +1 -1
  115. package/src/og/shaders/lumFilter.js +1 -1
  116. package/src/og/shaders/pointCloud.js +42 -42
  117. package/src/og/shaders/screenFrame.js +1 -1
  118. package/src/og/shaders/shape.js +15 -21
  119. package/src/og/shaders/skybox.js +37 -37
  120. package/src/og/shaders/toneMapping.js +1 -1
  121. package/src/og/shapes/BaseShape.js +129 -57
  122. package/src/og/shapes/Icosphere.js +30 -15
  123. package/src/og/shapes/Sphere.js +13 -16
  124. package/src/og/terrain/BilTerrain.js +2 -1
  125. package/src/og/terrain/EmptyTerrain.js +2 -2
  126. package/src/og/terrain/Geoid.js +2 -2
  127. package/src/og/terrain/GlobusTerrain.js +10 -10
  128. package/src/og/terrain/MapboxTerrain.js +1 -1
  129. package/src/og/utils/GeoImageCreator.js +9 -9
  130. package/src/og/utils/Loader.js +6 -6
  131. package/src/og/utils/NormalMapCreator.js +13 -13
  132. package/src/og/utils/TerrainWorker.js +1 -1
  133. package/src/og/utils/TextureAtlas.js +20 -22
  134. package/src/og/utils/VectorTileCreator.js +5 -5
  135. package/src/og/utils/earcut.js +1 -1
  136. package/src/og/utils/shared.js +15 -15
  137. package/src/og/webgl/Framebuffer.js +101 -53
  138. package/src/og/webgl/Handler.js +125 -85
  139. package/src/og/webgl/Multisample.js +55 -27
  140. package/src/og/webgl/Program.js +80 -35
  141. package/src/og/webgl/ProgramController.js +27 -23
  142. package/src/og/webgl/callbacks.js +8 -8
  143. package/types/Clock.d.ts +6 -2
  144. package/types/Deferred.d.ts +1 -1
  145. package/types/Events.d.ts +8 -4
  146. package/types/Extent.d.ts +37 -33
  147. package/types/Globe.d.ts +15 -13
  148. package/types/ImageCanvas.d.ts +5 -3
  149. package/types/LonLat.d.ts +24 -24
  150. package/types/Popup.d.ts +4 -0
  151. package/types/QueueArray.d.ts +6 -2
  152. package/types/Rectangle.d.ts +10 -4
  153. package/types/Stack.d.ts +4 -0
  154. package/types/ajax.d.ts +1 -1
  155. package/types/astro/earth.d.ts +3 -2
  156. package/types/bv/Box.d.ts +10 -5
  157. package/types/bv/Sphere.d.ts +13 -7
  158. package/types/camera/Camera.d.ts +90 -81
  159. package/types/camera/Frustum.d.ts +26 -22
  160. package/types/camera/PlanetCamera.d.ts +49 -53
  161. package/types/control/CompassButton.d.ts +4 -4
  162. package/types/control/Control.d.ts +7 -4
  163. package/types/control/DebugInfo.d.ts +3 -4
  164. package/types/control/EarthCoordinates.d.ts +6 -6
  165. package/types/control/EarthNavigation.d.ts +42 -0
  166. package/types/control/KeyboardNavigation.d.ts +3 -4
  167. package/types/control/LayerSwitcher.d.ts +3 -5
  168. package/types/control/Lighting.d.ts +3 -3
  169. package/types/control/MouseNavigation.d.ts +47 -0
  170. package/types/control/ScaleControl.d.ts +3 -3
  171. package/types/control/ShowFps.d.ts +3 -4
  172. package/types/control/SimpleNavigation.d.ts +3 -6
  173. package/types/control/Sun.d.ts +8 -10
  174. package/types/control/ToggleWireframe.d.ts +3 -3
  175. package/types/control/TouchNavigation.d.ts +48 -0
  176. package/types/control/ZoomControl.d.ts +3 -4
  177. package/types/control/index.d.ts +3 -1
  178. package/types/ellipsoid/Ellipsoid.d.ts +47 -43
  179. package/types/ellipsoid/wgs84.d.ts +3 -2
  180. package/types/entity/BaseBillboard.d.ts +41 -34
  181. package/types/entity/Billboard.d.ts +7 -7
  182. package/types/entity/BillboardHandler.d.ts +4 -0
  183. package/types/entity/Entity.d.ts +101 -83
  184. package/types/entity/EntityCollection.d.ts +57 -43
  185. package/types/entity/GeoObject.d.ts +111 -0
  186. package/types/entity/GeoObjectHandler.d.ts +77 -0
  187. package/types/entity/Geometry.d.ts +9 -7
  188. package/types/entity/GeometryHandler.d.ts +2 -2
  189. package/types/entity/Label.d.ts +24 -29
  190. package/types/entity/LabelHandler.d.ts +9 -2
  191. package/types/entity/LabelWorker.d.ts +9 -0
  192. package/types/entity/PointCloud.d.ts +8 -8
  193. package/types/entity/PointCloudHandler.d.ts +3 -3
  194. package/types/entity/Polyline.d.ts +58 -55
  195. package/types/entity/Ray.d.ts +19 -18
  196. package/types/entity/Strip.d.ts +8 -7
  197. package/types/entity/StripHandler.d.ts +3 -3
  198. package/types/entity/index.d.ts +7 -7
  199. package/types/input/KeyboardHandler.d.ts +10 -0
  200. package/types/input/MouseHandler.d.ts +5 -0
  201. package/types/input/TouchHandler.d.ts +5 -0
  202. package/types/layer/BaseGeoImage.d.ts +23 -35
  203. package/types/layer/CanvasTiles.d.ts +15 -22
  204. package/types/layer/GeoImage.d.ts +5 -18
  205. package/types/layer/GeoVideo.d.ts +5 -30
  206. package/types/layer/KML.d.ts +20 -15
  207. package/types/layer/Layer.d.ts +326 -0
  208. package/types/layer/Material.d.ts +45 -0
  209. package/types/layer/Vector.d.ts +208 -0
  210. package/types/layer/WMS.d.ts +4 -7
  211. package/types/layer/XYZ.d.ts +19 -25
  212. package/types/light/LightSource.d.ts +54 -53
  213. package/types/math/Line2.d.ts +11 -0
  214. package/types/math/Line3.d.ts +10 -0
  215. package/types/math/Mat3.d.ts +30 -18
  216. package/types/math/Mat4.d.ts +71 -52
  217. package/types/math/Plane.d.ts +5 -4
  218. package/types/math/Quat.d.ts +379 -0
  219. package/types/math/Ray.d.ts +82 -0
  220. package/types/math/Vec2.d.ts +102 -101
  221. package/types/math/Vec3.d.ts +143 -142
  222. package/types/math/Vec4.d.ts +40 -39
  223. package/types/math/coder.d.ts +12 -11
  224. package/types/math.d.ts +8 -8
  225. package/types/mercator.d.ts +3 -3
  226. package/types/proj/EPSG3857.d.ts +3 -2
  227. package/types/proj/EPSG4326.d.ts +3 -2
  228. package/types/proj/Proj.d.ts +42 -0
  229. package/types/quadTree/EntityCollectionNode.d.ts +34 -0
  230. package/types/quadTree/Node.d.ts +61 -0
  231. package/types/renderer/Renderer.d.ts +300 -0
  232. package/types/renderer/RendererEvents.d.ts +10 -7
  233. package/types/scene/BaseNode.d.ts +9 -9
  234. package/types/scene/Planet.d.ts +131 -126
  235. package/types/scene/RenderNode.d.ts +22 -23
  236. package/types/segment/Segment.d.ts +279 -0
  237. package/types/segment/SegmentLonLat.d.ts +16 -0
  238. package/types/shaders/geoObject.d.ts +3 -0
  239. package/types/shapes/BaseShape.d.ts +43 -40
  240. package/types/shapes/Sphere.d.ts +7 -7
  241. package/types/terrain/BilTerrain.d.ts +0 -1
  242. package/types/terrain/EmptyTerrain.d.ts +4 -4
  243. package/types/terrain/GlobusTerrain.d.ts +17 -54
  244. package/types/terrain/MapboxTerrain.d.ts +0 -1
  245. package/types/utils/GeoImageCreator.d.ts +3 -2
  246. package/types/utils/TextureAtlas.d.ts +8 -8
  247. package/types/utils/shared.d.ts +25 -24
  248. package/types/webgl/Framebuffer.d.ts +5 -5
  249. package/types/webgl/Handler.d.ts +68 -43
  250. package/types/webgl/Multisample.d.ts +5 -5
  251. package/types/webgl/Program.d.ts +8 -2
  252. package/types/webgl/ProgramController.d.ts +18 -13
  253. package/src/og/inherits.js +0 -8
  254. package/src/og/utils/polylabel.js +0 -176
  255. package/types/inherits.d.ts +0 -4
@@ -34,4 +34,4 @@ export function bloom() {
34
34
  gl_FragColor = vOriginal + vT1 + vT2;
35
35
  }`
36
36
  });
37
- };
37
+ }
@@ -24,7 +24,7 @@ export function buildKernel(sigma) {
24
24
  for (i = 0; i < kernelSize; ++i) values[i] /= sum;
25
25
 
26
26
  return values;
27
- };
27
+ }
28
28
 
29
29
  export function blur() {
30
30
 
@@ -76,4 +76,4 @@ export function blur() {
76
76
  gl_FragColor = sum;
77
77
  }`
78
78
  });
79
- };
79
+ }
@@ -45,4 +45,4 @@ export function depth() {
45
45
  fragColor = vec4(c, c, c, 1.0);
46
46
  }`
47
47
  });
48
- };
48
+ }
@@ -0,0 +1,211 @@
1
+ /**
2
+ * @module og/shaders/drawnode
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { Program } from "../webgl/Program.js";
8
+
9
+ export const geo_object = () =>
10
+ new Program("geo_object", {
11
+ uniforms: {
12
+ viewMatrix: "mat4",
13
+ projectionMatrix: "mat4",
14
+ normalMatrix: "mat3",
15
+
16
+ uScaleByDistance: "vec3",
17
+
18
+ eyePositionHigh: "vec3",
19
+ eyePositionLow: "vec3",
20
+
21
+ lightsPositions: "vec4",
22
+ lightsParamsv: "vec3",
23
+ lightsParamsf: "float"
24
+ },
25
+ attributes: {
26
+ aVertexPosition: "vec3",
27
+ aVertexNormal: "vec3",
28
+ aPositionHigh: { type: "vec3", divisor: 1 },
29
+ aPositionLow: { type: "vec3", divisor: 1 },
30
+ aDirection: { type: "vec3", divisor: 1 },
31
+ aPitchRoll: { type: "vec2", divisor: 1 },
32
+ aColor: { type: "vec4", divisor: 1 },
33
+ aScale: { type: "float", divisor: 1 }
34
+ },
35
+ vertexShader: `precision highp float;
36
+
37
+ attribute vec3 aVertexPosition;
38
+ attribute vec3 aVertexNormal;
39
+ attribute vec3 aPositionHigh;
40
+ attribute vec3 aPositionLow;
41
+ attribute vec3 aDirection;
42
+ attribute vec2 aPitchRoll;
43
+ attribute vec4 aColor;
44
+ attribute float aScale;
45
+
46
+ uniform vec3 uScaleByDistance;
47
+ uniform mat4 projectionMatrix;
48
+ uniform mat4 viewMatrix;
49
+ uniform mat3 normalMatrix;
50
+
51
+ uniform vec3 eyePositionHigh;
52
+ uniform vec3 eyePositionLow;
53
+
54
+ varying vec3 vNormal;
55
+ varying vec4 vPosition;
56
+ varying vec4 vColor;
57
+
58
+ const float RADIANS = 3.141592653589793 / 180.0;
59
+
60
+ void main(void) {
61
+
62
+ vColor = aColor;
63
+ float roll = aPitchRoll.y * RADIANS;
64
+ mat3 rotZ = mat3(
65
+ vec3(cos(roll), sin(roll), 0.0),
66
+ vec3(-sin(roll), cos(roll), 0.0),
67
+ vec3(0.0, 0.0, 1.0)
68
+ );
69
+
70
+ float pitch = aPitchRoll.x * RADIANS;
71
+ mat3 rotX = mat3(
72
+ vec3(1.0, 0.0, 0.0),
73
+ vec3(0.0, cos(pitch), sin(pitch)),
74
+ vec3(0.0, -sin(pitch), cos(pitch))
75
+ );
76
+
77
+ vec3 position = aPositionHigh + aPositionLow;
78
+ vec3 r = cross(normalize(-position), aDirection);
79
+ mat3 modelMatrix = mat3(r, normalize(position), -aDirection) * rotX * rotZ; /*up=-cross(aDirection, r)*/
80
+
81
+ vec3 look = position - (eyePositionHigh + eyePositionLow);
82
+ float lookLength = length(look);
83
+ float scd = aScale * (1.0 - smoothstep(uScaleByDistance[0], uScaleByDistance[1], lookLength)) * (1.0 - step(uScaleByDistance[2], lookLength));
84
+ vNormal = normalMatrix * modelMatrix * aVertexNormal;
85
+
86
+ vec3 highDiff = aPositionHigh - eyePositionHigh;
87
+ vec3 lowDiff = aPositionLow + modelMatrix * (aVertexPosition * scd) - eyePositionLow;
88
+
89
+ mat4 viewMatrixRTE = viewMatrix;
90
+ viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
91
+
92
+ vPosition = viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
93
+
94
+ gl_Position = projectionMatrix * vPosition;
95
+ }`,
96
+ fragmentShader: `precision highp float;
97
+
98
+ varying vec4 vColor;
99
+ #define MAX_POINT_LIGHTS 1
100
+
101
+ uniform vec4 lightsPositions[MAX_POINT_LIGHTS];
102
+ uniform vec3 lightsParamsv[MAX_POINT_LIGHTS * 3];
103
+ uniform float lightsParamsf[MAX_POINT_LIGHTS];
104
+
105
+ varying vec3 vNormal;
106
+ varying vec4 vPosition;
107
+
108
+ void main(void) {
109
+ vec3 lightWeighting;
110
+ vec3 lightDirection;
111
+ vec3 normal;
112
+ vec3 eyeDirection;
113
+ vec3 reflectionDirection;
114
+ float specularLightWeighting;
115
+ float diffuseLightWeighting;
116
+
117
+ lightDirection = normalize(lightsPositions[0].xyz - vPosition.xyz * lightsPositions[0].w);
118
+ normal = normalize(vNormal);
119
+ eyeDirection = normalize(-vPosition.xyz);
120
+ reflectionDirection = reflect(-lightDirection, normal);
121
+ specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), lightsParamsf[0]);
122
+ diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);
123
+ lightWeighting = lightsParamsv[0] + lightsParamsv[1] * diffuseLightWeighting + lightsParamsv[2] * specularLightWeighting;
124
+ gl_FragColor = vec4(lightWeighting, 1.0) * vColor;
125
+ }`
126
+ });
127
+
128
+ export const geo_object_picking = () =>
129
+ new Program("geo_object_picking", {
130
+ uniforms: {
131
+ viewMatrix: "mat4",
132
+ projectionMatrix: "mat4",
133
+
134
+ uScaleByDistance: "vec3",
135
+
136
+ eyePositionHigh: "vec3",
137
+ eyePositionLow: "vec3",
138
+ pickingScale: "float",
139
+
140
+ },
141
+ attributes: {
142
+ aVertexPosition: "vec3",
143
+ aPositionHigh: { type: "vec3", divisor: 1 },
144
+ aPositionLow: { type: "vec3", divisor: 1 },
145
+ aDirection: { type: "vec3", divisor: 1 },
146
+ aPitchRoll: { type: "vec2", divisor: 1 },
147
+ aPickingColor: { type: "vec3", divisor: 1 },
148
+ aScale: { type: "float", divisor: 1 }
149
+ },
150
+ vertexShader: `precision highp float;
151
+
152
+ attribute vec3 aVertexPosition;
153
+ attribute vec3 aPositionHigh;
154
+ attribute vec3 aPositionLow;
155
+ attribute vec3 aDirection;
156
+ attribute vec2 aPitchRoll;
157
+ attribute vec3 aPickingColor;
158
+ attribute float aScale;
159
+
160
+ uniform vec3 uScaleByDistance;
161
+ uniform mat4 projectionMatrix;
162
+ uniform mat4 viewMatrix;
163
+ uniform float pickingScale;
164
+
165
+ uniform vec3 eyePositionHigh;
166
+ uniform vec3 eyePositionLow;
167
+
168
+ varying vec3 vColor;
169
+
170
+ const float RADIANS = 3.141592653589793 / 180.0;
171
+
172
+ void main(void) {
173
+
174
+ vColor = aPickingColor;
175
+ float roll = aPitchRoll.y * RADIANS;
176
+ mat3 rotZ = mat3(
177
+ vec3(cos(roll), sin(roll), 0.0),
178
+ vec3(-sin(roll), cos(roll), 0.0),
179
+ vec3(0.0, 0.0, 1.0)
180
+ );
181
+
182
+ float pitch = aPitchRoll.x * RADIANS;
183
+ mat3 rotX = mat3(
184
+ vec3(1.0, 0.0, 0.0),
185
+ vec3(0.0, cos(pitch), sin(pitch)),
186
+ vec3(0.0, -sin(pitch), cos(pitch))
187
+ );
188
+
189
+ vec3 position = aPositionHigh + aPositionLow;
190
+ vec3 r = cross(normalize(-position), aDirection);
191
+ mat3 modelMatrix = mat3(r, normalize(position), -aDirection) * rotX * rotZ; /*up=-cross(aDirection, r)*/
192
+
193
+ vec3 look = position - (eyePositionHigh + eyePositionLow);
194
+ float lookLength = length(look);
195
+ float scd = aScale * pickingScale * (1.0 - smoothstep(uScaleByDistance[0], uScaleByDistance[1], lookLength)) * (1.0 - step(uScaleByDistance[2], lookLength));
196
+
197
+ vec3 highDiff = aPositionHigh - eyePositionHigh;
198
+ vec3 lowDiff = aPositionLow + modelMatrix * (aVertexPosition * scd) - eyePositionLow;
199
+
200
+ mat4 viewMatrixRTE = viewMatrix;
201
+ viewMatrixRTE[3] = vec4(0.0, 0.0, 0.0, 1.0);
202
+
203
+ gl_Position = projectionMatrix *viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
204
+ }`,
205
+ fragmentShader:
206
+ `precision highp float;
207
+ varying vec3 vColor;
208
+ void main () {
209
+ gl_FragColor = vec4(vColor, 1.0);
210
+ }`
211
+ });
@@ -454,4 +454,4 @@ export function label_screen() {
454
454
  gl_FragColor = vec4(v_rgba.rgb, opacity * v_rgba.a);
455
455
  }`
456
456
  });
457
- };
457
+ }
@@ -38,4 +38,4 @@ export function lumFilter() {
38
38
  gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
39
39
  }`
40
40
  });
41
- };
41
+ }
@@ -1,42 +1,42 @@
1
- /**
2
- * @module og/shaders/pointCloud
3
- */
4
-
5
- 'use strict';
6
-
7
- import { Program } from '../webgl/Program.js';
8
- import { types } from '../webgl/types.js';
9
-
10
- //Picking is the same
11
- export function pointCloud() {
12
- return new Program("pointCloud", {
13
- uniforms: {
14
- projectionViewMatrix: { type: types.MAT4 },
15
- opacity: { type: types.FLOAT },
16
- pointSize: { type: types.FLOAT }
17
- },
18
- attributes: {
19
- coordinates: { type: types.VEC3, enableArray: true },
20
- colors: { type: types.VEC3, enableArray: true }
21
- },
22
- vertexShader:
23
- `attribute vec3 coordinates;
24
- attribute vec4 colors;
25
- uniform mat4 projectionViewMatrix;
26
- uniform float opacity;
27
- uniform float pointSize;
28
- varying vec4 color;
29
- void main() {
30
- color = colors;
31
- color.a *= opacity;
32
- gl_Position = projectionViewMatrix * vec4(coordinates, 1.0);
33
- gl_PointSize = pointSize;
34
- }`,
35
- fragmentShader:
36
- `precision highp float;
37
- varying vec4 color;
38
- void main(void) {
39
- gl_FragColor = color;
40
- }`
41
- });
42
- };
1
+ /**
2
+ * @module og/shaders/pointCloud
3
+ */
4
+
5
+ 'use strict';
6
+
7
+ import { Program } from '../webgl/Program.js';
8
+ import { types } from '../webgl/types.js';
9
+
10
+ //Picking is the same
11
+ export function pointCloud() {
12
+ return new Program("pointCloud", {
13
+ uniforms: {
14
+ projectionViewMatrix: { type: types.MAT4 },
15
+ opacity: { type: types.FLOAT },
16
+ pointSize: { type: types.FLOAT }
17
+ },
18
+ attributes: {
19
+ coordinates: { type: types.VEC3, enableArray: true },
20
+ colors: { type: types.VEC3, enableArray: true }
21
+ },
22
+ vertexShader:
23
+ `attribute vec3 coordinates;
24
+ attribute vec4 colors;
25
+ uniform mat4 projectionViewMatrix;
26
+ uniform float opacity;
27
+ uniform float pointSize;
28
+ varying vec4 color;
29
+ void main() {
30
+ color = colors;
31
+ color.a *= opacity;
32
+ gl_Position = projectionViewMatrix * vec4(coordinates, 1.0);
33
+ gl_PointSize = pointSize;
34
+ }`,
35
+ fragmentShader:
36
+ `precision highp float;
37
+ varying vec4 color;
38
+ void main(void) {
39
+ gl_FragColor = color;
40
+ }`
41
+ });
42
+ }
@@ -28,4 +28,4 @@ export function screenFrame() {
28
28
  gl_FragColor = texture2D( texture, tc );
29
29
  }`
30
30
  });
31
- };
31
+ }
@@ -2,10 +2,10 @@
2
2
  * @module og/shaders/shape
3
3
  */
4
4
 
5
- 'use strict';
5
+ "use strict";
6
6
 
7
- import { Program } from '../webgl/Program.js';
8
- import { types } from '../webgl/types.js';
7
+ import { Program } from "../webgl/Program.js";
8
+ import { types } from "../webgl/types.js";
9
9
 
10
10
  export function shape_wl() {
11
11
  return new Program("shape_wl", {
@@ -23,12 +23,11 @@ export function shape_wl() {
23
23
  uSampler: { type: types.SAMPLER2D }
24
24
  },
25
25
  attributes: {
26
- aVertexNormal: { type: types.VEC3, enableArray: true },
27
- aVertexPosition: { type: types.VEC3, enableArray: true },
28
- aTextureCoord: { type: types.VEC2, enableArray: true }
26
+ aVertexNormal: { type: types.VEC3 },
27
+ aVertexPosition: { type: types.VEC3 },
28
+ aTextureCoord: { type: types.VEC2 }
29
29
  },
30
- vertexShader:
31
- `attribute vec3 aVertexNormal;
30
+ vertexShader: `attribute vec3 aVertexNormal;
32
31
  attribute vec3 aVertexPosition;
33
32
  attribute vec2 aTextureCoord;
34
33
  uniform mat4 projectionMatrix;
@@ -45,8 +44,7 @@ export function shape_wl() {
45
44
  vPosition = viewMatrix * modelMatrix * vec4(aVertexPosition, 1.0);
46
45
  gl_Position = projectionMatrix * vPosition;
47
46
  }`,
48
- fragmentShader:
49
- `precision highp float;
47
+ fragmentShader: `precision highp float;
50
48
  varying vec2 vTextureCoord;
51
49
  varying vec3 vNormal;
52
50
  varying vec4 vPosition;
@@ -76,7 +74,7 @@ export function shape_wl() {
76
74
  gl_FragColor = vec4(lightWeighting, uColor.a) * cc * uColor;
77
75
  }`
78
76
  });
79
- };
77
+ }
80
78
 
81
79
  export function shape_nl() {
82
80
  return new Program("shape_nl", {
@@ -90,8 +88,7 @@ export function shape_nl() {
90
88
  aVertexPosition: { type: types.VEC3, enableArray: true },
91
89
  aTextureCoord: { type: types.VEC2, enableArray: true }
92
90
  },
93
- vertexShader:
94
- `attribute vec3 aVertexPosition;
91
+ vertexShader: `attribute vec3 aVertexPosition;
95
92
  attribute vec2 aTextureCoord;
96
93
  uniform mat4 projectionViewMatrix;
97
94
  uniform mat4 modelMatrix;
@@ -101,8 +98,7 @@ export function shape_nl() {
101
98
  gl_Position = projectionViewMatrix * (modelMatrix * vec4(aVertexPosition, 1.0));
102
99
  vTextureCoord = aTextureCoord;
103
100
  }`,
104
- fragmentShader:
105
- `precision highp float;
101
+ fragmentShader: `precision highp float;
106
102
  uniform vec4 uColor;
107
103
  uniform sampler2D uSampler;
108
104
  varying vec2 vTextureCoord;
@@ -110,7 +106,7 @@ export function shape_nl() {
110
106
  gl_FragColor = uColor*texture2D( uSampler, vTextureCoord.st );
111
107
  }`
112
108
  });
113
- };
109
+ }
114
110
 
115
111
  export function shape_picking() {
116
112
  return new Program("shape_picking", {
@@ -122,20 +118,18 @@ export function shape_picking() {
122
118
  attributes: {
123
119
  aVertexPosition: { type: types.VEC3, enableArray: true }
124
120
  },
125
- vertexShader:
126
- `attribute vec3 aVertexPosition;
121
+ vertexShader: `attribute vec3 aVertexPosition;
127
122
  uniform mat4 projectionViewMatrix;
128
123
  uniform mat4 modelMatrix;
129
124
 
130
125
  void main(void) {
131
126
  gl_Position = projectionViewMatrix * (modelMatrix * vec4(aVertexPosition, 1.0));
132
127
  }`,
133
- fragmentShader:
134
- `precision highp float;
128
+ fragmentShader: `precision highp float;
135
129
  uniform vec4 uColor;
136
130
  uniform sampler2D uSampler;
137
131
  void main(void) {
138
132
  gl_FragColor = uColor;
139
133
  }`
140
134
  });
141
- };
135
+ }
@@ -1,37 +1,37 @@
1
- /**
2
- * @module og/shaders/skybox
3
- */
4
-
5
- 'use strict';
6
-
7
- import { Program } from '../webgl/Program.js';
8
- import { types } from '../webgl/types.js';
9
-
10
- export function skybox() {
11
- return new Program("skybox", {
12
- uniforms: {
13
- projectionViewMatrix: { type: types.MAT4 },
14
- uSampler: { type: types.SAMPLERCUBE },
15
- pos: { type: types.VEC3 }
16
- },
17
- attributes: {
18
- aVertexPosition: { type: types.VEC3, enableArray: true }
19
- },
20
- vertexShader:
21
- `attribute vec3 aVertexPosition;
22
- uniform mat4 projectionViewMatrix;
23
- uniform vec3 pos;
24
- varying vec3 vTextureCoord;
25
- void main(void) {
26
- vTextureCoord = aVertexPosition;
27
- gl_Position = projectionViewMatrix * vec4(aVertexPosition + pos, 1.0);
28
- }`,
29
- fragmentShader:
30
- `precision lowp float;
31
- varying vec3 vTextureCoord;
32
- uniform samplerCube uSampler;
33
- void main(void) {
34
- gl_FragColor = textureCube(uSampler, vTextureCoord);
35
- }`
36
- });
37
- };
1
+ /**
2
+ * @module og/shaders/skybox
3
+ */
4
+
5
+ 'use strict';
6
+
7
+ import { Program } from '../webgl/Program.js';
8
+ import { types } from '../webgl/types.js';
9
+
10
+ export function skybox() {
11
+ return new Program("skybox", {
12
+ uniforms: {
13
+ projectionViewMatrix: { type: types.MAT4 },
14
+ uSampler: { type: types.SAMPLERCUBE },
15
+ pos: { type: types.VEC3 }
16
+ },
17
+ attributes: {
18
+ aVertexPosition: { type: types.VEC3, enableArray: true }
19
+ },
20
+ vertexShader:
21
+ `attribute vec3 aVertexPosition;
22
+ uniform mat4 projectionViewMatrix;
23
+ uniform vec3 pos;
24
+ varying vec3 vTextureCoord;
25
+ void main(void) {
26
+ vTextureCoord = aVertexPosition;
27
+ gl_Position = projectionViewMatrix * vec4(aVertexPosition + pos, 1.0);
28
+ }`,
29
+ fragmentShader:
30
+ `precision lowp float;
31
+ varying vec3 vTextureCoord;
32
+ uniform samplerCube uSampler;
33
+ void main(void) {
34
+ gl_FragColor = textureCube(uSampler, vTextureCoord);
35
+ }`
36
+ });
37
+ }
@@ -86,4 +86,4 @@ export function toneMapping() {
86
86
  fragColor = vec4(mapped, 1.0);
87
87
  }`
88
88
  });
89
- };
89
+ }