xy-map 1.1.22 → 1.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/xy-map.common.js +535 -47
- package/xy-map.umd.js +535 -47
- package/xy-map.umd.min.js +2 -2
package/xy-map.umd.js
CHANGED
|
@@ -234,7 +234,7 @@ ___CSS_LOADER_EXPORT___.push([module.id, ".snow[data-v-59d7e867]{position:absolu
|
|
|
234
234
|
|
|
235
235
|
/***/ }),
|
|
236
236
|
|
|
237
|
-
/***/
|
|
237
|
+
/***/ 2597:
|
|
238
238
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
239
239
|
|
|
240
240
|
"use strict";
|
|
@@ -248,7 +248,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
248
248
|
|
|
249
249
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_noSourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
250
250
|
// Module
|
|
251
|
-
___CSS_LOADER_EXPORT___.push([module.id, ".tools[data-v-
|
|
251
|
+
___CSS_LOADER_EXPORT___.push([module.id, ".tools[data-v-48ba5a0f]{position:absolute;left:0;top:0;margin:15px;background-color:hsla(0,0%,100%,.9);padding:14px;border-radius:5px}.tools .tools-bar[data-v-48ba5a0f]{cursor:pointer}.right-fixed[data-v-48ba5a0f]{position:absolute;right:0;top:0;margin:15px}", ""]);
|
|
252
252
|
// Exports
|
|
253
253
|
/* harmony default export */ __webpack_exports__["default"] = (___CSS_LOADER_EXPORT___);
|
|
254
254
|
|
|
@@ -23798,19 +23798,19 @@ var update = add("5928cba1", content, true, {"sourceMap":false,"shadowMode":fals
|
|
|
23798
23798
|
|
|
23799
23799
|
/***/ }),
|
|
23800
23800
|
|
|
23801
|
-
/***/
|
|
23801
|
+
/***/ 3901:
|
|
23802
23802
|
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {
|
|
23803
23803
|
|
|
23804
23804
|
// style-loader: Adds some css to the DOM by adding a <style> tag
|
|
23805
23805
|
|
|
23806
23806
|
// load the styles
|
|
23807
|
-
var content = __webpack_require__(
|
|
23807
|
+
var content = __webpack_require__(2597);
|
|
23808
23808
|
if(content.__esModule) content = content.default;
|
|
23809
23809
|
if(typeof content === 'string') content = [[module.id, content, '']];
|
|
23810
23810
|
if(content.locals) module.exports = content.locals;
|
|
23811
23811
|
// add the styles to the DOM
|
|
23812
23812
|
var add = (__webpack_require__(208)/* ["default"] */ .Z)
|
|
23813
|
-
var update = add("
|
|
23813
|
+
var update = add("292bbaf9", content, true, {"sourceMap":false,"shadowMode":false});
|
|
23814
23814
|
|
|
23815
23815
|
/***/ }),
|
|
23816
23816
|
|
|
@@ -51366,12 +51366,12 @@ this.manager.itemError(url);throw err;}delete loading[url];for(let i=0,il=callba
|
|
|
51366
51366
|
*
|
|
51367
51367
|
* Sub classes have to implement the parse() method which will be used in load().
|
|
51368
51368
|
*/class CompressedTextureLoader extends (/* unused pure expression or super */ null && (Loader)){constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){const scope=this;const images=[];const texture=new CompressedTexture();const loader=new FileLoader(this.manager);loader.setPath(this.path);loader.setResponseType('arraybuffer');loader.setRequestHeader(this.requestHeader);loader.setWithCredentials(scope.withCredentials);let loaded=0;function loadTexture(i){loader.load(url[i],function(buffer){const texDatas=scope.parse(buffer,true);images[i]={width:texDatas.width,height:texDatas.height,format:texDatas.format,mipmaps:texDatas.mipmaps};loaded+=1;if(loaded===6){if(texDatas.mipmapCount===1)texture.minFilter=LinearFilter;texture.image=images;texture.format=texDatas.format;texture.needsUpdate=true;if(onLoad)onLoad(texture);}},onProgress,onError);}if(Array.isArray(url)){for(let i=0,il=url.length;i<il;++i){loadTexture(i);}}else{// compressed cubemap texture stored in a single DDS file
|
|
51369
|
-
loader.load(url,function(buffer){const texDatas=scope.parse(buffer,true);if(texDatas.isCubemap){const faces=texDatas.mipmaps.length/texDatas.mipmapCount;for(let f=0;f<faces;f++){images[f]={mipmaps:[]};for(let i=0;i<texDatas.mipmapCount;i++){images[f].mipmaps.push(texDatas.mipmaps[f*texDatas.mipmapCount+i]);images[f].format=texDatas.format;images[f].width=texDatas.width;images[f].height=texDatas.height;}}texture.image=images;}else{texture.image.width=texDatas.width;texture.image.height=texDatas.height;texture.mipmaps=texDatas.mipmaps;}if(texDatas.mipmapCount===1){texture.minFilter=LinearFilter;}texture.format=texDatas.format;texture.needsUpdate=true;if(onLoad)onLoad(texture);},onProgress,onError);}return texture;}}class ImageLoader extends
|
|
51369
|
+
loader.load(url,function(buffer){const texDatas=scope.parse(buffer,true);if(texDatas.isCubemap){const faces=texDatas.mipmaps.length/texDatas.mipmapCount;for(let f=0;f<faces;f++){images[f]={mipmaps:[]};for(let i=0;i<texDatas.mipmapCount;i++){images[f].mipmaps.push(texDatas.mipmaps[f*texDatas.mipmapCount+i]);images[f].format=texDatas.format;images[f].width=texDatas.width;images[f].height=texDatas.height;}}texture.image=images;}else{texture.image.width=texDatas.width;texture.image.height=texDatas.height;texture.mipmaps=texDatas.mipmaps;}if(texDatas.mipmapCount===1){texture.minFilter=LinearFilter;}texture.format=texDatas.format;texture.needsUpdate=true;if(onLoad)onLoad(texture);},onProgress,onError);}return texture;}}class ImageLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){if(this.path!==undefined)url=this.path+url;url=this.manager.resolveURL(url);const scope=this;const cached=Cache.get(url);if(cached!==undefined){scope.manager.itemStart(url);setTimeout(function(){if(onLoad)onLoad(cached);scope.manager.itemEnd(url);},0);return cached;}const image=createElementNS('img');function onImageLoad(){removeEventListeners();Cache.add(url,this);if(onLoad)onLoad(this);scope.manager.itemEnd(url);}function onImageError(event){removeEventListeners();if(onError)onError(event);scope.manager.itemError(url);scope.manager.itemEnd(url);}function removeEventListeners(){image.removeEventListener('load',onImageLoad,false);image.removeEventListener('error',onImageError,false);}image.addEventListener('load',onImageLoad,false);image.addEventListener('error',onImageError,false);if(url.slice(0,5)!=='data:'){if(this.crossOrigin!==undefined)image.crossOrigin=this.crossOrigin;}scope.manager.itemStart(url);image.src=url;return image;}}class CubeTextureLoader extends (/* unused pure expression or super */ null && (Loader)){constructor(manager){super(manager);}load(urls,onLoad,onProgress,onError){const texture=new CubeTexture();const loader=new ImageLoader(this.manager);loader.setCrossOrigin(this.crossOrigin);loader.setPath(this.path);let loaded=0;function loadTexture(i){loader.load(urls[i],function(image){texture.images[i]=image;loaded++;if(loaded===6){texture.needsUpdate=true;if(onLoad)onLoad(texture);}},undefined,onError);}for(let i=0;i<urls.length;++i){loadTexture(i);}return texture;}}/**
|
|
51370
51370
|
* Abstract Base class to load generic binary textures formats (rgbe, hdr, ...)
|
|
51371
51371
|
*
|
|
51372
51372
|
* Sub classes have to implement the parse() method which will be used in load().
|
|
51373
51373
|
*/class DataTextureLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){const scope=this;const texture=new DataTexture();const loader=new FileLoader(this.manager);loader.setResponseType('arraybuffer');loader.setRequestHeader(this.requestHeader);loader.setPath(this.path);loader.setWithCredentials(scope.withCredentials);loader.load(url,function(buffer){const texData=scope.parse(buffer);if(!texData)return;if(texData.image!==undefined){texture.image=texData.image;}else if(texData.data!==undefined){texture.image.width=texData.width;texture.image.height=texData.height;texture.image.data=texData.data;}texture.wrapS=texData.wrapS!==undefined?texData.wrapS:ClampToEdgeWrapping;texture.wrapT=texData.wrapT!==undefined?texData.wrapT:ClampToEdgeWrapping;texture.magFilter=texData.magFilter!==undefined?texData.magFilter:LinearFilter;texture.minFilter=texData.minFilter!==undefined?texData.minFilter:LinearFilter;texture.anisotropy=texData.anisotropy!==undefined?texData.anisotropy:1;if(texData.encoding!==undefined){texture.encoding=texData.encoding;}if(texData.flipY!==undefined){texture.flipY=texData.flipY;}if(texData.format!==undefined){texture.format=texData.format;}if(texData.type!==undefined){texture.type=texData.type;}if(texData.mipmaps!==undefined){texture.mipmaps=texData.mipmaps;texture.minFilter=LinearMipmapLinearFilter;// presumably...
|
|
51374
|
-
}if(texData.mipmapCount===1){texture.minFilter=LinearFilter;}if(texData.generateMipmaps!==undefined){texture.generateMipmaps=texData.generateMipmaps;}texture.needsUpdate=true;if(onLoad)onLoad(texture,texData);},onProgress,onError);return texture;}}class TextureLoader extends
|
|
51374
|
+
}if(texData.mipmapCount===1){texture.minFilter=LinearFilter;}if(texData.generateMipmaps!==undefined){texture.generateMipmaps=texData.generateMipmaps;}texture.needsUpdate=true;if(onLoad)onLoad(texture,texData);},onProgress,onError);return texture;}}class TextureLoader extends Loader{constructor(manager){super(manager);}load(url,onLoad,onProgress,onError){const texture=new Texture();const loader=new ImageLoader(this.manager);loader.setCrossOrigin(this.crossOrigin);loader.setPath(this.path);loader.load(url,function(image){texture.image=image;texture.needsUpdate=true;if(onLoad!==undefined){onLoad(texture);}},onProgress,onError);return texture;}}class Light extends three_module_Object3D{constructor(color,intensity=1){super();this.isLight=true;this.type='Light';this.color=new Color(color);this.intensity=intensity;}dispose(){// Empty here in base class; some subclasses override.
|
|
51375
51375
|
}copy(source,recursive){super.copy(source,recursive);this.color.copy(source.color);this.intensity=source.intensity;return this;}toJSON(meta){const data=super.toJSON(meta);data.object.color=this.color.getHex();data.object.intensity=this.intensity;if(this.groundColor!==undefined)data.object.groundColor=this.groundColor.getHex();if(this.distance!==undefined)data.object.distance=this.distance;if(this.angle!==undefined)data.object.angle=this.angle;if(this.decay!==undefined)data.object.decay=this.decay;if(this.penumbra!==undefined)data.object.penumbra=this.penumbra;if(this.shadow!==undefined)data.object.shadow=this.shadow.toJSON();return data;}}class HemisphereLight extends (/* unused pure expression or super */ null && (Light)){constructor(skyColor,groundColor,intensity){super(skyColor,intensity);this.isHemisphereLight=true;this.type='HemisphereLight';this.position.copy(three_module_Object3D.DefaultUp);this.updateMatrix();this.groundColor=new Color(groundColor);}copy(source,recursive){super.copy(source,recursive);this.groundColor.copy(source.groundColor);return this;}}const _projScreenMatrix$1=/*@__PURE__*/new Matrix4();const _lightPositionWorld$1=/*@__PURE__*/new Vector3();const _lookTarget$1=/*@__PURE__*/new Vector3();class LightShadow{constructor(camera){this.camera=camera;this.bias=0;this.normalBias=0;this.radius=1;this.blurSamples=8;this.mapSize=new Vector2(512,512);this.map=null;this.mapPass=null;this.matrix=new Matrix4();this.autoUpdate=true;this.needsUpdate=false;this._frustum=new Frustum();this._frameExtents=new Vector2(1,1);this._viewportCount=1;this._viewports=[new Vector4(0,0,1,1)];}getViewportCount(){return this._viewportCount;}getFrustum(){return this._frustum;}updateMatrices(light){const shadowCamera=this.camera;const shadowMatrix=this.matrix;_lightPositionWorld$1.setFromMatrixPosition(light.matrixWorld);shadowCamera.position.copy(_lightPositionWorld$1);_lookTarget$1.setFromMatrixPosition(light.target.matrixWorld);shadowCamera.lookAt(_lookTarget$1);shadowCamera.updateMatrixWorld();_projScreenMatrix$1.multiplyMatrices(shadowCamera.projectionMatrix,shadowCamera.matrixWorldInverse);this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);shadowMatrix.set(0.5,0.0,0.0,0.5,0.0,0.5,0.0,0.5,0.0,0.0,0.5,0.5,0.0,0.0,0.0,1.0);shadowMatrix.multiply(_projScreenMatrix$1);}getViewport(viewportIndex){return this._viewports[viewportIndex];}getFrameExtents(){return this._frameExtents;}dispose(){if(this.map){this.map.dispose();}if(this.mapPass){this.mapPass.dispose();}}copy(source){this.camera=source.camera.clone();this.bias=source.bias;this.radius=source.radius;this.mapSize.copy(source.mapSize);return this;}clone(){return new this.constructor().copy(this);}toJSON(){const object={};if(this.bias!==0)object.bias=this.bias;if(this.normalBias!==0)object.normalBias=this.normalBias;if(this.radius!==1)object.radius=this.radius;if(this.mapSize.x!==512||this.mapSize.y!==512)object.mapSize=this.mapSize.toArray();object.camera=this.camera.toJSON(false).object;delete object.camera.matrix;return object;}}class SpotLightShadow extends (/* unused pure expression or super */ null && (LightShadow)){constructor(){super(new PerspectiveCamera(50,1,0.5,500));this.isSpotLightShadow=true;this.focus=1;}updateMatrices(light){const camera=this.camera;const fov=RAD2DEG*2*light.angle*this.focus;const aspect=this.mapSize.width/this.mapSize.height;const far=light.distance||camera.far;if(fov!==camera.fov||aspect!==camera.aspect||far!==camera.far){camera.fov=fov;camera.aspect=aspect;camera.far=far;camera.updateProjectionMatrix();}super.updateMatrices(light);}copy(source){super.copy(source);this.focus=source.focus;return this;}}class SpotLight extends (/* unused pure expression or super */ null && (Light)){constructor(color,intensity,distance=0,angle=Math.PI/3,penumbra=0,decay=1){super(color,intensity);this.isSpotLight=true;this.type='SpotLight';this.position.copy(three_module_Object3D.DefaultUp);this.updateMatrix();this.target=new three_module_Object3D();this.distance=distance;this.angle=angle;this.penumbra=penumbra;this.decay=decay;// for physically correct lights, should be 2.
|
|
51376
51376
|
this.map=null;this.shadow=new SpotLightShadow();}get power(){// compute the light's luminous power (in lumens) from its intensity (in candela)
|
|
51377
51377
|
// by convention for a spotlight, luminous power (lm) = π * luminous intensity (cd)
|
|
@@ -54932,14 +54932,14 @@ const addLayerModel = (option, layerId = '') => {
|
|
|
54932
54932
|
// camera = new THREE.Camera()
|
|
54933
54933
|
// 场景
|
|
54934
54934
|
scene = new Scene();
|
|
54935
|
-
// scene.background = new THREE.Color(
|
|
54936
|
-
|
|
54937
|
-
//
|
|
54938
|
-
|
|
54939
|
-
|
|
54940
|
-
|
|
54941
|
-
|
|
54942
|
-
|
|
54935
|
+
// scene.background = new THREE.Color(0xffffff)
|
|
54936
|
+
const texture = new TextureLoader().load('/img/blue.jpg');
|
|
54937
|
+
texture.mapping = EquirectangularRefractionMapping; // 带折射效果
|
|
54938
|
+
texture.wrapS = texture.wrapT = RepeatWrapping;
|
|
54939
|
+
console.log(texture);
|
|
54940
|
+
scene.scale.set(100, 100, 100);
|
|
54941
|
+
scene.background = texture;
|
|
54942
|
+
scene.environment = texture;
|
|
54943
54943
|
|
|
54944
54944
|
// 创建灯光
|
|
54945
54945
|
if (opt.directionalLight && opt.directionalLight.length > 0) {
|
|
@@ -55066,7 +55066,24 @@ const addLayerModel = (option, layerId = '') => {
|
|
|
55066
55066
|
// getIntersects() // 点击事件
|
|
55067
55067
|
},
|
|
55068
55068
|
|
|
55069
|
-
render:
|
|
55069
|
+
render: (gl, matrix) => {
|
|
55070
|
+
const rotationX = new Matrix4().makeRotationAxis(new Vector3(1, 0, 0), modelTransform.rotateX);
|
|
55071
|
+
const rotationY = new Matrix4().makeRotationAxis(new Vector3(0, 1, 0), modelTransform.rotateY);
|
|
55072
|
+
const rotationZ = new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), modelTransform.rotateZ);
|
|
55073
|
+
const m = new Matrix4().fromArray(matrix);
|
|
55074
|
+
const l = new Matrix4().makeTranslation(modelTransform.translateX, modelTransform.translateY, modelTransform.translateZ).scale(new Vector3(modelTransform.scale, -modelTransform.scale, modelTransform.scale)).multiply(rotationX).multiply(rotationY).multiply(rotationZ);
|
|
55075
|
+
camera.projectionMatrix.elements = matrix;
|
|
55076
|
+
camera.projectionMatrix = m.multiply(l);
|
|
55077
|
+
|
|
55078
|
+
// renderer.toneMapping = THREE.ACESFilmicToneMapping
|
|
55079
|
+
// renderer.toneMappingExposure = 1.5
|
|
55080
|
+
|
|
55081
|
+
renderer.resetState();
|
|
55082
|
+
renderer.render(scene, camera);
|
|
55083
|
+
// composer.render()
|
|
55084
|
+
labelRenderer.render(scene, camera);
|
|
55085
|
+
map.triggerRepaint();
|
|
55086
|
+
}
|
|
55070
55087
|
};
|
|
55071
55088
|
return customLayer;
|
|
55072
55089
|
function loadHDR() {
|
|
@@ -55077,26 +55094,6 @@ const addLayerModel = (option, layerId = '') => {
|
|
|
55077
55094
|
});
|
|
55078
55095
|
}
|
|
55079
55096
|
|
|
55080
|
-
// 渲染摄像机
|
|
55081
|
-
function cameraUpdate(gl, matrix) {
|
|
55082
|
-
const rotationX = new Matrix4().makeRotationAxis(new Vector3(1, 0, 0), modelTransform.rotateX);
|
|
55083
|
-
const rotationY = new Matrix4().makeRotationAxis(new Vector3(0, 1, 0), modelTransform.rotateY);
|
|
55084
|
-
const rotationZ = new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), modelTransform.rotateZ);
|
|
55085
|
-
const m = new Matrix4().fromArray(matrix);
|
|
55086
|
-
const l = new Matrix4().makeTranslation(modelTransform.translateX, modelTransform.translateY, modelTransform.translateZ).scale(new Vector3(modelTransform.scale, -modelTransform.scale, modelTransform.scale)).multiply(rotationX).multiply(rotationY).multiply(rotationZ);
|
|
55087
|
-
camera.projectionMatrix.elements = matrix;
|
|
55088
|
-
camera.projectionMatrix = m.multiply(l);
|
|
55089
|
-
|
|
55090
|
-
// renderer.toneMapping = THREE.ACESFilmicToneMapping
|
|
55091
|
-
// renderer.toneMappingExposure = 1.5
|
|
55092
|
-
|
|
55093
|
-
renderer.resetState();
|
|
55094
|
-
renderer.render(scene, camera);
|
|
55095
|
-
// composer.render()
|
|
55096
|
-
labelRenderer.render(scene, camera);
|
|
55097
|
-
map.triggerRepaint();
|
|
55098
|
-
}
|
|
55099
|
-
|
|
55100
55097
|
// 点击事件
|
|
55101
55098
|
function getIntersects() {
|
|
55102
55099
|
const container = map.getCanvas();
|
|
@@ -55136,6 +55133,495 @@ const addLayerModel = (option, layerId = '') => {
|
|
|
55136
55133
|
}
|
|
55137
55134
|
});
|
|
55138
55135
|
};
|
|
55136
|
+
;// CONCATENATED MODULE: ./node_modules/three/examples/jsm/objects/Water.js
|
|
55137
|
+
|
|
55138
|
+
|
|
55139
|
+
/**
|
|
55140
|
+
* Work based on :
|
|
55141
|
+
* https://github.com/Slayvin: Flat mirror for three.js
|
|
55142
|
+
* https://home.adelphi.edu/~stemkoski/ : An implementation of water shader based on the flat mirror
|
|
55143
|
+
* http://29a.ch/ && http://29a.ch/slides/2012/webglwater/ : Water shader explanations in WebGL
|
|
55144
|
+
*/
|
|
55145
|
+
|
|
55146
|
+
class Water extends Mesh {
|
|
55147
|
+
constructor(geometry, options = {}) {
|
|
55148
|
+
super(geometry);
|
|
55149
|
+
this.isWater = true;
|
|
55150
|
+
const scope = this;
|
|
55151
|
+
const textureWidth = options.textureWidth !== undefined ? options.textureWidth : 512;
|
|
55152
|
+
const textureHeight = options.textureHeight !== undefined ? options.textureHeight : 512;
|
|
55153
|
+
const clipBias = options.clipBias !== undefined ? options.clipBias : 0.0;
|
|
55154
|
+
const alpha = options.alpha !== undefined ? options.alpha : 1.0;
|
|
55155
|
+
const time = options.time !== undefined ? options.time : 0.0;
|
|
55156
|
+
const normalSampler = options.waterNormals !== undefined ? options.waterNormals : null;
|
|
55157
|
+
const sunDirection = options.sunDirection !== undefined ? options.sunDirection : new Vector3(0.70707, 0.70707, 0.0);
|
|
55158
|
+
const sunColor = new Color(options.sunColor !== undefined ? options.sunColor : 0xffffff);
|
|
55159
|
+
const waterColor = new Color(options.waterColor !== undefined ? options.waterColor : 0x7F7F7F);
|
|
55160
|
+
const eye = options.eye !== undefined ? options.eye : new Vector3(0, 0, 0);
|
|
55161
|
+
const distortionScale = options.distortionScale !== undefined ? options.distortionScale : 20.0;
|
|
55162
|
+
const side = options.side !== undefined ? options.side : FrontSide;
|
|
55163
|
+
const fog = options.fog !== undefined ? options.fog : false;
|
|
55164
|
+
|
|
55165
|
+
//
|
|
55166
|
+
|
|
55167
|
+
const mirrorPlane = new Plane();
|
|
55168
|
+
const normal = new Vector3();
|
|
55169
|
+
const mirrorWorldPosition = new Vector3();
|
|
55170
|
+
const cameraWorldPosition = new Vector3();
|
|
55171
|
+
const rotationMatrix = new Matrix4();
|
|
55172
|
+
const lookAtPosition = new Vector3(0, 0, -1);
|
|
55173
|
+
const clipPlane = new Vector4();
|
|
55174
|
+
const view = new Vector3();
|
|
55175
|
+
const target = new Vector3();
|
|
55176
|
+
const q = new Vector4();
|
|
55177
|
+
const textureMatrix = new Matrix4();
|
|
55178
|
+
const mirrorCamera = new PerspectiveCamera();
|
|
55179
|
+
const renderTarget = new WebGLRenderTarget(textureWidth, textureHeight);
|
|
55180
|
+
const mirrorShader = {
|
|
55181
|
+
uniforms: UniformsUtils.merge([UniformsLib.fog, UniformsLib.lights, {
|
|
55182
|
+
'normalSampler': {
|
|
55183
|
+
value: null
|
|
55184
|
+
},
|
|
55185
|
+
'mirrorSampler': {
|
|
55186
|
+
value: null
|
|
55187
|
+
},
|
|
55188
|
+
'alpha': {
|
|
55189
|
+
value: 1.0
|
|
55190
|
+
},
|
|
55191
|
+
'time': {
|
|
55192
|
+
value: 0.0
|
|
55193
|
+
},
|
|
55194
|
+
'size': {
|
|
55195
|
+
value: 1.0
|
|
55196
|
+
},
|
|
55197
|
+
'distortionScale': {
|
|
55198
|
+
value: 20.0
|
|
55199
|
+
},
|
|
55200
|
+
'textureMatrix': {
|
|
55201
|
+
value: new Matrix4()
|
|
55202
|
+
},
|
|
55203
|
+
'sunColor': {
|
|
55204
|
+
value: new Color(0x7F7F7F)
|
|
55205
|
+
},
|
|
55206
|
+
'sunDirection': {
|
|
55207
|
+
value: new Vector3(0.70707, 0.70707, 0)
|
|
55208
|
+
},
|
|
55209
|
+
'eye': {
|
|
55210
|
+
value: new Vector3()
|
|
55211
|
+
},
|
|
55212
|
+
'waterColor': {
|
|
55213
|
+
value: new Color(0x555555)
|
|
55214
|
+
}
|
|
55215
|
+
}]),
|
|
55216
|
+
vertexShader: /* glsl */`
|
|
55217
|
+
uniform mat4 textureMatrix;
|
|
55218
|
+
uniform float time;
|
|
55219
|
+
|
|
55220
|
+
varying vec4 mirrorCoord;
|
|
55221
|
+
varying vec4 worldPosition;
|
|
55222
|
+
|
|
55223
|
+
#include <common>
|
|
55224
|
+
#include <fog_pars_vertex>
|
|
55225
|
+
#include <shadowmap_pars_vertex>
|
|
55226
|
+
#include <logdepthbuf_pars_vertex>
|
|
55227
|
+
|
|
55228
|
+
void main() {
|
|
55229
|
+
mirrorCoord = modelMatrix * vec4( position, 1.0 );
|
|
55230
|
+
worldPosition = mirrorCoord.xyzw;
|
|
55231
|
+
mirrorCoord = textureMatrix * mirrorCoord;
|
|
55232
|
+
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
55233
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
55234
|
+
|
|
55235
|
+
#include <beginnormal_vertex>
|
|
55236
|
+
#include <defaultnormal_vertex>
|
|
55237
|
+
#include <logdepthbuf_vertex>
|
|
55238
|
+
#include <fog_vertex>
|
|
55239
|
+
#include <shadowmap_vertex>
|
|
55240
|
+
}`,
|
|
55241
|
+
fragmentShader: /* glsl */`
|
|
55242
|
+
uniform sampler2D mirrorSampler;
|
|
55243
|
+
uniform float alpha;
|
|
55244
|
+
uniform float time;
|
|
55245
|
+
uniform float size;
|
|
55246
|
+
uniform float distortionScale;
|
|
55247
|
+
uniform sampler2D normalSampler;
|
|
55248
|
+
uniform vec3 sunColor;
|
|
55249
|
+
uniform vec3 sunDirection;
|
|
55250
|
+
uniform vec3 eye;
|
|
55251
|
+
uniform vec3 waterColor;
|
|
55252
|
+
|
|
55253
|
+
varying vec4 mirrorCoord;
|
|
55254
|
+
varying vec4 worldPosition;
|
|
55255
|
+
|
|
55256
|
+
vec4 getNoise( vec2 uv ) {
|
|
55257
|
+
vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);
|
|
55258
|
+
vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );
|
|
55259
|
+
vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );
|
|
55260
|
+
vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );
|
|
55261
|
+
vec4 noise = texture2D( normalSampler, uv0 ) +
|
|
55262
|
+
texture2D( normalSampler, uv1 ) +
|
|
55263
|
+
texture2D( normalSampler, uv2 ) +
|
|
55264
|
+
texture2D( normalSampler, uv3 );
|
|
55265
|
+
return noise * 0.5 - 1.0;
|
|
55266
|
+
}
|
|
55267
|
+
|
|
55268
|
+
void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {
|
|
55269
|
+
vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );
|
|
55270
|
+
float direction = max( 0.0, dot( eyeDirection, reflection ) );
|
|
55271
|
+
specularColor += pow( direction, shiny ) * sunColor * spec;
|
|
55272
|
+
diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;
|
|
55273
|
+
}
|
|
55274
|
+
|
|
55275
|
+
#include <common>
|
|
55276
|
+
#include <packing>
|
|
55277
|
+
#include <bsdfs>
|
|
55278
|
+
#include <fog_pars_fragment>
|
|
55279
|
+
#include <logdepthbuf_pars_fragment>
|
|
55280
|
+
#include <lights_pars_begin>
|
|
55281
|
+
#include <shadowmap_pars_fragment>
|
|
55282
|
+
#include <shadowmask_pars_fragment>
|
|
55283
|
+
|
|
55284
|
+
void main() {
|
|
55285
|
+
|
|
55286
|
+
#include <logdepthbuf_fragment>
|
|
55287
|
+
vec4 noise = getNoise( worldPosition.xz * size );
|
|
55288
|
+
vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );
|
|
55289
|
+
|
|
55290
|
+
vec3 diffuseLight = vec3(0.0);
|
|
55291
|
+
vec3 specularLight = vec3(0.0);
|
|
55292
|
+
|
|
55293
|
+
vec3 worldToEye = eye-worldPosition.xyz;
|
|
55294
|
+
vec3 eyeDirection = normalize( worldToEye );
|
|
55295
|
+
sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );
|
|
55296
|
+
|
|
55297
|
+
float distance = length(worldToEye);
|
|
55298
|
+
|
|
55299
|
+
vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;
|
|
55300
|
+
vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );
|
|
55301
|
+
|
|
55302
|
+
float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );
|
|
55303
|
+
float rf0 = 0.3;
|
|
55304
|
+
float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );
|
|
55305
|
+
vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;
|
|
55306
|
+
vec3 albedo = mix( ( sunColor * diffuseLight * 0.3 + scatter ) * getShadowMask(), ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance);
|
|
55307
|
+
vec3 outgoingLight = albedo;
|
|
55308
|
+
gl_FragColor = vec4( outgoingLight, alpha );
|
|
55309
|
+
|
|
55310
|
+
#include <tonemapping_fragment>
|
|
55311
|
+
#include <fog_fragment>
|
|
55312
|
+
}`
|
|
55313
|
+
};
|
|
55314
|
+
const material = new ShaderMaterial({
|
|
55315
|
+
fragmentShader: mirrorShader.fragmentShader,
|
|
55316
|
+
vertexShader: mirrorShader.vertexShader,
|
|
55317
|
+
uniforms: UniformsUtils.clone(mirrorShader.uniforms),
|
|
55318
|
+
lights: true,
|
|
55319
|
+
side: side,
|
|
55320
|
+
fog: fog
|
|
55321
|
+
});
|
|
55322
|
+
material.uniforms['mirrorSampler'].value = renderTarget.texture;
|
|
55323
|
+
material.uniforms['textureMatrix'].value = textureMatrix;
|
|
55324
|
+
material.uniforms['alpha'].value = alpha;
|
|
55325
|
+
material.uniforms['time'].value = time;
|
|
55326
|
+
material.uniforms['normalSampler'].value = normalSampler;
|
|
55327
|
+
material.uniforms['sunColor'].value = sunColor;
|
|
55328
|
+
material.uniforms['waterColor'].value = waterColor;
|
|
55329
|
+
material.uniforms['sunDirection'].value = sunDirection;
|
|
55330
|
+
material.uniforms['distortionScale'].value = distortionScale;
|
|
55331
|
+
material.uniforms['eye'].value = eye;
|
|
55332
|
+
scope.material = material;
|
|
55333
|
+
scope.onBeforeRender = function (renderer, scene, camera) {
|
|
55334
|
+
mirrorWorldPosition.setFromMatrixPosition(scope.matrixWorld);
|
|
55335
|
+
cameraWorldPosition.setFromMatrixPosition(camera.matrixWorld);
|
|
55336
|
+
rotationMatrix.extractRotation(scope.matrixWorld);
|
|
55337
|
+
normal.set(0, 0, 1);
|
|
55338
|
+
normal.applyMatrix4(rotationMatrix);
|
|
55339
|
+
view.subVectors(mirrorWorldPosition, cameraWorldPosition);
|
|
55340
|
+
|
|
55341
|
+
// Avoid rendering when mirror is facing away
|
|
55342
|
+
|
|
55343
|
+
if (view.dot(normal) > 0) return;
|
|
55344
|
+
view.reflect(normal).negate();
|
|
55345
|
+
view.add(mirrorWorldPosition);
|
|
55346
|
+
rotationMatrix.extractRotation(camera.matrixWorld);
|
|
55347
|
+
lookAtPosition.set(0, 0, -1);
|
|
55348
|
+
lookAtPosition.applyMatrix4(rotationMatrix);
|
|
55349
|
+
lookAtPosition.add(cameraWorldPosition);
|
|
55350
|
+
target.subVectors(mirrorWorldPosition, lookAtPosition);
|
|
55351
|
+
target.reflect(normal).negate();
|
|
55352
|
+
target.add(mirrorWorldPosition);
|
|
55353
|
+
mirrorCamera.position.copy(view);
|
|
55354
|
+
mirrorCamera.up.set(0, 1, 0);
|
|
55355
|
+
mirrorCamera.up.applyMatrix4(rotationMatrix);
|
|
55356
|
+
mirrorCamera.up.reflect(normal);
|
|
55357
|
+
mirrorCamera.lookAt(target);
|
|
55358
|
+
mirrorCamera.far = camera.far; // Used in WebGLBackground
|
|
55359
|
+
|
|
55360
|
+
mirrorCamera.updateMatrixWorld();
|
|
55361
|
+
mirrorCamera.projectionMatrix.copy(camera.projectionMatrix);
|
|
55362
|
+
|
|
55363
|
+
// Update the texture matrix
|
|
55364
|
+
textureMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
|
|
55365
|
+
textureMatrix.multiply(mirrorCamera.projectionMatrix);
|
|
55366
|
+
textureMatrix.multiply(mirrorCamera.matrixWorldInverse);
|
|
55367
|
+
|
|
55368
|
+
// Now update projection matrix with new clip plane, implementing code from: http://www.terathon.com/code/oblique.html
|
|
55369
|
+
// Paper explaining this technique: http://www.terathon.com/lengyel/Lengyel-Oblique.pdf
|
|
55370
|
+
mirrorPlane.setFromNormalAndCoplanarPoint(normal, mirrorWorldPosition);
|
|
55371
|
+
mirrorPlane.applyMatrix4(mirrorCamera.matrixWorldInverse);
|
|
55372
|
+
clipPlane.set(mirrorPlane.normal.x, mirrorPlane.normal.y, mirrorPlane.normal.z, mirrorPlane.constant);
|
|
55373
|
+
const projectionMatrix = mirrorCamera.projectionMatrix;
|
|
55374
|
+
q.x = (Math.sign(clipPlane.x) + projectionMatrix.elements[8]) / projectionMatrix.elements[0];
|
|
55375
|
+
q.y = (Math.sign(clipPlane.y) + projectionMatrix.elements[9]) / projectionMatrix.elements[5];
|
|
55376
|
+
q.z = -1.0;
|
|
55377
|
+
q.w = (1.0 + projectionMatrix.elements[10]) / projectionMatrix.elements[14];
|
|
55378
|
+
|
|
55379
|
+
// Calculate the scaled plane vector
|
|
55380
|
+
clipPlane.multiplyScalar(2.0 / clipPlane.dot(q));
|
|
55381
|
+
|
|
55382
|
+
// Replacing the third row of the projection matrix
|
|
55383
|
+
projectionMatrix.elements[2] = clipPlane.x;
|
|
55384
|
+
projectionMatrix.elements[6] = clipPlane.y;
|
|
55385
|
+
projectionMatrix.elements[10] = clipPlane.z + 1.0 - clipBias;
|
|
55386
|
+
projectionMatrix.elements[14] = clipPlane.w;
|
|
55387
|
+
eye.setFromMatrixPosition(camera.matrixWorld);
|
|
55388
|
+
|
|
55389
|
+
// Render
|
|
55390
|
+
|
|
55391
|
+
const currentRenderTarget = renderer.getRenderTarget();
|
|
55392
|
+
const currentXrEnabled = renderer.xr.enabled;
|
|
55393
|
+
const currentShadowAutoUpdate = renderer.shadowMap.autoUpdate;
|
|
55394
|
+
scope.visible = false;
|
|
55395
|
+
renderer.xr.enabled = false; // Avoid camera modification and recursion
|
|
55396
|
+
renderer.shadowMap.autoUpdate = false; // Avoid re-computing shadows
|
|
55397
|
+
|
|
55398
|
+
renderer.setRenderTarget(renderTarget);
|
|
55399
|
+
renderer.state.buffers.depth.setMask(true); // make sure the depth buffer is writable so it can be properly cleared, see #18897
|
|
55400
|
+
|
|
55401
|
+
if (renderer.autoClear === false) renderer.clear();
|
|
55402
|
+
renderer.render(scene, mirrorCamera);
|
|
55403
|
+
scope.visible = true;
|
|
55404
|
+
renderer.xr.enabled = currentXrEnabled;
|
|
55405
|
+
renderer.shadowMap.autoUpdate = currentShadowAutoUpdate;
|
|
55406
|
+
renderer.setRenderTarget(currentRenderTarget);
|
|
55407
|
+
|
|
55408
|
+
// Restore viewport
|
|
55409
|
+
|
|
55410
|
+
const viewport = camera.viewport;
|
|
55411
|
+
if (viewport !== undefined) {
|
|
55412
|
+
renderer.state.viewport(viewport);
|
|
55413
|
+
}
|
|
55414
|
+
};
|
|
55415
|
+
}
|
|
55416
|
+
}
|
|
55417
|
+
|
|
55418
|
+
;// CONCATENATED MODULE: ./src/package/layers/water.js
|
|
55419
|
+
|
|
55420
|
+
|
|
55421
|
+
|
|
55422
|
+
|
|
55423
|
+
|
|
55424
|
+
|
|
55425
|
+
|
|
55426
|
+
|
|
55427
|
+
|
|
55428
|
+
|
|
55429
|
+
|
|
55430
|
+
const water_defaultOptions = {
|
|
55431
|
+
id: 'water',
|
|
55432
|
+
position: [103.353557, 23.362395],
|
|
55433
|
+
// 位置
|
|
55434
|
+
hight: 0,
|
|
55435
|
+
// 高度
|
|
55436
|
+
size: [4000, 4000],
|
|
55437
|
+
edit: false
|
|
55438
|
+
};
|
|
55439
|
+
|
|
55440
|
+
/**
|
|
55441
|
+
* 添加水面
|
|
55442
|
+
*/
|
|
55443
|
+
const addLayerWater = (option, layerId = '') => {
|
|
55444
|
+
return new Promise(resolve => {
|
|
55445
|
+
let {
|
|
55446
|
+
map
|
|
55447
|
+
} = package_map;
|
|
55448
|
+
let opt = Object.assign({}, water_defaultOptions, option);
|
|
55449
|
+
let camera = '';
|
|
55450
|
+
let scene = '';
|
|
55451
|
+
let group = '';
|
|
55452
|
+
let renderer = '';
|
|
55453
|
+
let customLayer = '';
|
|
55454
|
+
let waterP = '';
|
|
55455
|
+
// let waterTop = ''
|
|
55456
|
+
let waterBottom = '';
|
|
55457
|
+
if (hasLayer(opt.id)) {
|
|
55458
|
+
removeLayer(opt.id);
|
|
55459
|
+
}
|
|
55460
|
+
addWater();
|
|
55461
|
+
map.addLayer(customLayer, layerId);
|
|
55462
|
+
resolve(group);
|
|
55463
|
+
function addWater() {
|
|
55464
|
+
const modelOrigin = opt.position; // 中心点
|
|
55465
|
+
const modelAltitude = opt.height; // 高度
|
|
55466
|
+
const modelRotate = [Math.PI / 2, 0, 0];
|
|
55467
|
+
const modelAsMercatorCoordinate = mapbox_gl_default().MercatorCoordinate.fromLngLat(modelOrigin, modelAltitude);
|
|
55468
|
+
const modelTransform = {
|
|
55469
|
+
translateX: modelAsMercatorCoordinate.x,
|
|
55470
|
+
translateY: modelAsMercatorCoordinate.y,
|
|
55471
|
+
translateZ: modelAsMercatorCoordinate.z,
|
|
55472
|
+
rotateX: modelRotate[0],
|
|
55473
|
+
rotateY: modelRotate[1],
|
|
55474
|
+
rotateZ: modelRotate[2],
|
|
55475
|
+
scale: modelAsMercatorCoordinate.meterInMercatorCoordinateUnits()
|
|
55476
|
+
};
|
|
55477
|
+
|
|
55478
|
+
// 根据CustomLayerInterface为三维模型配置自定义层
|
|
55479
|
+
customLayer = {
|
|
55480
|
+
id: opt.id,
|
|
55481
|
+
type: 'custom',
|
|
55482
|
+
renderingMode: '3d',
|
|
55483
|
+
onAdd: (map, gl) => {
|
|
55484
|
+
const container = map.getCanvas();
|
|
55485
|
+
|
|
55486
|
+
// 摄像机
|
|
55487
|
+
camera = new PerspectiveCamera(50, container.clientWidth / container.clientHeight, 1, 5000);
|
|
55488
|
+
// camera = new THREE.Camera()
|
|
55489
|
+
// 场景
|
|
55490
|
+
scene = new Scene();
|
|
55491
|
+
group = new Group();
|
|
55492
|
+
group.name = 'water';
|
|
55493
|
+
scene.add(group);
|
|
55494
|
+
|
|
55495
|
+
// 水面
|
|
55496
|
+
let geometry = getWaterGeometry(modelAsMercatorCoordinate, opt);
|
|
55497
|
+
let bottomMat = new MeshBasicMaterial({
|
|
55498
|
+
color: opt.color || 0x7597dc,
|
|
55499
|
+
opacity: 0.7,
|
|
55500
|
+
transparent: true
|
|
55501
|
+
});
|
|
55502
|
+
waterBottom = new Mesh(geometry, bottomMat);
|
|
55503
|
+
|
|
55504
|
+
// 动态水面
|
|
55505
|
+
waterP = new Water(geometry, {
|
|
55506
|
+
textureWidth: 64,
|
|
55507
|
+
textureHeight: 64,
|
|
55508
|
+
waterNormals: new TextureLoader().load('/img/waternormals.jpg', texture => {
|
|
55509
|
+
texture.wrapS = texture.wrapT = RepeatWrapping;
|
|
55510
|
+
}),
|
|
55511
|
+
alpha: 0.3,
|
|
55512
|
+
side: DoubleSide,
|
|
55513
|
+
sunColor: 0xffffff,
|
|
55514
|
+
waterColor: 0xffffff,
|
|
55515
|
+
distortionScale: 3.7,
|
|
55516
|
+
fog: scene.fog !== undefined
|
|
55517
|
+
});
|
|
55518
|
+
waterP.material.transparent = true;
|
|
55519
|
+
scene.position.y = opt.hight;
|
|
55520
|
+
group.add(waterP);
|
|
55521
|
+
group.add(waterBottom);
|
|
55522
|
+
group.rotation.x = -Math.PI / 2;
|
|
55523
|
+
|
|
55524
|
+
// loadBackground()
|
|
55525
|
+
|
|
55526
|
+
// 渲染器
|
|
55527
|
+
renderer = new WebGLRenderer({
|
|
55528
|
+
canvas: map.getCanvas(),
|
|
55529
|
+
context: gl,
|
|
55530
|
+
logarithmicDepthBuffer: true,
|
|
55531
|
+
antialias: true
|
|
55532
|
+
});
|
|
55533
|
+
renderer.autoClear = false;
|
|
55534
|
+
renderer.physicallyCorrectLights = true;
|
|
55535
|
+
// renderer.outputEncoding = THREE.sRGBEncoding
|
|
55536
|
+
renderer.setSize(container.clientWidth, container.clientHeight);
|
|
55537
|
+
|
|
55538
|
+
// 曝光度
|
|
55539
|
+
// renderer.toneMapping = THREE.ACESFilmicToneMapping
|
|
55540
|
+
// renderer.toneMappingExposure = 1
|
|
55541
|
+
|
|
55542
|
+
// 缩放比例调整
|
|
55543
|
+
window.addEventListener('resize', () => {
|
|
55544
|
+
renderer.setSize(container.clientWidth, container.clientHeight);
|
|
55545
|
+
camera.aspect = container.clientWidth / container.clientHeight;
|
|
55546
|
+
camera.updateProjectionMatrix();
|
|
55547
|
+
});
|
|
55548
|
+
|
|
55549
|
+
// 天空
|
|
55550
|
+
// let sky = new Sky()
|
|
55551
|
+
// scene.add(sky)
|
|
55552
|
+
// sky.scale.setScalar(10000000)
|
|
55553
|
+
|
|
55554
|
+
// const gui = opt.edit ? new dat.GUI() : null
|
|
55555
|
+
// if (gui) {
|
|
55556
|
+
// gui.add(group.position, 'y').step(0.1).name('淹没高度(米)')
|
|
55557
|
+
// }
|
|
55558
|
+
|
|
55559
|
+
// RoomEnvironment
|
|
55560
|
+
// const pmremGenerator = new THREE.PMREMGenerator(renderer)
|
|
55561
|
+
// scene.environment = pmremGenerator.fromScene(new RoomEnvironment(), 0.001).texture
|
|
55562
|
+
},
|
|
55563
|
+
|
|
55564
|
+
render: (gl, matrix) => {
|
|
55565
|
+
const rotationX = new Matrix4().makeRotationAxis(new Vector3(1, 0, 0), modelTransform.rotateX);
|
|
55566
|
+
const rotationY = new Matrix4().makeRotationAxis(new Vector3(0, 1, 0), modelTransform.rotateY);
|
|
55567
|
+
const rotationZ = new Matrix4().makeRotationAxis(new Vector3(0, 0, 1), modelTransform.rotateZ);
|
|
55568
|
+
const m = new Matrix4().fromArray(matrix);
|
|
55569
|
+
const l = new Matrix4().makeTranslation(modelTransform.translateX, modelTransform.translateY, modelTransform.translateZ).scale(new Vector3(modelTransform.scale, -modelTransform.scale, modelTransform.scale)).multiply(rotationX).multiply(rotationY).multiply(rotationZ);
|
|
55570
|
+
camera.projectionMatrix.elements = matrix;
|
|
55571
|
+
camera.projectionMatrix = m.multiply(l);
|
|
55572
|
+
renderer.resetState();
|
|
55573
|
+
renderer.render(scene, camera);
|
|
55574
|
+
map.triggerRepaint();
|
|
55575
|
+
|
|
55576
|
+
// 水面动画
|
|
55577
|
+
waterP.material.uniforms['time'].value += 1.0 / 60.0;
|
|
55578
|
+
// if (waterTop.material.map) {
|
|
55579
|
+
// waterTop.material.map.offset.x += 0.0005
|
|
55580
|
+
// }
|
|
55581
|
+
}
|
|
55582
|
+
};
|
|
55583
|
+
|
|
55584
|
+
return customLayer;
|
|
55585
|
+
|
|
55586
|
+
//获取水面轮廓
|
|
55587
|
+
function getWaterGeometry(center, opt) {
|
|
55588
|
+
if (opt.data) {
|
|
55589
|
+
var points = [];
|
|
55590
|
+
opt.data.features.forEach(geo => {
|
|
55591
|
+
geo.geometry.coordinates.forEach(arr => {
|
|
55592
|
+
arr.forEach(item => {
|
|
55593
|
+
let mercatorCoordinate = mapbox_gl_default().MercatorCoordinate.fromLngLat(item, 0);
|
|
55594
|
+
let units = mercatorCoordinate.meterInMercatorCoordinateUnits();
|
|
55595
|
+
points.push(new Vector2((mercatorCoordinate.x - center.x) / units, -1 * (mercatorCoordinate.y - center.y) / units));
|
|
55596
|
+
});
|
|
55597
|
+
});
|
|
55598
|
+
});
|
|
55599
|
+
var shape = new Shape(points);
|
|
55600
|
+
return new ShapeGeometry(shape);
|
|
55601
|
+
} else {
|
|
55602
|
+
return new PlaneGeometry(opt.size[0], opt.size[1]);
|
|
55603
|
+
}
|
|
55604
|
+
}
|
|
55605
|
+
|
|
55606
|
+
// 环境贴图
|
|
55607
|
+
function loadBackground() {
|
|
55608
|
+
// let sky = new Sky()
|
|
55609
|
+
// let uniforms = sky.material.uniforms
|
|
55610
|
+
// uniforms['turbidity'].value = 10
|
|
55611
|
+
// uniforms['rayleigh'].value = 3
|
|
55612
|
+
// uniforms['mieCoefficient'].value = 0.005
|
|
55613
|
+
// uniforms['mieDirectionalG'].value = 0.7
|
|
55614
|
+
// scene.add(sky)
|
|
55615
|
+
|
|
55616
|
+
new RGBELoader().setPath('/model/hdr/').load('hdr1.hdr', function (texture) {
|
|
55617
|
+
texture.mapping = EquirectangularReflectionMapping;
|
|
55618
|
+
scene.background = texture;
|
|
55619
|
+
scene.environment = texture;
|
|
55620
|
+
});
|
|
55621
|
+
}
|
|
55622
|
+
}
|
|
55623
|
+
});
|
|
55624
|
+
};
|
|
55139
55625
|
// EXTERNAL MODULE: ./src/package/style/hoverHtml.css
|
|
55140
55626
|
var hoverHtml = __webpack_require__(544);
|
|
55141
55627
|
;// CONCATENATED MODULE: ./src/package/util/mapHoverHtml.js
|
|
@@ -58600,8 +59086,8 @@ var mapFullScreen_component = normalizeComponent(
|
|
|
58600
59086
|
)
|
|
58601
59087
|
|
|
58602
59088
|
/* harmony default export */ var mapFullScreen = (mapFullScreen_component.exports);
|
|
58603
|
-
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/index.vue?vue&type=template&id=
|
|
58604
|
-
var
|
|
59089
|
+
;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/index.vue?vue&type=template&id=48ba5a0f&scoped=true&
|
|
59090
|
+
var drawvue_type_template_id_48ba5a0f_scoped_true_render = function render() {
|
|
58605
59091
|
var _vm = this,
|
|
58606
59092
|
_c = _vm._self._c;
|
|
58607
59093
|
return _c('div', [_c('div', {
|
|
@@ -58722,7 +59208,7 @@ var drawvue_type_template_id_018cd082_scoped_true_render = function render() {
|
|
|
58722
59208
|
staticClass: "right-fixed"
|
|
58723
59209
|
}, [_vm._t("right-fixed")], 2)]);
|
|
58724
59210
|
};
|
|
58725
|
-
var
|
|
59211
|
+
var drawvue_type_template_id_48ba5a0f_scoped_true_staticRenderFns = [];
|
|
58726
59212
|
|
|
58727
59213
|
// EXTERNAL MODULE: ./node_modules/@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.js
|
|
58728
59214
|
var mapbox_gl_draw = __webpack_require__(1512);
|
|
@@ -58868,7 +59354,7 @@ var mapStyle_component = normalizeComponent(
|
|
|
58868
59354
|
showMapStyle: {
|
|
58869
59355
|
// 修改地图风格
|
|
58870
59356
|
type: Boolean,
|
|
58871
|
-
default:
|
|
59357
|
+
default: false
|
|
58872
59358
|
}
|
|
58873
59359
|
},
|
|
58874
59360
|
data() {
|
|
@@ -59031,9 +59517,9 @@ var mapStyle_component = normalizeComponent(
|
|
|
59031
59517
|
});
|
|
59032
59518
|
;// CONCATENATED MODULE: ./src/package/draw/index.vue?vue&type=script&lang=js&
|
|
59033
59519
|
/* harmony default export */ var package_drawvue_type_script_lang_js_ = (drawvue_type_script_lang_js_);
|
|
59034
|
-
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/index.vue?vue&type=style&index=0&id=
|
|
59035
|
-
var
|
|
59036
|
-
;// CONCATENATED MODULE: ./src/package/draw/index.vue?vue&type=style&index=0&id=
|
|
59520
|
+
// EXTERNAL MODULE: ./node_modules/vue-style-loader/index.js??clonedRuleSet-64.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[4]!./node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/package/draw/index.vue?vue&type=style&index=0&id=48ba5a0f&prod&lang=scss&scoped=true&
|
|
59521
|
+
var drawvue_type_style_index_0_id_48ba5a0f_prod_lang_scss_scoped_true_ = __webpack_require__(3901);
|
|
59522
|
+
;// CONCATENATED MODULE: ./src/package/draw/index.vue?vue&type=style&index=0&id=48ba5a0f&prod&lang=scss&scoped=true&
|
|
59037
59523
|
|
|
59038
59524
|
;// CONCATENATED MODULE: ./src/package/draw/index.vue
|
|
59039
59525
|
|
|
@@ -59046,11 +59532,11 @@ var drawvue_type_style_index_0_id_018cd082_prod_lang_scss_scoped_true_ = __webpa
|
|
|
59046
59532
|
|
|
59047
59533
|
var draw_component = normalizeComponent(
|
|
59048
59534
|
package_drawvue_type_script_lang_js_,
|
|
59049
|
-
|
|
59050
|
-
|
|
59535
|
+
drawvue_type_template_id_48ba5a0f_scoped_true_render,
|
|
59536
|
+
drawvue_type_template_id_48ba5a0f_scoped_true_staticRenderFns,
|
|
59051
59537
|
false,
|
|
59052
59538
|
null,
|
|
59053
|
-
"
|
|
59539
|
+
"48ba5a0f",
|
|
59054
59540
|
null
|
|
59055
59541
|
|
|
59056
59542
|
)
|
|
@@ -59785,6 +60271,7 @@ var polygon_component = normalizeComponent(
|
|
|
59785
60271
|
|
|
59786
60272
|
|
|
59787
60273
|
|
|
60274
|
+
|
|
59788
60275
|
// 图层操作
|
|
59789
60276
|
const mapLayers = {
|
|
59790
60277
|
showLayerText: showLayerText,
|
|
@@ -59812,7 +60299,8 @@ const mapDraw = {
|
|
|
59812
60299
|
addLayerPolygon: addLayerPolygon,
|
|
59813
60300
|
addLayerCircle: addLayerCircle,
|
|
59814
60301
|
addCircleAnimate: addCircleAnimate,
|
|
59815
|
-
addLayerModel: addLayerModel
|
|
60302
|
+
addLayerModel: addLayerModel,
|
|
60303
|
+
addLayerWater: addLayerWater
|
|
59816
60304
|
};
|
|
59817
60305
|
|
|
59818
60306
|
// 地图工具
|