+
@@ -54,6 +54,7 @@
+ 按集中站生成并保存
保存
返回
@@ -87,13 +88,30 @@ export default {
field: '',
cardMode: 'generate',
index: '',
- isPreview: true
+ isPreview: true,
+ loading: false
};
},
computed: {
...mapGetters('map', [
'sectionList',
'stationList',
+ 'signalList',
+ 'switchList',
+ 'stationStandList',
+ 'automaticRouteButtonList',
+ 'axleCounterResetButtonList',
+ 'cycleButtonList',
+ 'directionRodList',
+ 'indicatorLightList',
+ 'lineList',
+ 'outerFrameList',
+ 'psdList',
+ 'responderList',
+ 'tbStrategyList',
+ 'tempSpeedLimitList',
+ 'textList',
+ 'totalGuideLockButtonVOList',
'localStationConfig',
'seclectDeviceList'
]),
@@ -214,6 +232,43 @@ export default {
this.addModel = { stationCodeList: [], elementList: [] };
this.index = '';
this.cardMode = 'generate';
+ },
+ generateData() {
+ this.loading = true;
+ this.tableData = [];
+ this.stationList.forEach(item => {
+ if (item.centralized) {
+ this.tableData.push({stationCodeList: [...item.chargeStationCodeList, item.code], elementList: [...item.chargeStationCodeList, item.code]});
+ }
+ });
+
+ [...this.sectionList, ...this.signalList, ...this.stationStandList, ...this.switchList, ...this.automaticRouteButtonList,
+ ...this.axleCounterResetButtonList, ...this.cycleButtonList, ...this.indicatorLightList, ...this.lineList, ...this.outerFrameList,
+ ...this.responderList, ...this.tbStrategyList, ...this.tempSpeedLimitList, ...this.textList, ...this.totalGuideLockButtonVOList].forEach(item => {
+ const target = this.tableData.find(elem => elem.stationCodeList.includes(item.stationCode));
+ target && target.elementList.push(item.code);
+ });
+ [...this.directionRodList].forEach(item => {
+ const target = this.tableData.find(elem => elem.stationCodeList.includes(item.deviceStationCode));
+ target && target.elementList.push(item.code);
+ });
+ this.psdList.forEach(item => {
+ const stand = this.$store.getters['map/getDeviceByCode'](item.standCode);
+ const target = this.tableData.find(elem => elem.stationCodeList.includes(stand.stationCode));
+ target && target.elementList.push(item.code);
+ });
+ const map = this.$store.state.map.map;
+ const param = {
+ displayList: this.tableData,
+ mapId: this.$route.params.mapId
+ };
+ saveMap(Object.assign(map, param)).then(response => {
+ this.loading = false;
+ this.$message.success('保存现地配置成功');
+ }).catch(() => {
+ this.loading = false;
+ this.$messageBox('保存现地配置失败');
+ });
}
}
};
From 663e874e06b69e8adc070aafdf4b0aa96513c0b9 Mon Sep 17 00:00:00 2001
From: sunzhenyu
Date: Thu, 15 Jul 2021 10:56:04 +0800
Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=89=E7=BB=B4?=
=?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=BC=96=E8=BE=91=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/jlmap3d/edit/jlmap3dedit.js | 34 +--
src/jlmap3d/lesson3d/lesson3dplayer.js | 20 +-
.../lesson3d/manager/assetmodelmanager.js | 89 +++++--
.../lesson3d/manager/controlmanager.js | 16 +-
src/jlmap3d/lesson3d/utils/fire.js | 236 ++++++++++++++++++
.../assetmodelmanager/assetmodelmanager.js | 154 ++++++++----
src/jlmap3d/lesson3dedit/lesson3deditor.js | 40 ++-
.../lesson3dedit/component/lessonprogress.vue | 2 +-
.../lesson3dedit/component/lessonsetup.vue | 24 +-
.../lesson3dedit/component/property.vue | 8 +-
.../jlmap3d/lesson3dedit/lesson3dedit.vue | 5 +
11 files changed, 504 insertions(+), 124 deletions(-)
create mode 100644 src/jlmap3d/lesson3d/utils/fire.js
diff --git a/src/jlmap3d/edit/jlmap3dedit.js b/src/jlmap3d/edit/jlmap3dedit.js
index 801178367..ff089cdf1 100644
--- a/src/jlmap3d/edit/jlmap3dedit.js
+++ b/src/jlmap3d/edit/jlmap3dedit.js
@@ -188,7 +188,7 @@ export function JLmap3dEdit(dom, data, mapid) {
// let exportmodels = scope.mapdata.stationstandlist.group;
let exportSectionModel = scope.mapdata.sectionlist.sectiongroup;
objDownload("section",exporter.parse( exportSectionModel ));
-
+
if(scope.mapdata.stationstandlist){
let exportStationModel = scope.mapdata.stationstandlist.group;
objDownload("station",exporter.parse( exportStationModel ));
@@ -323,6 +323,9 @@ export function JLmap3dEdit(dom, data, mapid) {
let stationStopGroup = new THREE.Group();
scope.scene.add(stationStopGroup);
this.testrail = function(){
+ scope.scene.remove(stationStopGroup);
+ stationStopGroup = new THREE.Group();
+ scope.scene.add(stationStopGroup);
if(stationStopGroup.children.length == 0){
for(let k in scope.mapdata.sectionlist.sections.datalist){
if(scope.mapdata.sectionlist.sections.datalist[k].standTrack == true){
@@ -338,27 +341,28 @@ export function JLmap3dEdit(dom, data, mapid) {
plane2.rotation.y = Math.PI/2;
let leftpos = scope.mapdata.sectionlist.sections.datalist[k].leftStopPercent*(scope.mapdata.sectionlist.sections.datalist[k].railpoint[2].x -scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x)+scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x;
let rightpos = scope.mapdata.sectionlist.sections.datalist[k].rightStopPercent*(scope.mapdata.sectionlist.sections.datalist[k].railpoint[2].x -scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x)+scope.mapdata.sectionlist.sections.datalist[k].railpoint[0].x;
- console.log("==========");
- console.log(scope.mapdata.sectionlist.sections.datalist[k].leftStopPercent);
- console.log(scope.mapdata.sectionlist.sections.datalist[k].rightStopPercent);
+ // console.log("==========");
+ // console.log(scope.mapdata.sectionlist.sections.datalist[k].leftStopPercent);
+ // console.log(scope.mapdata.sectionlist.sections.datalist[k].rightStopPercent);
plane1.position.set(leftpos,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
plane2.position.set(rightpos,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].y,scope.mapdata.sectionlist.sections.datalist[k].railpoint[1].z);
stationStopGroup.add(plane1);
stationStopGroup.add(plane2);
}
}
- }else{
- for(let i=0,leni = stationStopGroup.children.length;i {
+ let assetModelManager = new AssetModelManager(scope,scene,controlManager);
+ assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
+ scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
animateManager.initAnimation(assetModelManager);
controlManager.init(animateManager.actions,assetModelManager);
@@ -82,7 +89,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
this.changeIndex = function(nowIndex){
lessonIndex = nowIndex;
-
+ scope.nowSceneType = lessonData.lessonProgress[nowIndex].progressScene;
if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
controlManager.initControlMode(lessonIndex);
@@ -108,10 +115,12 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
}
controlManager.initRoleMode(roleMode);
- if(lessonData.lessonProgress[lessonIndex].action.length>0){
+ console.log(assetModelManager);
+ // if(lessonData.lessonProgress[lessonIndex].action.length>0){
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,roleMode,assetModelManager.lessonTriggerList);
- }
+ // }
};
+
//循环渲染函数
function animate() {
@@ -124,6 +133,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
if(controlManager.controlMode == "non"){
controlManager.updateOrbitControl();
}
+ fire.update();
animateManager.updateAnimation();
requestAnimationFrame(animate);
diff --git a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js
index 0ed2b6169..1bada05c5 100644
--- a/src/jlmap3d/lesson3d/manager/assetmodelmanager.js
+++ b/src/jlmap3d/lesson3d/manager/assetmodelmanager.js
@@ -1,7 +1,7 @@
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
-export function AssetModelManager(scene) {
+export function AssetModelManager(editor,scene) {
let scope = this;
@@ -9,7 +9,18 @@ export function AssetModelManager(scene) {
this.otherModel = new THREE.Group();
- scene.add(this.otherModel);
+ let groupList = [];
+ groupList["standstation"] = new THREE.Group();
+ groupList["stopstation"] = new THREE.Group();
+ groupList["device"] = new THREE.Group();
+ groupList["xl"] = new THREE.Group();
+ groupList["dc"] = new THREE.Group();
+
+ let geometryDevice = new THREE.PlaneGeometry( 100, 100, 32 );
+ let materialDevice = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
+ let planeDevice = new THREE.Mesh( geometryDevice, materialDevice );
+ planeDevice.rotation.x = -Math.PI/2;
+ groupList["device"].add(planeDevice);
this.loadAsset = [];
@@ -22,6 +33,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['FTDH'] = {
@@ -32,6 +44,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['IN'] = {
@@ -42,6 +55,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['OUT'] = {
@@ -52,6 +66,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['PBMDH'] = {
@@ -62,16 +77,26 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
//场景中可触发事件模型
this.lessonTriggerList = [];
+ scope.lessonTriggerList["standstation"] = [];
+ scope.lessonTriggerList["stopstation"] = [];
+ scope.lessonTriggerList["device"] = [];
+ scope.lessonTriggerList["xl"] = [];
+ scope.lessonTriggerList["dc"] = [];
//加载课程资源
- this.lessonAssetsLoader = function(assetList,modelList){
+ this.lessonAssetsLoader = function(lessonData){
let initlist = [];
+ this.otherModel = groupList[lessonData.lessonProgress[0].progressScene];
+ scene.add(this.otherModel);
+ let assetList = lessonData.assetList;
+
if(assetList){
for(let i = 0;i {
initTriggerList();
+ let modelList = lessonData.modelList;
for(let i=0;i {
//console.log(error);
@@ -126,8 +157,8 @@ export function AssetModelManager(scene) {
}
- this.addActionModel = function(actionModel){
- scope.otherModel.add(actionModel);
+ this.addActionModel = function(actionModel,nowSceneType){
+ groupList[nowSceneType].add(actionModel);
}
//
@@ -144,18 +175,18 @@ export function AssetModelManager(scene) {
scope.staticAsset['station'].mesh.getObjectByName("FTAN").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
scope.staticAsset['station'].mesh.getObjectByName("FTAN").actionName = "FTDH";
- scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
+ scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
scope.staticAsset['station'].mesh.getObjectByName("FTKG").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
scope.staticAsset['station'].mesh.getObjectByName("FTKG").actionName = "FTDH";
- scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
+ scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default";
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关";
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").actionName = "PBMDH";
- scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
+ scope.lessonTriggerList["standstation"].push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
}
@@ -170,9 +201,12 @@ export function AssetModelManager(scene) {
newModelTrigger.showType = "loadModel";
newModelTrigger.label = assetData.packageName;
newModelTrigger.position.copy(pos);
- scope.otherModel.add(newModelTrigger);
- scope.lessonTriggerList.push(newModelTrigger);
- updateTriggerList(scope.lessonTriggerList);
+ newModelTrigger.sceneType = nowSceneType;
+
+ scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
+ groupList[nowSceneType].add(newModelTrigger);
+
+ updateTriggerList(scope.lessonTriggerList[nowSceneType]);
}else{
scope.loadAsset[assetData.id] = {
modelId:assetData.id,
@@ -182,6 +216,7 @@ export function AssetModelManager(scene) {
assetType:'loadModel',
isUse:true,
resourceType:"三维课程",
+ sceneType:nowSceneType,
};
fbxpromise(scope.loadAsset[assetData.id]).then(function(object){
@@ -191,10 +226,12 @@ export function AssetModelManager(scene) {
newModelTrigger.modelId = assetData.id;
newModelTrigger.label = assetData.packageName;
newModelTrigger.position.copy(pos);
- scope.otherModel.add(newModelTrigger);
- scope.lessonTriggerList.push(newModelTrigger);
+ newModelTrigger.sceneType = nowSceneType;
- updateTriggerList(scope.lessonTriggerList);
+ scope.lessonTriggerList[nowSceneType].push(newModelTrigger);
+ groupList[nowSceneType].add(newModelTrigger);
+
+ updateTriggerList(scope.lessonTriggerList[nowSceneType]);
// resolve("loadednew");
});
}
@@ -207,14 +244,22 @@ export function AssetModelManager(scene) {
var loader = new THREE.FBXLoader();
if(asset.assetType == "static"){
loader.load( asset.url, function ( object ) {
+ if(asset.sceneType){
+ object.sceneType = asset.sceneType;
+ }
object.name = asset.modelId;
asset.mesh = object;
- scene.add(object);
+ groupList[asset.sceneType].add(object);
+ // scene.add(object);
resolve();
} );
}else{
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
+ if(asset.sceneType){
+ object.sceneType = asset.sceneType;
+ }
asset.mesh = object;
+
if(asset.assetType == "default"){
// scene.add(object);
}else if(asset.assetType == 'loadModel'){
diff --git a/src/jlmap3d/lesson3d/manager/controlmanager.js b/src/jlmap3d/lesson3d/manager/controlmanager.js
index a80bfe298..51aed9510 100644
--- a/src/jlmap3d/lesson3d/manager/controlmanager.js
+++ b/src/jlmap3d/lesson3d/manager/controlmanager.js
@@ -105,7 +105,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
this.initRoleMode = function(rMode,role){
roleMode = rMode;
nowRole = role;
- console.log(roleMode);
+ // console.log(roleMode);
};
const worldOctree = new Octree();
@@ -158,8 +158,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
eventBoxs[i].setFromObject(eventBoxs[i].mesh);
// console.log(eventBoxs[i]);
if(hitBox.intersectsBox(eventBoxs[i])){
- console.log("相交");
- console.log(eventBoxs[i].action);
+ // console.log("相交");
+ // console.log(eventBoxs[i].action);
if(eventBoxs[i].action.actionMode == "remove"){
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
@@ -170,7 +170,7 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
}
- console.log("slice");
+ // console.log("slice");
eventBoxs.splice(i,1);
i--;
}
@@ -229,9 +229,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
document.addEventListener( 'mousedown', (event) => {
fpsMouseStatus = true;
// document.body.requestPointerLock();
- console.log("mousedown-----------------------");
- console.log(raycasterBoxs);
- console.log(roleMode);
+ // console.log("mousedown-----------------------");
+ // console.log(raycasterBoxs);
+ // console.log(roleMode);
if(raycasterBoxs.length>0 && roleMode){
var mouse = new THREE.Vector2();
@@ -504,6 +504,8 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
eventTrigger = lessonTriggerList;
scope.eventHitMode = true;
}
+ console.log(actions);
+ console.log(rMode);
nowActions = actions;
// let newEventBoxs = [];
// eventBoxs = newEventBoxs;
diff --git a/src/jlmap3d/lesson3d/utils/fire.js b/src/jlmap3d/lesson3d/utils/fire.js
new file mode 100644
index 000000000..d8a244c56
--- /dev/null
+++ b/src/jlmap3d/lesson3d/utils/fire.js
@@ -0,0 +1,236 @@
+export function Fire() {
+ let scope = this;
+ this.points = {};
+ var last_time_activate = Date.now();
+
+
+ this.init = function(scene){
+ scope.points = new Points();
+ scope.points.init();
+ scene.add(scope.points.obj);
+ }
+
+ this.update = function(){
+ var now = Date.now();
+ scope.points.update();
+ if (now - last_time_activate > 10) {
+
+ scope.points.activateMover();
+ last_time_activate = Date.now();
+ }
+ }
+
+ var Mover = function() {
+ this.position = new THREE.Vector3();
+ this.velocity = new THREE.Vector3();
+ this.acceleration = new THREE.Vector3();
+ this.anchor = new THREE.Vector3();
+ this.mass = 1;
+ this.r = 0;
+ this.g = 0;
+ this.b = 0;
+ this.a = 1;
+ this.time = 0;
+ this.is_active = false;
+ };
+
+ Mover.prototype = {
+ init: function(vector) {
+ this.position = vector.clone();
+ this.velocity = vector.clone();
+ this.anchor = vector.clone();
+ this.acceleration.set(0, 0, 0);
+ this.a = 1;
+ this.time = 0;
+ },
+ updatePosition: function() {
+ this.position.copy(this.velocity);
+ },
+ updateVelocity: function() {
+ this.acceleration.divideScalar(this.mass);
+ this.velocity.add(this.acceleration);
+ // if (this.velocity.distanceTo(this.position) >= 1) {
+ // this.direct(this.velocity);
+ // }
+ },
+ applyForce: function(vector) {
+ this.acceleration.add(vector);
+ },
+ applyFriction: function() {
+ var friction = friction(this.acceleration, 0.1);
+ this.applyForce(friction);
+ },
+ applyDragForce: function(value) {
+ var drag = drag(this.acceleration, value);
+ this.applyForce(drag);
+ },
+ hook: function(rest_length, k) {
+ var force = hook(this.velocity, this.anchor, rest_length, k);
+ this.applyForce(force);
+ },
+ activate: function() {
+ this.is_active = true;
+ },
+ inactivate: function() {
+ this.is_active = false;
+ }
+ };
+
+
+ var Points = function() {
+ this.movers_num = 3000;
+ this.movers = [];
+ this.geometry = null;
+ this.material = null;
+ this.obj = null;
+ this.texture = null;
+ this.antigravity = new THREE.Vector3(0, 0.1, 0);
+};
+
+Points.prototype = {
+ init: function() {
+ this.createTexture();
+ this.geometry = new THREE.Geometry();
+ this.material = new THREE.PointsMaterial({
+ color: 0xff6633,
+ size: 3,
+ transparent: true,
+ opacity: 0.5,
+ map: this.texture,
+ // depthTest: false,
+ depthWrite:false,
+ alphaTest: 0.1,
+ blending: THREE.AdditiveBlending,
+ });
+ for (var i = 0; i < this.movers_num; i++) {
+ var mover = new Mover();
+
+ mover.init(new THREE.Vector3((10*Math.random()-49), 1.6, (10*Math.random()+11)));
+ this.movers.push(mover);
+ this.geometry.vertices.push(mover.position);
+ }
+ this.obj = new THREE.Points(this.geometry, this.material);
+ this.obj.renderOrder = 1;
+ },
+ update: function() {
+ var points_vertices = [];
+
+ for (var i = 0; i < this.movers.length; i++) {
+ var mover = this.movers[i];
+ if (mover.is_active) {
+ mover.applyForce(this.antigravity);
+ mover.updateVelocity();
+ mover.updatePosition();
+ if (mover.position.y > 8) {
+ mover.inactivate();
+ }
+ }
+ points_vertices.push(mover.position);
+ }
+ this.obj.geometry.vertices = points_vertices;
+ this.obj.geometry.verticesNeedUpdate = true;
+ },
+ activateMover: function() {
+ var count = 0;
+ for (var i = 0; i < this.movers.length; i++) {
+ var mover = this.movers[i];
+
+ if (mover.is_active) continue;
+ var rad1 = getRadian(Math.log(getRandomInt(200, 256)) / Math.log(256) * 270);
+ var rad2 = getRadian(getRandomInt(0, 360));
+ var force = getSpherical(rad1, rad2, 1);
+ mover.activate();
+ mover.init(new THREE.Vector3((10*Math.random()-49), 5, (10*Math.random()+11)));
+ mover.applyForce(force);
+
+ count++;
+ if (count >= 10) break;
+ }
+ },
+ createTexture: function() {
+ var canvas = document.createElement('canvas');
+ var ctx = canvas.getContext('2d');
+ var grad = null;
+
+ canvas.width = 200;
+ canvas.height = 200;
+ grad = ctx.createRadialGradient(100, 100, 20, 100, 100, 100);
+ grad.addColorStop(0.2, 'rgba(255, 255, 255, 1)');
+ grad.addColorStop(0.5, 'rgba(255, 255, 255, 0.3)');
+ grad.addColorStop(1.0, 'rgba(255, 255, 255, 0)');
+ ctx.fillStyle = grad;
+ ctx.arc(100, 100, 100, 0, Math.PI / 180, true);
+ ctx.fill();
+ this.texture = new THREE.Texture(canvas);
+ this.texture.minFilter = THREE.NearestFilter;
+ this.texture.needsUpdate = true;
+ }
+ };
+
+ var HemiLight = function() {
+ this.rad1 = getRadian(60);
+ this.rad2 = getRadian(30);
+ this.range = 1000;
+ this.hex1 = 0xffffff;
+ this.hex2 = 0x333333;
+ this.intensity = 1;
+ this.obj;
+ };
+
+ HemiLight.prototype = {
+ init: function(hex1, hex2) {
+ if (hex1) this.hex1 = hex1;
+ if (hex2) this.hex2 = hex2;
+ this.obj = new THREE.HemisphereLight(this.hex1, this.hex2, this.intensity);
+ this.setPosition();
+ },
+ setPosition: function() {
+ var points = getSpherical(this.rad1, this.rad2, this.range);
+ this.obj.position.copy(points);
+ }
+ };
+
+ function getRandomInt(min, max) {
+ return Math.floor(Math.random() * (max - min)) + min;
+ }
+ function getDegree(radian) {
+ return radian / Math.PI * 180;
+ }
+ function getRadian(degrees) {
+ return degrees * Math.PI / 180;
+ }
+ function getSpherical(rad1, rad2, r) {
+ var x = Math.cos(rad1) * Math.cos(rad2) * r;
+ var z = Math.cos(rad1) * Math.sin(rad2) * r;
+ var y = Math.sin(rad1) * r;
+ return new THREE.Vector3(x, y, z);
+ }
+
+
+ function friction(acceleration, mu, normal, mass) {
+ var force = acceleration.clone();
+ if (!normal) normal = 1;
+ if (!mass) mass = 1;
+ force.multiplyScalar(-1);
+ force.normalize();
+ force.multiplyScalar(mu);
+ return force;
+ }
+
+ function drag(acceleration, value) {
+ var force = acceleration.clone();
+ force.multiplyScalar(-1);
+ force.normalize();
+ force.multiplyScalar(acceleration.length() * value);
+ return force;
+ }
+
+ function hook(velocity, anchor, rest_length, k) {
+ var force = velocity.clone().sub(anchor);
+ var distance = force.length() - rest_length;
+ force.normalize();
+ force.multiplyScalar(-1 * k * distance);
+ return force;
+ }
+
+}
diff --git a/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js b/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js
index d454ec556..1508366ce 100644
--- a/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js
+++ b/src/jlmap3d/lesson3dedit/assetmodelmanager/assetmodelmanager.js
@@ -2,7 +2,7 @@ import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
-export function AssetModelManager(scene) {
+export function AssetModelManager(editor,scene) {
let scope = this;
@@ -10,7 +10,18 @@ export function AssetModelManager(scene) {
this.otherModel = new THREE.Group();
- scene.add(this.otherModel);
+ let groupList = [];
+ groupList["standstation"] = new THREE.Group();
+ groupList["stopstation"] = new THREE.Group();
+ groupList["device"] = new THREE.Group();
+ groupList["xl"] = new THREE.Group();
+ groupList["dc"] = new THREE.Group();
+
+ let geometryDevice = new THREE.PlaneGeometry( 100, 100, 32 );
+ let materialDevice = new THREE.MeshBasicMaterial( {color: 0xffffff, side: THREE.DoubleSide} );
+ let planeDevice = new THREE.Mesh( geometryDevice, materialDevice );
+ planeDevice.rotation.x = -Math.PI/2;
+ groupList["device"].add(planeDevice);
this.loadAsset = [];
@@ -23,6 +34,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['FTDH'] = {
@@ -33,6 +45,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['IN'] = {
@@ -43,6 +56,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['OUT'] = {
@@ -53,6 +67,7 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
scope.staticAsset['PBMDH'] = {
@@ -63,12 +78,30 @@ export function AssetModelManager(scene) {
assetType:'static',
isUse:true,
resourceType:"三维课程",
+ sceneType:"standstation",
};
//场景中可触发事件模型
this.lessonTriggerList = [];
+ scope.lessonTriggerList["standstation"] = [];
+ scope.lessonTriggerList["stopstation"] = [];
+ scope.lessonTriggerList["device"] = [];
+ scope.lessonTriggerList["xl"] = [];
+ scope.lessonTriggerList["dc"] = [];
+
+ this.changeSceneGroup = function(groupType){
+ console.log(groupType);
+ console.log(editor.nowSceneType);
+ console.log(scope.lessonTriggerList[editor.nowSceneType]);
+ editor.nowSceneType = groupType;
+ scene.remove(this.otherModel);
+ this.otherModel = groupList[groupType];
+ scene.add(this.otherModel);
+ updateTriggerList(scope.lessonTriggerList[editor.nowSceneType]);
+ }
+
this.saveModelList = function(){
let modelList = {
assetList:[],
@@ -83,51 +116,63 @@ export function AssetModelManager(scene) {
assetType:scope.loadAsset[k].assetType,
isUse:scope.loadAsset[k].isUse,
resourceType:scope.loadAsset[k].resourceType,
+ sceneType:scope.loadAsset[k].sceneType,
});
}
- for(let i=0;i {
initTriggerList();
- if(modelList){
+ if(lessonData){
+ let modelList = lessonData.modelList;
for(let i=0;i {
@@ -167,12 +216,12 @@ export function AssetModelManager(scene) {
});
}
- this.deleteAsset = function(selectModel){
+ this.deleteAsset = function(selectModel,nowSceneType){
scope.otherModel.remove(selectModel);
for(let i=0;i0 || lessonData.modelList.length>0){
- assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList);
+ assetModelManager.lessonAssetsLoader(lessonData);
}else{
assetModelManager.lessonAssetsLoader();
}
@@ -108,6 +110,30 @@ export function Lesson3dEditor(dom,lessonData) {
scope.renderer.setSize(dom.offsetWidth,dom.offsetHeight);
}
+ this.changeIndex = function(nowIndex){
+ lessonIndex = nowIndex;
+ scope.nowSceneType = lessonData.lessonProgress[lessonIndex].progressScene;
+ // if(lessonData.lessonProgress[lessonIndex].roleName == nowRole){
+ // controlManager.initControlMode(lessonIndex);
+ // controlManager.initRoleMode(true,nowRole);
+ // controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,true);
+ // }else{
+ // controlManager.initRoleMode(false,nowRole);
+ // controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,false);
+ // }
+
+ }
+
+ this.editActionManager = function(type,value1,value2){
+ console.log(type);
+ console.log(value1);
+ console.log(value2);
+ if(type == "changeScene"){
+ assetModelManager.changeSceneGroup(value1);
+ scope.nowSceneType = value1;
+ }
+ }
+
this.createModelTrigger = function(assetData,mousePos){
var mouse = new THREE.Vector2();
@@ -123,7 +149,7 @@ export function Lesson3dEditor(dom,lessonData) {
var intersects = raycaster.intersectObjects( scene.children,true );
if(intersects.length>0){
- assetModelManager.lessonAssetsNewLoader(assetData,intersects[0].point);
+ assetModelManager.lessonAssetsNewLoader(assetData,intersects[0].point,scope.nowSceneType);
}
}
@@ -138,6 +164,6 @@ export function Lesson3dEditor(dom,lessonData) {
this.deleteModel = function(selectModel){
transcontrol.detach();
- assetModelManager.deleteAsset(selectModel);
+ assetModelManager.deleteAsset(selectModel,scope.nowSceneType);
}
}
diff --git a/src/views/jlmap3d/lesson3dedit/component/lessonprogress.vue b/src/views/jlmap3d/lesson3dedit/component/lessonprogress.vue
index a529c136b..eecc3769a 100644
--- a/src/views/jlmap3d/lesson3dedit/component/lessonprogress.vue
+++ b/src/views/jlmap3d/lesson3dedit/component/lessonprogress.vue
@@ -15,7 +15,7 @@
icon="el-icon-folder-add" @click="addProgress">
-