@antv/l7-layers 2.18.3 → 2.19.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 (204) hide show
  1. package/es/citybuliding/models/build.js +1 -1
  2. package/es/citybuliding/shaders/build_vert.glsl +0 -1
  3. package/es/core/BaseModel.js +4 -2
  4. package/es/core/CommonStyleAttribute.js +20 -0
  5. package/es/core/interface.d.ts +4 -0
  6. package/es/{Geometry → geometry}/models/billboard.js +1 -1
  7. package/es/{Geometry → geometry}/models/plane.js +1 -1
  8. package/es/{Geometry → geometry}/models/sprite.js +1 -1
  9. package/{lib/Geometry → es/geometry}/shaders/billboard_vert.glsl +1 -8
  10. package/es/geometry/shaders/plane_vert.glsl +31 -0
  11. package/es/{Geometry → geometry}/shaders/sprite_vert.glsl +2 -8
  12. package/es/heatmap/models/grid.js +1 -1
  13. package/es/heatmap/models/grid3d.js +1 -1
  14. package/es/heatmap/models/heatmap.js +1 -1
  15. package/es/heatmap/models/hexagon.js +1 -1
  16. package/es/heatmap/shaders/grid_vert.glsl +1 -1
  17. package/es/heatmap/shaders/heatmap_framebuffer_vert.glsl +1 -1
  18. package/es/heatmap/shaders/hexagon_3d_vert.glsl +1 -1
  19. package/es/heatmap/shaders/hexagon_vert.glsl +1 -1
  20. package/es/image/models/image.js +1 -1
  21. package/es/image/shaders/image_vert.glsl +3 -7
  22. package/es/index.d.ts +1 -1
  23. package/es/index.js +1 -1
  24. package/es/line/models/arc.js +3 -3
  25. package/es/line/models/arc_3d.js +2 -2
  26. package/es/line/models/earthArc_3d.js +2 -2
  27. package/es/line/models/flow.js +1 -1
  28. package/es/line/models/great_circle.js +1 -1
  29. package/es/line/models/line.js +2 -2
  30. package/es/line/models/linearline.js +1 -1
  31. package/es/line/models/simpleLine.js +1 -1
  32. package/es/line/models/wall.js +1 -1
  33. package/es/line/shaders/dash/arc_dash_vert.glsl +3 -6
  34. package/es/line/shaders/dash/line_dash_vert.glsl +2 -1
  35. package/es/line/shaders/flow/flow_line_vert.glsl +2 -7
  36. package/es/line/shaders/line_arc2d_vert.glsl +1 -1
  37. package/es/line/shaders/line_arc_3d_vert.glsl +3 -8
  38. package/es/line/shaders/line_arc_great_circle_vert.glsl +4 -6
  39. package/es/line/shaders/line_arc_vert.glsl +3 -9
  40. package/es/line/shaders/line_bezier_vert.glsl +1 -1
  41. package/es/line/shaders/line_vert.glsl +1 -1
  42. package/es/line/shaders/linear/arc3d_linear_vert.glsl +2 -8
  43. package/es/line/shaders/linear/arc_linear_vert.glsl +3 -6
  44. package/es/line/shaders/linearLine/line_linear_vert.glsl +1 -1
  45. package/es/line/shaders/simple/simpleline_vert.glsl +1 -1
  46. package/es/line/shaders/wall/wall_vert.glsl +1 -1
  47. package/es/mask/models/fill.js +1 -1
  48. package/es/mask/shaders/mask_vert.glsl +1 -1
  49. package/es/point/models/billboard_point.js +1 -1
  50. package/es/point/models/earthExtrude.js +1 -1
  51. package/es/point/models/earthFill.js +1 -1
  52. package/es/point/models/extrude.js +1 -1
  53. package/es/point/models/fill.js +1 -1
  54. package/es/point/models/fillmage.js +1 -1
  55. package/es/point/models/image.js +1 -1
  56. package/es/point/models/normal.js +1 -1
  57. package/es/point/models/radar.js +2 -2
  58. package/es/point/models/text.js +1 -1
  59. package/es/point/shaders/billboard_point_vert.glsl +2 -2
  60. package/es/point/shaders/earth/extrude_vert.glsl +1 -1
  61. package/es/point/shaders/earth/fill_vert.glsl +1 -1
  62. package/es/point/shaders/extrude/extrude_vert.glsl +2 -6
  63. package/es/point/shaders/fill_vert.glsl +3 -10
  64. package/es/point/shaders/image/fillImage_vert.glsl +2 -8
  65. package/es/point/shaders/image_vert.glsl +3 -6
  66. package/es/point/shaders/normal_vert.glsl +1 -1
  67. package/es/point/shaders/radar/radar_frag.glsl +0 -6
  68. package/es/point/shaders/radar/radar_vert.glsl +2 -9
  69. package/es/point/shaders/text_vert.glsl +2 -7
  70. package/es/polygon/index.js +3 -1
  71. package/es/polygon/models/extrude.js +3 -3
  72. package/es/polygon/models/extrusion.d.ts +17 -0
  73. package/es/polygon/models/extrusion.js +137 -0
  74. package/es/polygon/models/fill.js +2 -2
  75. package/es/polygon/models/index.d.ts +1 -1
  76. package/es/polygon/models/index.js +3 -1
  77. package/es/polygon/models/ocean.js +1 -1
  78. package/es/polygon/models/water.js +1 -1
  79. package/es/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -10
  80. package/es/polygon/shaders/extrude/polygon_extrude_vert.glsl +2 -8
  81. package/es/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +2 -8
  82. package/es/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +13 -0
  83. package/es/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +34 -0
  84. package/es/polygon/shaders/polygon_linear_vert.glsl +2 -7
  85. package/es/polygon/shaders/polygon_vert.glsl +3 -6
  86. package/es/polygon/shaders/water/polygon_ocean_vert.glsl +2 -7
  87. package/es/polygon/shaders/water/polygon_water_vert.glsl +2 -6
  88. package/es/raster/models/raster.js +1 -1
  89. package/es/raster/models/rasterRgb.js +1 -1
  90. package/es/raster/models/rasterTerrainRgb.js +1 -1
  91. package/es/raster/shaders/raster_2d_vert.glsl +2 -6
  92. package/es/raster/shaders/raster_vert.glsl +2 -12
  93. package/es/raster/shaders/rater_terrain_rgb_vert.glsl +2 -7
  94. package/es/wind/models/wind.js +1 -1
  95. package/es/wind/shaders/wind_vert.glsl +3 -7
  96. package/lib/citybuliding/models/build.js +1 -1
  97. package/lib/citybuliding/shaders/build_vert.glsl +0 -1
  98. package/lib/core/BaseModel.js +4 -2
  99. package/lib/core/CommonStyleAttribute.js +20 -0
  100. package/lib/{Geometry → geometry}/models/billboard.js +1 -1
  101. package/lib/{Geometry → geometry}/models/plane.js +1 -1
  102. package/lib/{Geometry → geometry}/models/sprite.js +1 -1
  103. package/{es/Geometry → lib/geometry}/shaders/billboard_vert.glsl +1 -8
  104. package/lib/geometry/shaders/plane_vert.glsl +31 -0
  105. package/lib/{Geometry → geometry}/shaders/sprite_vert.glsl +2 -8
  106. package/lib/heatmap/models/grid.js +1 -1
  107. package/lib/heatmap/models/grid3d.js +1 -1
  108. package/lib/heatmap/models/heatmap.js +1 -1
  109. package/lib/heatmap/models/hexagon.js +1 -1
  110. package/lib/heatmap/shaders/grid_vert.glsl +1 -1
  111. package/lib/heatmap/shaders/heatmap_framebuffer_vert.glsl +1 -1
  112. package/lib/heatmap/shaders/hexagon_3d_vert.glsl +1 -1
  113. package/lib/heatmap/shaders/hexagon_vert.glsl +1 -1
  114. package/lib/image/models/image.js +1 -1
  115. package/lib/image/shaders/image_vert.glsl +3 -7
  116. package/lib/index.js +2 -2
  117. package/lib/line/models/arc.js +3 -3
  118. package/lib/line/models/arc_3d.js +2 -2
  119. package/lib/line/models/earthArc_3d.js +2 -2
  120. package/lib/line/models/flow.js +1 -1
  121. package/lib/line/models/great_circle.js +1 -1
  122. package/lib/line/models/line.js +2 -2
  123. package/lib/line/models/linearline.js +1 -1
  124. package/lib/line/models/simpleLine.js +1 -1
  125. package/lib/line/models/wall.js +1 -1
  126. package/lib/line/shaders/dash/arc_dash_vert.glsl +3 -6
  127. package/lib/line/shaders/dash/line_dash_vert.glsl +2 -1
  128. package/lib/line/shaders/flow/flow_line_vert.glsl +2 -7
  129. package/lib/line/shaders/line_arc2d_vert.glsl +1 -1
  130. package/lib/line/shaders/line_arc_3d_vert.glsl +3 -8
  131. package/lib/line/shaders/line_arc_great_circle_vert.glsl +4 -6
  132. package/lib/line/shaders/line_arc_vert.glsl +3 -9
  133. package/lib/line/shaders/line_bezier_vert.glsl +1 -1
  134. package/lib/line/shaders/line_vert.glsl +1 -1
  135. package/lib/line/shaders/linear/arc3d_linear_vert.glsl +2 -8
  136. package/lib/line/shaders/linear/arc_linear_vert.glsl +3 -6
  137. package/lib/line/shaders/linearLine/line_linear_vert.glsl +1 -1
  138. package/lib/line/shaders/simple/simpleline_vert.glsl +1 -1
  139. package/lib/line/shaders/wall/wall_vert.glsl +1 -1
  140. package/lib/mask/models/fill.js +1 -1
  141. package/lib/mask/shaders/mask_vert.glsl +1 -1
  142. package/lib/point/models/billboard_point.js +1 -1
  143. package/lib/point/models/earthExtrude.js +1 -1
  144. package/lib/point/models/earthFill.js +1 -1
  145. package/lib/point/models/extrude.js +1 -1
  146. package/lib/point/models/fill.js +1 -1
  147. package/lib/point/models/fillmage.js +1 -1
  148. package/lib/point/models/image.js +1 -1
  149. package/lib/point/models/normal.js +1 -1
  150. package/lib/point/models/radar.js +2 -2
  151. package/lib/point/models/text.js +1 -1
  152. package/lib/point/shaders/billboard_point_vert.glsl +2 -2
  153. package/lib/point/shaders/earth/extrude_vert.glsl +1 -1
  154. package/lib/point/shaders/earth/fill_vert.glsl +1 -1
  155. package/lib/point/shaders/extrude/extrude_vert.glsl +2 -6
  156. package/lib/point/shaders/fill_vert.glsl +3 -10
  157. package/lib/point/shaders/image/fillImage_vert.glsl +2 -8
  158. package/lib/point/shaders/image_vert.glsl +3 -6
  159. package/lib/point/shaders/normal_vert.glsl +1 -1
  160. package/lib/point/shaders/radar/radar_frag.glsl +0 -6
  161. package/lib/point/shaders/radar/radar_vert.glsl +2 -9
  162. package/lib/point/shaders/text_vert.glsl +2 -7
  163. package/lib/polygon/index.js +3 -1
  164. package/lib/polygon/models/extrude.js +3 -3
  165. package/lib/polygon/models/extrusion.js +144 -0
  166. package/lib/polygon/models/fill.js +2 -2
  167. package/lib/polygon/models/index.js +3 -1
  168. package/lib/polygon/models/ocean.js +1 -1
  169. package/lib/polygon/models/water.js +1 -1
  170. package/lib/polygon/shaders/extrude/polygon_extrude_picklight_vert.glsl +2 -10
  171. package/lib/polygon/shaders/extrude/polygon_extrude_vert.glsl +2 -8
  172. package/lib/polygon/shaders/extrude/polygon_extrudetex_vert.glsl +2 -8
  173. package/lib/polygon/shaders/extrusion/polygon_extrusion_frag.glsl +13 -0
  174. package/lib/polygon/shaders/extrusion/polygon_extrusion_vert.glsl +34 -0
  175. package/lib/polygon/shaders/polygon_linear_vert.glsl +2 -7
  176. package/lib/polygon/shaders/polygon_vert.glsl +3 -6
  177. package/lib/polygon/shaders/water/polygon_ocean_vert.glsl +2 -7
  178. package/lib/polygon/shaders/water/polygon_water_vert.glsl +2 -6
  179. package/lib/raster/models/raster.js +1 -1
  180. package/lib/raster/models/rasterRgb.js +1 -1
  181. package/lib/raster/models/rasterTerrainRgb.js +1 -1
  182. package/lib/raster/shaders/raster_2d_vert.glsl +2 -6
  183. package/lib/raster/shaders/raster_vert.glsl +2 -12
  184. package/lib/raster/shaders/rater_terrain_rgb_vert.glsl +2 -7
  185. package/lib/wind/models/wind.js +1 -1
  186. package/lib/wind/shaders/wind_vert.glsl +3 -7
  187. package/package.json +7 -7
  188. package/es/Geometry/shaders/plane_vert.glsl +0 -53
  189. package/lib/Geometry/shaders/plane_vert.glsl +0 -53
  190. /package/es/{Geometry → geometry}/index.d.ts +0 -0
  191. /package/es/{Geometry → geometry}/index.js +0 -0
  192. /package/es/{Geometry → geometry}/models/billboard.d.ts +0 -0
  193. /package/es/{Geometry → geometry}/models/index.d.ts +0 -0
  194. /package/es/{Geometry → geometry}/models/index.js +0 -0
  195. /package/es/{Geometry → geometry}/models/plane.d.ts +0 -0
  196. /package/es/{Geometry → geometry}/models/sprite.d.ts +0 -0
  197. /package/es/{Geometry → geometry}/shaders/billboard_frag.glsl +0 -0
  198. /package/es/{Geometry → geometry}/shaders/plane_frag.glsl +0 -0
  199. /package/es/{Geometry → geometry}/shaders/sprite_frag.glsl +0 -0
  200. /package/lib/{Geometry → geometry}/index.js +0 -0
  201. /package/lib/{Geometry → geometry}/models/index.js +0 -0
  202. /package/lib/{Geometry → geometry}/shaders/billboard_frag.glsl +0 -0
  203. /package/lib/{Geometry → geometry}/shaders/plane_frag.glsl +0 -0
  204. /package/lib/{Geometry → geometry}/shaders/sprite_frag.glsl +0 -0
