修改三位课程播放器动画,增加课程

This commit is contained in:
“sunzy” 2022-01-10 18:13:06 +08:00
parent 4affc37803
commit b34d46bd15
6 changed files with 41 additions and 13 deletions

View File

@ -64,9 +64,8 @@ export function Lesson3dPlayer(dom,lessonData,lessonIndex) {
accidentManager.loadAccidentList(lessonData.accidentList)
}
let loadingInstance = Loading.service({ fullscreen: true });
let assetModelManager = new AssetModelManager(scope,scene,controlManager);
let assetModelManager = new AssetModelManager(scope,scene);
console.log(lessonData);
assetModelManager.lessonAssetsLoader(lessonData).then((result) => {
scope.nowSceneType = lessonData.lessonProgress[0].progressScene;
animateManager.initAnimation(assetModelManager);

View File

@ -8,9 +8,12 @@ export function AnimateManager() {
let mixers = [];
this.actions = [];
let clock = new THREE.Clock();
let mixerUpdateDelta;
this.initAnimation = function(assetModelManager){
for(let k in assetModelManager.staticAsset){
if(assetModelManager.staticAsset[k].mesh.animations.length > 0){
// console.log(assetModelManager.staticAsset[k]);
@ -57,10 +60,28 @@ export function AnimateManager() {
}
}
for(let j in assetModelManager.lessonTriggerList){
for(let i =0;i<assetModelManager.lessonTriggerList[j].length;i++){
if(assetModelManager.lessonTriggerList[j][i].cloneanimations){
let animations = assetModelManager.lessonTriggerList[j][i].animations;
let mixer = new THREE.AnimationMixer( assetModelManager.lessonTriggerList[j][i] );
let actionName = assetModelManager.lessonTriggerList[j][i].name;
scope.actions[actionName] = {
status:"01",
action:mixer.clipAction( assetModelManager.lessonTriggerList[j][i].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--){

View File

@ -112,9 +112,7 @@ export function AssetModelManager(editor,scene) {
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];
@ -153,10 +151,14 @@ export function AssetModelManager(editor,scene) {
initTriggerList();
let modelList = lessonData.modelList;
for(let i=0;i<modelList.length;i++){
// console.log(modelList[i]);
let newModelTrigger = scope.loadAsset[modelList[i].modelId].mesh.clone(true);
if(scope.loadAsset[modelList[i].modelId].mesh.animations.length>0){
newModelTrigger.animations = scope.loadAsset[modelList[i].modelId].mesh.animations;
newModelTrigger.cloneanimations = true;
}
newModelTrigger.showType = "loadModel";
newModelTrigger.label = modelList[i].label;
newModelTrigger.name = modelList[i].label;
newModelTrigger.modelId = modelList[i].modelId;
newModelTrigger.visible = modelList[i].visible;
newModelTrigger.position.x = modelList[i].pos.x;

View File

@ -318,7 +318,7 @@
},
initPublish(lessonId){
getPublishLesson3dData(lessonId).then(data => {
console.log(data);
// console.log(data);
this.netData.name = data.data.name;
this.netData.type = data.data.type;
@ -447,7 +447,7 @@
this.netData.data = JSON.stringify(saveData);
// console.log();
updateLesson3dData(this.$route.query.lessonId,this.netData).then(data => {
console.log(data);
// console.log(data);
}).catch(() => {
});
},

View File

@ -210,6 +210,12 @@ export default {
name: "列车回库",
type: "1",
pic: '/other/7.png',
},
{
id: "26",
name: "列车运行",
type: "1",
pic: '/other/26.png',
}
],
@ -224,7 +230,7 @@ export default {
},
mounted() {
getSelectLesson3dList().then(response => {
console.log(response);
// console.log(response);
// this.lessonData = response.data;
}).catch(() => {});
},

View File

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB