Skip to content

Commit 6eb82b7

Browse files
fix(GLTFLoader): add uv fallback (#227)
1 parent 73531c8 commit 6eb82b7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/loaders/GLTFLoader.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import {
6161
Vector3,
6262
VectorKeyframeTrack,
6363
sRGBEncoding,
64+
REVISION,
6465
} from 'three'
6566
import { toTrianglesDrawMode } from '../utils/BufferGeometryUtils'
6667

@@ -1587,8 +1588,21 @@ const ATTRIBUTES = {
15871588
POSITION: 'position',
15881589
NORMAL: 'normal',
15891590
TANGENT: 'tangent',
1590-
TEXCOORD_0: 'uv',
1591-
TEXCOORD_1: 'uv2',
1591+
// uv => uv1, 4 uv channels
1592+
// https://github.com/mrdoob/three.js/pull/25943
1593+
// https://github.com/mrdoob/three.js/pull/25788
1594+
...(REVISION.replace(/\D+/g, '') >= 152
1595+
? {
1596+
TEXCOORD_0: 'uv',
1597+
TEXCOORD_1: 'uv1',
1598+
TEXCOORD_2: 'uv2',
1599+
TEXCOORD_3: 'uv3',
1600+
}
1601+
: {
1602+
TEXCOORD_0: 'uv',
1603+
TEXCOORD_1: 'uv2',
1604+
}),
1605+
15921606
COLOR_0: 'color',
15931607
WEIGHTS_0: 'skinWeight',
15941608
JOINTS_0: 'skinIndex',

0 commit comments

Comments
 (0)