|
@@ -38,16 +38,13 @@ const Canvas3d = defineComponent({
|
|
const { actions, components, controls, store } = useQueditor();
|
|
const { actions, components, controls, store } = useQueditor();
|
|
store.showLoading = false;
|
|
store.showLoading = false;
|
|
const getLocalSource = (asset: any) => {
|
|
const getLocalSource = (asset: any) => {
|
|
- let pack = cloneDeep(asset);
|
|
|
|
- let source = pack.source;
|
|
|
|
|
|
+ let source = cloneDeep(asset);
|
|
|
|
|
|
const { deviceCtrl } = useCtx();
|
|
const { deviceCtrl } = useCtx();
|
|
const httpServer = deviceCtrl.httpServer;
|
|
const httpServer = deviceCtrl.httpServer;
|
|
- let scope = this;
|
|
|
|
|
|
|
|
//模型处理
|
|
//模型处理
|
|
let geom = source.geoms[0];
|
|
let geom = source.geoms[0];
|
|
- let osgbinUrl = geom.osgjs.url;
|
|
|
|
|
|
|
|
geom.osgjs.url = httpServer + geom.osgjs.url;
|
|
geom.osgjs.url = httpServer + geom.osgjs.url;
|
|
source.geoms = [geom];
|
|
source.geoms = [geom];
|
|
@@ -81,28 +78,27 @@ const Canvas3d = defineComponent({
|
|
m.opacity.texture.url = httpServer + m.opacity.texture.url;
|
|
m.opacity.texture.url = httpServer + m.opacity.texture.url;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-
|
|
|
|
- //环境球
|
|
|
|
- source.env3ds.forEach((item: any) => {
|
|
|
|
- if (item.background?.image?.url) {
|
|
|
|
- item.background.image.url = httpServer + item.background.image.url;
|
|
|
|
- }
|
|
|
|
- item.config.textures.forEach((t: any) => {
|
|
|
|
- t.images.forEach((im: any) => {
|
|
|
|
- im.file = httpServer + im.file;
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- source.scenes.forEach((c: any) => {
|
|
|
|
- //@ts-ignore
|
|
|
|
- const url = c.background?.image?.url;
|
|
|
|
- if (url) {
|
|
|
|
- //@ts-ignore
|
|
|
|
- c.background.image.url = httpServer + c.background.image.url;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+ const scene = {
|
|
|
|
+ background: {
|
|
|
|
+ color: [0.749, 0.749, 0.749],
|
|
|
|
+ type: 2,
|
|
|
|
+ },
|
|
|
|
+ id: "001",
|
|
|
|
+ products: [
|
|
|
|
+ {
|
|
|
|
+ id: "1",
|
|
|
|
+ prodId: source.products[0].id,
|
|
|
|
+ transform: {
|
|
|
|
+ pos: [0, 0, 0],
|
|
|
|
+ rotation: [0, 0, 0],
|
|
|
|
+ scale: [1, 1, 1],
|
|
|
|
+ },
|
|
|
|
+ visible: true,
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ source.scenes = [scene];
|
|
return source;
|
|
return source;
|
|
};
|
|
};
|
|
const initQueen = () => {
|
|
const initQueen = () => {
|
|
@@ -110,18 +106,7 @@ const Canvas3d = defineComponent({
|
|
actions.initPack(source);
|
|
actions.initPack(source);
|
|
actions.on("initQueen3dScene:success", () => {
|
|
actions.on("initQueen3dScene:success", () => {
|
|
const queen3d = controls.queen3dCtrl.queen3d;
|
|
const queen3d = controls.queen3dCtrl.queen3d;
|
|
- const app = controls.queen3dCtrl.queen3d.getAppInstance();
|
|
|
|
-
|
|
|
|
- app.setNoPan(true);
|
|
|
|
-
|
|
|
|
queen3d.setTransparntBg();
|
|
queen3d.setTransparntBg();
|
|
-
|
|
|
|
- queen3d.setControllerZoom(0.5, 6);
|
|
|
|
-
|
|
|
|
- if (queen3d.picker) {
|
|
|
|
- queen3d.picker.enable = false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
queen3d.redraw();
|
|
queen3d.redraw();
|
|
state.loaded = true;
|
|
state.loaded = true;
|
|
emit("init", true);
|
|
emit("init", true);
|
|
@@ -141,7 +126,7 @@ export default defineComponent({
|
|
setup(props) {
|
|
setup(props) {
|
|
const query = getQuery();
|
|
const query = getQuery();
|
|
const dialogId = query.dialogid;
|
|
const dialogId = query.dialogid;
|
|
- const meshId = query.id;
|
|
|
|
|
|
+ const source = query.source;
|
|
const packRef = ref();
|
|
const packRef = ref();
|
|
const state = reactive({ loaded: false, loading: true });
|
|
const state = reactive({ loaded: false, loading: true });
|
|
// window.addEventListener("message", (e: any) => {
|
|
// window.addEventListener("message", (e: any) => {
|
|
@@ -157,7 +142,7 @@ export default defineComponent({
|
|
// });
|
|
// });
|
|
const { actions } = useList();
|
|
const { actions } = useList();
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
- const res = await actions.loadPack3d({ meshId: meshId } as any);
|
|
|
|
|
|
+ const res = await actions.loadPack3d({ source: source } as any);
|
|
packRef.value = res?.data;
|
|
packRef.value = res?.data;
|
|
state.loaded = true;
|
|
state.loaded = true;
|
|
document.addEventListener("mousedown", () => {
|
|
document.addEventListener("mousedown", () => {
|