瀏覽代碼

interpolation rework

Nikolay Suslov 4 年之前
父節點
當前提交
a67c18513f

+ 15 - 2
public/vwf/model/aframe/addon/aframe-components.js

@@ -23,6 +23,7 @@ AFRAME.registerComponent('scene-utils', {
 
     init: function () {
         this.mirrors = {};
+        this.interpolationComponents = {};
 
         //this.setCameraControl();
         const sceneEnterVR = (e) => {
@@ -98,11 +99,23 @@ AFRAME.registerComponent('scene-utils', {
 
     },
 
-     tick: function (t) {
+     tick: function (t, dt) {
 
             Object.values(this.mirrors).forEach(el => {
                 el.mirrorTick.call(el)
-            })
+            });
+            
+            // Object.values(this.interpolationComponents).forEach(el => {
+            //     el.interpolationTick.call(el, t, dt)
+            // });
+
+     },
+
+     tock: function (t, dt) {
+
+        // Object.values(this.interpolationComponents).forEach(el => {
+        //     el.interpolationTock.call(el, t, dt)
+        // });
 
      }
 })

+ 8 - 1
public/vwf/model/aframe/addon/aframe-interpolation.js

@@ -19,6 +19,7 @@ AFRAME.registerComponent('interpolation', {
   init: function () {
 
     this.driver = vwf.views["vwf/view/aframeComponent"];
+    //this.el.sceneEl.components['scene-utils'].interpolationComponents[this.el.id] = this;
 
   },
 
@@ -39,11 +40,16 @@ AFRAME.registerComponent('interpolation', {
    * Called when a component is removed (e.g., via removeAttribute).
    * Generally undoes all modifications to the entity.
    */
-  remove: function () { },
+  remove: function () { 
+
+    //delete this.el.sceneEl.components['scene-utils'].interpolationComponents[this.el.id]
+
+  },
 
   /**
    * Called on each scene tick.
    */
+  // interpolationTick
   tick: function (t, dt) {
 
 
@@ -72,6 +78,7 @@ AFRAME.registerComponent('interpolation', {
 
   },
 
+  //interpolationTock
   tock: function (t, dt) {
     if (this.node) {
       if (this.enabled && this.node.interpolate && this.driver.interpolateView) {