修改三维沙盘天气
@ -1,20 +1,21 @@
|
|||||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||||
|
|
||||||
export function WeatherManager(){
|
export function WeatherManager(scene){
|
||||||
let scope = this;
|
let scope = this;
|
||||||
let spriteSwitch = false;
|
let spriteSwitch = false;
|
||||||
let spriteSpeed = 0;
|
let spriteSpeed = 0;
|
||||||
let spriteRota = 0;
|
let spriteRota = 0;
|
||||||
|
|
||||||
let sunnyTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/sunny.jpg" );
|
let zsTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/zs.jpg" );
|
||||||
let eveningTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/evening.jpg" );
|
let zwTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/zw.jpg" );
|
||||||
let rainTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/rain.png" );
|
let bwTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/bw.jpg" );
|
||||||
|
let ywTexture = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/background/yw.jpg" );
|
||||||
|
|
||||||
let rainPoint = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/sprite/rainsprite.png" );
|
let rainPoint = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/sprite/rainsprite.png" );
|
||||||
let snowPoint = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/sprite/snowsprite.png" );
|
let snowPoint = new THREE.TextureLoader().load(JL3D_LOCAL_STATIC+"/sprite/snowsprite.png" );
|
||||||
|
|
||||||
let geometry = new THREE.SphereGeometry( 3000, 32, 32 );
|
let geometry = new THREE.SphereGeometry( 3000, 32, 32 );
|
||||||
let material = new THREE.MeshBasicMaterial( {map:sunnyTexture,side:THREE.DoubleSide} );
|
let material = new THREE.MeshBasicMaterial( {map:zsTexture,side:THREE.DoubleSide} );
|
||||||
scope.skybox = new THREE.Mesh( geometry, material);
|
scope.skybox = new THREE.Mesh( geometry, material);
|
||||||
scope.skybox.position.set( 0, 0, 0 );
|
scope.skybox.position.set( 0, 0, 0 );
|
||||||
|
|
||||||
@ -44,31 +45,80 @@ export function WeatherManager(){
|
|||||||
|
|
||||||
|
|
||||||
this.changeweather = function(type){
|
this.changeweather = function(type){
|
||||||
if(type == "sunny"){
|
scene.fog = null;
|
||||||
scope.skybox.material.map = sunnyTexture;
|
switch (type) {
|
||||||
|
case 'zaoshang':
|
||||||
|
scope.skybox.material.map = zsTexture;
|
||||||
|
break;
|
||||||
|
case 'zhongwu':
|
||||||
|
scope.skybox.material.map = zwTexture;
|
||||||
|
break;
|
||||||
|
case 'bangwan':
|
||||||
|
scope.skybox.material.map = bwTexture;
|
||||||
|
break;
|
||||||
|
case 'yewan':
|
||||||
|
scope.skybox.material.map = ywTexture;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case 'sunny':
|
||||||
spriteSwitch = false;
|
spriteSwitch = false;
|
||||||
}
|
break;
|
||||||
if(type == "evening"){
|
case 'yt':
|
||||||
scope.skybox.material.map = eveningTexture;
|
|
||||||
spriteSwitch = false;
|
spriteSwitch = false;
|
||||||
}
|
scene.fog = new THREE.Fog(0xE0E0E0, 1000, 3500);
|
||||||
if(type == "rain"){
|
break;
|
||||||
scope.skybox.material.map = rainTexture;
|
case 'rain':
|
||||||
scope.instance.material.map = rainPoint;
|
scope.instance.material.map = rainPoint;
|
||||||
spriteSwitch = true;
|
spriteSwitch = true;
|
||||||
spriteSpeed = 0.01;
|
spriteSpeed = 0.01;
|
||||||
spriteRota = 0;
|
spriteRota = 0;
|
||||||
scope.instance.material.size = 0.5;
|
scope.instance.material.size = 0.5;
|
||||||
}
|
scene.fog = new THREE.Fog(0xE0E0E0, 1000, 3500);
|
||||||
if(type == "snow"){
|
break;
|
||||||
scope.skybox.material.map = rainTexture;
|
case 'snow':
|
||||||
scope.instance.material.map = snowPoint;
|
scope.instance.material.map = snowPoint;
|
||||||
spriteSwitch = true;
|
spriteSwitch = true;
|
||||||
spriteSpeed = 0.0001;
|
spriteSpeed = 0.0001;
|
||||||
spriteRota = 0.002;
|
spriteRota = 0.002;
|
||||||
scope.instance.material.size = 1.5;
|
scope.instance.material.size = 1.5;
|
||||||
|
scene.fog = new THREE.Fog(0xE0E0E0, 1000, 3500);
|
||||||
|
break;
|
||||||
|
case 'dy':
|
||||||
|
spriteSwitch = false;
|
||||||
|
scene.fog = new THREE.Fog(0xE0E0E0, 500, 3000);
|
||||||
|
break;
|
||||||
|
case 'sand':
|
||||||
|
scene.fog = new THREE.Fog(0x977C00, 1, 1000);
|
||||||
|
break;
|
||||||
|
case 'wm':
|
||||||
|
spriteSwitch = false;
|
||||||
|
scene.fog = new THREE.Fog(0x9D9D9D, 1, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// if(type == "sunny"){
|
||||||
|
// scope.skybox.material.map = sunnyTexture;
|
||||||
|
// spriteSwitch = false;
|
||||||
|
// }
|
||||||
|
// if(type == "evening"){
|
||||||
|
// scope.skybox.material.map = eveningTexture;
|
||||||
|
// spriteSwitch = false;
|
||||||
|
// }
|
||||||
|
// if(type == "rain"){
|
||||||
|
// scope.skybox.material.map = rainTexture;
|
||||||
|
|
||||||
|
// }
|
||||||
|
// if(type == "snow"){
|
||||||
|
// scope.skybox.material.map = rainTexture;
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
if(spriteSwitch == true){
|
if(spriteSwitch == true){
|
||||||
if(scope.skybox.children.length == 0){
|
if(scope.skybox.children.length == 0){
|
||||||
scope.skybox.add(scope.instance);
|
scope.skybox.add(scope.instance);
|
||||||
|
@ -57,7 +57,7 @@ export function JLmap3d(dom, data,skinCode,storemod,routegroup,project) {
|
|||||||
scene.add(scenesimulation);
|
scene.add(scenesimulation);
|
||||||
scene.add(scenestation);
|
scene.add(scenestation);
|
||||||
|
|
||||||
let weatherManager = new WeatherManager();
|
let weatherManager = new WeatherManager(scene);
|
||||||
scene.add(weatherManager.skybox);
|
scene.add(weatherManager.skybox);
|
||||||
// scene.add(weatherManager.instance);
|
// scene.add(weatherManager.instance);
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ export default {
|
|||||||
pic:JL3D_LOCAL_STATIC+'/sprite/sunny.png',
|
pic:JL3D_LOCAL_STATIC+'/sprite/sunny.png',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type:'evening',
|
type:'yt',
|
||||||
pic:JL3D_LOCAL_STATIC+'/sprite/evening.png',
|
pic:JL3D_LOCAL_STATIC+'/sprite/evening.png',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -69,6 +69,18 @@ export default {
|
|||||||
{
|
{
|
||||||
type:'snow',
|
type:'snow',
|
||||||
pic:JL3D_LOCAL_STATIC+'/sprite/snow.png',
|
pic:JL3D_LOCAL_STATIC+'/sprite/snow.png',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type:'dy',
|
||||||
|
pic:JL3D_LOCAL_STATIC+'/sprite/dy.png',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type:'sand',
|
||||||
|
pic:JL3D_LOCAL_STATIC+'/sprite/sand.png',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type:'wm',
|
||||||
|
pic:JL3D_LOCAL_STATIC+'/sprite/wm.png',
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
BIN
static/background/bw.jpg
Normal file
After Width: | Height: | Size: 173 KiB |
Before Width: | Height: | Size: 1.0 MiB |
Before Width: | Height: | Size: 1.9 MiB |
Before Width: | Height: | Size: 1002 KiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 2.4 MiB |
BIN
static/background/yw.jpg
Normal file
After Width: | Height: | Size: 142 KiB |
BIN
static/background/zs.jpg
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
static/background/zw.jpg
Normal file
After Width: | Height: | Size: 168 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |