diff --git a/src/components/InteractiveObjects/GenericObject.vue b/src/components/InteractiveObjects/GenericObject.vue
new file mode 100644
index 0000000..4d67d14
--- /dev/null
+++ b/src/components/InteractiveObjects/GenericObject.vue
@@ -0,0 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/components/InteractiveObjects/InteractiveObject.js b/src/components/InteractiveObjects/InteractiveObject.js
index 129e2e4..d15e93a 100644
--- a/src/components/InteractiveObjects/InteractiveObject.js
+++ b/src/components/InteractiveObjects/InteractiveObject.js
@@ -1,7 +1,4 @@
-//import { Hint } from "./Hint";
-import { Group, AnimationMixer, LoopPingPong, Vector3 } from "three";
-import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
-import { assignMaterial, assignParams } from "@/lib/MeshUtils";
+import { Group } from "three";
import { PuzzleGame1 } from "./PuzzleGame1";
import { PuzzleGame2 } from "./PuzzleGame2";
// import { Game3 } from "./games/Game3";
@@ -19,8 +16,8 @@ class InteractiveObject {
this.name = obj.name;
this.ready = new Promise((resolve, reject) => {
let mesh;
- switch (obj.id) {
- case 'group':
+ switch (obj.type || 'GenericObject') {
+ case 'Group':
mesh = new Group();
obj.group.forEach(g => {
let go = new InteractiveObject(g, context);
@@ -30,51 +27,18 @@ class InteractiveObject {
});
resolve(mesh);
break;
- case 'text':
+ case 'Text':
let text = new TextObject(obj, context);
resolve(text.object);
break;
- case 'mesh':
- mesh = obj.value;
- resolve(mesh);
- break;
- case 'image':
+ case 'Image':
let imo = new ImageObject(obj, context);
mesh = imo.object;
resolve(mesh);
break;
- case 'hint':
- let hint = new Hint(obj, context);
- mesh = hint.object;
- resolve(mesh);
- break;
- case 'gltf':
- //console.log('loadingg', obj.value)
- new GLTFLoader().load(obj.value, (gltf) => {
- let gltfObj = gltf.scene;
- gltf.scene.traverse(function (object) {
- object.frustumCulled = false;
- if (obj.name && obj.name == object.name) {
- gltfObj = object;
- }
- // object.castShadow = true;
- // object.receiveShadow = true;
- });
- assignMaterial(gltfObj, obj, context);
- if (gltf.animations && gltf.animations.length) {
- let mixer = new AnimationMixer(gltfObj);
- context.mixers.push(mixer);
- let action = mixer.clipAction(gltf.animations[0]);
- action.setLoop(LoopPingPong);
- action.play();
- }
- resolve(gltfObj);
- });
- break;
- case 'asset':
- mesh = context.assets[obj.value].clone();
- assignMaterial(mesh, obj, context);
- resolve(mesh);
+ case 'GenericObject':
+ let promise = context.load(`/asset/default/${obj.$go.asset.name}`);
+ promise.then(resolve);
break;
case 'PuzzleGame1':
case 'PuzzleGame2':
@@ -94,41 +58,6 @@ class InteractiveObject {
}
});
this.ready.then((mesh) => {
- mesh.go = {};
- // let restriction;
- // if (!context.disableRestrictions && obj.restriction) {
- // restriction = {
- // type: 'deny',
- // a: [obj.room.localToWorld(new Vector3().fromArray(obj.restriction[0])), obj.room.localToWorld(new Vector3().fromArray(obj.restriction[1]))]
- // };
- // context.areas.push(restriction);
- // }
- mesh.go.finish = () => {
- if (obj.finish) {
- var f;
- if (obj.finish.nextAction) {
- var next = obj.finish.nextAction;
- delete obj.finish.nextAction;
- f = () => {
- if (next.activate) {
- context.activate(next.activate);
- }
- };
- }
- var me = obj.finish._ || {};
- delete obj.finish._;
- context.motionEngine.add({ o: mesh, a: obj.finish, t: me.t || 1, f: me.f || f, d: me.d || 0 });
- }
- if (restriction) context.areas.splice(context.areas.indexOf(restriction), 1);
- };
- if (mesh.object) mesh.object.onfinish = mesh.go.finish;
- assignParams(mesh, obj);
- obj.animation && context.motionEngine.add({
- o: mesh,
- a: obj.animation.motion,
- r: obj.animation.repeat,
- t: obj.animation.duration || 1
- });
this.object = mesh;
});
}
diff --git a/src/components/InteractiveObjects/VideoPlayer.js b/src/components/InteractiveObjects/VideoPlayer.js
index 6c0f2a5..3bf7d26 100644
--- a/src/components/InteractiveObjects/VideoPlayer.js
+++ b/src/components/InteractiveObjects/VideoPlayer.js
@@ -30,7 +30,7 @@ class VideoPlayer {
vi.pause();
}
});
- resolve(plane);
+ resolve(this);
})
vi.addEventListener('play', ()=>{
if (context.dashboard?.active){
@@ -48,7 +48,7 @@ class VideoPlayer {
scale: plane.scale.clone()
}
}
- console.log(data.location)
+ //console.log(data.location)
context.dashboard.group.attach(plane);
//plane.applyMatrix4(m.invert())
diff --git a/src/components/InteractiveObjects/VideoPlayer.vue b/src/components/InteractiveObjects/VideoPlayer.vue
index 0f2568c..52769da 100644
--- a/src/components/InteractiveObjects/VideoPlayer.vue
+++ b/src/components/InteractiveObjects/VideoPlayer.vue
@@ -1,15 +1,15 @@
-
-
- Choose video object
-
-
{{ modelValue.title }}
+
+
+ Choose video object
+
+