6

我正在努力为盒子图元创建线框。尝试了颜色、不透明度和透明属性,但似乎都不起作用。这是代码 -

<a-entity geometry="primitive: box; width: 1; height: 1; depth: 1" position="0 1 0" material="color: #0000FF; opacity: 0.5;" rotation="0 0 120"></a-entity>

需要渲染这样的东西 -

在此处输入图像描述

4

2 回答 2

7

您需要稍微查看一下THREE.Material 文档,因为 A-Frame 无法公开所有选项。这是一个示例组件,使用以下wireframe选项:

 AFRAME.registerComponent('wireframe', {
   dependencies: ['material'],
   init: function () {
     this.el.components.material.material.wireframe = true;
   }
 });

 <a-entity geometry="primitive: box" material="color: blue" wireframe></a-entity>
于 2016-08-09T14:39:00.310 回答
3

在 A-Frame 0.9.0 中,您可以定义wireframe: truestandardmaterial的属性,例如:

<a-entity geometry="primitive: box; width: 1; height: 1; depth: 1"
          position="0 1 0"
          material="color: #0000FF; opacity: 0.5; wireframe: true"
          rotation="0 0 120">
</a-entity>

也许你会得到比你需要的更多的电线(至少在我得到的效果图中,有一些对角线的电线,不仅仅是边缘),但也许足够好而且非常简单。

于 2019-10-11T15:09:09.643 回答