|
|
<!DOCTYPE html>
|
|
|
<html lang="zh">
|
|
|
|
|
|
<head>
|
|
|
<meta charset="utf-8" />
|
|
|
<base href="../../../" />
|
|
|
<script src="page.js"></script>
|
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
[page:Object3D] → [page:Line] → [page:LineSegments] →
|
|
|
|
|
|
<h1>顶点切线辅助对象([name])</h1>
|
|
|
|
|
|
<p class="desc">
|
|
|
可视化对象的顶点切线。要求已在 [page:BufferAttribute custom attribute] 中指定切线或已使用 [page:BufferGeometry.computeTangents
|
|
|
computeTangents] 计算切线。<br /><br />
|
|
|
</p>
|
|
|
|
|
|
<h2>导入</h2>
|
|
|
|
|
|
<p>
|
|
|
[name] 是一个附加组件,必须显式导入。请参阅 [link:#manual/introduction/Installation Installation / Addons].
|
|
|
</p>
|
|
|
|
|
|
<code>
|
|
|
import { VertexTangentsHelper } from 'three/addons/helpers/VertexTangentsHelper.js';
|
|
|
</code>
|
|
|
|
|
|
<h2>代码示例</h2>
|
|
|
|
|
|
<code>
|
|
|
const geometry = new THREE.BoxGeometry( 10, 10, 10, 2, 2, 2 );
|
|
|
const material = new THREE.MeshStandardMaterial();
|
|
|
const mesh = new THREE.Mesh( geometry, material );
|
|
|
|
|
|
const helper = new VertexTangentsHelper( mesh, 1, 0x00ffff );
|
|
|
|
|
|
scene.add( mesh );
|
|
|
scene.add( helper );
|
|
|
</code>
|
|
|
|
|
|
<h2>例子</h2>
|
|
|
<p>
|
|
|
[example:webgl_helpers WebGL / helpers]
|
|
|
</p>
|
|
|
|
|
|
<h2>构造函数</h2>
|
|
|
|
|
|
|
|
|
<h3>[name]( [param:Object3D object], [param:Number size], [param:Hex color] )</h3>
|
|
|
<p>
|
|
|
[page:Object3D object] -- 要为其渲染顶点切线的对象。<br />
|
|
|
[page:Number size] -- (可选)箭头的长度。默认值为 *1*。<br />
|
|
|
[page:Hex color] --(可选)箭头的十六进制颜色。默认值为 *0x00ffff*。
|
|
|
</p>
|
|
|
|
|
|
|
|
|
<h2>属性</h2>
|
|
|
<p>有关常见属性,请参阅 [page:LineSegments] 基类。</p>
|
|
|
|
|
|
<h3>[property:Object matrixAutoUpdate]</h3>
|
|
|
<p>
|
|
|
请参阅 [page:Object3D.matrixAutoUpdate]。默认设置为 `false`,因为正在使用对象的 [page:Object3D.matrixWorld matrixWorld]。
|
|
|
</p>
|
|
|
|
|
|
<h3>[property:Object3D object]</h3>
|
|
|
<p>对其顶点切线进行可视化的对象。</p>
|
|
|
|
|
|
<h3>[property:Number size]</h3>
|
|
|
<p>箭头的长度。默认值为 *1*。</p>
|
|
|
|
|
|
|
|
|
<h2>方法</h2>
|
|
|
<p>有关常用方法,请参阅 [page:LineSegments] 基类。</p>
|
|
|
|
|
|
|
|
|
<h3>[method:undefined update]()</h3>
|
|
|
<p>根据对象的世界变换更新顶点切线预览。</p>
|
|
|
|
|
|
<h3>[method:undefined dispose]()</h3>
|
|
|
<p>
|
|
|
释放该实例分配的GPU相关资源。每当您的应用程序中不再使用此实例时,请调用此方法。
|
|
|
</p>
|
|
|
|
|
|
<h2>源代码</h2>
|
|
|
|
|
|
<p>
|
|
|
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/helpers/VertexTangentsHelper.js examples/jsm/helpers/VertexTangentsHelper.js]
|
|
|
</p>
|
|
|
</body>
|
|
|
|
|
|
</html>
|