具有自定义场景的AR.JS,其中包含使用3D力图创建的对象

时间:2019-10-28 16:46:04

标签: three.js aframe ar.js

我创建了带有3D力图(https://github.com/vasturiano/3d-force-graph)的3D图表。我想使用ar.js将该图表转换为基于增强现实网络的应用程序。 3d-force-graph正在使用three.js创建一个<canvas>元素。我可以将<canvas>与ar.js混合吗?

在ar.js的一些示例中,我不得不使用A-Frame(aframe.js)创建具有某些对象的场景,但是我的场景已经创建。

  1. 是否可以将ar.js与3d-force-graph.js创建的<canvas>一起使用,而根本不必使用aframe.js?
  2. 是否有一种方法可以使aframe.js使用以3d-force-graph.js创建的<canvas>作为场景?
  3. 是否可以将使用3d-force-graph.js创建的<canvas>中的3d对象作为对象导出到aframe.js场景中?

我已经使用3D力图创建了一个代码段。

谢谢

    // Random tree
    const N = 300;
    const gData = {
      nodes: [...Array(N).keys()].map(i => ({ id: i })),
      links: [...Array(N).keys()]
        .filter(id => id)
        .map(id => ({
          source: id,
          target: Math.round(Math.random() * (id-1))
        }))
    };
    const Graph = ForceGraph3D()
      (document.getElementById('3d-graph'))
        .graphData(gData);
<head>
  <style> body { margin: 0; } </style>

  <script src="//unpkg.com/3d-force-graph"></script>
  <!--<script src="../../dist/3d-force-graph.js"></script>-->
</head>

<body>
  <div id="3d-graph"></div>

</body>

0 个答案:

没有答案