@@ -0,0 +1,137 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
5
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
6
+ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
+ import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
9
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
+ import { AttributeType, gl } from '@antv/l7-core';
12
+ import BaseModel from "../../core/BaseModel";
13
+ import { PolygonExtrudeTriangulation } from "../../core/triangulation";
14
+ /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_frag.glsl' */
15
+ var polygonExtrudeFrag = "\nuniform float u_opacity: 1.0;\nvarying vec4 v_Color;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n\n gl_FragColor = v_Color;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
16
+ /* babel-plugin-inline-import '../shaders/extrusion/polygon_extrusion_vert.glsl' */
17
+ var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\n\n\n\nvarying vec4 v_Color;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n // project_pos.z += extrusionBase * 2.0;\n v_Color = a_Color;\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
18
+ var ExtrusionModel = /*#__PURE__*/function (_BaseModel) {
19
+ _inherits(ExtrusionModel, _BaseModel);
20
+ var _super = _createSuper(ExtrusionModel);
21
+ function ExtrusionModel() {
22
+ _classCallCheck(this, ExtrusionModel);
23
+ return _super.apply(this, arguments);
24
+ }
25
+ _createClass(ExtrusionModel, [{
26
+ key: "getUninforms",
27
+ value: function getUninforms() {
28
+ return _objectSpread({}, this.getStyleAttribute());
29
+ }
30
+ }, {
31
+ key: "initModels",
32
+ value: function () {
33
+ var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
34
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
35
+ while (1) switch (_context.prev = _context.next) {
36
+ case 0:
37
+ return _context.abrupt("return", this.buildModels());
38
+ case 1:
39
+ case "end":
40
+ return _context.stop();
41
+ }
42
+ }, _callee, this);
43
+ }));
44
+ function initModels() {
45
+ return _initModels.apply(this, arguments);
46
+ }
47
+ return initModels;
48
+ }()
49
+ }, {
50
+ key: "buildModels",
51
+ value: function () {
52
+ var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
53
+ var _this$getShaders, frag, vert, type, model;
54
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
55
+ while (1) switch (_context2.prev = _context2.next) {
56
+ case 0:
57
+ _this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
58
+ _context2.next = 3;
59
+ return this.layer.buildLayerModel({
60
+ moduleName: type,
61
+ vertexShader: vert,
62
+ fragmentShader: frag,
63
+ inject: this.getInject(),
64
+ triangulation: PolygonExtrudeTriangulation
65
+ });
66
+ case 3:
67
+ model = _context2.sent;
68
+ return _context2.abrupt("return", [model]);
69
+ case 5:
70
+ case "end":
71
+ return _context2.stop();
72
+ }
73
+ }, _callee2, this);
74
+ }));
75
+ function buildModels() {
76
+ return _buildModels.apply(this, arguments);
77
+ }
78
+ return buildModels;
79
+ }()
80
+ }, {
81
+ key: "getShaders",
82
+ value: function getShaders() {
83
+ return {
84
+ frag: polygonExtrudeFrag,
85
+ vert: polygonExtrudeVert,
86
+ type: 'polygonExtrude'
87
+ };
88
+ }
89
+ }, {
90
+ key: "clearModels",
91
+ value: function clearModels() {
92
+ var _this$texture;
93
+ (_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
94
+ }
95
+ }, {
96
+ key: "registerBuiltinAttributes",
97
+ value: function registerBuiltinAttributes() {
98
+ this.styleAttributeService.registerStyleAttribute({
99
+ name: 'normal',
100
+ type: AttributeType.Attribute,
101
+ descriptor: {
102
+ name: 'a_Normal',
103
+ buffer: {
104
+ // give the WebGL driver a hint that this buffer may change
105
+ usage: gl.STATIC_DRAW,
106
+ data: [],
107
+ type: gl.FLOAT
108
+ },
109
+ size: 3,
110
+ update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
111
+ return normal;
112
+ }
113
+ }
114
+ });
115
+ this.styleAttributeService.registerStyleAttribute({
116
+ name: 'size',
117
+ type: AttributeType.Attribute,
118
+ descriptor: {
119
+ name: 'a_Size',
120
+ buffer: {
121
+ usage: gl.DYNAMIC_DRAW,
122
+ data: [],
123
+ type: gl.FLOAT
124
+ },
125
+ size: 1,
126
+ update: function update(feature) {
127
+ var _feature$size = feature.size,
128
+ size = _feature$size === void 0 ? 10 : _feature$size;
129
+ return Array.isArray(size) ? [size[0]] : [size];
130
+ }
131
+ }
132
+ });
133
+ }
134
+ }]);
135
+ return ExtrusionModel;
136
+ }(BaseModel);
137
+ export { ExtrusionModel as default };
@@ -17,9 +17,9 @@ var polygon_frag = "varying vec4 v_color;\n#pragma include \"picking\"\n\nvoid m
17
17
  /* babel-plugin-inline-import '../shaders/polygon_linear_frag.glsl' */
