增加静态测试模型,修改三维课程播放器模型触发器模块,增加三维动画模块,修改课程信息模块
This commit is contained in:
parent
cf930c1e72
commit
2f60a7a352
@ -14,13 +14,12 @@ import { AssetModelManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.
|
||||
|
||||
import { ControlManager } from '@/jlmap3d/lesson3d/manager/controlmanager.js';
|
||||
|
||||
import { AnimateManager } from '@/jlmap3d/lesson3d/manager/animatemanager.js';
|
||||
|
||||
|
||||
// import { AnimationManager } from '@/jlmap3d/lesson3d/manager/assetmodelmanager.js';
|
||||
|
||||
|
||||
//动画播放相关
|
||||
let clock = new THREE.Clock();
|
||||
let delta;
|
||||
|
||||
let scene;
|
||||
|
||||
export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
@ -45,21 +44,28 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
light.position.set( 0, 4000, 0 );
|
||||
scene.add( light );
|
||||
|
||||
let animateManager = new AnimateManager();
|
||||
|
||||
let controlManager = new ControlManager( dom,scene,lessonData,lessonIndex);
|
||||
|
||||
let assetModelManager = new AssetModelManager(scene,controlManager);
|
||||
assetModelManager.lessonAssetsLoader(lessonData.assetList,lessonData.modelList).then((result) => {
|
||||
controlManager.initOctree(assetModelManager.loadAsset['default1'].mesh);
|
||||
|
||||
animate();
|
||||
|
||||
console.log(lessonData.lessonProgress[lessonIndex]);
|
||||
if(lessonData.lessonProgress[lessonIndex].action.length>0){
|
||||
controlManager.initNewEvent(lessonData.lessonProgress[lessonIndex].action,assetModelManager.lessonTriggerList);
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action,assetModelManager.lessonTriggerList);
|
||||
}
|
||||
|
||||
animateManager.initAnimation(assetModelManager);
|
||||
controlManager.init(animateManager.actions);
|
||||
startLesson();
|
||||
animate();
|
||||
resolve("loadeend"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
});;
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@ -67,7 +73,10 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
assetModelManager.otherModel.remove(actionModel);
|
||||
}
|
||||
|
||||
|
||||
this.changeIndex = function(nowIndex){
|
||||
lessonIndex = nowIndex;
|
||||
controlManager.changeIndexEvent(lessonData.lessonProgress[lessonIndex].action);
|
||||
}
|
||||
|
||||
//循环渲染函数
|
||||
function animate() {
|
||||
@ -78,7 +87,7 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
|
||||
if(controlManager.controlMode == "fps"){
|
||||
controlManager.updateFpsControl();
|
||||
}
|
||||
// delta = clock.getDelta();
|
||||
animateManager.updateAnimation();
|
||||
requestAnimationFrame(animate);
|
||||
|
||||
}
|
||||
|
47
src/jlmap3d/lesson3d/manager/animatemanager.js
Normal file
47
src/jlmap3d/lesson3d/manager/animatemanager.js
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
|
||||
export function AnimateManager() {
|
||||
|
||||
let scope = this;
|
||||
|
||||
this.animateList = [];
|
||||
|
||||
let mixers = [];
|
||||
this.actions = [];
|
||||
this.initAnimation = function(assetModelManager){
|
||||
|
||||
|
||||
for(let k in assetModelManager.staticAsset){
|
||||
if(assetModelManager.staticAsset[k].mesh.animations.length > 0){
|
||||
console.log(assetModelManager.staticAsset[k].mesh.name);
|
||||
let animations = assetModelManager.staticAsset[k].mesh.animations;
|
||||
let mixer = new THREE.AnimationMixer( assetModelManager.staticAsset[k].mesh );
|
||||
let actionName = assetModelManager.staticAsset[k].mesh.name;
|
||||
|
||||
console.log(actionName);
|
||||
scope.actions[actionName] = {
|
||||
status:"01",
|
||||
action:mixer.clipAction( assetModelManager.staticAsset[k].mesh.animations[ 0 ])
|
||||
};
|
||||
// scope.actions[actionName].action.play();
|
||||
mixers.push(mixer);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
let clock = new THREE.Clock();
|
||||
let mixerUpdateDelta;
|
||||
this.updateAnimation = function(){
|
||||
mixerUpdateDelta = clock.getDelta();
|
||||
|
||||
|
||||
for(let i=mixers.length-1;i>=0;i--){
|
||||
if(mixers[i]._actions[0].isRunning()){
|
||||
// console.log(scope.mixers[i]._actions[0].isRunning());
|
||||
mixers[i].update( mixerUpdateDelta );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
export function AssetModelManager(scene) {
|
||||
let scope = this;
|
||||
@ -12,16 +13,58 @@ export function AssetModelManager(scene) {
|
||||
|
||||
this.loadAsset = [];
|
||||
|
||||
this.loadAsset['default1'] = {
|
||||
modelId:'default1',
|
||||
this.staticAsset = [];
|
||||
scope.staticAsset['station'] = {
|
||||
modelId:'station',
|
||||
packageName:"车站",
|
||||
url:"/MODEL/2021-04-06/1381-54584.FBX",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/station.FBX",
|
||||
mesh:"",
|
||||
assetType:'default',
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['FTDH'] = {
|
||||
modelId:'FTDH',
|
||||
packageName:"电扶梯",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/FTDH.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['IN'] = {
|
||||
modelId:'IN',
|
||||
packageName:"进闸机",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/IN.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['OUT'] = {
|
||||
modelId:'OUT',
|
||||
packageName:"出闸机",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/OUT.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['PBMDH'] = {
|
||||
modelId:'PBMDH',
|
||||
packageName:"屏蔽门",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/PBMDH.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
|
||||
//场景中可触发事件模型
|
||||
this.lessonTriggerList = [];
|
||||
|
||||
@ -31,13 +74,20 @@ export function AssetModelManager(scene) {
|
||||
if(assetList){
|
||||
for(let i = 0;i<assetList.length;i++){
|
||||
assetList[i].mesh = "";
|
||||
scope.loadAsset[assetList[i].modelId] = assetList[i];
|
||||
if(assetList[i].modelId == "default1"){
|
||||
|
||||
}else{
|
||||
scope.loadAsset[assetList[i].modelId] = assetList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(let k in scope.staticAsset){
|
||||
initlist.push(fbxpromise(scope.staticAsset[k]));
|
||||
}
|
||||
|
||||
for(let k in scope.loadAsset){
|
||||
initlist.push(fbxpromise(scope.loadAsset[k]));
|
||||
|
||||
}
|
||||
|
||||
return new Promise(function(resolve, reject){
|
||||
@ -84,15 +134,21 @@ export function AssetModelManager(scene) {
|
||||
//FTKG 扶梯开关(钥匙孔)
|
||||
//FTTJ 扶梯台阶
|
||||
function initTriggerList(){
|
||||
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.loadAsset['default1'].mesh.getObjectByName("FTAN").showType = "default";
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
|
||||
scope.lessonTriggerList.push(scope.loadAsset['default1'].mesh.getObjectByName("FTAN"));
|
||||
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTKG").showType = "default";
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
|
||||
scope.lessonTriggerList.push(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
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.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"));
|
||||
|
||||
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
}
|
||||
@ -142,17 +198,28 @@ export function AssetModelManager(scene) {
|
||||
function fbxpromise(asset){
|
||||
return new Promise(function(resolve, reject){
|
||||
var loader = new THREE.FBXLoader();
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
|
||||
if(asset.assetType == "default"){
|
||||
console.log(asset);
|
||||
if(asset.assetType == "static"){
|
||||
loader.load( asset.url, function ( object ) {
|
||||
object.name = asset.modelId;
|
||||
asset.mesh = object;
|
||||
scene.add(object);
|
||||
resolve();
|
||||
} );
|
||||
}else{
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
asset.mesh = object;
|
||||
if(asset.assetType == "default"){
|
||||
console.log(object);
|
||||
// scene.add(object);
|
||||
}else if(asset.assetType == 'loadModel'){
|
||||
|
||||
}
|
||||
object.label = asset.packageName;
|
||||
asset.mesh = object;
|
||||
|
||||
resolve();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -3,6 +3,9 @@ import { Capsule } from '@/jlmap3d/lesson3d/math/Capsule.js';
|
||||
|
||||
import { Octree } from '@/jlmap3d/lesson3d/math/Octree.js';
|
||||
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
import { OBJLoader } from '@/jlmap3d/main/loaders/OBJLoader';
|
||||
|
||||
export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
|
||||
let scope = this;
|
||||
@ -12,8 +15,10 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
this.eventHitMode = false;
|
||||
|
||||
let eventBoxs = [];
|
||||
|
||||
|
||||
let raycasterBoxs = [];
|
||||
let actionList = [];
|
||||
let eventTrigger;
|
||||
let nowActions;
|
||||
|
||||
let renderer = new THREE.WebGLRenderer({ antialias: true });
|
||||
renderer.setClearColor(new THREE.Color(0x000000));
|
||||
@ -53,9 +58,9 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
const GRAVITY = 30;
|
||||
|
||||
const NUM_SPHERES = 20;
|
||||
const SPHERE_RADIUS = 0.2;
|
||||
const SPHERE_RADIUS = 0.1;
|
||||
|
||||
const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 32, 32 );
|
||||
const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 16, 16 );
|
||||
const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0x888855, roughness: 0.8, metalness: 0.5 } );
|
||||
|
||||
const spheres = [];
|
||||
@ -82,7 +87,29 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
scope.controls.enabled = false;
|
||||
}
|
||||
|
||||
let loaderObj = new THREE.OBJLoader();
|
||||
let pengzhuang;
|
||||
// load a resource
|
||||
loaderObj.load(
|
||||
// resource URL
|
||||
JL3D_LOCAL_STATIC+'/lesson3d/PZ427.obj',
|
||||
// called when resource is loaded
|
||||
function ( object ) {
|
||||
pengzhuang = object;
|
||||
},
|
||||
// called when loading is in progresses
|
||||
function ( xhr ) {
|
||||
|
||||
console.log( ( xhr.loaded / xhr.total * 100 ) + '% loaded' );
|
||||
|
||||
},
|
||||
// called when loading has errors
|
||||
function ( error ) {
|
||||
|
||||
console.log( 'An error happened' );
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
const worldOctree = new Octree();
|
||||
|
||||
@ -135,12 +162,14 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
if(hitBox.intersectsBox(eventBoxs[i])){
|
||||
console.log("相交");
|
||||
console.log(eventBoxs[i].action);
|
||||
if(eventBoxs[i].action.actionMode == "jump"){
|
||||
jumpEvent("action",eventBoxs[i].action);
|
||||
}
|
||||
|
||||
if(eventBoxs[i].action.actionMode == "remove"){
|
||||
actionEvent("remove",eventBoxs[i].action,eventBoxs[i].mesh);
|
||||
}
|
||||
|
||||
if(eventBoxs[i].action.actionMode == "jump"){
|
||||
jumpEvent("action",eventBoxs[i].action);
|
||||
}
|
||||
eventBoxs.splice(i,1);
|
||||
i--;
|
||||
}
|
||||
@ -165,8 +194,10 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
render();
|
||||
};
|
||||
|
||||
this.initOctree = function(object){
|
||||
worldOctree.fromGraphNode( object.getObjectByName("Object173") );
|
||||
this.init = function(actions){
|
||||
// worldOctree.fromGraphNode( object.getObjectByName("Object173") );
|
||||
worldOctree.fromGraphNode( pengzhuang );
|
||||
actionList = actions;
|
||||
// scope.controlMode = lessonData.lessonProgress[lessonIndex].controlMode;
|
||||
}
|
||||
|
||||
@ -182,11 +213,52 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
|
||||
} );
|
||||
let fpsMouseStatus = false;
|
||||
document.addEventListener( 'mousedown', () => {
|
||||
document.addEventListener( 'mousedown', (event) => {
|
||||
fpsMouseStatus = true;
|
||||
// document.body.requestPointerLock();
|
||||
|
||||
if(raycasterBoxs.length>0){
|
||||
var mouse = new THREE.Vector2();
|
||||
|
||||
var raycaster = new THREE.Raycaster();
|
||||
|
||||
mouse.x = ( event.clientX / dom.offsetWidth ) * 2 - 1;
|
||||
|
||||
mouse.y = - ( event.clientY / dom.offsetHeight ) * 2 + 1;
|
||||
|
||||
raycaster.setFromCamera(mouse,scope.nowCamera) // 也可以给构造函数传参的形式写
|
||||
console.log(raycasterBoxs);
|
||||
for(let i=0;i<raycasterBoxs.length;i++){
|
||||
var intersects = raycaster.intersectObject( raycasterBoxs[i].mesh);
|
||||
if(intersects.length>0){
|
||||
console.log(raycasterBoxs[i]);
|
||||
if(raycasterBoxs[i].type == "switch"){
|
||||
if(raycasterBoxs[i].action.status == "01"){
|
||||
raycasterBoxs[i].action.status = "02";
|
||||
raycasterBoxs[i].action.action.play();
|
||||
}else if(raycasterBoxs[i].action.status == "02"){
|
||||
raycasterBoxs[i].action.status = "01";
|
||||
raycasterBoxs[i].action.action.stop();
|
||||
}
|
||||
}
|
||||
if(raycasterBoxs[i].type == "urgeSwitch"){
|
||||
if(raycasterBoxs[i].action.status == "02"){
|
||||
raycasterBoxs[i].action.status = "01";
|
||||
raycasterBoxs[i].action.action.stop();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} );
|
||||
|
||||
|
||||
|
||||
document.body.addEventListener( 'mousemove', ( event ) => {
|
||||
if(fpsMouseStatus == true){
|
||||
fpsCamera.rotation.y -= event.movementX / 500;
|
||||
@ -377,27 +449,60 @@ export function ControlManager(dom,scene,lessonData,lessonIndex) {
|
||||
renderer.setSize(dom.offsetWidth,dom.offsetHeight);
|
||||
}
|
||||
|
||||
this.initNewEvent = function(actions,lessonTriggerList){
|
||||
console.log(actions);
|
||||
console.log(lessonTriggerList);
|
||||
this.changeIndexEvent = function(actions,lessonTriggerList){
|
||||
if(lessonTriggerList){
|
||||
eventTrigger = lessonTriggerList;
|
||||
scope.eventHitMode = true;
|
||||
}
|
||||
nowActions = actions;
|
||||
eventBoxs = [];
|
||||
raycasterBoxs = [];
|
||||
if(actions.length>0){
|
||||
for(let i=0;i<actions.length;i++){
|
||||
if(actions[i].actionType == "contact"){
|
||||
for(let j=0;j<lessonTriggerList.length;j++){
|
||||
|
||||
if(lessonTriggerList[j].label == actions[i].actionModel){
|
||||
if(actions[i].actionType == "contact"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventTestBox = new THREE.Box3(new THREE.Vector3(), new THREE.Vector3());
|
||||
eventTestBox.setFromObject(lessonTriggerList[j]);
|
||||
eventTestBox.mesh = lessonTriggerList[j];
|
||||
eventTestBox.setFromObject(eventTrigger[j]);
|
||||
eventTestBox.mesh = eventTrigger[j];
|
||||
eventTestBox.action = actions[i];
|
||||
eventBoxs.push(eventTestBox);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
scope.eventHitMode = true;
|
||||
|
||||
console.log(actions[i].actionType);
|
||||
if(actions[i].actionType == "switch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
console.log(eventTrigger);
|
||||
console.log(actionList);
|
||||
let eventRaycaster = {
|
||||
mesh:eventTrigger[j],
|
||||
action:actionList[eventTrigger[j].actionName],
|
||||
type:actions[i].actionType,
|
||||
};
|
||||
console.log(lessonData);
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(actions[i].actionType == "urgeSwitch"){
|
||||
for(let j=0;j<eventTrigger.length;j++){
|
||||
if(eventTrigger[j].label == actions[i].actionModel){
|
||||
let eventRaycaster = {
|
||||
mesh:eventTrigger[j],
|
||||
action:actionList[eventTrigger[j].actionName],
|
||||
type:actions[i].actionType,
|
||||
};
|
||||
raycasterBoxs.push(eventRaycaster);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(raycasterBoxs);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export function LessonData() {
|
||||
progressName:"命名",
|
||||
roleName:"",
|
||||
roleUse:true,
|
||||
|
||||
score:0,
|
||||
progressScene:"",
|
||||
nextCode:"",
|
||||
nextNode:"",
|
||||
@ -77,7 +77,7 @@ export function LessonData() {
|
||||
progressName:loadData[i].progressName,
|
||||
roleName:loadData[i].roleName,
|
||||
roleUse:loadData[i].roleUse,
|
||||
score:loadData[i].roleUse,
|
||||
score:loadData[i].score,
|
||||
progressScene:loadData[i].progressScene,
|
||||
nextCode:loadData[i].nextCode,
|
||||
nextNode:loadData[i].nextNode,
|
||||
|
@ -1,5 +1,7 @@
|
||||
import { BASE_ASSET_API } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
import { JL3D_LOCAL_STATIC } from '@/api/jlmap3d/assets3d.js';
|
||||
|
||||
export function AssetModelManager(scene) {
|
||||
let scope = this;
|
||||
|
||||
@ -12,16 +14,58 @@ export function AssetModelManager(scene) {
|
||||
|
||||
this.loadAsset = [];
|
||||
|
||||
this.loadAsset['default1'] = {
|
||||
modelId:'default1',
|
||||
this.staticAsset = [];
|
||||
scope.staticAsset['station'] = {
|
||||
modelId:'station',
|
||||
packageName:"车站",
|
||||
url:"/MODEL/2021-04-06/1381-54584.FBX",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/station.FBX",
|
||||
mesh:"",
|
||||
assetType:'default',
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['FTDH'] = {
|
||||
modelId:'FTDH',
|
||||
packageName:"电扶梯",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/FTDH.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['IN'] = {
|
||||
modelId:'IN',
|
||||
packageName:"进闸机",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/IN.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['OUT'] = {
|
||||
modelId:'OUT',
|
||||
packageName:"出闸机",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/OUT.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
scope.staticAsset['PBMDH'] = {
|
||||
modelId:'PBMDH',
|
||||
packageName:"屏蔽门",
|
||||
url:JL3D_LOCAL_STATIC+"/lesson3d/PBMDH.FBX",
|
||||
mesh:"",
|
||||
assetType:'static',
|
||||
isUse:true,
|
||||
resourceType:"三维课程",
|
||||
};
|
||||
|
||||
|
||||
//场景中可触发事件模型
|
||||
this.lessonTriggerList = [];
|
||||
|
||||
@ -77,23 +121,26 @@ export function AssetModelManager(scene) {
|
||||
if(assetList){
|
||||
for(let i = 0;i<assetList.length;i++){
|
||||
assetList[i].mesh = "";
|
||||
scope.loadAsset[assetList[i].modelId] = assetList[i];
|
||||
if(assetList[i].modelId == "default1"){
|
||||
|
||||
}else{
|
||||
scope.loadAsset[assetList[i].modelId] = assetList[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
for(let k in scope.staticAsset){
|
||||
initlist.push(fbxpromise(scope.staticAsset[k]));
|
||||
}
|
||||
|
||||
for(let k in scope.loadAsset){
|
||||
initlist.push(fbxpromise(scope.loadAsset[k]));
|
||||
|
||||
}
|
||||
|
||||
console.log(scope.loadAsset);
|
||||
return new Promise(function(resolve, reject){
|
||||
Promise.all(initlist).then((result) => {
|
||||
|
||||
|
||||
initTriggerList();
|
||||
if(modelList){
|
||||
for(let i=0;i<modelList.length;i++){
|
||||
console.log(modelList[i]);
|
||||
let newModelTrigger = scope.loadAsset[modelList[i].modelId].mesh.clone(true);
|
||||
newModelTrigger.showType = "loadModel";
|
||||
newModelTrigger.label = modelList[i].label;
|
||||
@ -108,8 +155,10 @@ export function AssetModelManager(scene) {
|
||||
scope.otherModel.add(newModelTrigger);
|
||||
scope.lessonTriggerList.push(newModelTrigger);
|
||||
}
|
||||
}
|
||||
|
||||
updateTriggerList(scope.lessonTriggerList);
|
||||
|
||||
resolve("loaderassets"); //['成功了', 'success']
|
||||
}).catch((error) => {
|
||||
//console.log(error);
|
||||
@ -131,13 +180,18 @@ export function AssetModelManager(scene) {
|
||||
//FTKG 扶梯开关(钥匙孔)
|
||||
//FTTJ 扶梯台阶
|
||||
function initTriggerList(){
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTAN").showType = "default";
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
|
||||
scope.lessonTriggerList.push(scope.loadAsset['default1'].mesh.getObjectByName("FTAN"));
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTAN").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTAN").label = "扶梯急停按钮";
|
||||
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTAN"));
|
||||
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTKG").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
|
||||
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("FTKG"));
|
||||
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").showType = "default";
|
||||
scope.staticAsset['station'].mesh.getObjectByName("spbmkg").label = "屏蔽门开关";
|
||||
scope.lessonTriggerList.push(scope.staticAsset['station'].mesh.getObjectByName("spbmkg"));
|
||||
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTKG").showType = "default";
|
||||
scope.loadAsset['default1'].mesh.getObjectByName("FTKG").label = "扶梯钥匙孔";
|
||||
scope.lessonTriggerList.push(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
|
||||
|
||||
// console.log(scope.loadAsset['default1'].mesh.getObjectByName("FTKG"));
|
||||
@ -187,16 +241,27 @@ export function AssetModelManager(scene) {
|
||||
function fbxpromise(asset){
|
||||
return new Promise(function(resolve, reject){
|
||||
var loader = new THREE.FBXLoader();
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
|
||||
if(asset.assetType == "default"){
|
||||
if(asset.assetType == "static"){
|
||||
loader.load( asset.url, function ( object ) {
|
||||
asset.mesh = object;
|
||||
scene.add(object);
|
||||
resolve();
|
||||
} );
|
||||
}else{
|
||||
loader.load( BASE_ASSET_API+asset.url, function ( object ) {
|
||||
asset.mesh = object;
|
||||
if(asset.assetType == "default"){
|
||||
|
||||
console.log(object);
|
||||
// scene.add(object);
|
||||
}else if(asset.assetType == 'loadModel'){
|
||||
|
||||
}
|
||||
asset.mesh = object;
|
||||
|
||||
resolve();
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ export function LessonData() {
|
||||
progressName:"命名",
|
||||
roleName:"",
|
||||
roleUse:true,
|
||||
|
||||
score:0,
|
||||
progressScene:"",
|
||||
nextCode:"",
|
||||
nextNode:"",
|
||||
@ -77,7 +77,7 @@ export function LessonData() {
|
||||
progressName:loadData[i].progressName,
|
||||
roleName:loadData[i].roleName,
|
||||
roleUse:loadData[i].roleUse,
|
||||
score:loadData[i].roleUse,
|
||||
score:loadData[i].score,
|
||||
progressScene:loadData[i].progressScene,
|
||||
nextCode:loadData[i].nextCode,
|
||||
nextNode:loadData[i].nextNode,
|
||||
|
@ -19,6 +19,7 @@ export function LessonTrigger() {
|
||||
picurl:"",
|
||||
},
|
||||
|
||||
|
||||
];
|
||||
|
||||
this.createTrigger = function(type){
|
||||
|
@ -33,6 +33,11 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="当前操作分数:" >
|
||||
<el-input v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].score" ></el-input>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="课程场景相机设置:">
|
||||
<el-switch
|
||||
v-model="lessonData.lessonData.lessonProgress[lessonEditIndex].changeCamera"
|
||||
@ -114,7 +119,7 @@
|
||||
<el-option label="接触" value="contact"></el-option>
|
||||
<el-option label="自动" value="auto"></el-option>
|
||||
<el-option label="开关" value="switch"></el-option>
|
||||
|
||||
<el-option label="紧急开关" value="urgeSwitch"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
@ -360,8 +365,7 @@
|
||||
}
|
||||
},
|
||||
deleteEventItem(deleteAction){
|
||||
console.log(this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].action);
|
||||
console.log(deleteAction);
|
||||
|
||||
for(let i=0;i<this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].action.length;i++){
|
||||
if(this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].action[i].actionName == deleteAction.actionName){
|
||||
this.lessonData.lessonData.lessonProgress[this.lessonEditIndex].action.splice(i,1);
|
||||
|
@ -217,6 +217,7 @@
|
||||
updateLesson3dData(this.$route.query.lessonId,this.netData).then(data => {
|
||||
console.log(data);
|
||||
}).catch(() => {
|
||||
|
||||
});
|
||||
},
|
||||
addProgress(){
|
||||
|
@ -75,10 +75,8 @@
|
||||
},
|
||||
initJobList(data){
|
||||
this.jobList = data;
|
||||
console.log(data);
|
||||
},
|
||||
selectJob(item){
|
||||
console.log(item);
|
||||
this.selectedJob = item;
|
||||
|
||||
},
|
||||
@ -94,7 +92,6 @@
|
||||
},
|
||||
selsectJobTool(selectTool,jobList){
|
||||
lesson3dSelect('toolproperty','jobpane',selectTool,jobList);
|
||||
console.log(selectTool);
|
||||
},
|
||||
generateUUID() {
|
||||
var d = new Date().getTime();
|
||||
|
@ -10,6 +10,9 @@
|
||||
</Step-Tips>
|
||||
|
||||
<Process-Log
|
||||
:lessonData='lessonData'
|
||||
:lessonPlayIndex='lessonPlayIndex'
|
||||
ref="processlog"
|
||||
v-show="lessonTools[1].isShow && lessonData.lessonData.lessonProgress[lessonPlayIndex].progressScene == 'standstation'">
|
||||
</Process-Log>
|
||||
|
||||
@ -120,6 +123,7 @@
|
||||
window.updateTriggerList = this.updateTriggerList;
|
||||
window.jumpEvent = this.jumpEvent;
|
||||
window.actionEvent = this.actionEvent;
|
||||
window.startLesson = this.startLesson;
|
||||
this.init(this.$route.query.lessonId);
|
||||
},
|
||||
beforeDestroy() {
|
||||
@ -145,6 +149,7 @@
|
||||
|
||||
this.lessonTools = loadData.lessonTools;
|
||||
this.lessonData.loadLessonProgress(loadData.lessonProgress);
|
||||
|
||||
}else{
|
||||
this.lessonData.initLessonProgress();
|
||||
this.$refs.jobpane.initJobList(this.jobPaneData.dataList);
|
||||
@ -155,7 +160,9 @@
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
|
||||
startLesson(){
|
||||
this.$refs.processlog.startLog();
|
||||
},
|
||||
saveLesson3dData(){
|
||||
this.lessonData.lessonData.lessonTools = this.lessonTools;
|
||||
let saveData = this.lessonData.lessonData;
|
||||
@ -180,6 +187,8 @@
|
||||
if(type == "tools"){
|
||||
this.lessonPlayIndex = action.nextNode;
|
||||
}
|
||||
|
||||
this.jl3d.changeIndex(this.lessonPlayIndex);
|
||||
},
|
||||
actionEvent(type,action,mesh){
|
||||
if(type == "remove"){
|
||||
|
@ -91,13 +91,10 @@
|
||||
this.jobList = data;
|
||||
},
|
||||
selectJob(item){
|
||||
console.log(item);
|
||||
this.selectedJob = item;
|
||||
},
|
||||
|
||||
selsectJobTool(selectTool){
|
||||
console.log(selectTool);
|
||||
console.log(this.lessonData.lessonData.lessonProgress[this.lessonPlayIndex]);
|
||||
let nowProgress = this.lessonData.lessonData.lessonProgress[this.lessonPlayIndex];
|
||||
if(selectTool.sceneId == nowProgress.id){
|
||||
jumpEvent("tools",selectTool);
|
||||
|
@ -1,23 +1,29 @@
|
||||
<template>
|
||||
<div class="processlogdiv" >
|
||||
<div class="processlogdiv"
|
||||
:style="{'background-image': 'url('+lessonbg+')'}">
|
||||
|
||||
<el-tabs type="border-card">
|
||||
<el-tab-pane label="进程">
|
||||
<div class="processtext" >
|
||||
{{processText}}
|
||||
<el-tabs type="border-card"
|
||||
:style="{'background-image': 'url('+lessonbg+')'}">
|
||||
<el-tab-pane label="进程" style="overflow-y:auto;">
|
||||
<div id="tabdiv" class = "tabdiv">
|
||||
<div class="processtext" v-for="(processItem,index) in processTexts">
|
||||
{{processItem.text}}
|
||||
</div>
|
||||
<div class="processtextnow" >
|
||||
{{nowProcessText}}
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="日志" >
|
||||
<div class="logtext" >
|
||||
{{logText}}
|
||||
<div id="tabdiv" class = "tabdiv">
|
||||
<div class="logtext" v-for="(logItem,index) in logTexts">
|
||||
{{logItem.text}}
|
||||
</div>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
|
||||
</el-tabs>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@ -27,30 +33,45 @@
|
||||
//进程日志
|
||||
export default {
|
||||
name: 'ProcessLog',
|
||||
props:['lessonData','lessonPlayIndex'],
|
||||
components: {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
processText:"",
|
||||
logText:"",
|
||||
lessonbg:JL3D_LOCAL_STATIC+"/lesson3d/lessonbg.png",
|
||||
nowProcessText:"",
|
||||
oldIndex:0,
|
||||
processTexts:[],
|
||||
logTexts:[],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
watch: {
|
||||
'lessonPlayIndex': {
|
||||
handler: function (newVal, oldVal) {
|
||||
|
||||
if (newVal != oldVal) {
|
||||
this.logTexts.push(this.lessonData.lessonData.lessonProgress[oldVal].stepTipsData);
|
||||
this.processTexts.push(this.lessonData.lessonData.lessonProgress[oldVal].stepTipsData);
|
||||
this.nowProcessText = this.lessonData.lessonData.lessonProgress[newVal].stepTipsData.text;
|
||||
var div = document.getElementById('tabdiv');
|
||||
div.scrollTop = div.scrollHeight;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
beforeDestroy() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
startLog(){
|
||||
this.nowProcessText = this.lessonData.lessonData.lessonProgress[this.lessonPlayIndex].stepTipsData.text;
|
||||
},
|
||||
|
||||
},
|
||||
|
||||
@ -62,23 +83,41 @@
|
||||
@import "src/styles/mixin.scss";
|
||||
.processlogdiv {
|
||||
position: absolute;
|
||||
width: 28%;
|
||||
height: 25%;
|
||||
width: 450px;
|
||||
height: 250px;
|
||||
right:0;
|
||||
bottom:0;
|
||||
// border-radius:10px;
|
||||
border:solid 2px #000;
|
||||
background-color: #000080;
|
||||
opacity: 0.6;
|
||||
color:#fff;
|
||||
border-radius:10px;
|
||||
z-index:1;
|
||||
}
|
||||
|
||||
.tabdiv{
|
||||
width:100%;
|
||||
height:175px;
|
||||
position: relative;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.processtext{
|
||||
font-size: 16px;
|
||||
color:#00ff00;
|
||||
border:solid 2px #fff;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.processtextnow{
|
||||
font-size: 16px;
|
||||
color:#ff0000;
|
||||
border:solid 2px #fff;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.logtext{
|
||||
font-size: 16px;
|
||||
color:#00ff00;
|
||||
border:solid 2px #fff;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
BIN
static/lesson3d/FTDH.2FBX
Normal file
BIN
static/lesson3d/FTDH.2FBX
Normal file
Binary file not shown.
BIN
static/lesson3d/FTDH.FBX
Normal file
BIN
static/lesson3d/FTDH.FBX
Normal file
Binary file not shown.
BIN
static/lesson3d/IN.FBX
Normal file
BIN
static/lesson3d/IN.FBX
Normal file
Binary file not shown.
BIN
static/lesson3d/OUT.FBX
Normal file
BIN
static/lesson3d/OUT.FBX
Normal file
Binary file not shown.
BIN
static/lesson3d/PBMDH.FBX
Normal file
BIN
static/lesson3d/PBMDH.FBX
Normal file
Binary file not shown.
5576
static/lesson3d/PZ427.obj
Normal file
5576
static/lesson3d/PZ427.obj
Normal file
File diff suppressed because it is too large
Load Diff
BIN
static/lesson3d/station.FBX
Normal file
BIN
static/lesson3d/station.FBX
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user