|
@@ -12,9 +12,10 @@ import {
|
|
|
showFullScreenLoading,
|
|
|
tryHideFullScreenLoading,
|
|
|
} from "../../../axios/filter";
|
|
|
+import { mapState } from "vuex";
|
|
|
|
|
|
export default {
|
|
|
- name: "threeVehicleModel", // 车辆模型中的threeJS
|
|
|
+ name: "threeVehicleModel", // 动力学配置中的threeJS
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
@@ -31,10 +32,14 @@ export default {
|
|
|
car: null,
|
|
|
cubeTexture: null,
|
|
|
raf: null,
|
|
|
- scale: 1.5, // 物体加载换算倍数
|
|
|
+ // scale: 2, // 物体加载换算倍数
|
|
|
};
|
|
|
},
|
|
|
|
|
|
+ computed: {
|
|
|
+ ...mapState(["scale"]),
|
|
|
+ },
|
|
|
+
|
|
|
props: {
|
|
|
carModel: {
|
|
|
type: String,
|
|
@@ -44,7 +49,6 @@ export default {
|
|
|
|
|
|
watch: {
|
|
|
carModel(newVal, oldVal) {
|
|
|
- console.log(newVal, oldVal);
|
|
|
if (newVal != oldVal) {
|
|
|
this.initCar(newVal);
|
|
|
}
|
|
@@ -106,29 +110,17 @@ export default {
|
|
|
this.car = null;
|
|
|
}
|
|
|
|
|
|
- console.log(model);
|
|
|
if (!model) return;
|
|
|
if (!model.includes(".glb")) return;
|
|
|
|
|
|
let that = this;
|
|
|
let loader = new GLTFLoader();
|
|
|
|
|
|
- // const loading = this.$loading({
|
|
|
- // lock: true,
|
|
|
- // text: "模型加载中,请稍等...",
|
|
|
- // // spinner: "el-icon-loading",
|
|
|
- // background: "rgba(0, 0, 0, 0.2)",
|
|
|
- // });
|
|
|
-
|
|
|
showFullScreenLoading();
|
|
|
|
|
|
- // model = `${this.publicPath}glb/AudiA6_10.glb`
|
|
|
-
|
|
|
loader.load(
|
|
|
model,
|
|
|
function (obj) {
|
|
|
- console.log(obj);
|
|
|
- // loading.close();
|
|
|
tryHideFullScreenLoading();
|
|
|
|
|
|
obj.scene.rotation.set(
|
|
@@ -146,7 +138,6 @@ export default {
|
|
|
// console.log((xhr.loaded / xhr.total) * 100 + "% loaded");
|
|
|
},
|
|
|
(error) => {
|
|
|
- // loading.close();
|
|
|
tryHideFullScreenLoading();
|
|
|
console.error(error);
|
|
|
}
|
|
@@ -158,7 +149,6 @@ export default {
|
|
|
this.initCamera();
|
|
|
this.initRenderer();
|
|
|
this.initLight();
|
|
|
- // this.initCar(this.carModel);
|
|
|
|
|
|
this.controls = new OrbitControls(
|
|
|
this.camera,
|