Fix baking vertex color when using multiple objects

This commit is contained in:
Lubos Lenco
2021-08-09 17:01:37 +02:00
parent af868f1612
commit 6461fb5395
2 changed files with 3 additions and 4 deletions
+2 -3
View File
@@ -142,11 +142,10 @@ class ImportMesh {
public static function addMesh(mesh: Dynamic) {
if (mesh.texa == null) {
equirectUnwrap(mesh);
}
if (mesh.texa == null) equirectUnwrap(mesh);
var raw = rawMesh(mesh);
raw.vertex_arrays.push({ values: mesh.texa, attrib: "tex", data: "short2norm" });
if (mesh.cola != null) raw.vertex_arrays.push({ values: mesh.cola, attrib: "col", data: "short4norm", padding: 1 });
new MeshData(raw, function(md: MeshData) {
+1 -1
View File
@@ -46,7 +46,7 @@ class MeshUtil {
}
for (j in 0...vas[1].values.length) va1[j + voff * 2] = vas[1].values[j];
for (j in 0...vas[2].values.length) va2[j + voff * 2] = vas[2].values[j];
if (va3 != null) for (j in 0...vas[3].values.length) va3[j + voff * 4] = vas[3].values[j];
if (va3 != null) for (j in 0...vas[3].values.length) va3[j + voff * 3] = vas[3].values[j];
for (j in 0...ias[0].values.length) ia[j + ioff] = ias[0].values[j] + voff;
voff += Std.int(vas[0].values.length / 4);