Skip to content

Commit

Permalink
feat(GLTFExporter): add support for 4 uv channels (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Oct 7, 2023
1 parent b87633c commit 086fadb
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
PerspectiveCamera,
WebGLRenderer,
} from 'three'
import { version } from '../_polyfill/constants'

async function readAsDataURL(blob) {
const buffer = await blob.arrayBuffer()
Expand Down Expand Up @@ -1529,8 +1530,17 @@ class GLTFWriter {

// Conversion between attributes names in threejs and gltf spec
const nameConversion = {
uv: 'TEXCOORD_0',
[REVISION.replace(/\D+/g, '') >= 152 ? 'uv1' : 'uv2']: 'TEXCOORD_1',
...(version >= 152
? {
uv: 'TEXCOORD_0',
uv1: 'TEXCOORD_1',
uv2: 'TEXCOORD_2',
uv3: 'TEXCOORD_3',
}
: {
uv: 'TEXCOORD_0',
uv2: 'TEXCOORD_1',
}),
color: 'COLOR_0',
skinWeight: 'WEIGHTS_0',
skinIndex: 'JOINTS_0',
Expand Down

0 comments on commit 086fadb

Please sign in to comment.