Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/api/en/core/BufferGeometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ <h3>[method:undefined computeTangents]()</h3>
<p>
Calculates and adds a tangent attribute to this geometry.<br />
The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
[page:BufferGeometryUtils.computeTangents] instead.
[page:BufferGeometryUtils.computeMikkTSpaceTangents] instead.
</p>

<h3>[method:undefined computeVertexNormals]()</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ko/core/BufferGeometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ <h3>[method:undefined computeTangents]()</h3>
기하학에 탄젠트 속성을 계산하고 추가합니다.<br />
이 계산은 인덱스가 있는 기하학에만 지원되며 위치, 법선, uv 속성이 정의되어야 합니다.
When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
[page:BufferGeometryUtils.computeTangents] instead.
[page:BufferGeometryUtils.computeMikkTSpaceTangents] instead.
</p>

<h3>[method:undefined computeVertexNormals]()</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/core/BufferGeometry.html
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ <h3>[method:undefined computeTangents]()</h3>
<p>
Calculates and adds a tangent attribute to this geometry.<br />
The computation is only supported for indexed geometries and if position, normal, and uv attributes are defined. When using a tangent space normal map, prefer the MikkTSpace algorithm provided by
[page:BufferGeometryUtils.computeTangents] instead.
[page:BufferGeometryUtils.computeMikkTSpaceTangents] instead.
</p>

<h3>[method:undefined computeVertexNormals]()</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/en/utils/BufferGeometryUtils.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ <h3>[method:Object computeMorphedAttributes]( [param:Mesh | Line | Points object

</p>

<h3>[method:Object computeTangents]( [param:BufferGeometry geometry], [param:Object MikkTSpace], [param:Boolean negateSign] = true )</h3>
<h3>[method:Object computeMikkTSpaceTangents]( [param:BufferGeometry geometry], [param:Object MikkTSpace], [param:Boolean negateSign] = true )</h3>
<ul>
<li>geometry -- Instance of [page:BufferGeometry].</li>
<li>MikkTSpace -- Instance of <i>examples/jsm/libs/mikktspace.module.js</i>, or <i>mikktspace</i> npm package. Await <i>MikkTSpace.ready</i> before use.
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/zh/utils/BufferGeometryUtils.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h3>[method:Object computeMorphedAttributes]( [param:Mesh | Line | Points object

</p>

<h3>[method:Object computeTangents]( [param:BufferGeometry geometry], [param:Object MikkTSpace], [param:Boolean negateSign] = true )</h3>
<h3>[method:Object computeMikkTSpaceTangents]( [param:BufferGeometry geometry], [param:Object MikkTSpace], [param:Boolean negateSign] = true )</h3>
<ul>
<li>geometry -- Instance of [page:BufferGeometry].</li>
<li>MikkTSpace -- Instance of <i>examples/jsm/libs/mikktspace.module.js</i>, or <i>mikktspace</i> npm package. Await <i>MikkTSpace.ready</i> before use.
Expand Down
14 changes: 13 additions & 1 deletion examples/jsm/utils/BufferGeometryUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ import {
Vector3,
} from 'three';

function computeTangents() {

function computeTangents( geometry, MikkTSpace, negateSign = true ) {
throw new Error( 'BufferGeometryUtils: computeTangents renamed to computeMikkTSpaceTangents.' );

}

function computeMikkTSpaceTangents( geometry, MikkTSpace, negateSign = true ) {

if ( ! MikkTSpace || ! MikkTSpace.isReady ) {

throw new Error( 'BufferGeometryUtils: Initialized MikkTSpace library required.' );

}

if ( ! geometry.hasAttribute( 'position' ) || ! geometry.hasAttribute( 'normal' ) || ! geometry.hasAttribute( 'uv' ) ) {

throw new Error( 'BufferGeometryUtils: Tangents require "position", "normal", and "uv" attributes.' );

}

function getAttributeArray( attribute ) {

if ( attribute.normalized || attribute.isInterleavedBufferAttribute ) {
Expand Down Expand Up @@ -1110,6 +1121,7 @@ function mergeGroups( geometry ) {

export {
computeTangents,
computeMikkTSpaceTangents,
mergeBufferGeometries,
mergeBufferAttributes,
interleaveAttributes,
Expand Down