18
18
  var polygon_linear_frag = "#pragma include \"picking\"\nuniform float u_opacitylinear: 0.0;\nuniform float u_dir: 1.0;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\nvarying vec4 v_Color;\n\n\nvoid main() {\n gl_FragColor = v_Color;\n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;\n }\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
19
19
  /* babel-plugin-inline-import '../shaders/polygon_linear_vert.glsl' */
20
- var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_Color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}";
20
+ var polygon_linear_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nuniform float u_opacitylinear: 0.0;\n\nattribute vec3 a_linear;\nvarying vec3 v_linear;\nvarying vec2 v_pos;\n\nvoid main() {\n if(u_opacitylinear > 0.0) {\n v_linear = a_linear;\n v_pos = a_Position.xy;\n }\n v_Color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n setPickingColor(a_PickingColor);\n}";
21
21
  /* babel-plugin-inline-import '../shaders/polygon_vert.glsl' */
22
- var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n\n";
22
+ var polygon_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\n\n\nuniform float u_raisingHeight: 0.0;\n\nvarying vec4 v_color;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n v_color = vec4(a_Color.xyz, a_Color.w * opacity);\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n\n";
23
23
  var FillModel = /*#__PURE__*/function (_BaseModel) {
24
24
  _inherits(FillModel, _BaseModel);
25
25
  var _super = _createSuper(FillModel);
@@ -1,4 +1,4 @@
1
- export type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean';
1
+ export type PolygonModelType = 'fill' | 'extrude' | 'line' | 'point_fill' | 'point_image' | 'point_normal' | 'point_extrude' | 'text' | 'water' | 'ocean' | 'extrusion';
2
2
  declare const PolygonModels: {
3
3
  [key in PolygonModelType]: any;
4
4
  };
@@ -5,6 +5,7 @@ import IMageModel from "../../point/models/image";
5
5
  import NormalModel from "../../point/models/normal";
6
6
  import TextModel from "../../point/models/text";
7
7
  import ExtrudeModel from "./extrude";
8
+ import Extrusion from "./extrusion";
8
9
  import FillModel from "./fill";
9
10
  import Ocean from "./ocean";
10
11
  import Water from "./water";
@@ -18,7 +19,8 @@ var PolygonModels = {
18
19
  point_normal: NormalModel,
19
20
  point_extrude: PointExtrudeModel,
20
21
  water: Water,
21
- ocean: Ocean
22
+ ocean: Ocean,
23
+ extrusion: Extrusion
22
24
  // point_fill: PointModels.fill,
23
25
  };
24
26
 
@@ -16,7 +16,7 @@ import { polygonTriangulation } from "../../core/triangulation";
16
16
  /* babel-plugin-inline-import '../shaders/water/polygon_ocean_frag.glsl' */
17
17
  var ocean_frag = "\nuniform float u_time: 0.0;\nuniform float u_opacity: 1.0;\n\nvarying vec2 v_uv;\n\nfloat coast2water_fadedepth = 0.10;\nfloat large_waveheight = .750; // change to adjust the \"heavy\" waves\nfloat large_wavesize = 3.4; // factor to adjust the large wave size\nfloat small_waveheight = 0.6; // change to adjust the small random waves\nfloat small_wavesize = 0.5; // factor to ajust the small wave size\nfloat water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact)\nfloat water_glossylight_fact= 120.; // range [1..200]\nfloat particle_amount = 70.;\n// vec3 watercolor = vec3(0.43, 0.60, 0.66); // 'transparent' low-water color (RGB)\n// vec3 watercolor2 = vec3(0.06, 0.07, 0.11); // deep-water color (RGB, should be darker than the low-water color)\nuniform vec4 u_watercolor;\nuniform vec4 u_watercolor2;\nvec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights\n#define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun\n\nuniform sampler2D u_texture1;\nuniform sampler2D u_texture2;\nuniform sampler2D u_texture3;\n\n \n\nfloat hash( float n ) {\n return fract(sin(n)*43758.5453123);\n}\n\n// 2d noise function\nfloat noise1( in vec2 x ) {\n vec2 p = floor(x);\n vec2 f = smoothstep(0.0, 1.0, fract(x));\n float n = p.x + p.y*57.0;\n return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),\n mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);\n}\n\nfloat noise(vec2 p) {\n return texture2D(u_texture2,p*vec2(1./256.)).x;\n}\n\nvec4 highness(vec2 p) {\n vec4 t = texture2D(u_texture1,fract(p));\n float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0;\n return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0);\n}\n\nfloat height_map( vec2 p ) {\n vec4 height=highness(p);\n /*\n height = -0.5+\n 0.5*smoothstep(-100.,0.,-height)+\n 2.75*smoothstep(0.,2.,height)+\n 1.75*smoothstep(2.,4.,height)+\n 2.75*smoothstep(4.,16.,height)+\n 1.5*smoothstep(16.,1000.,height);\n */\n\n mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 );\n //p = p*6.;\n float f = 0.6000*noise1( p ); p = m*p*1.1*6.;\n f += 0.2500*noise( p ); p = m*p*1.32;\n f += 0.1666*noise( p ); p = m*p*1.11;\n f += 0.0834*noise( p ); p = m*p*1.12;\n f += 0.0634*noise( p ); p = m*p*1.13;\n f += 0.0444*noise( p ); p = m*p*1.14;\n f += 0.0274*noise( p ); p = m*p*1.15;\n f += 0.0134*noise( p ); p = m*p*1.16;\n f += 0.0104*noise( p ); p = m*p*1.17;\n f += 0.0084*noise( p );\n f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5;\n const float FLAT_LEVEL = 0.92525;\n //f = f*0.25+height*0.75;\n if (f<FLAT_LEVEL)\n f = f;\n else\n f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase\n return clamp(f, 0., 10.);\n}\n\nvec3 plasma_quintic( float x ) {\n x = clamp( x, 0.0, 1.0);\n vec4 x1 = vec4( 1.0, x, x * x, x * x * x ); // 1 x x2 x3\n vec4 x2 = x1 * x1.w * x; // x4 x5 x6 x7\n return vec3(\n dot( x1.xyzw, vec4( +0.063861086, +1.992659096, -1.023901152, -0.490832805 ) ) + dot( x2.xy, vec2( +1.308442123, -0.914547012 ) ),\n dot( x1.xyzw, vec4( +0.049718590, -0.791144343, +2.892305078, +0.811726816 ) ) + dot( x2.xy, vec2( -4.686502417, +2.717794514 ) ),\n dot( x1.xyzw, vec4( +0.513275779, +1.580255060, -5.164414457, +4.559573646 ) ) + dot( x2.xy, vec2( -1.916810682, +0.570638854 ) ) );\n}\n\nvec4 color(vec2 p){\n vec4 c1 = vec4(1.7,1.6,.9,1);\n vec4 c2 = vec4(.2,.94,.1,1);\n vec4 c3 = vec4(.3,.2,.0,1);\n vec4 c4 = vec4(.99,.99,1.6,1);\n vec4 v = highness(p);\n float los = smoothstep(0.1,1.1,v.b);\n float his = smoothstep(3.5,6.5,v.b);\n float ces = smoothstep(1.,5.,v.a);\n vec4 lo = mix(c1,c2,los);\n vec4 hi = mix(c3,c4,his);\n vec4 ce = mix(lo,hi,ces);\n\n return vec4(plasma_quintic(ces),1).ragb;\n}\n\nvec3 terrain_map( vec2 p )\n{\n return color(p).rgb*0.75+0.25*vec3(0.7, .55, .4)+texture2D(u_texture3, fract(p*5.)).rgb*.5; // test-terrain is simply 'sandstone'\n}\n\nconst mat2 m = mat2( 0.72, -1.60, 1.60, 0.72 );\n\nfloat water_map( vec2 p, float height ) {\n vec2 p2 = p*large_wavesize;\n vec2 shift1 = 0.001*vec2( u_time*160.0*2.0, u_time*120.0*2.0 );\n vec2 shift2 = 0.001*vec2( u_time*190.0*2.0, -u_time*130.0*2.0 );\n\n // coarse crossing 'ocean' waves...\n float f = 0.6000*noise( p );\n f += 0.2500*noise( p*m );\n f += 0.1666*noise( p*m*m );\n float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;\n\n p *= small_wavesize;\n f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<9; i++)\n { p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }\n \n return wave+f*small_waveheight;\n}\n\nfloat nautic(vec2 p) {\n p *= 18.;\n float f = 0.;\n float amp = 1.0, s = .5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+u_time*s ))-.5); amp = amp*.5; s*=-1.227; }\n return pow(1.-f, 5.);\n}\n\nfloat particles(vec2 p) {\n p *= 200.;\n float f = 0.;\n float amp = 1.0, s = 1.5;\n for (int i=0; i<3; i++)\n { p = m*p*1.2; f += amp*noise( p+u_time*s ); amp = amp*.5; s*=-1.227; }\n return pow(f*.35, 7.)*particle_amount;\n}\n\nfloat test_shadow( vec2 xy, float height) {\n vec3 r0 = vec3(xy, height);\n vec3 rd = normalize( light - r0 );\n \n float hit = 1.0;\n float t = 0.001;\n for (int j=1; j<25; j++)\n {\n vec3 p = r0 + t*rd;\n float h = height_map( p.xy );\n float height_diff = p.z - h;\n if (height_diff<0.0)\n {\n return 0.0;\n }\n t += 0.01+height_diff*.02;\n hit = min(hit, 2.*height_diff/t); // soft shaddow \n }\n return hit;\n}\n\nvec3 CalcTerrain(vec2 uv, float height) {\n vec3 col = terrain_map( uv );\n vec2 iResolution = vec2(512.);\n float h1 = height_map(uv-vec2(0., 0.5)/ iResolution.xy);\n float h2 = height_map(uv+vec2(0., 0.5)/ iResolution.xy);\n float h3 = height_map(uv-vec2(0.5, 0.)/ iResolution.xy);\n float h4 = height_map(uv+vec2(0.5, 0.)/ iResolution.xy);\n vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));\n vec3 r0 = vec3(uv, height);\n vec3 rd = normalize( light - r0 );\n float grad = dot(norm, rd);\n col *= grad+pow(grad, 8.);\n float terrainshade = test_shadow( uv, height );\n col = mix(col*.25, col, terrainshade);\n return col;\n}\n\n\nvoid main() {\n vec3 watercolor = u_watercolor.rgb;\n vec3 watercolor2 = u_watercolor2.rgb;\n vec2 uv = v_uv;\n float WATER_LEVEL = 0.84; // Water level (range: 0.0 - 2.0)\n float deepwater_fadedepth = 0.4 + coast2water_fadedepth;\n float height = height_map( uv );\n vec3 col;\n\n float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);\n float level = WATER_LEVEL + .2*water_map(uv*15. + vec2(u_time*.1), waveheight);\n if (height > level)\n {\n col = CalcTerrain(uv, height);\n }\n if (height <= level)\n {\n vec2 dif = vec2(.0, .01);\n vec2 pos = uv*15. + vec2(u_time*.01);\n float h1 = water_map(pos-dif,waveheight);\n float h2 = water_map(pos+dif,waveheight);\n float h3 = water_map(pos-dif.yx,waveheight);\n float h4 = water_map(pos+dif.yx,waveheight);\n vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane\n uv += normwater.xy*.002*(level-height);\n \n col = CalcTerrain(uv, height);\n\n float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);\n float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);\n float intensity = col.r*.2126+col.g*.7152+col.b*.0722;\n watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2));\n\n vec3 r0 = vec3(uv, WATER_LEVEL);\n vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position\n float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction\n float specular = pow(grad, water_softlight_fact); // used for soft highlights \n float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights\n float gradpos = dot(vec3(0., 0., 1.), rd);\n float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...) \n float watershade = test_shadow( uv, level );\n watercolor *= 2.2+watershade;\n watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;\n watercolor /= (1.+specular1*1.25);\n watercolor += watershade*specular2*water_specularcolor;\n watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv));\n \n col = mix(col, watercolor, coastfade);\n }\n \n\n float opacity = u_opacity;\n gl_FragColor = vec4(col, opacity); \n}\n";
18
18
  /* babel-plugin-inline-import '../shaders/water/polygon_ocean_vert.glsl' */
19
- var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
19
+ var ocean_vert = "attribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\n\n\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n}\n\n";
20
20
  var isNumber = lodashUtil.isNumber;
21
21
  var OceanModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(OceanModel, _BaseModel);
@@ -16,7 +16,7 @@ import { polygonTriangulation } from "../../core/triangulation";
16
16
  /* babel-plugin-inline-import '../shaders/water/polygon_water_frag.glsl' */
17
17
  var water_frag = "uniform sampler2D u_texture;\nuniform float u_time: 0.0;\nuniform float u_speed: 1.0;\nuniform float u_opacity: 1.0;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\n\nfloat rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); }\n\nfloat water(vec3 p) {\n float t = u_time * u_speed;\n p.z += t * 2.; p.x += t * 2.;\n vec3 c1 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 3.; p.x += t * 0.52;\n vec3 c2 = texture2D(u_texture, p.xz / 30.).xyz;\n p.z += t * 4.; p.x += t * 0.8;\n vec3 c3 = texture2D(u_texture, p.xz / 30.).xyz;\n c1 += c2 - c3;\n float z = (c1.x + c1.y + c1.z) / 3.;\n return p.y + z / 4.;\n}\n\nfloat map(vec3 p) {\n float d = 100.0;\n d = water(p);\n return d;\n}\n\nfloat intersect(vec3 ro, vec3 rd) {\n float d = 0.0;\n for (int i = 0; i <= 100; i++) {\n float h = map(ro + rd * d);\n if (h < 0.1) return d;\n d += h;\n }\n return 0.0;\n}\n\nvec3 norm(vec3 p) {\n float eps = .1;\n return normalize(vec3(\n map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)),\n map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)),\n map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps))\n ));\n} \n\nfloat calSpc() {\n vec3 l1 = normalize(vec3(1, 1, 1));\n vec3 ro = vec3(-3, 20, -8);\n vec3 rc = vec3(0, 0, 0);\n vec3 ww = normalize(rc - ro);\n vec3 uu = normalize(cross(vec3(0,1,0), ww));\n vec3 vv = normalize(cross(rc - ro, uu));\n vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww);\n float d = intersect(ro, rd);\n vec3 p = ro + rd * d;\n vec3 n = norm(p);\n float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0);\n return spc;\n}\n\nvoid main() {\n float opacity = u_opacity;\n gl_FragColor = v_Color;\n gl_FragColor.a *= opacity;\n\n float spc = calSpc();\n gl_FragColor += spc * 0.4;\n}\n";
18
18
  /* babel-plugin-inline-import '../shaders/water/polygon_water_vert.glsl' */
19
- var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n}\n\n";
19
+ var water_vert = "attribute vec4 a_Color;\nattribute vec2 a_uv;\nattribute vec3 a_Position;\nuniform mat4 u_ModelMatrix;\n\n\nvarying vec4 v_Color;\nvarying vec2 v_uv;\nuniform float u_opacity: 1.0;\n\n\n#pragma include \"projection\"\n\nvoid main() {\n v_uv = a_uv;\n\n v_Color = a_Color;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));\n}\n\n";
20
20
  var isNumber = lodashUtil.isNumber;
