Handle missing uvs in gltf meshes

This commit is contained in:
luboslenco
2022-12-21 18:58:32 +01:00
parent 7500daadd9
commit 5edc68ab22
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -17,7 +17,8 @@ let import_gltf_glb = function(path, done) {
let inda = new Uint32Array(r.buffer, a._get_indices(), index_count);
let posa = new Int16Array(r.buffer, a._get_positions(), vertex_count * 4);
let nora = new Int16Array(r.buffer, a._get_normals(), vertex_count * 2);
let texa = new Int16Array(r.buffer, a._get_uvs(), vertex_count * 2);
let uvs = a._get_uvs();
let texa = uvs == 0 ? null : new Int16Array(r.buffer, uvs, vertex_count * 2);
let name = path.split("\\").pop().split("/").pop().split(".").shift();
done({
name: name,
+2 -1
View File
@@ -25,7 +25,8 @@ let import_gltf_glb = function(path, done) {
let inda = new Uint32Array(r.buffer, a._get_indices(), index_count);
let posa = new Int16Array(r.buffer, a._get_positions(), vertex_count * 4);
let nora = new Int16Array(r.buffer, a._get_normals(), vertex_count * 2);
let texa = new Int16Array(r.buffer, a._get_uvs(), vertex_count * 2);
let uvs = a._get_uvs();
let texa = uvs == 0 ? null : new Int16Array(r.buffer, uvs, vertex_count * 2);
let name = path.split("\\").pop().split("/").pop().split(".").shift();
done({
name: name,