repo: janusweb
action: commit
revision: 
path_from: 
revision_from: e73cd4071dcf8cb9d3189d3610a31c1bc5c87804:
path_to: 
revision_to: 
git.thebackupbox.net
janusweb
git clone git://git.thebackupbox.net/janusweb
commit e73cd4071dcf8cb9d3189d3610a31c1bc5c87804
Author: James Baicoianu 
Date:   Sun Feb 16 14:31:59 2020 -0800

    Added avatar UI app

diff --git a/media/assets/webui/apps/avatar/avatar.js b/media/assets/webui/apps/avatar/avatar.js
new file mode 100644
index 0000000000000000000000000000000000000000..45560fd11e52b58a966c900d3eb04a003f7ffe17
--- /dev/null
+++ b/media/assets/webui/apps/avatar/avatar.js
@@ -0,0 +1,37 @@
+janus.registerElement('avatar_simple', {
+  headsrc: 'media/assets/hoverscreen.obj',
+  bodysrc: '',
+  handsrc: '',
+  create() {
+    if (this.headsrc) {
+      this.head = this.createObject('object', {id: this.headsrc});
+    }
+    if (this.bodysrc) {
+      this.body = this.createObject('object', {id: this.bodysrc});
+    }
+    if (this.handsrc) {
+      this.hands = this.createObject('object', {id: this.handsrc});
+    }
+    //this.attachToPlayer();
+  },
+  attachToPlayer(player) {
+    // THIS IS WHERE I STOPPED
+    // I need to attach this avatar object to the player so it can do whatever it needs to position its sub-objects
+    // In this case this is the simple head-and-hands avatar style, but it should be done in a way that can work
+    // with more advanced types, like rigged models with IK
+    player.addEventListener('xrframe', (ev) => this.handleXRFrame(ev));
+  },
+  //update(dt) {
+  //},
+  handleXRFrame(ev) {
+    console.log('update it', ev.target, ev.data);
+  }
+});
+janus.registerElement('avatar_rigged', {
+  create() {
+  },
+  update(dt) {
+  },
+  updateXR(pose, referenceSpace) {
+  }
+});
diff --git a/media/assets/webui/apps/avatar/avatar.json b/media/assets/webui/apps/avatar/avatar.json
index 0967ef424bce6791893e9a57bb952f80fd536e93..
index ..7a99ed0c8ab6d87734a0347b7540fbeccfece93f 100644
--- a/media/assets/webui/apps/avatar/avatar.json
+++ b/media/assets/webui/apps/avatar/avatar.json
@@ -1 +1,9 @@
-{}
+{
+  "templates": {
+  },
+  "scripts":  ["./avatar.js"],
+  "css":      [],
+  "components": [
+  ]
+}
+

-----END OF PAGE-----