21
21
  var WaterModel = /*#__PURE__*/function (_BaseModel) {
22
22
  _inherits(WaterModel, _BaseModel);
@@ -10,7 +10,7 @@ attribute vec3 a_Normal;
10
10
  attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
- uniform mat4 u_Mvp;
13
+
14
14
 
15
15
  uniform float u_heightfixed: 0.0; // 默认不固定
16
16
  uniform float u_raisingHeight: 0.0;
@@ -42,15 +42,7 @@ void main() {
42
42
  }
43
43
  }
44
44
 
45
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
46
-
47
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
48
- // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
49
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
50
- } else {
51
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
52
- }
53
-
45
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
54
46
  float lightWeight = calc_lighting(pos);
55
47
  v_texture_data = vec2(a_Position.z,lightWeight);
56
48
 
@@ -10,7 +10,7 @@ attribute vec3 a_Normal;
10
10
  attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
- uniform mat4 u_Mvp;
13
+
14
14
  uniform vec4 u_sourceColor;
15
15
  uniform vec4 u_targetColor;
16
16
  uniform float u_linearColor: 0;
@@ -50,13 +50,7 @@ void main() {
50
50
  }
51
51
 
52
52
 
53
-
54
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
55
- // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
56
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
57
- } else {
58
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
59
- }
53
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
60
54
 
