Files
apt-nl-map/static/Magic4/js/three.js-dev/docs/examples/en/utils/BufferGeometryUtils.html
2024-12-04 10:21:04 +08:00

99 lines
3.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../../" />
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
<h1>[name]</h1>
<p class="desc">
A class containing utility functions for [page:BufferGeometry BufferGeometry] instances.
</p>
<h2>Methods</h2>
<h3>[method:BufferGeometry mergeBufferGeometries]( [param:Array geometries], [param:Boolean useGroups] )</h3>
<p>
geometries -- Array of [page:BufferGeometry BufferGeometry] instances.<br />
useGroups -- Whether groups should be generated for the merged geometry or not.<br /><br />
Merges a set of geometries into a single instance. All geometries must have compatible attributes.
If merge does not succeed, the method returns null.
</p>
<h3>[method:BufferAttribute mergeBufferAttributes]( [param:Array attributes] )</h3>
<p>
attributes -- Array of [page:BufferAttribute BufferAttribute] instances.<br /><br />
Merges a set of attributes into a single instance. All attributes must have compatible properties
and types, and [page:InterleavedBufferAttribute InterleavedBufferAttributes] are not supported. If merge does not succeed, the method
returns null.
</p>
<h3>[method:InterleavedBufferAttribute interleaveAttributes]( [param:Array attributes] )</h3>
<p>
attributes -- Array of [page:BufferAttribute BufferAttribute] instances.<br /><br />
Interleaves a set of attributes and returns a new array of corresponding attributes that share
a single InterleavedBuffer instance. All attributes must have compatible types. If merge does not
succeed, the method returns null.
</p>
<h3>[method:Number estimateBytesUsed]( [param:BufferGeometry geometry] )</h3>
<p>
geometry -- Instance of [page:BufferGeometry BufferGeometry] to estimate the memory use of.<br /><br />
Returns the amount of bytes used by all attributes to represent the geometry.
</p>
<h3>[method:BufferGeometry mergeVertices]( [param:BufferGeometry geometry], [param:Number tolerance] )</h3>
<p>
geometry -- Instance of [page:BufferGeometry BufferGeometry] to merge the vertices of.<br />
tolerance -- The maximum allowable difference between vertex attributes to merge. Defaults to 1e-4.<br /><br />
Returns a new [page:BufferGeometry BufferGeometry] with vertices for which all similar vertex attributes
(within tolerance) are merged.
</p>
<h3>[method:BufferGeometry toTrianglesDrawMode]( [param:BufferGeometry geometry], [param:TrianglesDrawMode drawMode] )</h3>
<p>
geometry -- Instance of [page:BufferGeometry BufferGeometry].<br />
drawMode -- The draw mode of the given geometry.<br /><br />
Returns a new indexed [page:BufferGeometry BufferGeometry] based on the [page:DrawModes THREE.TrianglesDrawMode] draw mode. This mode
corresponds to the *gl.TRIANGLES* WebGL primitive.
</p>
<h3>[method:Object computeMorphedAttributes]( [param:Mesh | Line | Points object] )</h3>
<p>
object -- Instance of [page:Mesh Mesh] | [page:Line Line] | [page:Points Points].<br /><br />
Returns the current attributes (Position and Normal) of a morphed/skinned [page:Object3D Object3D] whose geometry is a
[page:BufferGeometry BufferGeometry], together with the original ones: An Object with 4 properties:
`positionAttribute`, `normalAttribute`, `morphedPositionAttribute` and `morphedNormalAttribute`.
Helpful for Raytracing or Decals (i.e. a [page:DecalGeometry DecalGeometry] applied to a morphed Object
with a [page:BufferGeometry BufferGeometry] will use the original BufferGeometry, not the morphed/skinned one,
generating an incorrect result.
Using this function to create a shadow Object3D the DecalGeometry can be correctly generated).
</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/utils/BufferGeometryUtils.js examples/jsm/utils/BufferGeometryUtils.js]
</p>
</body>
</html>