Mesh export fix

This commit is contained in:
luboslenco
2019-03-24 13:04:16 +01:00
parent f119ec753d
commit 7fa4f24b4e
+8 -8
View File
@@ -209,20 +209,21 @@ class Exporter {
var off = 0;
for (p in UITrait.inst.paintObjects) {
var mesh = p.data.raw;
var sc = p.data.scalePos;
var posa = mesh.vertex_arrays[0].values;
var nora = mesh.vertex_arrays[1].values;
var texa = mesh.vertex_arrays[2].values;
var len = Std.int(posa.length / 3);
var len = Std.int(posa.length / 4);
s += "o " + p.name + "\n";
for (i in 0...len) {
s += "v " + posa[i * 4 + 0] + " " +
posa[i * 4 + 2] + " " +
(-posa[i * 4 + 1]) + "\n";
s += "v " + posa[i * 4 ] * sc + " " +
posa[i * 4 + 2] * sc + " " +
(-posa[i * 4 + 1] * sc) + "\n";
}
for (i in 0...len) {
s += "vn " + nora[i * 2 + 0] + " " +
s += "vn " + nora[i * 2 ] + " " +
posa[i * 4 + 3] + " " +
(-nora[i * 2 + 1]) + "\n";
(-nora[i * 2 + 1]) + "\n";
}
for (i in 0...len) {
s += "vt " + texa[i * 2 + 0] + " " +
@@ -230,8 +231,7 @@ class Exporter {
}
var inda = mesh.index_arrays[0].values;
for (i in 0...Std.int(inda.length / 3)) {
var i1 = inda[i * 3 + 0] + 1 + off;
var i1 = inda[i * 3 ] + 1 + off;
var i2 = inda[i * 3 + 1] + 1 + off;
var i3 = inda[i * 3 + 2] + 1 + off;
s += "f " + i1 + "/" + i1 + "/" + i1 + " " +