61
55
  // Tip: 部分机型 GPU 计算精度兼容
62
56
  if(isSide < 0.999) {
@@ -10,7 +10,7 @@ attribute vec3 a_Normal;
10
10
  attribute float a_Size;
11
11
  attribute vec3 a_uvs;
12
12
  uniform mat4 u_ModelMatrix;
13
- uniform mat4 u_Mvp;
13
+
14
14
  uniform sampler2D u_texture;
15
15
 
16
16
 
@@ -51,13 +51,7 @@ void main() {
51
51
  }
52
52
 
53
53
 
54
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
55
- // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));
56
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
57
- } else {
58
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
59
- }
60
-
54
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
61
55
 
62
56
 
63
57
 
@@ -0,0 +1,13 @@
1
+
2
+ uniform float u_opacity: 1.0;
3
+ varying vec4 v_Color;
4
+ varying vec2 v_texture_data;
5
+
6
+
7
+ #pragma include "picking"
8
+
9
+ void main() {
10
+
11
+ gl_FragColor = v_Color;
12
+ gl_FragColor = filterColor(gl_FragColor);
13
+ }
@@ -0,0 +1,34 @@
1
+ precision highp float;
2
+
3
+ #define ambientRatio 0.5
4
+ #define diffuseRatio 0.3
5
+ #define specularRatio 0.2
6
+
7
+ attribute vec4 a_Color;
8
+ attribute vec3 a_Position;
9
+ attribute vec3 a_Normal;
10
+ attribute float a_Size;
11
+ uniform mat4 u_ModelMatrix;
12
+
13
+
14
+
15
+
16
+ varying vec4 v_Color;
17
+
18
+ #pragma include "projection"
19
+ #pragma include "light"
20
+ #pragma include "picking"
21
+
22
+ void main() {
23
+
24
+ vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase * 1.5, 1.0);
25
+ float lightWeight = calc_lighting(pos);
26
+ vec4 project_pos = project_position(pos);
27
+ // project_pos.z += extrusionBase * 2.0;
28
+ v_Color = a_Color;
29
+ v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
30
+
31
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
32
+
33
+ setPickingColor(a_PickingColor);
34
+ }
@@ -2,7 +2,7 @@ attribute vec4 a_Color;
2
2
  attribute vec3 a_Position;
