瀏覽代碼

Introduce ARDemo.preload()

customisations
alemart 9 月之前
父節點
當前提交
18086578f6
共有 2 個檔案被更改,包括 24 行新增6 行删除
  1. 12
    3
      plugins/babylon-with-encantar.js
  2. 12
    3
      plugins/three-with-encantar.js

+ 12
- 3
plugins/babylon-with-encantar.js 查看文件

56
     {
56
     {
57
         // optional implementation
57
         // optional implementation
58
     }
58
     }
59
+
60
+    /**
61
+     * Preload resources before starting the AR session
62
+     * @returns {Promise<void> | SpeedyPromise<void>}
63
+     */
64
+    preload()
65
+    {
66
+        // optional implementation
67
+        return Promise.resolve();
68
+    }
59
 }
69
 }
60
 
70
 
61
 /**
71
 /**
291
     }
301
     }
292
 
302
 
293
     return Promise.resolve()
303
     return Promise.resolve()
294
-    .then(() => {
295
-        return demo.startSession(); // Promise or SpeedyPromise
296
-    })
304
+    .then(() => demo.preload())
305
+    .then(() => demo.startSession()) // Promise or SpeedyPromise
297
     .then(session => {
306
     .then(session => {
298
 
307
 
299
         ar._session = session;
308
         ar._session = session;

+ 12
- 3
plugins/three-with-encantar.js 查看文件

56
     {
56
     {
57
         // optional implementation
57
         // optional implementation
58
     }
58
     }
59
+
60
+    /**
61
+     * Preload resources before starting the AR session
62
+     * @returns {Promise<void> | SpeedyPromise<void>}
63
+     */
64
+    preload()
65
+    {
66
+        // optional implementation
67
+        return Promise.resolve();
68
+    }
59
 }
69
 }
60
 
70
 
61
 /**
71
 /**
275
     }
285
     }
276
 
286
 
277
     return Promise.resolve()
287
     return Promise.resolve()
278
-    .then(() => {
279
-        return demo.startSession(); // Promise or SpeedyPromise
280
-    })
288
+    .then(() => demo.preload())
289
+    .then(() => demo.startSession()) // Promise or SpeedyPromise
281
     .then(session => {
290
     .then(session => {
282
 
291
 
283
         ar._session = session;
292
         ar._session = session;

Loading…
取消
儲存