3
3
 
4
4
  uniform mat4 u_ModelMatrix;
5
- uniform mat4 u_Mvp;
5
+
6
6
  uniform float u_raisingHeight: 0.0;
7
7
 
8
8
  varying vec4 v_Color;
@@ -32,11 +32,6 @@ void main() {
32
32
  project_pos.z += u_raisingHeight * mapboxZoomScale;
33
33
  }
34
34
 
35
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
36
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
37
- } else {
38
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
39
- }
40
-
35
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
41
36
  setPickingColor(a_PickingColor);
42
37
  }
@@ -2,7 +2,7 @@ attribute vec4 a_Color;
2
2
  attribute vec3 a_Position;
3
3
 
4
4
  uniform mat4 u_ModelMatrix;
5
- uniform mat4 u_Mvp;
5
+
6
6
 
7
7
  uniform float u_raisingHeight: 0.0;
8
8
 
@@ -29,11 +29,8 @@ void main() {
29
29
  project_pos.z += u_raisingHeight * mapboxZoomScale;
30
30
  }
31
31
 
32
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
33
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
34
- } else {
35
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
36
- }
32
+
33
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
37
34
 
38
35
  setPickingColor(a_PickingColor);
39
36
  }
@@ -1,7 +1,7 @@
1
1
  attribute vec2 a_uv;
2
2
  attribute vec3 a_Position;
3
3
  uniform mat4 u_ModelMatrix;
4
- uniform mat4 u_Mvp;
4
+
5
5
 
6
6
  varying vec2 v_uv;
7
7
 
@@ -11,11 +11,6 @@ void main() {
11
11
  v_uv = a_uv;
12
12
 
13
13
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
14
-
15
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
16
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
17
- } else {
18
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
19
- }
14
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
20
15
  }
21
16
 
@@ -2,7 +2,7 @@ attribute vec4 a_Color;
2
2
  attribute vec2 a_uv;
3
3
  attribute vec3 a_Position;
4
4
  uniform mat4 u_ModelMatrix;
5
- uniform mat4 u_Mvp;
5
+
6
6
 
7
7
  varying vec4 v_Color;
8
8
  varying vec2 v_uv;
@@ -17,10 +17,6 @@ void main() {
17
17
  v_Color = a_Color;
18
18
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
19
19
 
20
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
21
- gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));
22
- } else {
23
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
24
- }
20
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xyz, 1.0));
25
21
  }
26
22
 
@@ -14,7 +14,7 @@ import { RasterImageTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/raster_2d_frag.glsl' */
15
15
  var rasterFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\nuniform float u_min;\nuniform float u_max;\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nvarying vec2 v_texCoord;\nbool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }\n\n\nvoid main() {\n\n float value = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).r;\n if (value == u_noDataValue || isnan_emu(value))\n discard;\n else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1]))\n discard;\n else {\n float normalisedValue =(value - u_domain[0]) / (u_domain[1] -u_domain[0]);\n vec4 color = texture2D(u_colorTexture,vec2(normalisedValue, 0));\n \n gl_FragColor = color;\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n \n }\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
17
- var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
17
+ var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
18
18
  var RasterModel = /*#__PURE__*/function (_BaseModel) {
19
19
  _inherits(RasterModel, _BaseModel);
20
20
  var _super = _createSuper(RasterModel);
@@ -17,7 +17,7 @@ import { AttributeType, gl } from '@antv/l7-core';
17
17
  import BaseModel from "../../core/BaseModel";
18
18
  import { RasterImageTriangulation } from "../../core/triangulation";
19
19
  /* babel-plugin-inline-import '../shaders/raster_2d_vert.glsl' */
20
- var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
20
+ var rasterVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
21
21
  /* babel-plugin-inline-import '../shaders/raster_rgb_frag.glsl' */
22
22
  var rasterFrag = "precision mediump float;\nuniform vec2 u_rminmax: vec2(0,255); \nuniform vec2 u_gminmax: vec2(0,255);\nuniform vec2 u_bminmax: vec2(0,255);\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nuniform float u_noDataValue : 0.0;\nvarying vec2 v_texCoord;\n\nvoid main() {\n vec3 rgb = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y)).rgb;\n if(rgb == vec3(u_noDataValue)) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n gl_FragColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);\n }\n if(gl_FragColor.a < 0.01)\n discard;\n \n}";
23
23
  var RasterModel = /*#__PURE__*/function (_BaseModel) {
@@ -14,7 +14,7 @@ import { RasterImageTriangulation } from "../../core/triangulation";
14
14
  /* babel-plugin-inline-import '../shaders/raster_terrain_rgb_frag.glsl' */
15
15
  var Raster_terrainFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\n\nuniform sampler2D u_texture;\nuniform sampler2D u_colorTexture;\n\nvarying vec2 v_texCoord;\n\nuniform vec2 u_domain;\nuniform float u_noDataValue;\nuniform bool u_clampLow: true;\nuniform bool u_clampHigh: true;\nuniform vec4 u_unpack;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_texture, coord,bias) * 255.0;\n data.a = -1.0;\n return dot(data, u_unpack);\n}\n\nvec4 getColor(float value) {\n float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);\n vec2 coord = vec2(normalisedValue, 0);\n return texture2D(u_colorTexture, coord);\n}\n\nvoid main() {\n float value = getElevation(v_texCoord,0.0);\n if (value == u_noDataValue) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else if ((!u_clampLow && value < u_domain[0]) || (!u_clampHigh && value > u_domain[1])) {\n gl_FragColor = vec4(0.0, 0, 0, 0.0);\n } else {\n \n gl_FragColor = getColor(value);\n gl_FragColor.a = gl_FragColor.a * u_opacity ;\n if(gl_FragColor.a < 0.01)\n discard;\n }\n}\n";
16
16
  /* babel-plugin-inline-import '../shaders/rater_terrain_rgb_vert.glsl' */
17
- var Raster_terrainVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
17
+ var Raster_terrainVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
18
18
  var RasterTerrainRGB = /*#__PURE__*/function (_BaseModel) {
19
19
  _inherits(RasterTerrainRGB, _BaseModel);
20
20
  var _super = _createSuper(RasterTerrainRGB);
@@ -1,6 +1,6 @@
1
1
  precision highp float;
2
2
  uniform mat4 u_ModelMatrix;
3
- uniform mat4 u_Mvp;
3
+
4
4
  attribute vec3 a_Position;
5
5
  attribute vec2 a_Uv;
6
6
  varying vec2 v_texCoord;
@@ -9,9 +9,5 @@ void main() {
9
9
  v_texCoord = a_Uv;
10
10
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
11
11
 
12
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
13
- gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));
14
- } else {
15
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
16
- }
12
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
17
13
  }
@@ -1,7 +1,7 @@
1
1
  precision highp float;
2
2
  attribute vec3 a_Position;
3
3
  uniform mat4 u_ModelMatrix;
4
- uniform mat4 u_Mvp;
4
+
5
5
  uniform vec4 u_extent;
6
6
  uniform sampler2D u_texture;
7
7
  uniform sampler2D u_colorTexture;
@@ -27,18 +27,8 @@ void main() {
27
27
  float value1 = (value - u_min) / (u_max -u_min);
28
28
  vec4 color = texture2D(u_colorTexture,vec2(intensity, 0));
29
29
 
30
- // if(uv.x > 1.0 || uv.y > 1.0) {
31
- // v_color = vec4(0.);
32
- // }
33
30
 
34
- // vec2 range = u_extent.zw - u_extent.xy;
35
- // vec4 project_pos = project_position(vec4(pos, 0, 1.0));
36
- // gl_Position = project_common_position_to_clipspace(vec4(pos.xy, project_scale(value) * u_heightRatio, 1.0));
37
31
 
38
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
39
- gl_Position = u_Mvp * (vec4(pos.xy, project_scale(value) * u_heightRatio, 1.0));
40
- } else {
41
- gl_Position = project_common_position_to_clipspace(vec4(pos.xy, project_scale(value) * u_heightRatio, 1.0));
42
- }
32
+ gl_Position = project_common_position_to_clipspace_v2(vec4(pos.xy, project_scale(value) * u_heightRatio, 1.0));
43
33
 
44
34
  }
@@ -1,6 +1,6 @@
1
1
  precision highp float;
2
2
  uniform mat4 u_ModelMatrix;
3
- uniform mat4 u_Mvp;
3
+
4
4
  attribute vec3 a_Position;
5
5
  attribute vec2 a_Uv;
6
6
  varying vec2 v_texCoord;
@@ -8,10 +8,5 @@ varying vec2 v_texCoord;
8
8
  void main() {
9
9
  v_texCoord = a_Uv;
10
10
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
11
- // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
12
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
13
- gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));
14
- } else {
15
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
16
- }
11
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
17
12
  }
@@ -16,7 +16,7 @@ import { RasterImageTriangulation } from "../../core/triangulation";
16
16
  /* babel-plugin-inline-import '../shaders/wind_frag.glsl' */
17
17
  var WindFrag = "precision mediump float;\nuniform float u_opacity: 1.0;\nuniform sampler2D u_texture;\nvarying vec2 v_texCoord;\nvoid main() {\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n gl_FragColor = color;\n gl_FragColor.a *= u_opacity;\n}\n";
18
18
  /* babel-plugin-inline-import '../shaders/wind_vert.glsl' */
19
- var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));\n }\n}\n";
19
+ var WindVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n#pragma include \"projection\"\nvoid main() {\n v_texCoord = a_Uv;\n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));\n}\n";
20
20
  import { Wind } from "./windRender";
21
21
  var defaultRampColors = {
22
22
  0.0: '#3288bd',
@@ -1,6 +1,6 @@
1
1
  precision highp float;
2
2
  uniform mat4 u_ModelMatrix;
3
- uniform mat4 u_Mvp;
3
+
4
4
  attribute vec3 a_Position;
5
5
  attribute vec2 a_Uv;
6
6
  varying vec2 v_texCoord;
@@ -8,10 +8,6 @@ varying vec2 v_texCoord;
8
8
  void main() {
9
9
  v_texCoord = a_Uv;
10
10
  vec4 project_pos = project_position(vec4(a_Position, 1.0));
11
-
12
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
13
- gl_Position = u_Mvp * (vec4(project_pos.xy,0., 1.0));
14
- } else {
15
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy,0., 1.0));
16
- }
11
+
12
+ gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy,0., 1.0));
17
13
  }
@@ -22,7 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
22
22
  /* babel-plugin-inline-import '../shaders/build_frag.glsl' */
23
23
  var buildFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_baseColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_brightColor : [ 1.0, 0, 0, 1.0 ];\nuniform vec4 u_windowColor : [ 1.0, 0, 0, 1.0 ];\nuniform float u_near : 0;\nuniform float u_far : 1;\nvarying vec4 v_Color;\nvarying vec2 v_texCoord;\nuniform float u_Zoom : 1;\nuniform float u_time;\n\nuniform float u_circleSweep;\nuniform float u_cityMinSize;\nuniform vec3 u_circleSweepColor;\nuniform float u_circleSweepSpeed;\n\nvarying float v_worldDis;\n\n#pragma include \"picking\"\n\nvec3 getWindowColor(float n, float hot, vec3 brightColor, vec3 darkColor) {\n float s = step(hot, n);\n vec3 color = mix(brightColor,vec3(0.9,0.9,1.0),n);\n\n return mix(darkColor, color, s);\n}\nfloat random (vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);\n}\n\nfloat LinearizeDepth()\n{\n float z = gl_FragCoord.z * 2.0 - 1.0;\n return (2.0 * u_near * u_far) / (u_far + u_near - z * (u_far - u_near));\n}\n\nvec3 fog(vec3 color, vec3 fogColor, float depth){\n float fogFactor=clamp(depth,0.0,1.0);\n vec3 output_color=mix(fogColor,color,fogFactor);\n return output_color;\n}\n\nfloat sdRect(vec2 p, vec2 sz) {\n vec2 d = abs(p) - sz;\n float outside = length(max(d, 0.));\n float inside = min(max(d.x, d.y), 0.);\n return outside + inside;\n}\n\nvoid main() {\n gl_FragColor = v_Color;\n vec3 baseColor = u_baseColor.xyz;\n vec3 brightColor = u_brightColor.xyz;\n vec3 windowColor = u_windowColor.xyz;\n float targetColId = 5.;\n float depth = 1.0 - LinearizeDepth() / u_far * u_Zoom;\n vec3 fogColor = vec3(23.0/255.0,31.0/255.0,51.0/255.0);\n if(v_texCoord.x < 0.) { //\u9876\u90E8\u989C\u8272\n vec3 foggedColor = fog(baseColor.xyz + vec3(0.12*0.9,0.2*0.9,0.3*0.9),fogColor,depth);\n gl_FragColor = vec4( foggedColor, v_Color.w);\n }else { // \u4FA7\u9762\u989C\u8272\n vec2 st = v_texCoord;\n vec2 UvScale = v_texCoord;\n float tStep = min(0.08,max(0.05* (18.0-u_Zoom),0.02));\n float tStart = 0.25 * tStep;\n float tEnd = 0.75 * tStep;\n float u = mod(UvScale.x, tStep);\n float v = mod(UvScale.y, tStep);\n float ux = floor(UvScale.x/tStep);\n float uy = floor(UvScale.y/tStep);\n float n = random(vec2(ux,uy));\n float lightP = u_time;\n float head = 1.0- step(0.005,st.y);\n /*step3*/\n // \u5C06\u7A97\u6237\u989C\u8272\u548C\u5899\u9762\u989C\u8272\u533A\u522B\u5F00\u6765\n float sU = step(tStart, u) - step(tEnd, u);\n float sV = step(tStart, v) - step(tEnd, v);\n vec2 windowSize = vec2(abs(tEnd-tStart),abs(tEnd-tStart));\n float dist = sdRect(vec2(u,v), windowSize);\n float s = sU * sV;\n\n float curColId = floor(UvScale.x / tStep);\n float sCol = step(targetColId - 0.2, curColId) - step(targetColId + 0.2, curColId);\n\n float mLightP = mod(lightP, 2.);\n float sRow = step(mLightP - 0.2, st.y) - step(mLightP, st.y);\n if(ux == targetColId){\n n =0.;\n }\n float timeP = min(0.75, abs ( sin(u_time/3.0) ) );\n float hot = smoothstep(1.0,0.0,timeP);\n vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), s);\n //vec3 color = mix(baseColor, getWindowColor(n,hot,brightColor,windowColor), 1.0);\n float sFinal = s * sCol * sRow;\n color += mix(baseColor, brightColor, sFinal*n);\n if (st.y<0.01){\n color = baseColor;\n }\n if(head ==1.0) { // \u9876\u90E8\u4EAE\u7EBF\n color = brightColor;\n }\n color = color * v_Color.rgb;\n\n vec3 foggedColor = fog(color,fogColor,depth);\n\n gl_FragColor = vec4(foggedColor,1.0);\n }\n\n\n if(u_circleSweep > 0.0 && v_worldDis < u_cityMinSize) {\n float r = fract(((v_worldDis/u_cityMinSize) - u_time * u_circleSweepSpeed) * 2.0);\n gl_FragColor.rgb += r * r * u_circleSweepColor;\n }\n \n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
24
24
  /* babel-plugin-inline-import '../shaders/build_vert.glsl' */
25
- var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\nuniform mat4 u_Mvp;\n\nuniform float u_circleSweep;\nuniform vec2 u_cityCenter;\n\nvarying float v_worldDis;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
25
+ var buildVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nuniform mat4 u_ModelMatrix;\n\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\nvarying vec4 v_Color;\n\nuniform float u_circleSweep;\nuniform vec2 u_cityCenter;\n\nvarying float v_worldDis;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n v_texCoord = a_Uv;\n\n if(u_circleSweep > 0.0) {\n vec2 lnglatscale = vec2(0.0);\n if(u_CoordinateSystem != COORDINATE_SYSTEM_P20_2) {\n lnglatscale = (a_Position.xy - u_cityCenter) * vec2(0.0, 0.135);\n }\n v_worldDis = length(a_Position.xy + lnglatscale - u_cityCenter);\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
26
26
  var CityBuildModel = /*#__PURE__*/function (_BaseModel) {
27
27
  (0, _inherits2.default)(CityBuildModel, _BaseModel);
28
28
  var _super = _createSuper(CityBuildModel);
@@ -14,7 +14,6 @@ attribute vec2 a_Uv;
14
14
  varying vec2 v_texCoord;
15
15
 
16
16
  varying vec4 v_Color;
17
- uniform mat4 u_Mvp;
18
17
 
19
18
  uniform float u_circleSweep;
20
19
  uniform vec2 u_cityCenter;